Browse Source

[ task #1036 ] Normalized usage of setEventMessage instead of
dol_htmloutput_mesg

simnandez 11 years ago
parent
commit
b5e10a061b

+ 3 - 7
htdocs/admin/security.php

@@ -1,6 +1,7 @@
 <?php
 /* Copyright (C) 2004-2009 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005-2007 Regis Houssin        <regis.houssin@capnetworks.com>
+ * Copyright (C) 2013 Juanjo Menent			    <jmenent@2byte.es>
  *
  * 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
@@ -37,9 +38,6 @@ if (!$user->admin) accessforbidden();
 // Allow/Disallow change to clear passwords once passwords are crypted
 $allow_disable_encryption=true;
 
-$mesg = '';
-
-
 /*
  * Actions
  */
@@ -135,7 +133,7 @@ if ($action == 'activate_encryptdbpassconf')
 	}
 	else
 	{
-		$mesg='<div class="warning">'.$langs->trans('InstrucToEncodePass',dol_encode($dolibarr_main_db_pass)).'</div>';
+		setEventMessage($langs->trans('InstrucToEncodePass',dol_encode($dolibarr_main_db_pass)),'warnings');	
 	}
 }
 else if ($action == 'disable_encryptdbpassconf')
@@ -150,7 +148,7 @@ else if ($action == 'disable_encryptdbpassconf')
 	}
 	else
 	{
-		$mesg='<div class="warning">'.$langs->trans('InstrucToClearPass',$dolibarr_main_db_pass).'</div>';
+		setEventMessage($langs->trans('InstrucToClearPass',$dolibarr_main_db_pass),'warnings');
 	}
 }
 
@@ -179,8 +177,6 @@ llxHeader('',$langs->trans("Passwords"));
 
 print_fiche_titre($langs->trans("SecuritySetup"),'','setup');
 
-dol_htmloutput_mesg($mesg);
-
 print $langs->trans("GeneratedPasswordDesc")."<br>\n";
 print "<br>\n";
 

+ 6 - 5
htdocs/admin/security_other.php

