diff --git a/src/app/attachment/controllers/AttachmentTypeController.php b/src/app/attachment/controllers/AttachmentTypeController.php index 9e12fa665c99e2035b249590ace8c31cef38844a..ae05d7ca1eec11bf8d422cd9276f223909ebf4a2 100644 --- a/src/app/attachment/controllers/AttachmentTypeController.php +++ b/src/app/attachment/controllers/AttachmentTypeController.php @@ -162,9 +162,9 @@ class AttachmentTypeController return $response->withStatus(400)->withJson(['errors' => 'Attachment type does not exist']); } - $attachments = AttachmentModel::get(['select' => 1, 'where' => ['attachment_type = ?', 'status != ?'], 'data' => [$attachmentType['type_id'], 'DEL']]); + $attachments = AttachmentModel::get(['select' => [1], 'where' => ['attachment_type = ?', 'status != ?'], 'data' => [$attachmentType['type_id'], 'DEL']]); if (!empty($attachments)) { - return $response->withStatus(400)->withJson(['errors' => 'Type is used in attachments']); + return $response->withStatus(400)->withJson(['errors' => 'Type is used in attachments', 'lang' => 'attachmentTypeUsed']); } AttachmentTypeModel::delete([ diff --git a/src/lang/lang-en.json b/src/lang/lang-en.json index eb5a00afd7a9b196640e093856c6cad41422d9dc..55df943ed5158d7af40310a8dfc6116fd2d8427b 100644 --- a/src/lang/lang-en.json +++ b/src/lang/lang-en.json @@ -2173,5 +2173,6 @@ "tooManySignUser": "Too many signatories", "requiredVisaUser": "{{min}} approvers required", "authorizedSignUser": "{{max}} signatories authorized", - "templateNameMandatory": "Template name mandatory" + "templateNameMandatory": "Template name mandatory", + "attachmentTypeUsed": "This type is used in attachment" } diff --git a/src/lang/lang-fr.json b/src/lang/lang-fr.json index b2868d85cff3591a67726679eda464202831c3e5..f600232d03e87a566a5e2bfdccd43494700741aa 100644 --- a/src/lang/lang-fr.json +++ b/src/lang/lang-fr.json @@ -2183,5 +2183,6 @@ "attachmentsTypes": "Type(s) de pièce(s) jointe(s)", "attachmentTypeModification": "Modification d'un type de pièce jointe", "iconLetter": "Lettre icône", - "noneAlt": "Aucune" + "noneAlt": "Aucune", + "attachmentTypeUsed": "Ce type est utilisé pour certaines pièces jointes" }