From b60c35c242d7a632e0c754d2ef7bb4a8f87a7868 Mon Sep 17 00:00:00 2001
From: Guillaume Heurtier <guillaume.heurtier@maarch.org>
Date: Thu, 3 Sep 2020 18:09:41 +0200
Subject: [PATCH] FEAT #14458 TIME 0:10 import contacts error lang

---
 src/app/contact/controllers/ContactController.php | 6 +++---
 src/lang/lang-en.json                             | 7 ++++++-
 src/lang/lang-fr.json                             | 7 ++++++-
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/app/contact/controllers/ContactController.php b/src/app/contact/controllers/ContactController.php
index b1c7b1aba6c..cbf03d727bb 100755
--- a/src/app/contact/controllers/ContactController.php
+++ b/src/app/contact/controllers/ContactController.php
@@ -1243,10 +1243,10 @@ class ContactController
                         // Check custom field format
                         $type = $customTypes[(string)$customId];
                         if (in_array($type, ['checkbox', 'select', 'radio']) && !Validator::arrayType()->validate($contact[$frontField])) {
-                            $errors[] = ['error' => "Argument {$frontField} is not an array for contact {$key}", 'index' => $key, 'lang' => 'argumentNotAnArray']; // TODO lang
+                            $errors[] = ['error' => "Argument {$frontField} is not an array for contact {$key}", 'index' => $key, 'lang' => 'argumentNotArray'];
                             continue 2;
                         } elseif ($customTypes[$customId] == 'integer' && !Validator::intVal()->validate($contact[$frontField])) {
-                            $errors[] = ['error' => "Argument {$frontField} is not an integer for contact {$key}", 'index' => $key, 'lang' => 'argumentNotAnInteger'];
+                            $errors[] = ['error' => "Argument {$frontField} is not an integer for contact {$key}", 'index' => $key, 'lang' => 'argumentNotInteger'];
                             continue 2;
                         } elseif ($customTypes[$customId] == 'date' && !Validator::date()->validate($contact[$frontField])) {
                             $errors[] = ['error' => "Argument {$frontField} is not a date for contact {$key}", 'index' => $key, 'lang' => 'argumentNotDate'];
@@ -1284,7 +1284,7 @@ class ContactController
                 $mandatoryParameters = ContactParameterModel::get(['select' => ['identifier'], 'where' => ['mandatory = ?', 'identifier not in (?)'], 'data' => [true, ['lastname', 'company']]]);
                 foreach ($mandatoryParameters as $mandatoryParameter) {
                         if (empty($contact[$mandatoryParameter['identifier']])) {
-                            $errors[] = ['error' => "Argument {$mandatoryParameter['identifier']} is empty for contact {$key}", 'index' => $key, 'lang' => 'argumentMailEmpty']; // TODO lang
+                            $errors[] = ['error' => "Argument {$mandatoryParameter['identifier']} is empty for contact {$key}", 'index' => $key, 'lang' => 'argumentMandatoryEmpty'];
                             continue 2;
                         }
                 }
diff --git a/src/lang/lang-en.json b/src/lang/lang-en.json
index 49a956ebe04..3a2b51a1cb0 100644
--- a/src/lang/lang-en.json
+++ b/src/lang/lang-en.json
@@ -1980,5 +1980,10 @@
     "registeredMailNumberRangeCreation": "Registered mail number range creation",
     "registeredMailNumberRangeModification": "Registered mail number range modification",
     "argumentCivilityNotCorrect": "Argument Civility is not a valid civility for a contact",
-    "argumentLastnameAndCompanyEmpty": "Arguments lastname and company are empty for a contact"
+    "argumentLastnameAndCompanyEmpty": "Arguments lastname and company are empty for a contact",
+    "argumentNotArray": "An argument is not an array for a contact",
+    "argumentNotInteger": "An argument is not an integer for a contact",
+    "argumentNotDate": "An argument is not a date for a contact",
+    "argumentNotString": "An argument is not a string for a contact",
+    "argumentMandatoryEmpty": "Mandatory argument is empty for a contact"
 }
diff --git a/src/lang/lang-fr.json b/src/lang/lang-fr.json
index 13415827b02..b5a65180c55 100644
--- a/src/lang/lang-fr.json
+++ b/src/lang/lang-fr.json
@@ -1978,5 +1978,10 @@
     "infoImportcontacts": "La colonne <b>id</b> est utilisée pour identifier un contact",
     "importContacts": "Importer des contacts",
     "argumentCivilityNotCorrect": "La donnée civility n'est pas une civilité valide pour un contact",
-    "argumentLastnameAndCompanyEmpty": "Les données lastname et company sont vides pour un contact"
+    "argumentLastnameAndCompanyEmpty": "Les données lastname et company sont vides pour un contact",
+    "argumentNotArray": "Une donnée n'est pas un tableau pour un contact",
+    "argumentNotInteger": "Une donnée n'est pas un entier pour un contact",
+    "argumentNotDate": "Une donnée n'est pas une date pour un contact",
+    "argumentNotString": "Une donnée n'est pas une chaîne de caractères pour un contact",
+    "argumentMandatoryEmpty": "Une donnée obligatoire est vide pour un contact"
 }
-- 
GitLab