[Qual] Uniformize code

This commit is contained in:
philippe grand 2015-12-04 19:45:39 +01:00
parent c91aa0aa90
commit 94fe00fe8d
4 changed files with 22 additions and 22 deletions

View File

@ -138,7 +138,7 @@ if (empty($reshook))
if (! empty($massaction) && count($toselect) < 1)
{
$error++;
setEventMessage("NoLineChecked","warnings");
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
}
if (! $error && $massaction == 'confirm_presend')

View File

@ -114,8 +114,8 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
$langs->load("other");
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret=dol_delete_file($file);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
$result=$ecmdir->changeNbOfFiles('-');
}

View File

@ -98,7 +98,7 @@ if (($action == 'create') || ($action == 'add'))
if (! (GETPOST('entrepot_id','int') > 0))
{
$langs->load("errors");
setEventMessage($langs->trans("WarehouseMustBeSelectedAtFirstStepWhenProductBatchModuleOn"),'errors');
setEventMessages($langs->trans("WarehouseMustBeSelectedAtFirstStepWhenProductBatchModuleOn"), null, 'errors');
header("Location: ".DOL_URL_ROOT.'/expedition/shipment.php?id='.$origin_id);
exit;
}
@ -303,7 +303,7 @@ if (empty($reshook))
if ($result < 0)
{
$langs->load("errors");
setEventMessage($langs->trans($object->error),'errors');
setEventMessages($langs->trans($object->error), null, 'errors');
}
else
{
@ -338,7 +338,7 @@ if (empty($reshook))
else
{
$langs->load("errors");
setEventMessage($langs->trans($object->error),'errors');
setEventMessages($langs->trans($object->error), null, 'errors');
}
}
@ -395,7 +395,7 @@ if (empty($reshook))
header("Location: card.php?id=".$object->id);
exit;
}
setEventMessage($object->error,'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
$action="";
@ -433,8 +433,8 @@ if (empty($reshook))
$upload_dir = $conf->expedition->dir_output . "/sending";
$file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
}
elseif ($action == 'classifybilled')
@ -482,7 +482,7 @@ if ($action == 'create')
print load_fiche_titre($langs->trans("CreateASending"));
if (! $origin)
{
setEventMessage($langs->trans("ErrorBadParameters"),'errors');
setEventMessages($langs->trans("ErrorBadParameters"), null, 'errors');
}
dol_htmloutput_mesg($mesg);

View File

@ -139,7 +139,7 @@ if ($action == 'add' && $user->rights->expensereport->creer)
if ($object->periode_existe($user,$object->date_debut,$object->date_fin))
{
$error++;
setEventMessage($langs->trans("ErrorDoubleDeclaration"),'errors');
setEventMessages($langs->trans("ErrorDoubleDeclaration"), null, 'errors');
$action='create';
}
@ -267,7 +267,7 @@ if ($action == "confirm_validate" && GETPOST("confirm") == "yes" && $id > 0 && $
if ($result)
{
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($emailFrom,2),$mailfile->getValidAddress($emailTo,2));
setEventMessage($mesg);
setEventMessages($mesg, null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
}
@ -279,11 +279,11 @@ if ($action == "confirm_validate" && GETPOST("confirm") == "yes" && $id > 0 && $
$mesg='';
$mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo);
$mesg.='<br>'.$mailfile->error;
setEventMessage($mesg,'errors');
setEventMessages($mesg, null, 'errors');
}
else
{
setEventMessage('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', 'warnings');
setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings');
}
}
}
@ -295,7 +295,7 @@ if ($action == "confirm_validate" && GETPOST("confirm") == "yes" && $id > 0 && $
}
else
{
setEventMessage($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), 'warnings');
setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings');
$action='';
}
}
@ -490,15 +490,15 @@ if ($action == "confirm_approve" && GETPOST("confirm") == "yes" && $id > 0 && $u
// SEND
$result=$mailfile->sendfile();
if ($result):
setEventMessage($langs->trans("MailSuccessfulySent",$emailFrom,$emailTo));
setEventMessages($langs->trans("MailSuccessfulySent",$emailFrom,$emailTo), null, 'mesgs');
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
else:
setEventMessage($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo),'errors');
setEventMessages($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo), null, 'errors');
endif;
else:
setEventMessage($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo),'errors');
setEventMessages($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo), null, 'errors');
endif;
// END - Send mail
else : // if ($resultPDF)
@ -576,13 +576,13 @@ if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user
$result=$mailfile->sendfile();
if ($result)
{
setEventMessage($langs->trans("MailSuccessfulySent",$emailFrom,$emailTo));
setEventMessages($langs->trans("MailSuccessfulySent",$emailFrom,$emailTo), null, 'mesgs');
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
}
else
{
setEventMessage($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo),'errors');
setEventMessages($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo), null, 'errors');
$mesg="Impossible d'envoyer l'email.";
}
// END - Send mail
@ -1059,8 +1059,8 @@ else if ($action == 'remove_file')
$upload_dir = $conf->expensereport->dir_output;
$file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
$action='';
}
}