From f22b3cdfee24da348694b326673b324b82d19aea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 20 Oct 2015 10:31:45 +0200 Subject: [PATCH] Fix some action has no effect in shipment --- htdocs/expedition/shipment.php | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 82bf1d01e6a..fa2457516ae 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -88,9 +88,7 @@ if ($action == 'setdatedelivery' && $user->rights->commande->creer) $commande->fetch($id); $result=$commande->set_date_livraison($user,$datelivraison); if ($result < 0) - { - $mesg='
'.$commande->error.'
'; - } + setEventMessages($commande->error, $commande->errors, 'errors'); } if ($action == 'setdeliveryaddress' && $user->rights->commande->creer) @@ -98,6 +96,8 @@ if ($action == 'setdeliveryaddress' && $user->rights->commande->creer) $commande = new Commande($db); $commande->fetch($id); $commande->setDeliveryAddress(GETPOST('delivery_address_id','int')); + if ($result < 0) + setEventMessages($commande->error, $commande->errors, 'errors'); } if ($action == 'setmode' && $user->rights->commande->creer) @@ -105,7 +105,24 @@ if ($action == 'setmode' && $user->rights->commande->creer) $commande = new Commande($db); $commande->fetch($id); $result = $commande->setPaymentMethods(GETPOST('mode_reglement_id','int')); - if ($result < 0) dol_print_error($db,$commande->error); + if ($result < 0) + setEventMessages($commande->error, $commande->errors, 'errors'); +} + +if ($action == 'setavailability' && $user->rights->commande->creer) { + $commande = new Commande($db); + $commande->fetch($id); + $result=$commande->availability(GETPOST('availability_id')); + if ($result < 0) + setEventMessages($commande->error, $commande->errors, 'errors'); +} + +if ($action == 'setdemandreason' && $user->rights->commande->creer) { + $commande = new Commande($db); + $commande->fetch($id); + $result=$commande->demand_reason(GETPOST('demand_reason_id')); + if ($result < 0) + setEventMessages($commande->error, $commande->errors, 'errors'); } if ($action == 'setconditions' && $user->rights->commande->creer) @@ -113,7 +130,8 @@ if ($action == 'setconditions' && $user->rights->commande->creer) $commande = new Commande($db); $commande->fetch($id); $result=$commande->setPaymentTerms(GETPOST('cond_reglement_id','int')); - if ($result < 0) dol_print_error($db,$commande->error); + if ($result < 0) + setEventMessages($commande->error, $commande->errors, 'errors'); } // shipping method @@ -121,6 +139,8 @@ if ($action == 'setshippingmethod' && $user->rights->commande->creer) { $commande = new Commande($db); $commande->fetch($id); $result=$commande->setShippingMethod(GETPOST('shipping_method_id', 'int')); + if ($result < 0) + setEventMessages($commande->error, $commande->errors, 'errors'); }