From fd7c9bf0bd154c149005d03018a0756d17bf7783 Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Wed, 28 Oct 2020 14:29:43 +0100
Subject: [PATCH] FEAT #15049 TIME 0:30 fix archival getReply

---
 bin/exportSeda/checkAllReplies.php | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/bin/exportSeda/checkAllReplies.php b/bin/exportSeda/checkAllReplies.php
index 6b655be2696..52a09328a0b 100755
--- a/bin/exportSeda/checkAllReplies.php
+++ b/bin/exportSeda/checkAllReplies.php
@@ -113,11 +113,12 @@ Bt_getWorkBatch();
 Bt_writeLog(['level' => 'INFO', 'message' => 'Retrieve mail sent to archiving system']);
 
 $acknowledgements = \Attachment\models\AttachmentModel::get([
-    'select' => ['res_id_master'],
+    'select' => ['res_id_master', 'typist'],
     'where'  => ['attachment_type = ?', 'status = ?'],
     'data'   => ['acknowledgement_record_management', 'TRA']
 ]);
-$acknowledgements = array_column($acknowledgements, 'res_id_master');
+$acknowledgementsTypist = array_column($acknowledgements, 'typist', 'res_id_master');
+$acknowledgements       = array_column($acknowledgements, 'res_id_master');
 
 $replies = \Attachment\models\AttachmentModel::get([
     'select' => ['res_id_master'],
@@ -162,10 +163,12 @@ foreach ($unitIdentifiers as $reference => $value) {
             'resIdMaster'   => $resId,
             'title'         => 'Réponse au transfert',
             'format'        => 'xml',
-            'status'        => 'TRA'
+            'status'        => 'TRA',
+            'typist'        => $acknowledgementsTypist[$resId]
         ]);
         if (empty($id) || !empty($id['errors'])) {
-            return ['errors' => ['[storeAttachment] ' . $id['errors']]];
+            Bt_writeLog(['level' => 'ERROR', 'message' => '[storeAttachment] ' . $id['errors']]);
+            continue;
         }
         \Resource\models\ResModel::update([
             'set'   => ['status' => $GLOBALS['statusReplyReceived']],
-- 
GitLab