@@ -1,6 +1,7 @@
 <?php
 /* Copyright (C) 2004-2013 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@capnetworks.com>
+ * Copyright (C) 2013 Juanjo Menent 			<jmenent@2byte.es>
  *
  * 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
@@ -82,27 +83,27 @@ else if (preg_match('/del_(.*)/',$action,$reg))
 else if ($action == 'MAIN_SESSION_TIMEOUT')
 {
     if (! dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db);
-    else $mesg=$langs->trans("RecordModifiedSuccessfully");
+    else setEventMessage($langs->trans("RecordModifiedSuccessfully"));
 }
 else if ($action == 'MAIN_UPLOAD_DOC')
 {
     if (! dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity)) dol_print_error($db);
-    else $mesg=$langs->trans("RecordModifiedSuccessfully");
+    else setEventMessage($langs->trans("RecordModifiedSuccessfully"));
 }
 else if ($action == 'MAIN_UMASK')
 {
     if (! dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity)) dol_print_error($db);
-    else $mesg=$langs->trans("RecordModifiedSuccessfully");
+    else setEventMessage($langs->trans("RecordModifiedSuccessfully"));
 }
 else if ($action == 'MAIN_ANTIVIRUS_COMMAND')
 {
     if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity)) dol_print_error($db);
-    else $mesg=$langs->trans("RecordModifiedSuccessfully");
+    else setEventMessage($langs->trans("RecordModifiedSuccessfully"));
 }
 else if ($action == 'MAIN_ANTIVIRUS_PARAM')
 {
     if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity)) dol_print_error($db);
-    else $mesg=$langs->trans("RecordModifiedSuccessfully");
+    else setEventMessage($langs->trans("RecordModifiedSuccessfully"));
 }
 
 // Delete file

+ 7 - 8
htdocs/admin/sms.php

@@ -1,6 +1,7 @@
 <?php
 /* Copyright (C) 2007-2011 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2009      Regis Houssin        <regis.houssin@capnetworks.com>
+ * Copyright (C) 2013 	   Juanjo Menent		<jmenent@2byte.es>
  *
  * 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,25 +88,25 @@ if ($action == 'send' && ! $_POST['cancel'])
 
 	if (! empty($formsms->error))
 	{
-	    $message='<div class="error">'.$formsms->error.'</div>';
+		setEventMessage($formsms->error,'errors');
 	    $action='test';
 	    $error++;
 	}
     if (empty($body))
     {
-        $message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Message")).'</div>';
+        setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Message")),'errors');
         $action='test';
         $error++;
     }
 	if (empty($smsfrom) || ! str_replace('+','',$smsfrom))
 	{
-		$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("SmsFrom")).'</div>';
+		setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("SmsFrom")),'errors');
         $action='test';
 		$error++;
 	}
 	if (empty($sendto) || ! str_replace('+','',$sendto))
 	{
-		$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("SmsTo")).'</div>';
+		setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("SmsTo")),'errors');
         $action='test';
 		$error++;
 	}
@@ -122,11 +123,11 @@ if ($action == 'send' && ! $_POST['cancel'])
 
 		if ($result)
 		{
-			$message='<div class="ok">'.$langs->trans("SmsSuccessfulySent",$smsfrom,$sendto).'</div>';
+			setEventMessage($langs->trans("SmsSuccessfulySent",$smsfrom,$sendto));
 		}
 		else
 		{
-			$message='<div class="error">'.$langs->trans("ResultKo").'<br>'.$smsfile->error.' '.$result.'</div>';
+			setEventMessage($langs->trans("ResultKo"),'errors');
 		}
 
 		$action='';
@@ -151,8 +152,6 @@ print_fiche_titre($langs->trans("SmsSetup"),'','setup');
 print $langs->trans("SmsDesc")."<br>\n";
 print "<br>\n";
 
-dol_htmloutput_mesg($message);
-
 // List of sending methods
 $listofmethods=(is_array($conf->modules_parts['sms'])?$conf->modules_parts['sms']:array());
 asort($listofmethods);

+ 3 - 6
htdocs/admin/spip.php

@@ -5,7 +5,7 @@
  * Copyright (C) 2004      Sebastien Di Cintio  <sdicintio@ressource-toi.org>
  * Copyright (C) 2004      Benoit Mortier       <benoit.mortier@opensides.be>
  * Copyright (C) 2005-2011 Regis Houssin        <regis.houssin@capnetworks.com>
- * Copyright (C) 2011 	   Juanjo Menent		<jmenent@2byte.es>
+ * Copyright (C) 2011-2013 Juanjo Menent		<jmenent@2byte.es>
  *
  * 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
@@ -70,11 +70,11 @@ if ($action == 'update' || $action == 'add')
 
 	if (! $error)
 	{
-		$mesg = '<div class="ok">'.$langs->trans("SetupSaved").'</div>';
+		setEventMessage($langs->trans("SetupSaved"));
 	}
 	else
 	{
-		$mesg = '<div class="error">'.$langs->trans("Error").'</div>';
+		setEventMessage($langs->trans("Error"),'errors');
 	}
 }
 
@@ -117,9 +117,6 @@ $head = mailmanspip_admin_prepare_head();
 
 dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
 
-
-dol_htmloutput_mesg($mesg);
-
 /*
  * Spip
  */

+ 4 - 6
htdocs/admin/stock.php

