';
- }
-
- dol_htmloutput_mesg();
+ dol_htmloutput_mesg($mesg);
if (!empty($object->origin))
{
@@ -1236,13 +1231,13 @@ else
print ''.$langs->trans("Validate").'';
}
}
-
+
// TODO add alternative status
/* if ($object->statut == 1 && $user->rights->expedition->valider)
{
print 'id.'&action=reopen">'.$langs->trans("ReOpen").'';
}*/
-
+
// Send
if ($object->statut == 1)
{
@@ -1257,7 +1252,7 @@ else
else print ''.$langs->trans('SendByMail').'';
}
}
-
+
// Create bill and Classify billed
if ($conf->facture->enabled && $object->statut > 0 && ! $object->billed)
{
@@ -1267,7 +1262,7 @@ else
//print ''.$langs->trans("CreateBill").'';
print ''.$langs->trans("CreateBill").'';
}
-
+
// TODO add alternative status
if ($user->rights->expedition->creer && $object->statut > 2)
{
@@ -1309,17 +1304,17 @@ else
$somethingshown=$formfile->show_documents('expedition',$objectref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
if ($genallowed && ! $somethingshown) $somethingshown=1;
-
+
print '
';
-
+
// List of actions on element
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php');
$formactions=new FormActions($db);
$somethingshown=$formactions->showactions($object,'shipping',$socid);
-
+
print '
';
}
-
+
/*
* Action presend
*
@@ -1328,10 +1323,10 @@ else
{
$ref = dol_sanitizeFileName($object->ref);
$file = $conf->expedition->dir_output . '/sending/' . $ref . '/' . $ref . '.pdf';
-
+
print ' ';
print_titre($langs->trans('SendShippingByEMail'));
-
+
// Cree l'objet formulaire mail
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php');
$formmail = new FormMail($db);
@@ -1358,17 +1353,17 @@ else
$formmail->param['models']='shipping_send';
$formmail->param['shippingid']=$object->id;
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
-
+
// Init list of files
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
{
$formmail->clear_attached_files();
$formmail->add_attached_files($file,dol_sanitizeFilename($ref.'.pdf'),'application/pdf');
}
-
+
// Show form
$formmail->show_form();
-
+
print ' ';
}
diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php
index 9e11f15fd91..61ddcc6ba9d 100644
--- a/htdocs/fichinter/fiche.php
+++ b/htdocs/fichinter/fiche.php
@@ -702,7 +702,9 @@ elseif ($fichinterid)
$societe=new Societe($db);
$societe->fetch($fichinter->socid);
- if ($mesg) dol_htmloutput_errors($mesg)." ";
+
+ dol_htmloutput_errors($mesg);
+
$head = fichinter_prepare_head($fichinter);
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index de7cd699f35..bfb074c71af 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -102,7 +102,7 @@ function dol_getprefix()
* To link to a module file from a module file, use include('./mymodulefile');
* To link to a module file from a core file, then this function can be used.
* @param relpath Relative path to file (Ie: mydir/myfile, ../myfile, ...)
- * @return int Result
+ * @return int false if include fails.
*/
function dol_include_once($relpath)
{
@@ -3711,11 +3711,11 @@ function monthArrayOrSelected($selected=0)
/**
* Get formated messages to output (Used to show messages on html output)
- * @param mesgstring Message
+ * @param mesgstring Message string
* @param mesgarray Messages array
- * @param style Style of message output
+ * @param style Style of message output ('ok' or 'error')
+ * @param keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify)
* @return string Return html output
- * @return $keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify)
* @see dol_print_error
* @see dol_htmloutput_errors
*/
@@ -3727,12 +3727,12 @@ function get_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb
$out='';
$divstart=$divend='';
+ // Use session mesg
if (isset($_SESSION['mesg']))
{
$mesgstring=$_SESSION['mesg'];
unset($_SESSION['mesg']);
}
-
if (isset($_SESSION['mesgarray']))
{
$mesgarray=$_SESSION['mesgarray'];
@@ -3790,7 +3790,7 @@ function get_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb
* Get formated error messages to output (Used to show messages on html output)
* @param mesgstring Error message
* @param mesgarray Error messages array
- * @return keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify)
+ * @param keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify)
* @return html Return html output
* @see dol_print_error
* @see dol_htmloutput_mesg
@@ -3801,18 +3801,24 @@ function get_htmloutput_errors($mesgstring='', $mesgarray='', $keepembedded=0)
}
/**
- * print formated messages to output (Used to show messages on html output)
+ * Print formated messages to output (Used to show messages on html output)
* @param mesgstring Message
* @param mesgarray Messages array
- * @param style Style of message output
- * @return string Return html output
- * @return $keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify)
+ * @param style Which style to use ('ok', 'error')
+ * @param keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify)
* @see dol_print_error
* @see dol_htmloutput_errors
*/
function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepembedded=0)
{
- print get_htmloutput_mesg($mesgstring,$mesgarray,$style,$keepembedded);
+ if (empty($mesgstring) && (! is_array($mesgarray) || sizeof($mesgarray) == 0)) return;
+
+ $iserror=0;
+ if (preg_match('/class="error"/i',$mesgstring)) $iserror++;
+ if ($style=='error') $iserror++;
+
+ if ($iserror) print get_htmloutput_mesg($mesgstring,$mesgarray,'error',$keepembedded);
+ else print get_htmloutput_mesg($mesgstring,$mesgarray,'ok',$keepembedded);
}
/**
@@ -3820,13 +3826,12 @@ function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb
* @param mesgstring Error message
* @param mesgarray Error messages array
* @return keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify)
- * @return html Return html output
* @see dol_print_error
* @see dol_htmloutput_mesg
*/
function dol_htmloutput_errors($mesgstring='', $mesgarray='', $keepembedded=0)
{
- print get_htmloutput_errors($mesgstring, $mesgarray,$keepembedded);
+ dol_htmloutput_mesg($mesgstring, $mesgarray, 'error', $keepembedded);
}
/**
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index 1c5f7d93e7f..110482c829e 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -235,8 +235,8 @@ if ($_GET["id"] || $_GET["ref"])
print "\n";
- if (preg_match('/class="error"/',$mesg)) dol_htmloutput_errors($mesg);
- else dol_htmloutput_mesg($mesg);
+
+ dol_htmloutput_mesg($mesg);
// Form to add or update a price
diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php
index 55cdb0c025d..908a9ee5485 100644
--- a/htdocs/user/fiche.php
+++ b/htdocs/user/fiche.php
@@ -894,8 +894,7 @@ else
if ($ret == 'html') print ' ';
}
- if (! preg_match('/class="error"/',$message)) dol_htmloutput_mesg($message);
- else dol_htmloutput_errors($message);
+ dol_htmloutput_mesg($message);
/*
* Fiche en mode visu