From fa5f09d6e090a142c80fd8707530a4c4c9ba0106 Mon Sep 17 00:00:00 2001 From: simnandez Date: Wed, 14 Aug 2013 12:48:00 +0200 Subject: [PATCH] [ task #1036 ] Normalized usage of setEventMessage instead of dol_htmloutput_mesg: Works in admin --- htdocs/admin/company.php | 24 +++++++++++++----------- htdocs/admin/compta.php | 12 +++++------- htdocs/admin/const.php | 8 +++----- htdocs/admin/contract.php | 10 ++++------ htdocs/admin/dict.php | 22 +++++++++------------- htdocs/admin/dons.php | 14 +++++++------- htdocs/admin/events.php | 7 ++----- htdocs/admin/facture.php | 31 ++++++++++++++----------------- htdocs/admin/fckeditor.php | 6 ++---- htdocs/admin/fichinter.php | 24 +++++++++++------------- htdocs/admin/geoipmaxmind.php | 20 +++++++++----------- htdocs/admin/ldap.php | 24 +++++++++++------------- htdocs/admin/ldap_contacts.php | 28 +++++++++++++--------------- htdocs/admin/ldap_groups.php | 26 ++++++++++++-------------- htdocs/admin/ldap_members.php | 24 +++++++++++------------- htdocs/admin/ldap_users.php | 24 +++++++++++------------- htdocs/admin/livraison.php | 20 +++++++++----------- htdocs/admin/mailing.php | 13 +++++-------- 18 files changed, 151 insertions(+), 186 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 0b1f6f41d25..5580249c141 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2007 Rodolphe Quiedeville * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2011 Philippe Grand * * This program is free software; you can redistribute it and/or modify @@ -41,8 +41,7 @@ $langs->load("companies"); if (! $user->admin) accessforbidden(); -$message=''; - +$error=0; /* * Actions @@ -122,18 +121,21 @@ if ( ($action == 'update' && empty($_POST["cancel"])) } else if (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result)) { + $error++; $langs->load("errors"); $tmparray=explode(':',$result); - $message .= '
'.$langs->trans('ErrorFileIsInfectedWithAVirus',$tmparray[1]).'
'; + setEventMessage($langs->trans('ErrorFileIsInfectedWithAVirus',$tmparray[1]),'errors'); } else { - $message .= '
'.$langs->trans("ErrorFailedToSaveFile").'
'; + $error++; + setEventMessage($langs->trans("ErrorFailedToSaveFile"),'errors'); } } else { - $message .= '
'.$langs->trans("ErrorOnlyPngJpgSupported").'
'; + $error++; + setEventMessage($langs->trans("ErrorOnlyPngJpgSupported"),'errors'); } } } @@ -157,7 +159,7 @@ if ( ($action == 'update' && empty($_POST["cancel"])) dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION",$_POST["optionlocaltax1"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION",$_POST["optionlocaltax2"],'chaine',0,'',$conf->entity); - if ($action != 'updateedit' && ! $message) + if ($action != 'updateedit' && ! $error) { header("Location: ".$_SERVER["PHP_SELF"]); exit; @@ -198,13 +200,15 @@ if ($action == 'addthumb') } else { - $message .= '
'.$langs->trans("ErrorImageFormatNotSupported").'
'; + $error++; + setEventMessage($langs->trans("ErrorImageFormatNotSupported"),'errors'); dol_syslog($langs->transnoentities("ErrorImageFormatNotSupported"),LOG_WARNING); } } else { - $message .= '
'.$langs->trans("ErrorFileDoesNotExists",$_GET["file"]).'
'; + $error++; + setEventMessage($langs->trans("ErrorFileDoesNotExists",$_GET["file"]),'errors'); dol_syslog($langs->transnoentities("ErrorFileDoesNotExists",$_GET["file"]),LOG_WARNING); } } @@ -628,8 +632,6 @@ else * Show parameters */ - dol_htmloutput_mesg($message); - // Actions buttons //print '
'; //print ''.$langs->trans("Modify").''; diff --git a/htdocs/admin/compta.php b/htdocs/admin/compta.php index 2c72fe7b478..a2abb070c3a 100644 --- a/htdocs/admin/compta.php +++ b/htdocs/admin/compta.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2013 Philippe Grand * * This program is free software; you can redistribute it and/or modify @@ -52,11 +52,11 @@ if ($action == 'setcomptamode') if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"),'errors'); } } @@ -74,11 +74,11 @@ if ($action == 'update' || $action == 'add') if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"),'errors'); } } @@ -214,8 +214,6 @@ if ($num) print "\n"; } -dol_htmloutput_mesg($mesg); - $db->close(); llxFooter(); diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index a2838ae7fe9..66f8d3afaaf 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013 Juanjo Menent * * 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 @@ -44,7 +45,6 @@ $constnote=GETPOST('constnote','alpha'); $consttype=(GETPOST('consttype','alpha')?GETPOST('consttype','alpha'):'chaine'); $typeconst=array('yesno' => 'yesno', 'texte' => 'texte', 'chaine' => 'chaine'); -$mesg=''; @@ -58,12 +58,12 @@ if ($action == 'add') if (empty($constname)) { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name")),'errors'); $error++; } if ($constvalue == '') { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Value")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Value")),'errors'); $error++; } @@ -174,8 +174,6 @@ print_fiche_titre($langs->trans("OtherSetup"),'','setup'); print $langs->trans("ConstDesc")."
\n"; print "
\n"; -dol_htmloutput_mesg($mesg); - print ''; print ''; print ''; diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index b50b316e50a..b2d53730f47 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2013 Philippe Grand * * This program is free software; you can redistribute it and/or modify @@ -53,13 +53,13 @@ if ($action == 'updateMask') if (! $res > 0) $error++; - if (! $error) + if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"),'errors'); } } @@ -199,8 +199,6 @@ if (is_resource($handle)) print '
'.$langs->trans("Name").'

