Clean and update code

This commit is contained in:
Philippe GRAND 2018-07-25 15:36:50 +02:00
parent 7d5464cfbc
commit ff04cb64c0
6 changed files with 19 additions and 15 deletions

View File

@ -4,7 +4,7 @@
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2016 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ion Agorria <ion@agorria.com>
@ -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 ++;
}
}

View File

@ -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
{

View File

@ -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 ++;
}
}

View File

@ -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);
}
}

View File

@ -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
{

View File

@ -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='';
}