From 791f6ea53271e7ac15db4e305973d285082cdc10 Mon Sep 17 00:00:00 2001 From: Guillaume Heurtier <guillaume.heurtier@maarch.org> Date: Fri, 4 Dec 2020 14:48:56 +0100 Subject: [PATCH] FIX #15570 TIME 0:50 fix doc date in future for outgoing mail + do not set in integrations if no document --- .../controllers/ResourceControlController.php | 11 +++++++---- src/app/resource/controllers/StoreController.php | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/app/resource/controllers/ResourceControlController.php b/src/app/resource/controllers/ResourceControlController.php index 9ead2e473c1..2e5aad504a0 100644 --- a/src/app/resource/controllers/ResourceControlController.php +++ b/src/app/resource/controllers/ResourceControlController.php @@ -426,10 +426,13 @@ class ResourceControlController return ['errors' => "Body documentDate is not a date"]; } - $documentDate = new \DateTime($body['documentDate']); - $tmr = new \DateTime('tomorrow'); - if ($documentDate > $tmr) { - return ['errors' => "Body documentDate is not a valid date"]; + $model = IndexingModelModel::getById(['id' => $body['modelId'], 'select' => ['category']]); + if ($model['category'] != 'outgoing') { + $documentDate = new \DateTime($body['documentDate']); + $tmr = new \DateTime('tomorrow'); + if ($documentDate > $tmr) { + return ['errors' => "Body documentDate is not a valid date"]; + } } } if (!empty($body['arrivalDate'])) { diff --git a/src/app/resource/controllers/StoreController.php b/src/app/resource/controllers/StoreController.php index be67493a6d6..9dc17a54a4d 100755 --- a/src/app/resource/controllers/StoreController.php +++ b/src/app/resource/controllers/StoreController.php @@ -206,7 +206,7 @@ class StoreController } $integrations = ['inSignatureBook' => false, 'inShipping' => false]; - if (!empty($args['integrations'])) { + if (!empty($args['integrations']) && !empty($args['encodedFile'])) { $integrations['inSignatureBook'] = !empty($args['integrations']['inSignatureBook']); $integrations['inShipping'] = !empty($args['integrations']['inShipping']); } -- GitLab