diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index 77b14b24c7a..e166b15c8ee 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -149,21 +149,21 @@ if (empty($reshook))
else $errors[] = 'FailedToValidateBarCode';
$error++;
- setEventMessage($errors,'errors');
+ setEventMessages($errors, null, 'errors');
}
}
if ($action == 'setaccountancy_code_buy') {
$result = $object->setAccountancyCode('buy', GETPOST('accountancy_code_buy'));
- if ($result < 0) setEventMessage(join(',',$object->errors), 'errors');
+ if ($result < 0) setEventMessages(join(',',$object->errors), null, 'errors');
$action="";
}
if ($action == 'setaccountancy_code_sell')
{
$result = $object->setAccountancyCode('sell', GETPOST('accountancy_code_sell'));
- if ($result < 0) setEventMessage(join(',',$object->errors), 'errors');
+ if ($result < 0) setEventMessages(join(',',$object->errors), null, 'errors');
$action="";
}
@@ -174,13 +174,13 @@ if (empty($reshook))
if (! GETPOST('label'))
{
- setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')), 'errors');
+ setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')), null, 'errors');
$action = "create";
$error++;
}
if (empty($ref))
{
- setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')), 'errors');
+ setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')), null, 'errors');
$action = "create";
$error++;
}
@@ -224,7 +224,8 @@ if (empty($reshook))
if ($result < 0)
{
$error++;
- setEventMessage('Failed to get bar code type information '.$stdobject->error, 'errors');
+ $mesg='Failed to get bar code type information ';
+ setEventMessages($mesg.$stdobject->error, $mesg.$stdobject->errors, 'errors');
}
$object->barcode_type_code = $stdobject->barcode_type_code;
$object->barcode_type_coder = $stdobject->barcode_type_coder;
@@ -290,8 +291,8 @@ if (empty($reshook))
}
else
{
- if (count($object->errors)) setEventMessage($object->errors, 'errors');
- else setEventMessage($langs->trans($object->error), 'errors');
+ if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors');
+ else setEventMessages($langs->trans($object->error), null, 'errors');
$action = "create";
}
}
@@ -353,7 +354,8 @@ if (empty($reshook))
if ($result < 0)
{
$error++;
- setEventMessage('Failed to get bar code type information '.$stdobject->error, 'errors');
+ $mesg='Failed to get bar code type information ';
+ setEventMessages($mesg.$stdobject->error, $mesg.$stdobject->errors, 'errors');
}
$object->barcode_type_code = $stdobject->barcode_type_code;
$object->barcode_type_coder = $stdobject->barcode_type_coder;
@@ -378,15 +380,15 @@ if (empty($reshook))
}
else
{
- if (count($object->errors)) setEventMessage($object->errors, 'errors');
- else setEventMessage($langs->trans($object->error), 'errors');
+ if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors');
+ else setEventMessages($langs->trans($object->error), null, 'errors');
$action = 'edit';
}
}
else
{
- if (count($object->errors)) setEventMessage($object->errors, 'errors');
- else setEventMessage($langs->trans("ErrorProductBadRefOrLabel"), 'errors');
+ if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors');
+ else setEventMessages($langs->trans("ErrorProductBadRefOrLabel"), null, 'errors');
$action = 'edit';
}
}
@@ -400,7 +402,7 @@ if (empty($reshook))
{
if (! GETPOST('clone_content') && ! GETPOST('clone_prices') )
{
- setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
+ setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
}
else
{
@@ -427,7 +429,7 @@ if (empty($reshook))
if ($result < 1)
{
$db->rollback();
- setEventMessage($langs->trans('ErrorProductClone'), 'errors');
+ setEventMessages($langs->trans('ErrorProductClone'), null, 'errors');
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$originalId);
exit;
}
@@ -454,7 +456,7 @@ if (empty($reshook))
$mesg=$langs->trans("ErrorProductAlreadyExists",$object->ref);
$mesg.=' ref.'">'.$langs->trans("ShowCardHere").'.';
- setEventMessage($mesg, 'errors');
+ setEventMessages($mesg, null, 'errors');
$object->fetch($id);
}
else
@@ -462,12 +464,12 @@ if (empty($reshook))
$db->rollback();
if (count($object->errors))
{
- setEventMessage($object->errors, 'errors');
+ setEventMessages($object->error, $object->errors, 'errors');
dol_print_error($db,$object->errors);
}
else
{
- setEventMessage($langs->trans($object->error), 'errors');
+ setEventMessages($langs->trans($object->error), null, 'errors');
dol_print_error($db,$object->error);
}
}
@@ -498,7 +500,7 @@ if (empty($reshook))
}
else
{
- setEventMessage($langs->trans($object->error), 'errors');
+ setEventMessages($langs->trans($object->error), null, 'errors');
$reload = 0;
$action='';
}
@@ -624,7 +626,7 @@ if (empty($reshook))
return;
}
- setEventMessage($langs->trans("ErrorUnknown") . ": $result", 'errors');
+ setEventMessages($langs->trans("ErrorUnknown") . ": $result", null, 'errors');
} elseif (GETPOST('commandeid') > 0) {
$result = $commande->addline(
$desc,
@@ -696,7 +698,7 @@ if (empty($reshook))
}
else {
$action="";
- setEventMessage($langs->trans("WarningSelectOneDocument"), 'warnings');
+ setEventMessages($langs->trans("WarningSelectOneDocument"), null, 'warnings');
}
}
diff --git a/htdocs/product/document.php b/htdocs/product/document.php
index ecb3d12bb52..8a4c68990c6 100644
--- a/htdocs/product/document.php
+++ b/htdocs/product/document.php
@@ -105,7 +105,7 @@ if (empty($reshook))
$filetomerge->file_name=$filename;
$result=$filetomerge->delete_by_file($user);
if ($result<0) {
- setEventMessage($filetomerge->error,'errors');
+ setEventMessages($filetomerge->error, $filetomerge->errors, 'errors');
}
}
}
@@ -137,7 +137,7 @@ if ($action=='filemerge')
$result=$filetomerge->delete_by_product($user, $object->id);
}
if ($result<0) {
- setEventMessage($filetomerge->error,'errors');
+ setEventMessages($filetomerge->error, $filetomerge->errors, 'errors');
}
// for each file checked add it to the product
@@ -152,7 +152,7 @@ if ($action=='filemerge')
$result=$filetomerge->create($user);
if ($result<0) {
- setEventMessage($filetomerge->error,'errors');
+ setEventMessages($filetomerge->error, $filetomerge->errors, 'errors');
}
}
}
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index 04007d2ede1..1f5e35a043a 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -101,7 +101,7 @@ if (empty($reshook))
if ($result > 0)
{
$object->cost_price = price2num($cost_price);
- setEventMessage($langs->trans("RecordSaved"));
+ setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
}
else
{
@@ -119,7 +119,7 @@ if (empty($reshook))
$action = '';
$result=$object->remove_product_fournisseur_price($rowid);
if($result > 0){
- setEventMessage($langs->trans("PriceRemoved"));
+ setEventMessages($langs->trans("PriceRemoved"), null, 'mesgs');
}else{
$error++;
setEventMessages($object->error, $object->errors, 'errors');
@@ -151,7 +151,7 @@ if (empty($reshook))
{
$error++;
$langs->load("errors");
- setEventMessage($langs->trans("ErrorFieldMustBeANumeric",'eeee'), 'errors');
+ setEventMessages($langs->trans("ErrorFieldMustBeANumeric",'eeee'), null, 'errors');
}
if (empty($quantity))
{
@@ -199,12 +199,12 @@ if (empty($reshook))
$object->fetch($object->product_id_already_linked);
$productLink = $object->getNomUrl(1,'supplier');
- setEventMessage($langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct",$productLink), 'errors');
+ setEventMessages($langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct",$productLink), null, 'errors');
}
else if ($ret < 0)
{
$error++;
- setEventMessage($object->error, 'errors');
+ setEventMessages($object->error, $object->errors, 'errors');
}
}
@@ -220,7 +220,7 @@ if (empty($reshook))
{
$error++;
- setEventMessage($object->error, $object->errors, 'errors');
+ setEventMessages($object->error, $object->errors, 'errors');
}
else
{
@@ -231,7 +231,7 @@ if (empty($reshook))
$price_result = $priceparser->parseProductSupplier($id, $price_expression, $quantity, $tva_tx);
if ($price_result < 0) { //Expression is not valid
$error++;
- setEventMessage($priceparser->translatedError(), 'errors');
+ setEventMessages($priceparser->translatedError(), null, 'errors');
}
}
if (! $error && ! empty($conf->dynamicprices->enabled)) {
@@ -239,7 +239,7 @@ if (empty($reshook))
if ($ret < 0)
{
$error++;
- setEventMessage($object->error, 'errors');
+ setEventMessages($object->error, $object->errors, 'errors');
}
}
}
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index b656b88efc6..335f6cd346a 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -293,7 +293,7 @@ else
// Displays product removal confirmation
if (GETPOST('delprod')) {
- setEventMessage($langs->trans("ProductDeleted", GETPOST('delprod')));
+ setEventMessages($langs->trans("ProductDeleted", GETPOST('delprod')), null, 'mesgs');
}
if ($sref) $param="&sref=".$sref;
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index 2a770841c60..e5b93d981af 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -6,7 +6,7 @@
* Copyright (C) 2006 Andre Cianfarani
* Copyright (C) 2014 Florian Henry
* Copyright (C) 2014 Juanjo Menent
- * Copyright (C) 2014 Philippe Grand
+ * Copyright (C) 2014-2015 Philippe Grand
* Copyright (C) 2014 Ion agorria
* Copyright (C) 2015 Alexandre Spangaro
* Copyright (C) 2015 Marcos GarcĂa
@@ -131,7 +131,7 @@ if (empty($reshook))
if ($priceparser->parseProduct($object) < 0) {
$error ++;
- setEventMessage($priceparser->translatedError(), 'errors');
+ setEventMessages($priceparser->translatedError(), null, 'errors');
}
}
}
@@ -194,7 +194,7 @@ if (empty($reshook))
$newprice_min = price2num($val['price_min'], 'MU');
if (!empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $newprice_min < $maxpricesupplier) {
- setEventMessage($langs->trans("MinimumPriceLimit", price($maxpricesupplier, 0, '', 1, - 1, - 1, 'auto')), 'errors');
+ setEventMessages($langs->trans("MinimumPriceLimit", price($maxpricesupplier, 0, '', 1, - 1, - 1, 'auto')), null, 'errors');
$error ++;
break;
}
@@ -203,7 +203,7 @@ if (empty($reshook))
if ($res < 0) {
$error ++;
- setEventMessage($object->error, 'errors');
+ setEventMessages($object->error, $object->errors, 'errors');
break;
}
}
@@ -211,12 +211,12 @@ if (empty($reshook))
if (!$error && $object->update($object->id, $user) < 0) {
$error++;
- setEventMessage($object->error, 'errors');
+ setEventMessages($object->error, $object->errors, 'errors');
}
if (empty($error)) {
$action = '';
- setEventMessage($langs->trans("RecordSaved"));
+ setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$db->commit();
} else {
$action = 'edit_price';
@@ -229,7 +229,7 @@ if (empty($reshook))
{
$result = $object->log_price_delete($user, $_GET ["lineid"]);
if ($result < 0) {
- setEventMessage($object->error, 'errors');
+ setEventMessages($object->error, $object->errors, 'errors');
}
}
@@ -341,7 +341,7 @@ if (empty($reshook))
if (! empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $prodcustprice->price_min<$maxpricesupplier)
{
- setEventMessage($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')),'errors');
+ setEventMessages($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')), null, 'errors');
$error++;
$action='add_customer_price';
}
@@ -351,9 +351,9 @@ if (empty($reshook))
$result = $prodcustprice->create($user, 0, $update_child_soc);
if ($result < 0) {
- setEventMessage($prodcustprice->error, 'errors');
+ setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
} else {
- setEventMessage($langs->trans('RecordSaved'), 'mesgs');
+ setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
}
$action = '';
@@ -367,9 +367,9 @@ if (empty($reshook))
$result = $prodcustprice->delete($user);
if ($result < 0) {
- setEventMessage($prodcustprice->error, 'mesgs');
+ setEventMessages($prodcustprice->error, $prodcustprice->errors, 'mesgs');
} else {
- setEventMessage($langs->trans('RecordDeleted'), 'errors');
+ setEventMessages($langs->trans('RecordDeleted'), null, 'errors');
}
$action = '';
}
@@ -391,7 +391,7 @@ if (empty($reshook))
if ($prodcustprice->price_min<$maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
{
- setEventMessage($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')),'errors');
+ setEventMessages($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')), null, 'errors');
$error++;
$action='update_customer_price';
}
@@ -401,9 +401,9 @@ if (empty($reshook))
$result = $prodcustprice->update($user, 0, $update_child_soc);
if ($result < 0) {
- setEventMessage($prodcustprice->error, 'errors');
+ setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
} else {
- setEventMessage($langs->trans('Save'), 'mesgs');
+ setEventMessages($langs->trans('Save'), null, 'mesgs');
}
$action = '';
@@ -1257,7 +1257,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
$result = $prodcustprice->fetch(GETPOST('lineid', 'int'));
if ($result < 0) {
- setEventMessage($prodcustprice->error, 'errors');
+ setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
}
print '