From aa6b5bc1ce72647a3c33b49980f629561ba4482e Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 29 Oct 2015 13:58:16 +0100 Subject: [PATCH] [Qual] Uniformize code --- htdocs/admin/ldap_members.php | 2 +- htdocs/admin/mails.php | 2 +- htdocs/admin/modules.php | 6 +++--- htdocs/admin/notification.php | 4 ++-- htdocs/admin/payment.php | 4 ++-- htdocs/admin/prelevement.php | 4 ++-- htdocs/admin/propal.php | 28 ++++++++++++++-------------- htdocs/admin/proxy.php | 6 +++--- htdocs/admin/salaries.php | 4 ++-- htdocs/admin/security.php | 4 ++-- htdocs/admin/security_file.php | 6 +++--- htdocs/admin/security_other.php | 2 +- htdocs/admin/sms.php | 6 +++--- htdocs/admin/spip.php | 4 ++-- htdocs/admin/stock.php | 4 ++-- htdocs/admin/supplier_invoice.php | 14 +++++++------- htdocs/admin/supplier_order.php | 10 +++++----- htdocs/admin/syslog.php | 8 ++++---- htdocs/admin/taxes.php | 4 ++-- 19 files changed, 61 insertions(+), 61 deletions(-) diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index 720147fa353..bd9eda149b4 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -117,7 +117,7 @@ $head = ldap_prepare_head(); // Test si fonction LDAP actives if (! function_exists("ldap_connect")) { - setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); + setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); } dol_fiche_head($head, 'members', $langs->trans("LDAPSetup")); diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 90ba23d0046..271605830bc 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -213,7 +213,7 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE } else { - setEventMessage($langs->trans("ResultKo").'
'.$mailfile->error.' '.$result,'errors'); + setEventMessages($langs->trans("ResultKo").'
'.$mailfile->error.' '.$result, null, 'errors'); } $action=''; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index b55830dff4d..14c95aa0d2e 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -66,7 +66,7 @@ $familyinfo=array( if ($action == 'set' && $user->admin) { $result=activateModule($value); - if ($result) setEventMessage($result, 'errors'); + if ($result) setEventMessages($result, null, 'errors'); header("Location: modules.php?mode=".$mode); exit; } @@ -74,7 +74,7 @@ if ($action == 'set' && $user->admin) if ($action == 'reset' && $user->admin) { $result=unActivateModule($value); - if ($result) setEventMessage($result, 'errors'); + if ($result) setEventMessages($result, null, 'errors'); header("Location: modules.php?mode=".$mode); exit; } @@ -125,7 +125,7 @@ foreach ($modulesdir as $dir) if (! empty($modNameLoaded[$modName])) { $mesg="Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.
"; - setEventMessage($mesg, 'warnings'); + setEventMessages($mesg, null, 'warnings'); dol_syslog($mesg, LOG_ERR); continue; } diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index dd97e44eb96..a7699db4292 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -93,13 +93,13 @@ if ($action == 'setvalue' && $user->admin) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index 1bf794d52f8..c9bf610bd1b 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -54,11 +54,11 @@ if ($action == 'updateMask') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 56aa69e9943..f2d8c2d84dc 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -81,12 +81,12 @@ if ($action == "set") if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 41362fd5664..b4f1fe67e0b 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -59,11 +59,11 @@ if ($action == 'updateMask') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -101,13 +101,13 @@ if ($action == 'specimen') } else { - setEventMessage($module->error,'errors'); + setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } else { - setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } @@ -121,11 +121,11 @@ if ($action == 'set_PROPALE_DRAFT_WATERMARK') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -139,11 +139,11 @@ if ($action == 'set_PROPOSAL_FREE_TEXT') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -155,11 +155,11 @@ if ($action == 'setdefaultduration') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -171,11 +171,11 @@ if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -199,12 +199,12 @@ if ($action == 'setModuleOptions') if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/proxy.php b/htdocs/admin/proxy.php index 100da221ce6..080dafca744 100644 --- a/htdocs/admin/proxy.php +++ b/htdocs/admin/proxy.php @@ -44,12 +44,12 @@ if (GETPOST("action") == 'set_proxy') { if (GETPOST("MAIN_USE_CONNECT_TIMEOUT") && ! is_numeric(GETPOST("MAIN_USE_CONNECT_TIMEOUT"))) { - setEventMessage($langs->trans("ErrorValueMustBeInteger"),'errors'); + setEventMessages($langs->trans("ErrorValueMustBeInteger"), null, 'errors'); $error++; } if (GETPOST("MAIN_USE_RESPONSE_TIMEOUT") && ! is_numeric(GETPOST("MAIN_USE_RESPONSE_TIMEOUT"))) { - setEventMessage($langs->trans("ErrorValueMustBeInteger"),'errors'); + setEventMessages($langs->trans("ErrorValueMustBeInteger"), null, 'errors'); $error++; } @@ -68,7 +68,7 @@ if (GETPOST("action") == 'set_proxy') if (! $error) { - setEventMessage($langs->trans("RecordModifiedSuccessfully")); + setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } } diff --git a/htdocs/admin/salaries.php b/htdocs/admin/salaries.php index 53deb9610ca..58e85dbf8d3 100644 --- a/htdocs/admin/salaries.php +++ b/htdocs/admin/salaries.php @@ -60,11 +60,11 @@ if ($action == 'update') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 397b16b1299..250a7426ff8 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -135,7 +135,7 @@ if ($action == 'activate_encryptdbpassconf') } else { - setEventMessage($langs->trans('InstrucToEncodePass',dol_encode($dolibarr_main_db_pass)),'warnings'); + setEventMessages($langs->trans('InstrucToEncodePass',dol_encode($dolibarr_main_db_pass)), null, 'warnings'); } } else if ($action == 'disable_encryptdbpassconf') @@ -152,7 +152,7 @@ else if ($action == 'disable_encryptdbpassconf') } else { - setEventMessage($langs->trans('InstrucToClearPass',$dolibarr_main_db_pass),'warnings'); + setEventMessages($langs->trans('InstrucToClearPass',$dolibarr_main_db_pass), null, 'warnings'); } } diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index a7afaf0ef0a..d1237a8c734 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -86,7 +86,7 @@ else if ($action == 'updateform') $res4=dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity); $res5=dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity); $res6=dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity); - if ($res3 && $res4 && $res5 && $res6) setEventMessage($langs->trans("RecordModifiedSuccessfully")); + if ($res3 && $res4 && $res5 && $res6) setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } @@ -97,8 +97,8 @@ else if ($action == 'delete') $langs->load("other"); $file = $conf->admin->dir_temp . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $ret=dol_delete_file($file); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); - else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); + if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); + else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); Header('Location: '.$_SERVER["PHP_SELF"]); exit; } diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 6c040e8d6d6..cd84962107d 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -76,7 +76,7 @@ else if ($action == 'updateform') { $res1=dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", $_POST["MAIN_APPLICATION_TITLE"],'chaine',0,'',$conf->entity); $res2=dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity); - if ($res1 && $res2) setEventMessage($langs->trans("RecordModifiedSuccessfully")); + if ($res1 && $res2) setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index bad71e31dc7..604b426b800 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -88,7 +88,7 @@ if ($action == 'send' && ! $_POST['cancel']) if (! empty($formsms->error)) { - setEventMessage($formsms->error,'errors'); + setEventMessages($formsms->error, $formsms->errors, 'errors'); $action='test'; $error++; } @@ -123,11 +123,11 @@ if ($action == 'send' && ! $_POST['cancel']) if ($result) { - setEventMessage($langs->trans("SmsSuccessfulySent",$smsfrom,$sendto)); + setEventMessages($langs->trans("SmsSuccessfulySent",$smsfrom,$sendto), null, 'mesgs'); } else { - setEventMessage($langs->trans("ResultKo"),'errors'); + setEventMessages($langs->trans("ResultKo"), null, 'errors'); } $action=''; diff --git a/htdocs/admin/spip.php b/htdocs/admin/spip.php index 13d959eb38c..241062732a4 100644 --- a/htdocs/admin/spip.php +++ b/htdocs/admin/spip.php @@ -71,11 +71,11 @@ if ($action == 'update' || $action == 'add') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } } diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index b446f5355ad..98ff43360a8 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -96,12 +96,12 @@ if($action) if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 7e075f25c8f..c1b350edfee 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2011-2013 Philippe Grand + * Copyright (C) 2011-2015 Philippe Grand * * 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 @@ -63,11 +63,11 @@ if ($action == 'updateMask') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -106,13 +106,13 @@ if ($action == 'specimen') // For invoices } else { - setEventMessage($module->error,'errors'); + setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } else { - setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } @@ -174,11 +174,11 @@ if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 69d518d9a61..bc25e8efa87 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2011-2013 Philippe Grand + * Copyright (C) 2011-2015 Philippe Grand * * 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 @@ -64,11 +64,11 @@ if ($action == 'updateMask') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -107,13 +107,13 @@ else if ($action == 'specimen') // For orders } else { - setEventMessage($module->error,'errors'); + setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->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/admin/syslog.php b/htdocs/admin/syslog.php index 59921dd3687..f3cfcff9807 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -119,12 +119,12 @@ if ($action == 'set') if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($error, 'errors'); + setEventMessages($error, $errors, 'errors'); } @@ -140,11 +140,11 @@ if ($action == 'setlevel') if (! $res > 0) $error++; if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index 36c2f66aa51..b1ce8ef5dab 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -98,10 +98,10 @@ if ($action == 'update') { if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } }