From a5e8063cfdfa186e9e3b189d468c233f92a9a14b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Tue, 25 Mar 2014 20:09:30 +0100 Subject: [PATCH] Fix: Bad management error --- htdocs/compta/facture.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index a338f588073..083a2e0518e 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -324,7 +324,8 @@ else if ($action == 'set_ref_client' && $user->rights->facture->creer) { } // Classify to validated -else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->facture->valider) { +else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->facture->valider) +{ $idwarehouse = GETPOST('idwarehouse'); $object->fetch($id); @@ -333,8 +334,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu // Check parameters // Check for mandatory prof id - for($i = 1; $i < 5; $i ++) { - + for($i = 1; $i < 6; $i ++) + { $idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY'; $idprof = 'idprof' . $i; if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory)) { @@ -362,9 +363,11 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu } } - if (! $error) { + if (! $error) + { $result = $object->validate($user, '', $idwarehouse); - if ($result >= 0) { + if ($result >= 0) + { // Define output language $outputlangs = $langs; $newlang = ''; @@ -381,7 +384,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } } else { - setEventMessage($object->error, 'errors'); + if (count($object->errors)) setEventMessage($object->errors, 'errors'); + else setEventMessage($object->error, 'errors'); } } } -- GitLab