diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index a3d30316522..b4b44de3a70 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -156,12 +156,11 @@ if (empty($reshook)) $result = $object->set_reopen($user); if ($result > 0) { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; + setEventMessages($langs->trans('OrderReopened', $object->ref), null); } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } } @@ -208,7 +207,7 @@ if (empty($reshook)) } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -471,7 +470,7 @@ if (empty($reshook)) $result = $object->set_date($user, $date); if ($result < 0) { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -481,7 +480,7 @@ if (empty($reshook)) $result = $object->set_date_livraison($user, $datelivraison); if ($result < 0) { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -529,16 +528,25 @@ if (empty($reshook)) elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) { $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } // bank account else if ($action == 'setbankaccount' && $user->rights->commande->creer) { $result=$object->setBankAccount(GETPOST('fk_account', 'int')); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } // shipping method else if ($action == 'setshippingmethod' && $user->rights->commande->creer) { $result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int')); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } else if ($action == 'setremisepercent' && $user->rights->commande->creer) { @@ -1032,7 +1040,7 @@ if (empty($reshook)) else if ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->commande->cloturer) { $result = $object->cloture($user); if ($result < 0) { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors(), 'errors'); } } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 907c9c7b46b..af07f9beb22 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2866,6 +2866,7 @@ abstract class CommonObject } else { + $this->errors[] = $this->db->lasterror(); return false; } } @@ -2875,7 +2876,7 @@ abstract class CommonObject * * @param int $id_incoterm Id of incoterm to set or '' to remove * @param string $location location of incoterm - * @return int <0 if KO, >0 if OK + * @return int >0 if KO, <0 if OK */ function setIncoterms($id_incoterm, $location) { @@ -2903,6 +2904,7 @@ abstract class CommonObject } else { + $this->errors[] = $this->db->lasterror(); return -1; } } diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 287a83afba3..3f635ad85b3 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -70,6 +70,7 @@ ValidateOrder=Validate order UnvalidateOrder=Unvalidate order DeleteOrder=Delete order CancelOrder=Cancel order +OrderReopened= Order %s Reopened AddOrder=Create order AddToMyOrders=Add to my orders AddToOtherOrders=Add to other orders