From be21405d219d04cd286c653f7490b9d1d1a89a1e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 May 2018 19:24:56 +0200 Subject: [PATCH] Fix missing error message --- htdocs/societe/card.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 204eff383d5..d0aa719e08c 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -296,7 +296,7 @@ if (empty($reshook)) if (! $error) { $result = $object->insertExtraFields(); - if ($result < 0) + if ($result < 0) { $error++; $errors = $object->errors; @@ -524,8 +524,8 @@ if (empty($reshook)) $error=$object->error; $errors=$object->errors; } } - - + + // Customer categories association $custcats = GETPOST( 'custcats', 'array' ); $object->setCategories($custcats, 'customer'); @@ -533,7 +533,7 @@ if (empty($reshook)) // Supplier categories association $suppcats = GETPOST('suppcats', 'array'); $object->setCategories($suppcats, 'supplier'); - + // Logo/Photo save $dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); @@ -638,10 +638,13 @@ if (empty($reshook)) $result = $object->update($socid, $user, 1, $object->oldcopy->codeclient_modifiable(), $object->oldcopy->codefournisseur_modifiable(), 'update', 0); if ($result <= 0) { - $error = $object->error; $errors = $object->errors; + $error++; + $errors = $object->errors; + setEventMessages($object->error, $object->errors, 'errors'); } + // Prevent thirdparty's emptying if a user hasn't rights $user->rights->categorie->lire (in such a case, post of 'custcats' is not defined) - if(!empty($user->rights->categorie->lire)){ + if(!empty($user->rights->categorie->lire)){ // Customer categories association $categories = GETPOST( 'custcats', 'array' ); $object->setCategories($categories, 'customer'); @@ -718,6 +721,7 @@ if (empty($reshook)) { $error++; $object->error .= $object->db->lasterror(); + setEventMessages($object->error, $object->errors, 'errors'); } }