Merge pull request #9159 from grandoc/new_branch_25_07_2018

Clean and update code
This commit is contained in:
Juanjo Menent 2018-08-02 10:36:27 +02:00 committed by GitHub
commit fcd9d49b16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 105 additions and 81 deletions

View File

@ -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'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
// Load translation files required by the page // 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->adherent->enabled)) $langs->load("members");
if (! empty($conf->don->enabled)) $langs->load("donations"); if (! empty($conf->don->enabled)) $langs->load("donations");
if (! empty($conf->loan->enabled)) $langs->load("loan"); if (! empty($conf->loan->enabled)) $langs->load("loan");

View File

@ -703,7 +703,7 @@ if ($massaction == 'confirm_createbills')
if (! $error) if (! $error)
{ {
$db->commit(); $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 // Make a redirect to avoid to bill twice if we make a refresh or back
$param=''; $param='';

View File

@ -1201,7 +1201,7 @@ function activateModulesRequiredByCountry($country_code)
{ {
activateModule($modName); activateModule($modName);
setEventMessage($objMod->automatic_activation[$country_code],'warnings'); setEventMessages($objMod->automatic_activation[$country_code], null, 'warnings');
} }
} }

View File

@ -152,9 +152,12 @@ class InterfaceTicketEmail extends DolibarrTriggers
} }
include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, '', '', 0, -1); $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, '', '', 0, -1);
if ($mailfile->error) { if ($mailfile->error)
setEventMessage($mailfile->error, 'errors'); {
} else { setEventMessages($mailfile->error, $mailfile->errors, 'errors');
}
else
{
$result = $mailfile->sendfile(); $result = $mailfile->sendfile();
} }
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {

View File

@ -276,7 +276,7 @@ if (empty($reshook))
// We try to set an amount // We try to set an amount
// Case we dont use the list of available qty for each warehouse/lot // Case we dont use the list of available qty for each warehouse/lot
// GUI does not allow this yet // GUI does not allow this yet
setEventMessage('StockIsRequiredToChooseWhichLotToUse', 'errors'); setEventMessages($langs->trans("StockIsRequiredToChooseWhichLotToUse"), null, 'errors');
} }
} }
} }

View File

@ -4,7 +4,7 @@
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2016 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2016 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es> * 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) 2012-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ion Agorria <ion@agorria.com> * Copyright (C) 2014 Ion Agorria <ion@agorria.com>
@ -350,8 +350,10 @@ if (empty($reshook))
if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) { if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) {
$idprod = $res->fk_product_child; $idprod = $res->fk_product_child;
} else { }
setEventMessage($langs->trans('ErrorProductCombinationNotFound'), 'errors'); else
{
setEventMessages($langs->trans('ErrorProductCombinationNotFound'), null, 'errors');
$error ++; $error ++;
} }
} }

View File

@ -425,7 +425,7 @@ if (empty($reshook))
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans('BillCreated', $nb_bills_created)); setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs');
} }
else else
{ {

View File

@ -1160,8 +1160,10 @@ if (empty($reshook))
if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) { if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) {
$idprod = $res->fk_product_child; $idprod = $res->fk_product_child;
} else { }
setEventMessage($langs->trans('ErrorProductCombinationNotFound'), 'errors'); else
{
setEventMessages($langs->trans('ErrorProductCombinationNotFound'), null, 'errors');
$error ++; $error ++;
} }
} }

View File

