diff --git a/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php b/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php index 793a2b585827ef4597cf4fa1cf00ac10bf117e5b..2ad75e5348271a3c9bb2dcb573c3481725d5f85c 100644 --- a/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php +++ b/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php @@ -63,7 +63,9 @@ function manage_form($arr_id, $history, $id_action, $label_action, $status, $col } } - \Attachment\models\AttachmentModel::freezeAttachment(['resId' => $attachmentToFreeze, 'table' => 'res_attachments']); + foreach ($attachmentToFreeze as $resId => $externalId) { + \Attachment\modelsx\AttachmentModel::freezeAttachment(['resId' => $resId, 'table' => 'res_attachments', 'externalId' => $externalId]); + } } return ['result' => $result, 'history_msg' => '']; diff --git a/src/app/attachment/models/AttachmentModelAbstract.php b/src/app/attachment/models/AttachmentModelAbstract.php index 1ed7406bfddf07cd94444f6ba4016a7ca85c764d..0f4864ce516547e5af29aeb08f46ec66dcf7e57c 100644 --- a/src/app/attachment/models/AttachmentModelAbstract.php +++ b/src/app/attachment/models/AttachmentModelAbstract.php @@ -179,14 +179,14 @@ abstract class AttachmentModelAbstract public static function freezeAttachment(array $aArgs) { - ValidatorModel::notEmpty($aArgs, ['table', 'resId']); - ValidatorModel::stringType($aArgs, ['table']); - ValidatorModel::arrayType($aArgs, ['resId']); + ValidatorModel::notEmpty($aArgs, ['table', 'resId', 'externalId']); + ValidatorModel::stringType($aArgs, ['table', 'externalId']); + ValidatorModel::intType($aArgs, ['resId']); DatabaseModel::update([ 'table' => $aArgs['table'], - 'set' => ['status' => 'FRZ'], - 'where' => ['res_id in (?)'], + 'set' => ['status' => 'FRZ', 'external_id' => $aArgs['externalId']], + 'where' => ['res_id = ?'], 'data' => [$aArgs['resId']] ]);