From e869ed51e46700dbbc616894c0fd6b0603672965 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 9 Apr 2016 10:41:39 +0200 Subject: [PATCH] Use the update method to edit cost price of a product instead of setValue that does not run triggers. --- htdocs/product/fournisseurs.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index ff37543f42e..ce6815911e1 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -100,11 +100,12 @@ if (empty($reshook)) if ($id) { $result=$object->fetch($id); - $result=$object->setValueFrom('cost_price', price2num($cost_price)); + $object->cost_price = price2num($cost_price); + $result=$object->update($object->id, $user); if ($result > 0) { - $object->cost_price = price2num($cost_price); setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + $action=''; } else { @@ -112,7 +113,6 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } } - $action=''; } if ($action == 'remove_pf') -- GitLab