Merge pull request #3955 from grandoc/develop

[Qual] Uniformize code
This commit is contained in:
Laurent Destailleur 2015-11-11 15:50:48 +01:00
commit a0606cece9
13 changed files with 75 additions and 75 deletions

View File

@ -139,7 +139,7 @@ if (empty($reshook))
$object->fetch($id); $object->fetch($id);
$object->fk_prospectlevel=GETPOST('prospect_level_id','alpha'); $object->fk_prospectlevel=GETPOST('prospect_level_id','alpha');
$result=$object->set_prospect_level($user); $result=$object->set_prospect_level($user);
if ($result < 0) setEventMessage($object->error,$object->errors,'errors'); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
} }
// set communication status // set communication status
@ -148,7 +148,7 @@ if (empty($reshook))
$object->fetch($id); $object->fetch($id);
$object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm'); $object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
$result=$object->set_commnucation_level($user); $result=$object->set_commnucation_level($user);
if ($result < 0) setEventMessages($object->error,$object->errors,'errors'); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
} }
// update outstandng limit // update outstandng limit

View File

@ -5,10 +5,10 @@
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
@ -123,7 +123,7 @@ if (empty($reshook))
{ {
if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
{ {
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
} }
else else
{ {
@ -140,7 +140,7 @@ if (empty($reshook))
} }
else else
{ {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$object = $orig; $object = $orig;
$action=''; $action='';
} }
@ -161,7 +161,7 @@ if (empty($reshook))
} }
else else
{ {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} }
@ -177,7 +177,7 @@ if (empty($reshook))
} }
else else
{ {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -208,7 +208,7 @@ if (empty($reshook))
} }
else else
{ {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -225,7 +225,7 @@ if (empty($reshook))
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); $datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
if ($datecommande == '') { if ($datecommande == '') {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')), 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')), null, 'errors');
$action = 'create'; $action = 'create';
$error++; $error++;
} }
@ -374,11 +374,11 @@ if (empty($reshook))
if ($reshook < 0) if ($reshook < 0)
$error++; $error++;
} else { } else {
setEventMessage($srcobject->error, 'errors'); setEventMessages($srcobject->error, $srcobject->errors, 'errors');
$error++; $error++;
} }
} else { } else {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$error++; $error++;
} }
} else { } else {
@ -414,7 +414,7 @@ if (empty($reshook))
{ {
$result = $object->add_contact(GETPOST('contactid'), 'CUSTOMER', 'external'); $result = $object->add_contact(GETPOST('contactid'), 'CUSTOMER', 'external');
if ($result < 0) { if ($result < 0) {
setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors'); setEventMessages($langs->trans("ErrorFailedToAddContact"), null, 'errors');
$error++; $error++;
} }
} }
@ -432,7 +432,7 @@ if (empty($reshook))
} else { } else {
$db->rollback(); $db->rollback();
$action = 'create'; $action = 'create';
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} }
@ -442,7 +442,7 @@ if (empty($reshook))
$ret=$object->classifyBilled(); $ret=$object->classifyBilled();
if ($ret < 0) { if ($ret < 0) {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -471,7 +471,7 @@ if (empty($reshook))
$result = $object->set_date($user, $date); $result = $object->set_date($user, $date);
if ($result < 0) { if ($result < 0) {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -481,7 +481,7 @@ if (empty($reshook))
$result = $object->set_date_livraison($user, $datelivraison); $result = $object->set_date_livraison($user, $datelivraison);
if ($result < 0) { if ($result < 0) {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -586,11 +586,11 @@ if (empty($reshook))
} }
if (empty($idprod) && ($price_ht < 0) && ($qty < 0)) { if (empty($idprod) && ($price_ht < 0) && ($qty < 0)) {
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors'); setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error++; $error++;
} }
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) { if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
$error++; $error++;
} }
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not '' if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not ''
@ -599,11 +599,11 @@ if (empty($reshook))
$error++; $error++;
} }
if ($qty == '') { if ($qty == '') {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error++; $error++;
} }
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc)) { if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc)) {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors');
$error++; $error++;
} }
@ -664,7 +664,7 @@ if (empty($reshook))
} }
else else
{ {
setEventMessage($prodcustprice->error,'errors'); setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
} }
} }
@ -748,7 +748,7 @@ if (empty($reshook))
if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) { if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) {
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency));
setEventMessage($mesg, 'errors'); setEventMessages($mesg, null, 'errors');
} else { } else {
// Insert line // Insert line
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $info_bits, 0, $price_base_type, $pu_ttc, $date_start, $date_end, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $fk_unit); $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $info_bits, 0, $price_base_type, $pu_ttc, $date_start, $date_end, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $fk_unit);
@ -802,7 +802,7 @@ if (empty($reshook))
unset($_POST['date_endmonth']); unset($_POST['date_endmonth']);
unset($_POST['date_endyear']); unset($_POST['date_endyear']);
} else { } else {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} }
@ -866,7 +866,7 @@ if (empty($reshook))
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
if ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) { if ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) {
setEventMessage($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), 'errors'); setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++; $error++;
} }
} else { } else {
@ -914,7 +914,7 @@ if (empty($reshook))
unset($_POST['fournprice']); unset($_POST['fournprice']);
unset($_POST['buying_price']); unset($_POST['buying_price']);
} else { } else {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} }
@ -947,7 +947,7 @@ if (empty($reshook))
if (! $idwarehouse || $idwarehouse == -1) if (! $idwarehouse || $idwarehouse == -1)
{ {
$error++; $error++;
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), 'errors'); setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
$action=''; $action='';
} }
} }
@ -1000,7 +1000,7 @@ if (empty($reshook))
if (! $idwarehouse || $idwarehouse == -1) if (! $idwarehouse || $idwarehouse == -1)
{ {
$error++; $error++;
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), 'errors'); setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
$action=''; $action='';
} }
} }
@ -1032,7 +1032,7 @@ if (empty($reshook))
else if ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->commande->cloturer) { else if ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->commande->cloturer) {
$result = $object->cloture($user); $result = $object->cloture($user);
if ($result < 0) { if ($result < 0) {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -1059,7 +1059,7 @@ if (empty($reshook))
if (! $idwarehouse || $idwarehouse == -1) if (! $idwarehouse || $idwarehouse == -1)
{ {
$error++; $error++;
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), 'errors'); setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
$action=''; $action='';
} }
} }
@ -1068,7 +1068,7 @@ if (empty($reshook))
$result = $object->cancel($idwarehouse); $result = $object->cancel($idwarehouse);
if ($result < 0) { if ($result < 0) {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} }
@ -1115,9 +1115,9 @@ if (empty($reshook))
$file = $upload_dir . '/' . GETPOST('file'); $file = $upload_dir . '/' . GETPOST('file');
$ret = dol_delete_file($file, 0, 0, 0, $object); $ret = dol_delete_file($file, 0, 0, 0, $object);
if ($ret) if ($ret)
setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else else
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
$action = ''; $action = '';
} }
} }
@ -1181,9 +1181,9 @@ if (empty($reshook))
} else { } else {
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
} else { } else {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} }

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net> /* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -69,11 +69,11 @@ if ($action == 'addcontact' && $user->rights->commande->creer)
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{ {
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
} }
else else
{ {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} }

View File

@ -74,7 +74,7 @@ if ($action == 'create')
if (is_array($selected) == false) if (is_array($selected) == false)
{ {
$error++; $error++;
setEventMessage($langs->trans('Error_OrderNotChecked'), 'errors'); setEventMessages($langs->trans('Error_OrderNotChecked'), null, 'errors');
} }
else else
{ {
@ -251,7 +251,7 @@ if (($action == 'create' || $action == 'add') && !$error)
} }
else else
{ {
setEventMessage($discount->error, 'errors'); setEventMessages($discount->error, $discount->errors, 'errors');
$error++; $error++;
break; break;
} }
@ -320,7 +320,7 @@ if (($action == 'create' || $action == 'add') && !$error)
} }
else else
{ {
setEventMessage($objectsrc->error, 'errors'); setEventMessages($objectsrc->error, $objectsrc->errors, 'errors');
$error++; $error++;
} }
$ii++; $ii++;
@ -328,7 +328,7 @@ if (($action == 'create' || $action == 'add') && !$error)
} }
else else
{ {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$error++; $error++;
} }
} }
@ -348,7 +348,7 @@ if (($action == 'create' || $action == 'add') && !$error)
$action='create'; $action='create';
$_GET["origin"]=$_POST["origin"]; $_GET["origin"]=$_POST["origin"];
$_GET["originid"]=$_POST["originid"]; $_GET["originid"]=$_POST["originid"];
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$error++; $error++;
} }
} }

View File

@ -152,13 +152,13 @@ if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banqu
$insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user); $insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user);
if ($insertid > 0) if ($insertid > 0)
{ {
setEventMessage($langs->trans("RecordSaved")); setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id."&action=addline"); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id."&action=addline");
exit; exit;
} }
else else
{ {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
else else

View File

@ -291,7 +291,7 @@ if ($result < 0)
{ {
$langs->load("errors"); $langs->load("errors");
$error++; $error++;
setEventMessage($langs->trans("ErrorFailedToCreateDir"), 'errors'); setEventMessages($langs->trans("ErrorFailedToCreateDir"), null, 'errors');
} }
else else
{ {

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -102,19 +102,19 @@ if ($_POST["action"] == 'add')
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number)) if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number))
{ {
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), 'error'); setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'error');
$action='create'; // Force chargement page en mode creation $action='create'; // Force chargement page en mode creation
$error++; $error++;
} }
if (empty($account->ref)) if (empty($account->ref))
{ {
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), 'errors'); setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors');
$action='create'; // Force chargement page en mode creation $action='create'; // Force chargement page en mode creation
$error++; $error++;
} }
if (empty($account->label)) if (empty($account->label))
{ {
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), 'errors'); setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
$action='create'; // Force chargement page en mode creation $action='create'; // Force chargement page en mode creation
$error++; $error++;
} }
@ -130,7 +130,7 @@ if ($_POST["action"] == 'add')
$_GET["id"]=$id; // Force chargement page en mode visu $_GET["id"]=$id; // Force chargement page en mode visu
} }
else { else {
setEventMessage($account->error,'errors'); setEventMessages($account->error, $account->errors, 'errors');
$action='create'; // Force chargement page en mode creation $action='create'; // Force chargement page en mode creation
} }
} }
@ -177,19 +177,19 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number)) if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number))
{ {
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), 'error'); setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'error');
$action='edit'; // Force chargement page en mode creation $action='edit'; // Force chargement page en mode creation
$error++; $error++;
} }
if (empty($account->ref)) if (empty($account->ref))
{ {
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), 'errors'); setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors');
$action='edit'; // Force chargement page en mode creation $action='edit'; // Force chargement page en mode creation
$error++; $error++;
} }
if (empty($account->label)) if (empty($account->label))
{ {
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), 'errors'); setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
$action='edit'; // Force chargement page en mode creation $action='edit'; // Force chargement page en mode creation
$error++; $error++;
} }
@ -206,7 +206,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
} }
else else
{ {
setEventMessage($account->error, 'errors'); setEventMessages($account->error, $account->errors, 'errors');
$action='edit'; // Force chargement page edition $action='edit'; // Force chargement page edition
} }
} }

View File

@ -133,9 +133,9 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes') {
$ret = dol_delete_file($file, 0, 0, 0, $object); $ret = dol_delete_file($file, 0, 0, 0, $object);
if ($ret) { if ($ret) {
setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
} else { } else {
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
} }
Header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); Header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);

View File

@ -81,7 +81,7 @@ if ($result < 0)
{ {
$langs->load("errors"); $langs->load("errors");
$error++; $error++;
setEventMessage($langs->trans("ErrorFailedToCreateDir"), 'errors'); setEventMessages($langs->trans("ErrorFailedToCreateDir"), null, 'errors');
} }
else else
{ {
@ -113,7 +113,7 @@ else
if ($mode == 'standard') if ($mode == 'standard')
{ {
// Chargement du tableau $amounts // Loading table $amounts
$amounts = array(); $amounts = array();
$monthnext = $month+1; $monthnext = $month+1;
@ -153,7 +153,7 @@ else
dol_print_error($db); dol_print_error($db);
} }
// Calcul de $solde avant le debut du graphe // Calculation of $solde before the start of the graph
$solde = 0; $solde = 0;
$sql = "SELECT SUM(b.amount)"; $sql = "SELECT SUM(b.amount)";
@ -265,7 +265,7 @@ else
if ($mode == 'standard') if ($mode == 'standard')
{ {
// Chargement du tableau $amounts // Loading table $amounts
$amounts = array(); $amounts = array();
$sql = "SELECT date_format(b.datev,'%Y%m%d')"; $sql = "SELECT date_format(b.datev,'%Y%m%d')";
$sql.= ", SUM(b.amount)"; $sql.= ", SUM(b.amount)";
@ -296,7 +296,7 @@ else
dol_print_error($db); dol_print_error($db);
} }
// Calcul de $solde avant le debut du graphe // Calculation of $solde before the start of the graph
$solde = 0; $solde = 0;
$sql = "SELECT SUM(b.amount)"; $sql = "SELECT SUM(b.amount)";
@ -403,7 +403,7 @@ else
if ($mode == 'showalltime') if ($mode == 'showalltime')
{ {
// Chargement du tableau $amounts // Loading table $amounts
$amounts = array(); $amounts = array();
$sql = "SELECT date_format(b.datev,'%Y%m%d')"; $sql = "SELECT date_format(b.datev,'%Y%m%d')";

View File

@ -113,7 +113,7 @@ foreach ($accounts as $key=>$type)
{ {
$result=$acc->load_board($user,$acc->id); $result=$acc->load_board($user,$acc->id);
if ($result<0) { if ($result<0) {
setEventMessage($acc->error, 'errors'); setEventMessages($acc->error, $acc->errors, 'errors');
} else { } else {
print $result->nbtodo; print $result->nbtodo;
if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')'; if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
@ -229,7 +229,7 @@ foreach ($accounts as $key=>$type)
{ {
$result=$acc->load_board($user,$acc->id); $result=$acc->load_board($user,$acc->id);
if ($result<0) { if ($result<0) {
setEventMessage($acc->error, 'errors'); setEventMessages($acc->error, $acc->errors, 'errors');
} else { } else {
print $result->nbtodo; print $result->nbtodo;
if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')'; if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';

View File

@ -104,7 +104,7 @@ if ($user->rights->banque->modifier && $action == "update")
if ($ac->courant == 2 && $_POST['value'] != 'LIQ') if ($ac->courant == 2 && $_POST['value'] != 'LIQ')
{ {
setEventMessage($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), 'errors'); setEventMessages($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), null, 'errors');
$error++; $error++;
} }
@ -146,7 +146,7 @@ if ($user->rights->banque->modifier && $action == "update")
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
setEventMessage($langs->trans("RecordSaved")); setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$db->commit(); $db->commit();
} }
else else
@ -184,7 +184,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action ==
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
setEventMessage($langs->trans("RecordSaved")); setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$db->commit(); $db->commit();
} }
else else
@ -205,7 +205,7 @@ $form = new Form($db);
llxHeader(); llxHeader();
// On initialise la liste des categories // The list of categories is initialized
$sql = "SELECT rowid, label"; $sql = "SELECT rowid, label";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_categ"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_categ";
$sql.= " ORDER BY label"; $sql.= " ORDER BY label";

View File

@ -71,7 +71,7 @@ if ($action == 'rappro' && $user->rights->banque->consolidate)
$result=$bankline->update_conciliation($user,$_POST["cat"]); $result=$bankline->update_conciliation($user,$_POST["cat"]);
if ($result < 0) if ($result < 0)
{ {
setEventMessage($bankline->error, 'errors'); setEventMessages($bankline->error, $bankline->errors, 'errors');
$error++; $error++;
break; break;
} }
@ -83,7 +83,7 @@ if ($action == 'rappro' && $user->rights->banque->consolidate)
{ {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans("ErrorPleaseTypeBankTransactionReportName"), 'errors'); setEventMessages($langs->trans("ErrorPleaseTypeBankTransactionReportName"), null, 'errors');
} }
if (! $error) if (! $error)

View File

@ -113,18 +113,18 @@ if ($action == 'add')
if (! $error) if (! $error)
{ {
$mesgs = $langs->trans("TransferFromToDone","<a href=\"account.php?account=".$accountfrom->id."\">".$accountfrom->label."</a>","<a href=\"account.php?account=".$accountto->id."\">".$accountto->label."</a>",$amount,$langs->transnoentities("Currency".$conf->currency)); $mesgs = $langs->trans("TransferFromToDone","<a href=\"account.php?account=".$accountfrom->id."\">".$accountfrom->label."</a>","<a href=\"account.php?account=".$accountto->id."\">".$accountto->label."</a>",$amount,$langs->transnoentities("Currency".$conf->currency));
setEventMessage($mesgs); setEventMessages($mesgs, null, 'mesgs');
$db->commit(); $db->commit();
} }
else else
{ {
setEventMessage($accountfrom->error.' '.$accountto->error, 'errors'); setEventMessages($accountfrom->error.' '.$accountto->error, null, 'errors');
$db->rollback(); $db->rollback();
} }
} }
else else
{ {
setEventMessage($langs->trans("ErrorFromToAccountsMustDiffers"), 'errors'); setEventMessages($langs->trans("ErrorFromToAccountsMustDiffers"), null, 'errors');
} }
} }
} }
@ -132,7 +132,7 @@ if ($action == 'add')
/* /*
* Affichage * View
*/ */
llxHeader(); llxHeader();