From 7d5464cfbcfd6182a69f46bef712eb4244ac3156 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 25 Jul 2018 15:25:23 +0200 Subject: [PATCH 1/5] Clean and update code --- htdocs/compta/bank/ligne.php | 2 +- htdocs/core/actions_massactions.inc.php | 2 +- htdocs/core/lib/admin.lib.php | 2 +- .../interface_50_modTicket_TicketEmail.class.php | 9 ++++++--- htdocs/expedition/card.php | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index 10e549dd094..94db9607c30 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Load translation files required by the page -$langs->loadLangs(array('banks', 'categories', 'compta', 'bills')); +$langs->loadLangs(array('banks', 'categories', 'compta', 'bills', 'other')); if (! empty($conf->adherent->enabled)) $langs->load("members"); if (! empty($conf->don->enabled)) $langs->load("donations"); if (! empty($conf->loan->enabled)) $langs->load("loan"); diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 646be9a3f92..7ce7ed12bff 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -703,7 +703,7 @@ if ($massaction == 'confirm_createbills') if (! $error) { $db->commit(); - setEventMessage($langs->trans('BillCreated', $nb_bills_created)); + setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs'); // Make a redirect to avoid to bill twice if we make a refresh or back $param=''; diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index eb3ef3698a4..0e7203ba748 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1201,7 +1201,7 @@ function activateModulesRequiredByCountry($country_code) { activateModule($modName); - setEventMessage($objMod->automatic_activation[$country_code],'warnings'); + setEventMessages($objMod->automatic_activation[$country_code], null, 'warnings'); } } diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 56bbd897f3d..3e28ea3e4ef 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -152,9 +152,12 @@ class InterfaceTicketEmail extends DolibarrTriggers } include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, '', '', 0, -1); - if ($mailfile->error) { - setEventMessage($mailfile->error, 'errors'); - } else { + if ($mailfile->error) + { + setEventMessages($mailfile->error, $mailfile->errors, 'errors'); + } + else + { $result = $mailfile->sendfile(); } if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index ab860ced2e9..faecdbd854e 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -276,7 +276,7 @@ if (empty($reshook)) // We try to set an amount // Case we dont use the list of available qty for each warehouse/lot // GUI does not allow this yet - setEventMessage('StockIsRequiredToChooseWhichLotToUse', 'errors'); + setEventMessages($langs->trans("StockIsRequiredToChooseWhichLotToUse"), null, 'errors'); } } } From ff04cb64c0b3609a9517c0fb4e9918ae37b742d3 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 25 Jul 2018 15:36:50 +0200 Subject: [PATCH 2/5] 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=''; } From efa6ad065921e4953bc571e5016fb1d47b7c2e10 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 25 Jul 2018 19:05:40 +0200 Subject: [PATCH 3/5] Clean and update code --- htdocs/product/price.php | 16 +++++++++------ htdocs/public/ticket/create_ticket.php | 28 +++++++++++++++++--------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 70e09114669..e68730acf64 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-2016 Juanjo Menent - * Copyright (C) 2014-2015 Philippe Grand + * Copyright (C) 2014-2018 Philippe Grand * Copyright (C) 2014 Ion agorria * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2015 Marcos García @@ -46,7 +46,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { } // Load translation files required by the page -$langs->loadLangs(array('products', 'bills', 'companies')); +$langs->loadLangs(array('products', 'bills', 'companies', 'other')); $mesg=''; $error=0; $errors=array(); @@ -464,8 +464,10 @@ if (empty($reshook)) $sql .= " WHERE rowid = " . $rowid; $result = $db->query($sql); - } else { - setEventMessage('delete_price_by_qty Missing Ids','errors'); + } + else + { + setEventMessages(('delete_price_by_qty'.$langs->transnoentities(MissingIds)), null,'errors'); } } @@ -477,8 +479,10 @@ if (empty($reshook)) $sql .= " WHERE fk_product_price = " . $priceid; $result = $db->query($sql); - } else { - setEventMessage('delete_all_price_by_qty Missing Ids','errors'); + } + else + { + setEventMessages(('delete_price_by_qty'.$langs->transnoentities(MissingIds)), null,'errors'); } } diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 066471fddff..c3c4979a843 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -177,7 +177,7 @@ if ($action == 'create_ticket' && GETPOST('add_ticket')) { $action = "infos_success"; } else { $object->db->rollback(); - setEventMessage($object->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action = 'create_ticket'; } @@ -226,9 +226,12 @@ if ($action == 'create_ticket' && GETPOST('add_ticket')) { } include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1); - if ($mailfile->error) { - setEventMessage($mailfile->error, 'errors'); - } else { + if ($mailfile->error || $mailfile->errors) + { + setEventMessages($mailfile->error, $mailfile->errors, 'errors'); + } + else + { $result = $mailfile->sendfile(); } if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { @@ -287,9 +290,12 @@ if ($action == 'create_ticket' && GETPOST('add_ticket')) { } include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; $mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1); - if ($mailfile->error) { - setEventMessage($mailfile->error, 'errors'); - } else { + if ($mailfile->error || $mailfile->errors) + { + setEventMessages($mailfile->error, $mailfile->errors, 'errors'); + } + else + { $result = $mailfile->sendfile(); } if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { @@ -308,10 +314,12 @@ if ($action == 'create_ticket' && GETPOST('add_ticket')) { $formmail->remove_attached_files($i); } - setEventMessage($langs->trans('YourTicketSuccessfullySaved')); + setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs'); } - } else { - setEventMessage($object->errors, 'errors'); + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); } } From 4eacad52f2ce32d3cb08c4b57ac7694be3b48bd5 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 27 Jul 2018 10:06:56 +0200 Subject: [PATCH 4/5] Clean and update code --- htdocs/public/ticket/list.php | 5 +++-- htdocs/public/ticket/view.php | 5 +++-- htdocs/resource/contact.php | 10 +++++----- htdocs/ticket/class/ticket.class.php | 11 +++++++---- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index d8290849f55..fe1dacbbbc7 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -121,8 +121,9 @@ if ($action == "view_ticketlist") { } } - if ($error) { - setEventMessage($object->errors, 'errors'); + if ($error || $errors) + { + setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } } diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 5383133c42e..38fcb3c4991 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -112,8 +112,9 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" | } } - if ($error) { - setEventMessage($object->errors, 'errors'); + if ($error || $errors) + { + setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } } diff --git a/htdocs/resource/contact.php b/htdocs/resource/contact.php index 981a07d7e73..e350c746c12 100644 --- a/htdocs/resource/contact.php +++ b/htdocs/resource/contact.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007-2009 Laurent Destailleur * Copyright (C) 2012 Juanjo Menent - * Copyright (C) 2016 Gilles Poirier + * Copyright (C) 2016 Gilles Poirier * * This program is free software; you can redistribute it and/or modify @@ -47,7 +47,7 @@ $result = $object->fetch($id,$ref); /* - * Ajout d'un nouveau contact + * Add a new contact */ if ($action == 'addcontact' && $user->rights->resource->write) @@ -72,17 +72,17 @@ if ($action == 'addcontact' && $user->rights->resource->write) $mesg = $object->error; } - setEventMessage($mesg, 'errors'); + setEventMessages($mesg, null, 'errors'); } } -// bascule du statut d'un contact +// Toggle the status of a contact else if ($action == 'swapstatut' && $user->rights->resource->write) { $result=$object->swapContactStatus(GETPOST('ligne','int')); } -// Efface un contact +// Erase a contact else if ($action == 'deletecontact' && $user->rights->resource->write) { $result = $object->delete_contact(GETPOST('lineid','int')); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 3dc0ab39756..bcec0158454 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1614,9 +1614,12 @@ class Ticket extends CommonObject } include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; $mailfile = new CMailFile($subject, $info_sendto['email'], $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, 0); - if ($mailfile->error) { - setEventMessage($mailfile->error, 'errors'); - } else { + if ($mailfile->error || $mailfile->errors) + { + setEventMessages($mailfile->error, $mailfile->errors, 'errors'); + } + else + { $result = $mailfile->sendfile(); if ($result > 0) { $nb_sent++; @@ -1627,7 +1630,7 @@ class Ticket extends CommonObject } } - setEventMessage($langs->trans('TicketNotificationNumberEmailSent', $nb_sent)); + setEventMessages($langs->trans('TicketNotificationNumberEmailSent', $nb_sent), null, 'mesgs'); } return $nb_sent; From 541e919ae0745453590fe0bf75b97510398d8cb2 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 27 Jul 2018 14:49:33 +0200 Subject: [PATCH 5/5] Clean and update code --- htdocs/user/notify/card.php | 4 ++-- htdocs/variants/admin/admin.php | 8 ++++---- htdocs/variants/card.php | 16 ++++++++-------- htdocs/variants/combinations.php | 16 ++++++++-------- htdocs/variants/create.php | 4 ++-- htdocs/variants/create_val.php | 6 +++--- htdocs/variants/generator.php | 6 +++--- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index 307b8ae5bc9..e8914298ac3 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2014 Laurent Destailleur - * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2016 Abbes Bahfir * @@ -67,7 +67,7 @@ if ($action == 'add') if ($actionid <= 0) { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Action")), 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Action")), null, 'errors'); $error++; } diff --git a/htdocs/variants/admin/admin.php b/htdocs/variants/admin/admin.php index dc039bf6d5f..57db7c49f20 100644 --- a/htdocs/variants/admin/admin.php +++ b/htdocs/variants/admin/admin.php @@ -31,15 +31,15 @@ if ($_POST) { $value = GETPOST('PRODUIT_ATTRIBUTES_HIDECHILD'); if (dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_HIDECHILD', $value, 'chaine', 0, '', $conf->entity)) { - setEventMessage($langs->trans('RecordSaved')); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } else { - setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); + setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors'); } if (dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_SEPARATOR', GETPOST('PRODUIT_ATTRIBUTES_SEPARATOR'), 'chaine', 0, '', $conf->entity)) { - setEventMessage($langs->trans('RecordSaved')); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } else { - setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); + setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors'); } } diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index 547a82d0f63..3addef7ddf9 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -50,9 +50,9 @@ if ($_POST) { $object->label = $label; if ($object->update($user) < 1) { - setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); + setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors'); } else { - setEventMessage($langs->trans('RecordSaved')); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); header('Location: '.dol_buildpath('/variants/card.php?id='.$id, 2)); exit(); } @@ -77,9 +77,9 @@ if ($_POST) { if (! $error) { if ($objectval->update($user) > 0) { - setEventMessage($langs->trans('RecordSaved')); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } else { - setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); + setEventMessage($langs->trans('CoreErrorMessage'), null, 'errors'); } } } @@ -99,11 +99,11 @@ if ($confirm == 'yes') { if ($res < 1 || ($object->delete() < 1)) { $db->rollback(); - setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); + setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors'); header('Location: '.dol_buildpath('/variants/card.php?id='.$object->id, 2)); } else { $db->commit(); - setEventMessage($langs->trans('RecordSaved')); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); header('Location: '.dol_buildpath('/variants/list.php', 2)); } exit(); @@ -113,9 +113,9 @@ if ($confirm == 'yes') { if ($objectval->fetch($valueid) > 0) { if ($objectval->delete() < 1) { - setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); + setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors'); } else { - setEventMessage($langs->trans('RecordSaved')); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } header('Location: '.dol_buildpath('/variants/card.php?id='.$object->id, 2)); diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index dbc413542c4..b741fef40bb 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -104,7 +104,7 @@ if ($_POST) { $features = $_SESSION['addvariant_'.$object->id]; if (!$features) { - setEventMessage($langs->trans('ErrorFieldsRequired'), 'errors'); + setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors'); } else { @@ -147,7 +147,7 @@ if ($_POST) { $result = $prodcomb->createProductCombination($object, $sanit_features, array(), $price_impact_percent, $price_impact, $weight_impact); if ($result > 0) { - setEventMessage($langs->trans('RecordSaved')); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); unset($_SESSION['addvariant_'.$object->id]); $db->commit(); @@ -214,7 +214,7 @@ if ($_POST) { } else { $db->commit(); - setEventMessage($langs->trans('RecordSaved')); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } } @@ -230,7 +230,7 @@ if ($_POST) { $prodcomb->variation_weight = $weight_impact; if ($prodcomb->update($user) > 0) { - setEventMessage($langs->trans('RecordSaved')); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); header('Location: '.dol_buildpath('/variants/combinations.php?id='.$id, 2)); exit(); } else { @@ -250,13 +250,13 @@ if ($action === 'confirm_deletecombination') { if ($prodcomb->delete($user) > 0 && $prodstatic->fetch($prodcomb->fk_product_child) > 0 && $prodstatic->delete($user) > 0) { $db->commit(); - setEventMessage($langs->trans('RecordSaved')); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); header('Location: '.dol_buildpath('/variants/combinations.php?id='.$object->id, 2)); exit(); } $db->rollback(); - setEventMessage($langs->trans('ProductCombinationAlreadyUsed'), 'errors'); + setEventMessages($langs->trans('ProductCombinationAlreadyUsed'), null, 'errors'); $action = ''; } } elseif ($action === 'edit') { @@ -284,12 +284,12 @@ if ($action === 'confirm_deletecombination') { header('Location: '.dol_buildpath('/variants/combinations.php?id='.$prodstatic->id, 2)); exit(); } else { - setEventMessage($langs->trans('ErrorCopyProductCombinations'), 'errors'); + setEventMessages($langs->trans('ErrorCopyProductCombinations'), null, 'errors'); } } } else { - setEventMessage($langs->trans('ErrorDestinationProductNotFound'), 'errors'); + setEventMessages($langs->trans('ErrorDestinationProductNotFound'), null, 'errors'); } } diff --git a/htdocs/variants/create.php b/htdocs/variants/create.php index f1a34a835b6..c4d775f3d50 100644 --- a/htdocs/variants/create.php +++ b/htdocs/variants/create.php @@ -29,7 +29,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); if ($_POST) { if (empty($ref) || empty($label)) { - setEventMessage($langs->trans('ErrorFieldsRequired'), 'errors'); + setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors'); } else { $prodattr = new ProductAttribute($db); @@ -38,7 +38,7 @@ if ($_POST) { $resid = $prodattr->create($user); if ($resid > 0) { - setEventMessage($langs->trans('RecordSaved')); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); if ($backtopage) { header('Location: '.$backtopage); diff --git a/htdocs/variants/create_val.php b/htdocs/variants/create_val.php index b290182a042..f0dd8e9cb74 100644 --- a/htdocs/variants/create_val.php +++ b/htdocs/variants/create_val.php @@ -58,7 +58,7 @@ if ($cancel) if ($action == 'add') { if (empty($ref) || empty($value)) { - setEventMessage($langs->trans('ErrorFieldsRequired'), 'errors'); + setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors'); } else { $objectval->fk_product_attribute = $object->id; @@ -66,11 +66,11 @@ if ($action == 'add') $objectval->value = $value; if ($objectval->create($user) > 0) { - setEventMessage($langs->trans('RecordSaved')); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); header('Location: '.DOL_URL_ROOT.'/variants/card.php?id='.$object->id); exit(); } else { - setEventMessage($langs->trans('ErrorCreatingProductAttributeValue'), 'errors'); + setEventMessages($langs->trans('ErrorCreatingProductAttributeValue'), null, 'errors'); } } } diff --git a/htdocs/variants/generator.php b/htdocs/variants/generator.php index 4daa2d8f45a..35cd9fc2a24 100644 --- a/htdocs/variants/generator.php +++ b/htdocs/variants/generator.php @@ -115,18 +115,18 @@ if ($_POST) { if ($res > 0) { $db->commit(); - setEventMessage($langs->trans('RecordSaved')); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); header('Location: '.dol_buildpath('/variants/combinations.php?id='.$id, 2)); exit; } } else { - setEventMessage($langs->trans('ErrorDeletingGeneratedProducts'), 'errors'); + setEventMessages($langs->trans('ErrorDeletingGeneratedProducts'), null, 'errors'); } $db->rollback(); } else { - setEventMessage($langs->trans('ErrorFieldsRequired'), 'errors'); + setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors'); } }