diff --git a/apps/maarch_entreprise/class/class_lists_Abstract.php b/apps/maarch_entreprise/class/class_lists_Abstract.php index 421d9bfe07d140b733a505be0ae6a6748adc2066..a72ab552450f081fd0364f18c245c38b78bf1f7a 100755 --- a/apps/maarch_entreprise/class/class_lists_Abstract.php +++ b/apps/maarch_entreprise/class/class_lists_Abstract.php @@ -1617,9 +1617,9 @@ abstract class lists_Abstract extends Database $return .= 'checked '; } - $isVersion = false; + $isVersion = 'false'; if ($resultTheLine[1]['value'] > 1) { - $isVersion = true; + $isVersion = 'true'; } $return .= 'onclick="setAttachmentInSignatureBook('.$resultTheLine[0]['value'].', '.$isVersion.');"/>Intégrer au parapheur'; diff --git a/apps/maarch_entreprise/js/angularFunctions.js b/apps/maarch_entreprise/js/angularFunctions.js index f1e4a86e4f193122caca1801eda4329b5a16ade1..3530d43437cb2c18ae94c9c06571632d0b6c939f 100755 --- a/apps/maarch_entreprise/js/angularFunctions.js +++ b/apps/maarch_entreprise/js/angularFunctions.js @@ -135,7 +135,7 @@ function setAttachmentInSignatureBook(id, isVersion) { window.parent.angularSignatureBookComponent.componentAfterAttach("left"); } }, error: function(err) { - alert("Une erreur s'est produite"); + alert("Une erreur s'est produite : " + err.responseJSON.exception[0].message); } }); } diff --git a/src/app/attachment/controllers/AttachmentController.php b/src/app/attachment/controllers/AttachmentController.php index 587199606a9c64851166c262f0b0d23b2b0fcee7..9aea504756012c5972949e2b015429f03e95c172 100644 --- a/src/app/attachment/controllers/AttachmentController.php +++ b/src/app/attachment/controllers/AttachmentController.php @@ -47,6 +47,9 @@ class AttachmentController $data = $request->getParams(); + $data['isVersion'] = filter_var($data['isVersion'], FILTER_VALIDATE_BOOLEAN); + + var_dump($data['isVersion']); $attachment = AttachmentModel::getById(['id' => $aArgs['id'], 'isVersion' => $data['isVersion']]); if (empty($attachment)) { diff --git a/src/app/attachment/models/AttachmentModelAbstract.php b/src/app/attachment/models/AttachmentModelAbstract.php index 2a914c3f92b7c9f04bdbd82cb5e2c7ad83710f78..17fbf2c781591757769324310aec1f5305d4938e 100644 --- a/src/app/attachment/models/AttachmentModelAbstract.php +++ b/src/app/attachment/models/AttachmentModelAbstract.php @@ -183,12 +183,11 @@ abstract class AttachmentModelAbstract public static function setInSignatureBook(array $aArgs) { - ValidatorModel::notEmpty($aArgs, ['id', 'isVersion']); + ValidatorModel::notEmpty($aArgs, ['id']); ValidatorModel::intVal($aArgs, ['id']); - ValidatorModel::stringType($aArgs, ['isVersion']); - ValidatorModel::boolType($aArgs, ['inSignatureBook']); + ValidatorModel::boolType($aArgs, ['inSignatureBook', 'isVersion']); - if ($aArgs['isVersion'] == 'true') { + if ($aArgs['isVersion'] == true) { $table = 'res_version_attachments'; } else { $table = 'res_attachments';