'; -dol_htmloutput_mesg($mesg); - $db->close(); llxFooter(); diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 217dc10fed6..507f01596c8 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2011 Philippe Grand * Copyright (C) 2011 Remy Younes * Copyright (C) 2012-2013 Marcos GarcĂ­a @@ -404,7 +404,6 @@ if ($id == 10) ); if (! empty($conf->global->MAIN_USE_LOCALTAX_TYPE_7)) $localtax_typeList["7"]= $langs->trans("Yes").' ('.$langs->trans("Type")." 7)"; //$langs->trans("AmountOnOrder") // We will enable this later. For the moment, work only of invoice localtype } -$msg=''; // Actions ajout ou modification d'une entree dans un dictionnaire de donnee @@ -442,20 +441,20 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) if ($fieldnamekey == 'unicode') $fieldnamekey = 'Unicode'; if ($fieldnamekey == 'deductible') $fieldnamekey = 'Deductible'; - $msg.=$langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)).'
'; + setEventMessage($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)),'errors'); } } // Other checks if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"],array('system','systemauto'))) { - $ok=0; - $msg.= $langs->transnoentities('ErrorReservedTypeSystemSystemAuto').'
'; + $ok=0; + setEventMessage($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'),'errors'); } if (isset($_POST["code"])) { if ($_POST["code"]=='0') { $ok=0; - $msg.= $langs->transnoentities('ErrorCodeCantContainZero').'
'; + setEventMessage($langs->transnoentities('ErrorCodeCantContainZero'),'errors'); } // FIXME regresion if code with not in numeric base /*if (!is_numeric($_POST['code'])) @@ -466,7 +465,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) } if (isset($_POST["country"]) && $_POST["country"]=='0') { $ok=0; - $msg.=$langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")).'
'; + setEventMessage($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")),'errors'); } // Clean some parameters @@ -530,7 +529,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) else { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - $msg=$langs->transnoentities("ErrorRecordAlreadyExists").'
'; + setEventMessage($langs->transnoentities("ErrorRecordAlreadyExists"),'errors'); } else { dol_print_error($db); @@ -574,11 +573,9 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $resql = $db->query($sql); if (! $resql) { - $msg=$db->error(); + setEventMessage($db->error(),'errors'); } } - - if ($msg) $msg='
'.$msg.'
'; //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition } @@ -600,7 +597,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete { if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') { - $msg='
'.$langs->transnoentities("ErrorRecordIsUsedByChild").'
'; + setEventMessage($langs->transnoentities("ErrorRecordIsUsedByChild"),'errors'); } else { @@ -688,7 +685,6 @@ if ($action == 'delete') */ if ($id) { - dol_htmloutput_mesg($msg); // Complete requete recherche valeurs avec critere de tri $sql=$tabsql[$id]; diff --git a/htdocs/admin/dons.php b/htdocs/admin/dons.php index 44b3386dab1..bb54f0ead67 100644 --- a/htdocs/admin/dons.php +++ b/htdocs/admin/dons.php @@ -1,6 +1,6 @@ - * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2012-2013 Juanjo Menent * Copyright (C) 2013 Philippe Grand * * This program is free software; you can redistribute it and/or modify @@ -65,13 +65,13 @@ if ($action == 'specimen') } else { - $mesg='
'.$obj->error.'
'; + setEventMessage($obj->error,'errors'); dol_syslog($obj->error, LOG_ERR); } } else { - $mesg='
'.$langs->trans("ErrorModuleNotFound").'
'; + setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } @@ -160,7 +160,7 @@ else dol_print_error($db); } -print ''; +print '
'; print ''; print ''; print ''; @@ -206,20 +206,20 @@ if (is_resource($handle)) print "'; } else { print ""; } diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index f4b00ddef5c..9523bf38abc 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -1,5 +1,6 @@ + * Copyright (C) 2013 Juanjo Menent * * 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,7 +61,7 @@ if ($action == "save") } $db->commit(); - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } @@ -116,10 +117,6 @@ print "\n"; print ''; - -dol_htmloutput_mesg($mesg); - - $db->close(); llxFooter(); diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 47775aa818c..e9d21ba2969 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -68,11 +68,11 @@ if ($action == 'updateMask') if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"),'errors'); } } @@ -110,13 +110,13 @@ if ($action == 'specimen') } else { - $mesg=''.$module->error.''; + setEventMessage($module->error,'errors'); dol_syslog($module->error, LOG_ERR); } } else { - $mesg=''.$langs->trans("ErrorModuleNotFound").''; + setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } @@ -138,11 +138,11 @@ if ($action == 'setModuleOptions') if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"),'errors'); } } @@ -199,11 +199,11 @@ if ($action == 'setribchq') if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"),'errors'); } } @@ -217,11 +217,11 @@ if ($action == 'set_FACTURE_DRAFT_WATERMARK') if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"),'errors'); } } @@ -235,11 +235,11 @@ if ($action == 'set_FACTURE_FREE_TEXT') if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"),'errors'); } } @@ -253,11 +253,11 @@ if ($action == 'setforcedate') if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"),'errors'); } } @@ -788,9 +788,6 @@ print "
'.$langs->trans("Name").''.$langs->trans("Description").'\n"; if ($conf->global->DON_ADDON_MODEL == $name) { - print img_picto($langs->trans("Enabled"),'on'); + print img_picto($langs->trans("Enabled"),'switch_on'); } else { print ' '; print ''; - print ''.img_picto($langs->trans("Enabled"),'on').''; + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } print '\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print "
\n"; //dol_fiche_end(); -dol_htmloutput_mesg($mesg); - - llxFooter(); $db->close(); diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 57bc089c6a5..e968798c9ce 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -1,7 +1,7 @@ * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2012-20113 Juanjo Menent * * 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 @@ -94,7 +94,7 @@ if (GETPOST('save','alpha')) { $res=dolibarr_set_const($db, "FCKEDITOR_TEST", GETPOST('formtestfield'),'chaine',0,'',$conf->entity); - if ($res > 0) $mesg=$langs->trans("RecordModifiedSuccessfully"); + if ($res > 0) setEventMessage($langs->trans("RecordModifiedSuccessfully")); } @@ -151,8 +151,6 @@ else print ''."\n"; - dol_htmloutput_mesg($mesg); - print '
'."\n"; print_fiche_titre($langs->trans("TestSubmitForm"),'',''); print '
'."\n"; diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 62779230379..a80c41cd60b 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2013 Philippe Grand * * This program is free software; you can redistribute it and/or modify @@ -60,11 +60,11 @@ if ($action == 'updateMask') if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"),'errors'); } } @@ -102,13 +102,13 @@ else if ($action == 'specimen') // For fiche inter } else { - $mesg=''.$obj->error.''; + setEventMessage($obj->error,'errors'); dol_syslog($obj->error, LOG_ERR); } } else { - $mesg=''.$langs->trans("ErrorModuleNotFound").''; + setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } @@ -163,11 +163,11 @@ else if ($action == 'set_FICHINTER_FREE_TEXT') if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"),'errors'); } } @@ -181,11 +181,11 @@ else if ($action == 'set_FICHINTER_DRAFT_WATERMARK') if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"),'errors'); } } @@ -198,11 +198,11 @@ elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS') if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"),'errors'); } } @@ -509,8 +509,6 @@ print ''; print '
'; -dol_htmloutput_mesg($mesg); - $db->close(); llxFooter(); diff --git a/htdocs/admin/geoipmaxmind.php b/htdocs/admin/geoipmaxmind.php index fd7704c2858..3222c1ccd92 100644 --- a/htdocs/admin/geoipmaxmind.php +++ b/htdocs/admin/geoipmaxmind.php @@ -1,6 +1,6 @@ - * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2011-2013 Juanjo Menent * * 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 @@ -46,7 +46,7 @@ if ($action == 'set') if (! $gimcdf && ! file_exists($gimcdf)) { - $mesg='
'.$langs->trans("ErrorFileNotFound",$gimcdf).'
'; + setEventMessage($langs->trans("ErrorFileNotFound",$gimcdf),'errors'); $error++; } @@ -56,13 +56,13 @@ if ($action == 'set') if (! $res > 0) $error++; if (! $error) - { - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $mesg = "".$langs->trans("Error").""; - } + { + setEventMessage($langs->trans("SetupSaved")); + } + else + { + setEventMessage($langs->trans("Error"),'errors'); + } } } @@ -155,8 +155,6 @@ if ($geoip) $geoip->close(); } -dol_htmloutput_mesg($mesg); - llxFooter(); $db->close(); diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index 58faff42ef1..7dc5650f761 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005 Regis Houssin * Copyright (C) 2006-2011 Laurent Destailleur - * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2011-2013 Juanjo Menent * * 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,15 +60,15 @@ if ($action == 'setvalue' && $user->admin) if (! dolibarr_set_const($db, 'LDAP_CONTACT_ACTIVE',GETPOST("activecontact"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_ACTIVE',GETPOST("activemembers"),'chaine',0,'',$conf->entity)) $error++; - if (! $error) - { - $db->commit(); - $mesg='
'.$langs->trans("SetupSaved").'
'; - } - else - { - $db->rollback(); - dol_print_error($db); + if (! $error) + { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } + else + { + $db->rollback(); + dol_print_error($db); } } @@ -89,7 +89,7 @@ $head = ldap_prepare_head(); // Test si fonction LDAP actives if (! function_exists("ldap_connect")) { - $mesg.='
'.$langs->trans("LDAPFunctionsNotAvailableOnPHP").'
'; ; + setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); } dol_fiche_head($head, 'ldap', $langs->trans("LDAPSetup")); @@ -323,8 +323,6 @@ if (function_exists("ldap_connect")) } } -dol_htmloutput_mesg($mesg); - $db->close(); llxFooter(); diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index 96382bdaa59..8406bef31a9 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005 Regis Houssin * Copyright (C) 2006-2011 Laurent Destailleur - * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2011-2013 Juanjo Menent * * 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 @@ -72,23 +72,23 @@ if ($action == 'setvalue' && $user->admin) $key=GETPOST("key"); if ($key) $valkey=$conf->global->$key; if (! dolibarr_set_const($db, 'LDAP_KEY_CONTACTS',$valkey,'chaine',0,'',$conf->entity)) $error++; - - if (! $error) - { - $db->commit(); - $mesg='
'.$langs->trans("SetupSaved").'
'; - } - else - { - $db->rollback(); - dol_print_error($db); + + if (! $error) + { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } + else + { + $db->rollback(); + dol_print_error($db); } } /* - * Visu + * View */ llxHeader('',$langs->trans("LDAPSetup"),'EN:Module_LDAP_En|FR:Module_LDAP|ES:Módulo_LDAP'); @@ -101,7 +101,7 @@ $head = ldap_prepare_head(); // Test si fonction LDAP actives if (! function_exists("ldap_connect")) { - $mesg.='
'.$langs->trans("LDAPFunctionsNotAvailableOnPHP").'
'; ; + setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); } dol_fiche_head($head, 'contacts', $langs->trans("LDAPSetup")); @@ -328,8 +328,6 @@ if (function_exists("ldap_connect")) } } -dol_htmloutput_mesg($mesg); - $db->close(); llxFooter(); diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index bc5d815e305..49b1973eb07 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005 Regis Houssin * Copyright (C) 2006-2011 Laurent Destailleur - * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2011-2013 Juanjo Menent * * 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,16 +64,16 @@ if ($action == 'setvalue' && $user->admin) $key=GETPOST("key"); if ($key) $valkey=$conf->global->$key; if (! dolibarr_set_const($db, 'LDAP_KEY_GROUPS',$valkey,'chaine',0,'',$conf->entity)) $error++; - - if (! $error) - { - $db->commit(); - $mesg='
'.$langs->trans("SetupSaved").'
'; - } - else - { - $db->rollback(); - dol_print_error($db); + + if (! $error) + { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } + else + { + $db->rollback(); + dol_print_error($db); } } @@ -93,7 +93,7 @@ $head = ldap_prepare_head(); // Test si fonction LDAP actives if (! function_exists("ldap_connect")) { - $mesg.='
'.$langs->trans("LDAPFunctionsNotAvailableOnPHP").'
'; ; + setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); } dol_fiche_head($head, 'groups', $langs->trans("LDAPSetup")); @@ -253,8 +253,6 @@ if (function_exists("ldap_connect")) } } -dol_htmloutput_mesg($mesg); - $db->close(); llxFooter(); diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index 2b3194b9cad..39847fc3025 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005 Regis Houssin * Copyright (C) 2006-2008 Laurent Destailleur - * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2011-2013 Juanjo Menent * * 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 @@ -87,15 +87,15 @@ if ($action == 'setvalue' && $user->admin) if ($key) $valkey=$conf->global->$key; if (! dolibarr_set_const($db, 'LDAP_KEY_MEMBERS',$valkey,'chaine',0,'',$conf->entity)) $error++; - if (! $error) - { - $db->commit(); - $mesg='
'.$langs->trans("SetupSaved").'
'; - } - else - { - $db->rollback(); - dol_print_error($db); + if (! $error) + { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } + else + { + $db->rollback(); + dol_print_error($db); } } @@ -115,7 +115,7 @@ $head = ldap_prepare_head(); // Test si fonction LDAP actives if (! function_exists("ldap_connect")) { - $mesg.='
'.$langs->trans("LDAPFunctionsNotAvailableOnPHP").'
'; ; + setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); } dol_fiche_head($head, 'members', $langs->trans("LDAPSetup")); @@ -436,8 +436,6 @@ if (function_exists("ldap_connect")) } -dol_htmloutput_mesg($mesg); - $db->close(); llxFooter(); diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index 7e084474208..a9d530cd8d9 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005 Regis Houssin * Copyright (C) 2006-2011 Laurent Destailleur - * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2011-2013 Juanjo Menent * * 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 @@ -74,15 +74,15 @@ if ($action == 'setvalue' && $user->admin) if ($key) $valkey=$conf->global->$key; if (! dolibarr_set_const($db, 'LDAP_KEY_USERS',$valkey,'chaine',0,'',$conf->entity)) $error++; - if (! $error) - { - $db->commit(); - $mesg='
'.$langs->trans("SetupSaved").'
'; - } - else - { - $db->rollback(); - dol_print_error($db); + if (! $error) + { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } + else + { + $db->rollback(); + dol_print_error($db); } } @@ -102,7 +102,7 @@ $head = ldap_prepare_head(); // Test si fonction LDAP actives if (! function_exists("ldap_connect")) { - $mesg.='
'.$langs->trans("LDAPFunctionsNotAvailableOnPHP").'
'; ; + setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); } dol_fiche_head($head, 'users', $langs->trans("LDAPSetup")); @@ -440,8 +440,6 @@ if (function_exists("ldap_connect")) } } -dol_htmloutput_mesg($mesg); - $db->close(); llxFooter(); diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 0235c7adc39..96e84af3d58 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2013 Philippe Grand * * This program is free software; you can redistribute it and/or modify @@ -56,13 +56,13 @@ if ($action == 'updateMask') if (! $res > 0) $error++; - if (! $error) + if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"),'errors'); } } @@ -73,13 +73,13 @@ if ($action == 'set_DELIVERY_FREE_TEXT') if (! $res > 0) $error++; - if (! $error) + if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"),'errors'); } } @@ -117,13 +117,13 @@ if ($action == 'specimen') } else { - $mesg=''.$module->error.''; + setEventMessage($module->error,'errors'); dol_syslog($module->error, LOG_ERR); } } else { - $mesg=''.$langs->trans("ErrorModuleNotFound").''; + setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } @@ -458,8 +458,6 @@ print ''; print ''; -dol_htmloutput_mesg($mesg); - $db->close(); llxFooter(); diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php index 6074272ddc8..ff945e2897e 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -1,7 +1,7 @@ * Copyright (C) 2005-2012 Laurent Destailleur - * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2011-2013 Juanjo Menent * * 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 @@ -80,16 +80,16 @@ if ($action == 'setvalue') } $res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE_KEY",$checkread_key,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; - - if (! $error) + + if (! $error) { $db->commit(); - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { $db->rollback(); - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"),'errors'); } } @@ -113,9 +113,6 @@ $h++; dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup")); -dol_htmloutput_mesg($mesg); - - if (! empty($conf->use_javascript_ajax)) { print "\n".'