@@ -2,9 +2,9 @@
 /* Copyright (C) 2006      Rodolphe Quiedeville <rodolphe@quiedeville.org>
  * Copyright (C) 2008-2010 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005-2009 Regis Houssin        <regis.houssin@capnetworks.com>
- * Copyright (C) 2012      Juanjo Menent		<jmenent@2byte.es>
+ * Copyright (C) 2012-2013 Juanjo Menent		<jmenent@2byte.es>
  * Copyright (C) 2013      Philippe Grand       <philippe.grand@atoo-net.com>
- * Copyright (C) 2013      Florian Henry       <florian.henry@open-concept.pro>
+ * Copyright (C) 2013      Florian Henry        <florian.henry@open-concept.pro>
  *
  * 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
@@ -85,12 +85,12 @@ if($action)
  	if (! $error)
     {
     	$db->commit();
-        $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
+        setEventMessage($langs->trans("SetupSaved"));
     }
     else
     {
     	$db->rollback();
-        $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
+        setEventMessage($langs->trans("Error"),'errors');
     }
 }
 
@@ -269,8 +269,6 @@ print "</td>\n";
 print "</tr>\n";
 print '</table>';
 
-dol_htmloutput_mesg($mesg);
-
 $db->close();
 
 llxFooter();

+ 19 - 21
htdocs/admin/supplier_invoice.php

@@ -4,7 +4,7 @@
  * Copyright (C) 2005-2011 Regis Houssin           <regis.houssin@capnetworks.com>
  * Copyright (C) 2004      Sebastien Di Cintio     <sdicintio@ressource-toi.org>
  * Copyright (C) 2004      Benoit Mortier          <benoit.mortier@opensides.be>
- * Copyright (C) 2010-2012 Juanjo Menent           <jmenent@2byte.es>
+ * Copyright (C) 2010-2013 Juanjo Menent           <jmenent@2byte.es>
  * Copyright (C) 2011-2013 Philippe Grand          <philippe.grand@atoo-net.com>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -61,14 +61,14 @@ if ($action == 'updateMask')
 
     if (! $res > 0) $error++;
 
-    if (! $error)
-    {
-        $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
-    }
-    else
-    {
-        $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
-    }
+	if (! $error)
+	{
+		setEventMessage($langs->trans("SetupSaved"));
+	}
+	else
+	{
+		setEventMessage($langs->trans("Error"),'errors');
+	}
 }
 
 if ($action == 'specimen')  // For invoices
@@ -106,13 +106,13 @@ if ($action == 'specimen')  // For invoices
     	}
     	else
     	{
-    		$mesg='<font class="error">'.$module->error.'</font>';
+    		setEventMessage($module->error,'errors');
     		dol_syslog($module->error, LOG_ERR);
     	}
     }
     else
     {
-    	$mesg='<font class="error">'.$langs->trans("ErrorModuleNotFound").'</font>';
+    	setEventMessage($langs->trans("ErrorModuleNotFound"),'errors');
     	dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
     }
 }
@@ -172,14 +172,14 @@ if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
 
     if (! $res > 0) $error++;
 
-    if (! $error)
-    {
-        $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
-    }
-    else
-    {
-        $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
-    }
+	if (! $error)
+	{
+		setEventMessage($langs->trans("SetupSaved"));
+	}
+	else
+	{
+		setEventMessage($langs->trans("Error"),'errors');
+	}
 }
 
 
@@ -467,8 +467,6 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
 print "</td></tr>\n";
 print '</form>';
 
-dol_htmloutput_mesg($mesg);
-
 $db->close();
 llxFooter();
 ?>

+ 19 - 21
htdocs/admin/supplier_order.php

@@ -4,7 +4,7 @@
  * Copyright (C) 2005-2011 Regis Houssin           <regis.houssin@capnetworks.com>
  * Copyright (C) 2004      Sebastien Di Cintio     <sdicintio@ressource-toi.org>
  * Copyright (C) 2004      Benoit Mortier          <benoit.mortier@opensides.be>
- * Copyright (C) 2010-2012 Juanjo Menent           <jmenent@2byte.es>
+ * Copyright (C) 2010-2013 Juanjo Menent           <jmenent@2byte.es>
  * Copyright (C) 2011-2013 Philippe Grand          <philippe.grand@atoo-net.com>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -61,14 +61,14 @@ if ($action == 'updateMask')
 
     if (! $res > 0) $error++;
 
-    if (! $error)
-    {
-        $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
-    }
-    else
-    {
-        $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
-    }
+	if (! $error)
+	{
+		setEventMessage($langs->trans("SetupSaved"));
+	}
+	else
+	{
+		setEventMessage($langs->trans("Error"),'errors');
+	}
 }
 
 else if ($action == 'specimen')  // For orders
@@ -106,13 +106,13 @@ else if ($action == 'specimen')  // For orders
     	}
     	else
     	{
-    		$mesg='<font class="error">'.$module->error.'</font>';
+    		setEventMessage($module->error,'errors');
     		dol_syslog($module->error, LOG_ERR);
     	}
     }
     else
     {
-    	$mesg='<font class="error">'.$langs->trans("ErrorModuleNotFound").'</font>';
+    	setEventMessage($langs->trans("ErrorModuleNotFound"),'errors');
     	dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
     }
 }
@@ -172,14 +172,14 @@ else if ($action == 'set_SUPPLIER_ORDER_FREE_TEXT')
 
     if (! $res > 0) $error++;
 
-    if (! $error)
-    {
-        $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
-    }
-    else
-    {
-        $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
-    }
+	if (! $error)
+	{
+		setEventMessage($langs->trans("SetupSaved"));
+	}
+	else
+	{
+		setEventMessage($langs->trans("Error"),'errors');
+	}
 }
 
 
@@ -462,8 +462,6 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
 print "</td></tr>\n";
 print '</form>';
 
-dol_htmloutput_mesg($mesg);
-
 $db->close();
 llxFooter();
 ?>

+ 10 - 11
htdocs/admin/syslog.php

@@ -2,6 +2,7 @@
 /* Copyright (C) 2005-2012 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005-2009 Regis Houssin        <regis.houssin@capnetworks.com>
  * Copyright (C) 2007      Rodolphe Quiedeville <rodolphe@quiedeville.org>
+ * Copyright (C) 2013	   Juanjo Menent        <jmenent@2byte.es>
  *
  * 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
@@ -31,7 +32,7 @@ if (!$user->admin) accessforbidden();
 $langs->load("admin");
 $langs->load("other");
 
-$error=0; $mesg='';
+$error=0;
 $action = GETPOST("action");
 
 $syslogModules = array();
@@ -110,12 +111,12 @@ if ($action == 'set')
     if (! $error)
 	{
 		$db->commit();
-		$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
+		setEventMessage($langs->trans("SetupSaved"));
 	}
 	else
 	{
 		$db->rollback();
-		if (empty($mesg)) $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
+		setEventMessage($langs->trans("Error"),'errors');
 	}
 
 }
@@ -129,12 +130,12 @@ if ($action == 'setlevel')
 
 	if (! $res > 0) $error++;
 	if (! $error)
-    {
-        $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
-    }
-    else
-    {
-        $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
+	{
+		setEventMessage($langs->trans("SetupSaved"));
+	}
+	else
+	{
+		setEventMessage($langs->trans("Error"),'errors');
 	}
 }
 
@@ -249,8 +250,6 @@ print '</td></tr>';
 print '</table>';
 print "</form>\n";
 
-dol_htmloutput_mesg($mesg);
-
 llxFooter();
 
 $db->close();

+ 3 - 5
htdocs/admin/taxes.php

@@ -2,7 +2,7 @@
 /* Copyright (C) 2004      Rodolphe Quiedeville <rodolphe@quiedeville.org>
  * Copyright (C) 2004-2008 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005-2009 Regis Houssin        <regis.houssin@capnetworks.com>
- * Copyright (C) 2011-2012 Juanjo Menent		<jmenent@2byte.es>
+ * Copyright (C) 2011-2013 Juanjo Menent		<jmenent@2byte.es>
  *
  * 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
@@ -82,12 +82,12 @@ if ($action == 'settaxmode')
     if (! $error)
     {
         $db->commit();
-        $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
+        setEventMessage($langs->trans("SetupSaved"));
     }
     else
     {
         $db->rollback();
-        $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
+        setEventMessage($langs->trans("Error"),'errors');
     }
 
 
@@ -208,8 +208,6 @@ else
     print '</table>';
 }
 
-dol_htmloutput_mesg($mesg);
-
 $db->close();
 
 llxFooter();