@ -180,13 +180,13 @@ if ($action == 'specimen') // For products
} }
else else
{ {
setEventMessage($obj->error,'errors'); setEventMessages($obj->error, $obj->errors, 'errors');
dol_syslog($obj->error, LOG_ERR); dol_syslog($obj->error, LOG_ERR);
} }
} }
else else
{ {
setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); 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) if (($result = $propal->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0)
{ {
dol_syslog($langs->trans('FailedToGetCostPrice')); dol_syslog($langs->trans('FailedToGetCostPrice'));
setEventMessage($langs->trans('FailedToGetCostPrice'), 'errors'); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors');
} }
else else
{ {
@ -732,7 +732,7 @@ if (empty($reshook))
if (($result = $commande->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0) if (($result = $commande->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0)
{ {
dol_syslog($langs->trans('FailedToGetCostPrice')); dol_syslog($langs->trans('FailedToGetCostPrice'));
setEventMessage($langs->trans('FailedToGetCostPrice'), 'errors'); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors');
} }
else else
{ {
@ -775,7 +775,7 @@ if (empty($reshook))
if (($result = $facture->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0) if (($result = $facture->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0)
{ {
dol_syslog($langs->trans('FailedToGetCostPrice')); dol_syslog($langs->trans('FailedToGetCostPrice'));
setEventMessage($langs->trans('FailedToGetCostPrice'), 'errors'); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors');
} }
else else
{ {

View File

@ -6,7 +6,7 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014-2015 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2014-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2014 Ion agorria <ion@agorria.com> * Copyright (C) 2014 Ion agorria <ion@agorria.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
@ -46,7 +46,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
} }
// Load translation files required by the page // 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(); $mesg=''; $error=0; $errors=array();
@ -464,8 +464,10 @@ if (empty($reshook))
$sql .= " WHERE rowid = " . $rowid; $sql .= " WHERE rowid = " . $rowid;
$result = $db->query($sql); $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; $sql .= " WHERE fk_product_price = " . $priceid;
$result = $db->query($sql); $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');
} }
} }

View File

@ -135,7 +135,7 @@ if ($action == 'addlimitstockwarehouse' && !empty($user->rights->produit->creer)
// Update // Update
$pse->seuil_stock_alerte = $seuil_stock_alerte; $pse->seuil_stock_alerte = $seuil_stock_alerte;
$pse->desiredstock = $desiredstock; $pse->desiredstock = $desiredstock;
if($pse->update($user) > 0) setEventMessage($langs->trans('ProductStockWarehouseUpdated')); if($pse->update($user) > 0) setEventMessages($langs->trans('ProductStockWarehouseUpdated'), null, 'mesgs');
} else { } else {
@ -144,7 +144,7 @@ if ($action == 'addlimitstockwarehouse' && !empty($user->rights->produit->creer)
$pse->fk_product = $id; $pse->fk_product = $id;
$pse->seuil_stock_alerte = GETPOST('seuil_stock_alerte'); $pse->seuil_stock_alerte = GETPOST('seuil_stock_alerte');
$pse->desiredstock = GETPOST('desiredstock'); $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 = new ProductStockEntrepot($db);
$pse->fetch(GETPOST('fk_productstockwarehouse')); $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 = ''; $action = '';
@ -176,7 +176,7 @@ if ($action == 'setseuil_stock_alerte' && !empty($user->rights->produit->creer))
if ($result < 0) if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
//else //else
// setEventMessage($lans->trans("SavedRecordSuccessfully")); // setEventMessages($lans->trans("SavedRecordSuccessfully"), null, 'mesgs');
$action=''; $action='';
} }

View File

@ -177,7 +177,7 @@ if ($action == 'create_ticket' && GETPOST('add_ticket')) {
$action = "infos_success"; $action = "infos_success";
} else { } else {
$object->db->rollback(); $object->db->rollback();
setEventMessage($object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$action = 'create_ticket'; $action = 'create_ticket';
} }
@ -226,9 +226,12 @@ if ($action == 'create_ticket' && GETPOST('add_ticket')) {
} }
include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1); $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1);
if ($mailfile->error) { if ($mailfile->error || $mailfile->errors)
setEventMessage($mailfile->error, 'errors'); {
} else { setEventMessages($mailfile->error, $mailfile->errors, 'errors');
}
else
{
$result = $mailfile->sendfile(); $result = $mailfile->sendfile();
} }
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { 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'; include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1); $mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1);
if ($mailfile->error) { if ($mailfile->error || $mailfile->errors)
setEventMessage($mailfile->error, 'errors'); {
} else { setEventMessages($mailfile->error, $mailfile->errors, 'errors');
}
else
{
$result = $mailfile->sendfile(); $result = $mailfile->sendfile();
} }
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { 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); $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');
} }
} }

View File

@ -121,8 +121,9 @@ if ($action == "view_ticketlist") {
} }
} }
if ($error) { if ($error || $errors)
setEventMessage($object->errors, 'errors'); {
setEventMessages($object->error, $object->errors, 'errors');
$action = ''; $action = '';
} }
} }

View File

