From aa6ec3d0dd8a77ff640cbb10d7d5e0aa1e22ceea Mon Sep 17 00:00:00 2001
From: Mathieu <mathieu.pionnier@maarch.org>
Date: Mon, 31 Jan 2022 16:03:27 +0100
Subject: [PATCH] FEAT #18862 TIME 0:01 fix always empty title

---
 src/app/attachment/controllers/AttachmentController.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/app/attachment/controllers/AttachmentController.php b/src/app/attachment/controllers/AttachmentController.php
index 6d4af5f0faf..380024d0f73 100755
--- a/src/app/attachment/controllers/AttachmentController.php
+++ b/src/app/attachment/controllers/AttachmentController.php
@@ -1038,7 +1038,7 @@ class AttachmentController
             return ['errors' => 'Body resIdMaster is empty or not an integer'];
         } elseif (!Validator::stringType()->notEmpty()->validate($body['type'])) {
             return ['errors' => 'Body type is empty or not a string'];
-        } elseif (!empty($body['title']) || !Validator::length(1, 255)->validate($body['title'])) {
+        } elseif (!empty($body['title']) && !Validator::length(1, 255)->validate($body['title'])) {
             return ['errors' => 'Body title number of characters must be between 1 and 255 characters)'];
         } elseif (isset($body['status']) && !in_array($body['status'], ['A_TRA', 'TRA', 'SEND_MASS'])) {
             return ['errors' => 'Body status can only be A_TRA, TRA or SEND_MASS'];
-- 
GitLab