From 4666de85e2ed4f5b2a9605b2319aba1f6324f467 Mon Sep 17 00:00:00 2001 From: KreizIT Date: Fri, 4 Jul 2014 16:18:54 +0200 Subject: [PATCH] Fix: [ bug #1508 ] STOCK_MOVEMENT does not show trigger error message --- ChangeLog | 2 ++ htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN | 6 ++++++ htdocs/product/class/product.class.php | 4 ++-- htdocs/product/stock/product.php | 7 +++++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0c80f04d4b0..989c34bd305 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,8 @@ For users: - Fix: [ bug #1463, #1464 ] Proposal triggers problem - Fix: [ bug #1498, #1499 ] Shipment/Delivery triggers problem - Fix: [ bug #1465, #1466 ] Product triggers problem +- Fix: [ bug #1508 ] STOCK_MOVEMENT does not show trigger error message + For translators: - Update language files. diff --git a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN index f19d717043a..ee99d202bdd 100644 --- a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN +++ b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN @@ -226,6 +226,12 @@ class InterfaceDemo dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } elseif ($action == 'PRODUCT_PRICE_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + //Stock mouvement + elseif ($action == 'STOCK_MOVEMENT') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index adf45fed387..b9d0da37c80 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2867,7 +2867,7 @@ class Product extends CommonObject } else { - dol_print_error($this->db); + $this->error=$movementstock->error; $this->db->rollback(); return -1; } @@ -3454,7 +3454,7 @@ class Product extends CommonObject } else { - dol_print_error($this->db); + $this->error=$movementstock->error; $this->db->rollback(); return -1; } diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 338169a6154..a9b9c000553 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -154,6 +154,11 @@ if ($action == "correct_stock" && ! $cancel) header("Location: ".$_SERVER["PHP_SELF"]."?id=".$product->id); exit; } + else + { + setEventMessage($product->error,'errors'); + $action='correction'; + } } } } @@ -253,6 +258,8 @@ if ($id > 0 || $ref) $titre=$langs->trans("CardProduct".$product->type); $picto=($product->type==1?'service':'product'); dol_fiche_head($head, 'stock', $titre, 0, $picto); + + dol_htmloutput_events(); $form = new Form($db);