@ -112,8 +112,9 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" |
} }
} }
if ($error) { if ($error || $errors)
setEventMessage($object->errors, 'errors'); {
setEventMessages($object->error, $object->errors, 'errors');
$action = ''; $action = '';
} }
} }

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> /* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com> * Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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) if ($action == 'addcontact' && $user->rights->resource->write)
@ -72,17 +72,17 @@ if ($action == 'addcontact' && $user->rights->resource->write)
$mesg = $object->error; $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) else if ($action == 'swapstatut' && $user->rights->resource->write)
{ {
$result=$object->swapContactStatus(GETPOST('ligne','int')); $result=$object->swapContactStatus(GETPOST('ligne','int'));
} }
// Efface un contact // Erase a contact
else if ($action == 'deletecontact' && $user->rights->resource->write) else if ($action == 'deletecontact' && $user->rights->resource->write)
{ {
$result = $object->delete_contact(GETPOST('lineid','int')); $result = $object->delete_contact(GETPOST('lineid','int'));

View File

@ -1614,9 +1614,12 @@ class Ticket extends CommonObject
} }
include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; 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); $mailfile = new CMailFile($subject, $info_sendto['email'], $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, 0);
if ($mailfile->error) { if ($mailfile->error || $mailfile->errors)
setEventMessage($mailfile->error, 'errors'); {
} else { setEventMessages($mailfile->error, $mailfile->errors, 'errors');
}
else
{
$result = $mailfile->sendfile(); $result = $mailfile->sendfile();
if ($result > 0) { if ($result > 0) {
$nb_sent++; $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; return $nb_sent;

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Abbes Bahfir <contact@dolibarrpar.com> * Copyright (C) 2016 Abbes Bahfir <contact@dolibarrpar.com>
* *
@ -67,7 +67,7 @@ if ($action == 'add')
if ($actionid <= 0) if ($actionid <= 0)
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Action")), 'errors'); setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Action")), null, 'errors');
$error++; $error++;
} }

View File

@ -31,15 +31,15 @@ if ($_POST) {
$value = GETPOST('PRODUIT_ATTRIBUTES_HIDECHILD'); $value = GETPOST('PRODUIT_ATTRIBUTES_HIDECHILD');
if (dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_HIDECHILD', $value, 'chaine', 0, '', $conf->entity)) { if (dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_HIDECHILD', $value, 'chaine', 0, '', $conf->entity)) {
setEventMessage($langs->trans('RecordSaved')); setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
} else { } 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)) { 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 { } else {
setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
} }
} }

View File

@ -50,9 +50,9 @@ if ($_POST) {
$object->label = $label; $object->label = $label;
if ($object->update($user) < 1) { if ($object->update($user) < 1) {
setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
} else { } else {
setEventMessage($langs->trans('RecordSaved')); setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
header('Location: '.dol_buildpath('/variants/card.php?id='.$id, 2)); header('Location: '.dol_buildpath('/variants/card.php?id='.$id, 2));
exit(); exit();
} }
@ -77,9 +77,9 @@ if ($_POST) {
if (! $error) if (! $error)
{ {
if ($objectval->update($user) > 0) { if ($objectval->update($user) > 0) {
setEventMessage($langs->trans('RecordSaved')); setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
} else { } 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)) { if ($res < 1 || ($object->delete() < 1)) {
$db->rollback(); $db->rollback();
setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
header('Location: '.dol_buildpath('/variants/card.php?id='.$object->id, 2)); header('Location: '.dol_buildpath('/variants/card.php?id='.$object->id, 2));
} else { } else {
$db->commit(); $db->commit();
setEventMessage($langs->trans('RecordSaved')); setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
header('Location: '.dol_buildpath('/variants/list.php', 2)); header('Location: '.dol_buildpath('/variants/list.php', 2));
} }
exit(); exit();
@ -113,9 +113,9 @@ if ($confirm == 'yes') {
if ($objectval->fetch($valueid) > 0) { if ($objectval->fetch($valueid) > 0) {
if ($objectval->delete() < 1) { if ($objectval->delete() < 1) {
setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
} else { } else {
setEventMessage($langs->trans('RecordSaved')); setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
} }
header('Location: '.dol_buildpath('/variants/card.php?id='.$object->id, 2)); header('Location: '.dol_buildpath('/variants/card.php?id='.$object->id, 2));

View File

@ -104,7 +104,7 @@ if ($_POST) {
$features = $_SESSION['addvariant_'.$object->id]; $features = $_SESSION['addvariant_'.$object->id];
if (!$features) { if (!$features) {
setEventMessage($langs->trans('ErrorFieldsRequired'), 'errors'); setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors');
} }
else else
{ {
@ -147,7 +147,7 @@ if ($_POST) {
$result = $prodcomb->createProductCombination($object, $sanit_features, array(), $price_impact_percent, $price_impact, $weight_impact); $result = $prodcomb->createProductCombination($object, $sanit_features, array(), $price_impact_percent, $price_impact, $weight_impact);
if ($result > 0) if ($result > 0)
{ {
setEventMessage($langs->trans('RecordSaved')); setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
unset($_SESSION['addvariant_'.$object->id]); unset($_SESSION['addvariant_'.$object->id]);
$db->commit(); $db->commit();
@ -214,7 +214,7 @@ if ($_POST) {
} else { } else {
$db->commit(); $db->commit();
setEventMessage($langs->trans('RecordSaved')); setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
} }
} }
@ -230,7 +230,7 @@ if ($_POST) {
$prodcomb->variation_weight = $weight_impact; $prodcomb->variation_weight = $weight_impact;
if ($prodcomb->update($user) > 0) { 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)); header('Location: '.dol_buildpath('/variants/combinations.php?id='.$id, 2));
exit(); exit();
} else { } 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) { if ($prodcomb->delete($user) > 0 && $prodstatic->fetch($prodcomb->fk_product_child) > 0 && $prodstatic->delete($user) > 0) {
$db->commit(); $db->commit();
setEventMessage($langs->trans('RecordSaved')); setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$object->id, 2)); header('Location: '.dol_buildpath('/variants/combinations.php?id='.$object->id, 2));
exit(); exit();
} }
$db->rollback(); $db->rollback();
setEventMessage($langs->trans('ProductCombinationAlreadyUsed'), 'errors'); setEventMessages($langs->trans('ProductCombinationAlreadyUsed'), null, 'errors');
$action = ''; $action = '';
} }
} elseif ($action === 'edit') { } elseif ($action === 'edit') {
@ -284,12 +284,12 @@ if ($action === 'confirm_deletecombination') {
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$prodstatic->id, 2)); header('Location: '.dol_buildpath('/variants/combinations.php?id='.$prodstatic->id, 2));
exit(); exit();
} else { } else {
setEventMessage($langs->trans('ErrorCopyProductCombinations'), 'errors'); setEventMessages($langs->trans('ErrorCopyProductCombinations'), null, 'errors');
} }
} }
} else { } else {
setEventMessage($langs->trans('ErrorDestinationProductNotFound'), 'errors'); setEventMessages($langs->trans('ErrorDestinationProductNotFound'), null, 'errors');
} }
} }

View File

@ -29,7 +29,7 @@ $backtopage = GETPOST('backtopage', 'alpha');
if ($_POST) { if ($_POST) {
if (empty($ref) || empty($label)) { if (empty($ref) || empty($label)) {
setEventMessage($langs->trans('ErrorFieldsRequired'), 'errors'); setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors');
} else { } else {
$prodattr = new ProductAttribute($db); $prodattr = new ProductAttribute($db);
@ -38,7 +38,7 @@ if ($_POST) {
$resid = $prodattr->create($user); $resid = $prodattr->create($user);
if ($resid > 0) { if ($resid > 0) {
setEventMessage($langs->trans('RecordSaved')); setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
if ($backtopage) if ($backtopage)
{ {
header('Location: '.$backtopage); header('Location: '.$backtopage);

View File

@ -58,7 +58,7 @@ if ($cancel)
if ($action == 'add') if ($action == 'add')
{ {
if (empty($ref) || empty($value)) { if (empty($ref) || empty($value)) {
setEventMessage($langs->trans('ErrorFieldsRequired'), 'errors'); setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors');
} else { } else {
$objectval->fk_product_attribute = $object->id; $objectval->fk_product_attribute = $object->id;
@ -66,11 +66,11 @@ if ($action == 'add')
$objectval->value = $value; $objectval->value = $value;
if ($objectval->create($user) > 0) { 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); header('Location: '.DOL_URL_ROOT.'/variants/card.php?id='.$object->id);
exit(); exit();
} else { } else {
setEventMessage($langs->trans('ErrorCreatingProductAttributeValue'), 'errors'); setEventMessages($langs->trans('ErrorCreatingProductAttributeValue'), null, 'errors');
} }
} }
} }

View File

@ -115,18 +115,18 @@ if ($_POST) {
if ($res > 0) { if ($res > 0) {
$db->commit(); $db->commit();
setEventMessage($langs->trans('RecordSaved')); setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$id, 2)); header('Location: '.dol_buildpath('/variants/combinations.php?id='.$id, 2));
exit; exit;
} }
} else { } else {
setEventMessage($langs->trans('ErrorDeletingGeneratedProducts'), 'errors'); setEventMessages($langs->trans('ErrorDeletingGeneratedProducts'), null, 'errors');
} }
$db->rollback(); $db->rollback();
} else { } else {
setEventMessage($langs->trans('ErrorFieldsRequired'), 'errors'); setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors');
} }
} }