From ff04cb64c0b3609a9517c0fb4e9918ae37b742d3 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 25 Jul 2018 15:36:50 +0200 Subject: [PATCH] Clean and update code --- htdocs/fourn/commande/card.php | 8 +++++--- htdocs/fourn/commande/list.php | 2 +- htdocs/fourn/facture/card.php | 6 ++++-- htdocs/product/admin/product.php | 4 ++-- htdocs/product/card.php | 6 +++--- htdocs/product/stock/product.php | 8 ++++---- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index e1670e0c4d0..bab095fe6fa 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -4,7 +4,7 @@ * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2016 Regis Houssin * Copyright (C) 2010-2015 Juanjo Menent - * Copyright (C) 2011-2015 Philippe Grand + * Copyright (C) 2011-2018 Philippe Grand * Copyright (C) 2012-2016 Marcos GarcĂ­a * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Ion Agorria @@ -350,8 +350,10 @@ if (empty($reshook)) if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) { $idprod = $res->fk_product_child; - } else { - setEventMessage($langs->trans('ErrorProductCombinationNotFound'), 'errors'); + } + else + { + setEventMessages($langs->trans('ErrorProductCombinationNotFound'), null, 'errors'); $error ++; } } diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 971f99717f4..25f3118ad14 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -425,7 +425,7 @@ if (empty($reshook)) if (! $error) { $db->commit(); - setEventMessage($langs->trans('BillCreated', $nb_bills_created)); + setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs'); } else { diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index d409ba35b86..aefd04914ad 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1160,8 +1160,10 @@ if (empty($reshook)) if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) { $idprod = $res->fk_product_child; - } else { - setEventMessage($langs->trans('ErrorProductCombinationNotFound'), 'errors'); + } + else + { + setEventMessages($langs->trans('ErrorProductCombinationNotFound'), null, 'errors'); $error ++; } } diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index cbf47bbcd21..9b32720a9a8 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -180,13 +180,13 @@ if ($action == 'specimen') // For products } else { - setEventMessage($obj->error,'errors'); + setEventMessages($obj->error, $obj->errors, 'errors'); dol_syslog($obj->error, LOG_ERR); } } else { - setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index b01aa8bc3f1..adb127d67f8 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -689,7 +689,7 @@ if (empty($reshook)) if (($result = $propal->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0) { dol_syslog($langs->trans('FailedToGetCostPrice')); - setEventMessage($langs->trans('FailedToGetCostPrice'), 'errors'); + setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); } else { @@ -732,7 +732,7 @@ if (empty($reshook)) if (($result = $commande->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0) { dol_syslog($langs->trans('FailedToGetCostPrice')); - setEventMessage($langs->trans('FailedToGetCostPrice'), 'errors'); + setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); } else { @@ -775,7 +775,7 @@ if (empty($reshook)) if (($result = $facture->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0) { dol_syslog($langs->trans('FailedToGetCostPrice')); - setEventMessage($langs->trans('FailedToGetCostPrice'), 'errors'); + setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); } else { diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 7c18dc11281..d2da5abd3e0 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -135,7 +135,7 @@ if ($action == 'addlimitstockwarehouse' && !empty($user->rights->produit->creer) // Update $pse->seuil_stock_alerte = $seuil_stock_alerte; $pse->desiredstock = $desiredstock; - if($pse->update($user) > 0) setEventMessage($langs->trans('ProductStockWarehouseUpdated')); + if($pse->update($user) > 0) setEventMessages($langs->trans('ProductStockWarehouseUpdated'), null, 'mesgs'); } else { @@ -144,7 +144,7 @@ if ($action == 'addlimitstockwarehouse' && !empty($user->rights->produit->creer) $pse->fk_product = $id; $pse->seuil_stock_alerte = GETPOST('seuil_stock_alerte'); $pse->desiredstock = GETPOST('desiredstock'); - if($pse->create($user) > 0) setEventMessage($langs->trans('ProductStockWarehouseCreated')); + if($pse->create($user) > 0) setEventMessages($langs->trans('ProductStockWarehouseCreated'), null, 'mesgs'); } @@ -160,7 +160,7 @@ if($action == 'delete_productstockwarehouse' && !empty($user->rights->produit->c $pse = new ProductStockEntrepot($db); $pse->fetch(GETPOST('fk_productstockwarehouse')); - if($pse->delete($user) > 0) setEventMessage($langs->trans('ProductStockWarehouseDeleted')); + if($pse->delete($user) > 0) setEventMessages($langs->trans('ProductStockWarehouseDeleted'), null, 'mesgs'); $action = ''; @@ -176,7 +176,7 @@ if ($action == 'setseuil_stock_alerte' && !empty($user->rights->produit->creer)) if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); //else - // setEventMessage($lans->trans("SavedRecordSuccessfully")); + // setEventMessages($lans->trans("SavedRecordSuccessfully"), null, 'mesgs'); $action=''; }