Uniformize code

This commit is contained in:
Laurent Destailleur 2011-06-17 22:24:52 +00:00
parent 9d5ddb19e9
commit 337f41c8e1
15 changed files with 55 additions and 57 deletions

View File

@ -622,7 +622,7 @@ if ($action == 'create')
print_fiche_titre($langs->trans("NewMember"));
dol_htmloutput_errors($errmsg,$errmsgs);
dol_htmloutput_mesg($errmsg,$errmsgs,'error');
dol_htmloutput_mesg($mesg,$mesgs);
if ($conf->use_javascript_ajax)

View File

@ -365,7 +365,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
if ($conf->global->FACTURE_ADDON.'.php' == $file) // If module is the one used, we show existing errors
{
if (! empty($module->error)) dol_htmloutput_errors($module->error,'',1);
if (! empty($module->error)) dol_htmloutput_mesg($module->error,'','error',1);
}
print '</td>';

View File

@ -612,9 +612,8 @@ if ($_GET["action"] == 'create')
print_fiche_titre($langs->trans("NewMailing"));
if (preg_match('/class="error"/i',$message)) dol_htmloutput_errors($message);
else dol_htmloutput_mesg($message);
dol_htmloutput_mesg($message);
print '<table class="border" width="100%">';
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("MailTitle").'</td><td><input class="flat" name="titre" size="40" value="'.$_POST['titre'].'"></td></tr>';
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("MailFrom").'</td><td><input class="flat" name="from" size="40" value="'.$conf->global->MAILING_EMAIL_FROM.'"></td></tr>';

View File

@ -104,7 +104,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
}
else
{
$mesg=$object->error;
$mesg='<div class="error">'.$object->error.'</div>';
$action='';
}
}
@ -124,7 +124,7 @@ if ($action == 'reopen' && $user->rights->commande->creer)
}
else
{
$mesg='<div class="error">'.$fac->error.'</div>';
$mesg='<div class="error">'.$object->error.'</div>';
}
}
}
@ -143,7 +143,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes')
}
else
{
$mesg=$object->error;
$mesg='<div class="error">'.$object->error.'</div>';
}
}
}
@ -173,7 +173,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes')
}
else
{
print $object->error;
$mesg='<div class="error">'.$object->error.'</div>';
}
}
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
@ -1124,7 +1124,7 @@ if ($action == 'create' && $user->rights->commande->creer)
{
print_fiche_titre($langs->trans('CreateOrder'));
dol_htmloutput_errors($mesg,$mesgs);
dol_htmloutput_mesg($mesg,$mesgs,'error');
$soc = new Societe($db);
if ($socid) $res=$soc->fetch($socid);
@ -1424,7 +1424,7 @@ else
if ($id > 0 || ! empty($ref))
{
dol_htmloutput_errors($mesg,$mesgs);
dol_htmloutput_mesg($mesg,$mesgs);
$product_static=new Product($db);

View File

@ -215,8 +215,7 @@ $h++;
dol_fiche_head($head, $hselected, $langs->trans('LineRecord'),0,'account');
if (! preg_match('/class="error"/i',$mesg)) dol_htmloutput_mesg($mesg);
else dol_htmloutput_errors($mesg);
dol_htmloutput_mesg($mesg);
$sql = "SELECT b.rowid,b.dateo as do,b.datev as dv, b.amount, b.label, b.rappro,";
$sql.= " b.num_releve, b.fk_user_author, b.num_chq, b.fk_type, b.fk_account, b.fk_bordereau as receiptid,";

View File

@ -184,7 +184,7 @@ if ($_GET["action"] == 'create')
{
print_fiche_titre($langs->trans("NewTrip"));
if ($mesg) dol_htmloutput_errors($mesg);
dol_htmloutput_errors($mesg);
$datec = dol_mktime(12, 0, 0,
$_POST["remonth"],

View File

@ -1841,8 +1841,7 @@ else
*/
if ($id > 0 || ! empty($ref))
{
if (preg_match('/class="error"/',$mesg)) dol_htmloutput_errors($mesg);
else dol_htmloutput_mesg($mesg);
dol_htmloutput_mesg($mesg);
$result=$object->fetch($id,$ref);
if ($result > 0)

View File

@ -227,7 +227,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
if ($facture->type == 2) $title.=$langs->trans("EnterPaymentDueToCustomer");
print_fiche_titre($title);
if ($errmsg) dol_htmloutput_errors($errmsg);
dol_htmloutput_errors($errmsg);
// Bouchon
if ($facture->type == 2)

View File

@ -286,7 +286,7 @@ else
}
}
//if ($mesg) print $mesg.'<br>';
dol_htmloutput_errors($mesg);

View File

@ -480,7 +480,7 @@ if ($action == 'create')
{
dol_fiche_head($head, $a, $langs->trans("AddContract"), 0, 'contract');
dol_htmloutput_errors($mesg);
dol_htmloutput_errors($mesg,'');
$soc = new Societe($db);
$soc->fetch($socid);
@ -583,7 +583,7 @@ else
exit;
}
dol_htmloutput_errors($mesg);
dol_htmloutput_errors($mesg,'');
$nbofservices=sizeof($object->lines);

View File

@ -835,12 +835,7 @@ else
if ($object->id > 0)
{
if ($mesg)
{
print '<div class="error">'.$mesg.'</div>';
}
dol_htmloutput_mesg();
dol_htmloutput_mesg($mesg);
if (!empty($object->origin))
{
@ -1236,13 +1231,13 @@ else
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Validate").'</a>';
}
}
// TODO add alternative status
/* if ($object->statut == 1 && $user->rights->expedition->valider)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("ReOpen").'</a>';
}*/
// Send
if ($object->statut == 1)
{
@ -1257,7 +1252,7 @@ else
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
}
}
// Create bill and Classify billed
if ($conf->facture->enabled && $object->statut > 0 && ! $object->billed)
{
@ -1267,7 +1262,7 @@ else
//print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;origin='.$object->origin.'&amp;originid='.$object->origin_id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
}
// 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 '</td><td valign="top" width="50%">';
// 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 '</td></tr></table>';
}
/*
* Action presend
*
@ -1328,10 +1323,10 @@ else
{
$ref = dol_sanitizeFileName($object->ref);
$file = $conf->expedition->dir_output . '/sending/' . $ref . '/' . $ref . '.pdf';
print '<br>';
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 '<br>';
}

View File

@ -702,7 +702,9 @@ elseif ($fichinterid)
$societe=new Societe($db);
$societe->fetch($fichinter->socid);
if ($mesg) dol_htmloutput_errors($mesg)."<br>";
dol_htmloutput_errors($mesg);
$head = fichinter_prepare_head($fichinter);

View File

@ -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);
}
/**

View File

@ -235,8 +235,8 @@ if ($_GET["id"] || $_GET["ref"])
print "</div>\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

View File

@ -894,8 +894,7 @@ else
if ($ret == 'html') print '<br>';
}
if (! preg_match('/class="error"/',$message)) dol_htmloutput_mesg($message);
else dol_htmloutput_errors($message);
dol_htmloutput_mesg($message);
/*
* Fiche en mode visu