From 311b9af511b604ec7f10d19441890eef8a29d6e0 Mon Sep 17 00:00:00 2001
From: Guillaume Heurtier <guillaume.heurtier@maarch.org>
Date: Mon, 13 Jan 2020 15:28:21 +0100
Subject: [PATCH] FEAT #12091 TIME 0:45 put attachments in signatory by default
 if it is a signed type

---
 src/app/attachment/controllers/AttachmentController.php | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/app/attachment/controllers/AttachmentController.php b/src/app/attachment/controllers/AttachmentController.php
index 5c0b5716257..3a514b1cea4 100755
--- a/src/app/attachment/controllers/AttachmentController.php
+++ b/src/app/attachment/controllers/AttachmentController.php
@@ -57,6 +57,11 @@ class AttachmentController
             'collId'    => 'attachments_coll'
         ]);
 
+        $attachmentsTypes = AttachmentModel::getAttachmentsTypesByXML();
+        if ($attachmentsTypes[$body['type']]['sign']) {
+            AttachmentModel::setInSignatureBook(['id' => $id, 'inSignatureBook' => true]);
+        }
+
         $customId = CoreConfigModel::getCustomId();
         $customId = empty($customId) ? 'null' : $customId;
         exec("php src/app/convert/scripts/FullTextScript.php --customId {$customId} --resId {$id} --collId attachments_coll --userId {$GLOBALS['id']} > /dev/null &");
-- 
GitLab