From d517595f824a81ae5e0d0ffaed9237ca3462bc5e Mon Sep 17 00:00:00 2001 From: philippe grand Date: Wed, 28 Oct 2015 19:28:18 +0100 Subject: [PATCH] [Qual] Uniformize code --- htdocs/admin/fichinter.php | 28 ++++++++++++++-------------- htdocs/admin/geoipmaxmind.php | 6 +++--- htdocs/admin/ldap.php | 4 ++-- htdocs/admin/ldap_contacts.php | 4 ++-- htdocs/admin/ldap_groups.php | 4 ++-- htdocs/admin/ldap_members.php | 4 ++-- htdocs/admin/ldap_users.php | 6 +++--- htdocs/admin/limits.php | 6 +++--- htdocs/admin/livraison.php | 18 +++++++++--------- htdocs/admin/loan.php | 4 ++-- htdocs/admin/mailing.php | 4 ++-- htdocs/admin/mailman.php | 4 ++-- htdocs/admin/mails.php | 6 +++--- htdocs/admin/menus.php | 3 +-- htdocs/langs/en_US/admin.lang | 1 + 15 files changed, 51 insertions(+), 51 deletions(-) diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index d29420316a9..103ba462607 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-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 @@ -60,11 +60,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'); } } @@ -102,13 +102,13 @@ else if ($action == 'specimen') // For fiche inter } else { - setEventMessage($obj->error,'errors'); - dol_syslog($obj->error, LOG_ERR); + 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); } } @@ -133,12 +133,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'); } } @@ -192,11 +192,11 @@ else if ($action == 'set_FICHINTER_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'); } } @@ -209,11 +209,11 @@ else if ($action == 'set_FICHINTER_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'); } } @@ -226,11 +226,11 @@ elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS') 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/geoipmaxmind.php b/htdocs/admin/geoipmaxmind.php index 5e4c9de6fd7..b4d379e15d1 100644 --- a/htdocs/admin/geoipmaxmind.php +++ b/htdocs/admin/geoipmaxmind.php @@ -46,7 +46,7 @@ if ($action == 'set') if (! $gimcdf && ! file_exists($gimcdf)) { - setEventMessage($langs->trans("ErrorFileNotFound",$gimcdf),'errors'); + setEventMessages($langs->trans("ErrorFileNotFound",$gimcdf), null, 'errors'); $error++; } @@ -57,11 +57,11 @@ if ($action == 'set') 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/ldap.php b/htdocs/admin/ldap.php index cd55cddbf45..bfccacc40ac 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -63,7 +63,7 @@ if ($action == 'setvalue' && $user->admin) if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -89,7 +89,7 @@ $head = ldap_prepare_head(); // Test si fonction LDAP actives if (! function_exists("ldap_connect")) { - setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); + setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); } dol_fiche_head($head, 'ldap', $langs->trans("LDAPSetup")); diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index d24147417e3..3af47f46aac 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -77,7 +77,7 @@ if ($action == 'setvalue' && $user->admin) if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -102,7 +102,7 @@ $head = ldap_prepare_head(); // Test si fonction LDAP actives if (! function_exists("ldap_connect")) { - setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); + setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); } dol_fiche_head($head, 'contacts', $langs->trans("LDAPSetup")); diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index 765a1549038..bba8f2109a3 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -68,7 +68,7 @@ if ($action == 'setvalue' && $user->admin) if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -93,7 +93,7 @@ $head = ldap_prepare_head(); // Test si fonction LDAP actives if (! function_exists("ldap_connect")) { - setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); + setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); } dol_fiche_head($head, 'groups', $langs->trans("LDAPSetup")); diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index ae92c8f38cd..720147fa353 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -92,7 +92,7 @@ if ($action == 'setvalue' && $user->admin) if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -117,7 +117,7 @@ $head = ldap_prepare_head(); // Test si fonction LDAP actives if (! function_exists("ldap_connect")) { - setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); + setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); } dol_fiche_head($head, 'members', $langs->trans("LDAPSetup")); diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index 096f844436f..76d3bb9dfd0 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -78,7 +78,7 @@ if ($action == 'setvalue' && $user->admin) if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -103,7 +103,7 @@ $head = ldap_prepare_head(); // Test si fonction LDAP actives if (! function_exists("ldap_connect")) { - setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); + setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); } dol_fiche_head($head, 'users', $langs->trans("LDAPSetup")); @@ -427,7 +427,7 @@ if (function_exists("ldap_connect")) } else { - setEventMessage($ldap->error, 'errors'); + setEventMessages($ldap->error, $ldap->errors, 'errors'); } print "
\n"; diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 8949fba6d3c..823866f8ce6 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -43,7 +43,7 @@ if ($action == 'update') || $_POST["MAIN_MAX_DECIMALS_SHOWN"] > $MAXDEC) { $error++; - setEventMessage($langs->trans("ErrorDecimalLargerThanAreForbidden",$MAXDEC), 'errors'); + setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden",$MAXDEC), null, 'errors'); } if ($_POST["MAIN_MAX_DECIMALS_UNIT"] < 0 @@ -52,7 +52,7 @@ if ($action == 'update') { $langs->load("errors"); $error++; - setEventMessage($langs->trans("ErrorNegativeValueNotAllowed"), 'errors'); + setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors'); } if ($_POST["MAIN_ROUNDING_RULE_TOT"]) @@ -61,7 +61,7 @@ if ($action == 'update') { $langs->load("errors"); $error++; - setEventMessage($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), 'errors'); + setEventMessages($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), null, 'errors'); } } diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 38345adac9a..ec00cc7233c 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -6,7 +6,7 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2011-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 @@ -58,11 +58,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'); } } @@ -75,11 +75,11 @@ if ($action == 'set_DELIVERY_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'); } } @@ -117,13 +117,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); } } @@ -148,12 +148,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/loan.php b/htdocs/admin/loan.php index a966b751955..1cc55bd5a36 100644 --- a/htdocs/admin/loan.php +++ b/htdocs/admin/loan.php @@ -61,11 +61,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/mailing.php b/htdocs/admin/mailing.php index 8c4769780fd..541c8aa1b2d 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -64,12 +64,12 @@ if ($action == 'setvalue') 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/mailman.php b/htdocs/admin/mailman.php index e3aab979a41..27d7b59553a 100644 --- a/htdocs/admin/mailman.php +++ b/htdocs/admin/mailman.php @@ -65,11 +65,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/mails.php b/htdocs/admin/mails.php index c973d1a5852..90ba23d0046 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -123,7 +123,7 @@ if (! empty($_POST['removedfile']) || ! empty($_POST['removedfilehtml'])) $result = dol_delete_file($pathtodelete,1); if ($result) { - setEventMessage($langs->trans("FileWasRemoved"), $filetodelete); + setEventMessages(array($langs->trans("FileWasRemoved"), $filetodelete), null, 'mesgs'); include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); @@ -209,7 +209,7 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE if ($result) { - setEventMessage($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($email_from,2),$mailfile->getValidAddress($sendto,2))); + setEventMessages($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($email_from,2),$mailfile->getValidAddress($sendto,2)), null, 'mesgs'); } else { @@ -677,7 +677,7 @@ else $errormsg .= ' - '.$mail->error; } - setEventMessage($errormsg, 'errors'); + setEventMessages($errormsg, null, 'errors'); } print '
'; } diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php index c0ac9a3df8c..f8b89c515aa 100644 --- a/htdocs/admin/menus.php +++ b/htdocs/admin/menus.php @@ -102,8 +102,7 @@ if ($action == 'update' && empty($_POST["cancel"])) else { $error++; - //TODO: Translate - setEventMessage('Failed to initialize menu '.$key.'.', 'errors'); + setEventMessages($langs->trans("FailedToInitializeMenu").' '.$key, null, 'errors'); $db->rollback(); } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index c3f2da80612..a4b7423ebe8 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1532,6 +1532,7 @@ DeleteMenu=Delete menu entry ConfirmDeleteMenu=Are you sure you want to delete menu entry %s ? DeleteLine=Delete line ConfirmDeleteLine=Are you sure you want to delete this line ? +FailedToInitializeMenu=Failed to initialize menu ##### Tax ##### TaxSetup=Taxes, social or fiscal taxes and dividends module setup OptionVatMode=VAT due