From c7160fb830ce98dd416131ec942384f6a9d3b722 Mon Sep 17 00:00:00 2001 From: "florian.azizian" <florian.azizian@maarch.org> Date: Wed, 12 Sep 2018 17:25:15 +0100 Subject: [PATCH] FEAT #8305 et #8306 historic for external signatory book --- modules/visa/batch/batch_tools.php | 11 +++++++--- .../batch/process_mailsFromSignatoryBook.php | 20 +++++++++++++++---- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/modules/visa/batch/batch_tools.php b/modules/visa/batch/batch_tools.php index 59a310875b1..892758866f2 100755 --- a/modules/visa/batch/batch_tools.php +++ b/modules/visa/batch/batch_tools.php @@ -104,7 +104,7 @@ function Bt_history($aArgs = []) { $query = "INSERT INTO history (table_name, record_id, event_type, " . "user_id, event_date, info, id_module, remote_ip, event_id) values(?, ?, ?, ?, CURRENT_TIMESTAMP, ?, ?, ?, ?)"; - $arrayPDO = array($aArgs['table_name'], $aArgs['record_id'], 'UP', 'superadmin', $aArgs['info'], 'visa', 'localhost', 'attachup'); + $arrayPDO = array($aArgs['table_name'], $aArgs['record_id'], $aArgs['event_type'], 'superadmin', $aArgs['info'], 'visa', 'localhost', $aArgs['event_id']); $GLOBALS['db']->query($query, $arrayPDO); } @@ -213,16 +213,21 @@ function Bt_refusedSignedMail($aArgs = []) $GLOBALS['db']->query("UPDATE res_letterbox SET status = '" . $aArgs['refusedStatus'] . "' WHERE res_id = ?", [$aArgs['resIdMaster']]); + $historyInfo = 'La signature de la pièce jointe '.$aArgs['resIdAttachment'].' ('.$aArgs['tableAttachment'].') a été refusée dans le parapheur externe'; Bt_history([ 'table_name' => $aArgs['tableAttachment'], 'record_id' => $aArgs['resIdAttachment'], - 'info' => 'Signature refusée dans le parapheur externe' + 'info' => $historyInfo, + 'event_type' => 'UP', + 'event_id' => 'attachup' ]); Bt_history([ 'table_name' => 'res_letterbox', 'record_id' => $aArgs['resIdMaster'], - 'info' => 'La signature de la pièce jointe '.$aArgs['resIdAttachment'].' ('.$aArgs['tableAttachment'].') a été refusée dans le parapheur externe' + 'info' => $historyInfo, + 'event_type' => 'ACTION#1', + 'event_id' => '1' ]); } diff --git a/modules/visa/batch/process_mailsFromSignatoryBook.php b/modules/visa/batch/process_mailsFromSignatoryBook.php index 1ccc046dbad..300187bd9be 100755 --- a/modules/visa/batch/process_mailsFromSignatoryBook.php +++ b/modules/visa/batch/process_mailsFromSignatoryBook.php @@ -262,15 +262,21 @@ foreach ($retrievedMails['isVersion'] as $resId => $value) { $GLOBALS['db']->query("UPDATE res_version_attachments set status = 'TRA' WHERE res_id = ?", [$resId]); Bt_processVisaWorkflow(['res_id_master' => $value->res_id_master]); + + $historyInfo = 'La signature de la pièce jointe '.$resId.' (res_version_attachments) a été validée dans le parapheur externe'; Bt_history([ 'table_name' => 'res_version_attachments', 'record_id' => $resId, - 'info' => 'Signature validée dans le parapheur externe' + 'info' => $historyInfo, + 'event_type' => 'UP', + 'event_id' => 'attachup' ]); Bt_history([ 'table_name' => 'res_letterbox', 'record_id' => $value->res_id_master, - 'info' => 'La signature de la pièce jointe '.$resId.' (res_version_attachments) a été validée dans le parapheur externe' + 'info' => $historyInfo, + 'event_type' => 'ACTION#1', + 'event_id' => '1' ]); } elseif ($value->status == 'refused') { Bt_refusedSignedMail([ @@ -302,15 +308,21 @@ foreach ($retrievedMails['noVersion'] as $resId => $value) { $GLOBALS['db']->query("UPDATE res_attachments SET status = 'TRA' WHERE res_id = ?", [$resId]); Bt_processVisaWorkflow(['res_id_master' => $value->res_id_master]); + + $historyInfo = 'La signature de la pièce jointe '.$resId.' (res_attachments) a été validée dans le parapheur externe'; Bt_history([ 'table_name' => 'res_attachments', 'record_id' => $resId, - 'info' => 'Signature validée dans le parapheur externe' + 'info' => $historyInfo, + 'event_type' => 'UP', + 'event_id' => 'attachup' ]); Bt_history([ 'table_name' => 'res_letterbox', 'record_id' => $value->res_id_master, - 'info' => 'La signature de la pièce jointe '.$resId.' (res_attachments) a été validée dans le parapheur externe' + 'info' => $historyInfo, + 'event_type' => 'ACTION#1', + 'event_id' => '1' ]); } elseif ($value->status == 'refused') { Bt_refusedSignedMail([ -- GitLab