Migrated old error notifications to the """new""" system
This commit is contained in:
parent
434bb1bec7
commit
ac824728bc
@ -129,7 +129,7 @@ if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights
|
||||
if ($_POST["userid"] != $user->id && $_POST["userid"] != $object->user_id)
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly").'</div>';
|
||||
setEventMessage($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ if ($action == 'setsocid')
|
||||
$thirdparty=new Societe($db);
|
||||
$thirdparty->fetch(GETPOST('socid','int'));
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->getFullName($langs),$othermember->login,$thirdparty->name).'</div>';
|
||||
setEventMessage($langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->getFullName($langs),$othermember->login,$thirdparty->name), 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -81,8 +81,6 @@ if (! empty($canvas))
|
||||
// Security check
|
||||
$result=restrictedArea($user,'adherent',$rowid,'','','fk_soc', 'rowid', $objcanvas);
|
||||
|
||||
$errmsg=''; $errmsgs=array();
|
||||
|
||||
if ($rowid > 0)
|
||||
{
|
||||
// Load member
|
||||
@ -128,7 +126,7 @@ if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights
|
||||
if ($userid != $user->id && $userid != $object->user_id)
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly").'</div>';
|
||||
setEventMessage($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,7 +162,7 @@ if ($action == 'setsocid')
|
||||
$thirdparty=new Societe($db);
|
||||
$thirdparty->fetch($socid);
|
||||
$error++;
|
||||
$errmsg='<div class="error">'.$langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->getFullName($langs),$othermember->login,$thirdparty->name).'</div>';
|
||||
setEventMessage($langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->getFullName($langs),$othermember->login,$thirdparty->name), 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,12 +188,12 @@ if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user
|
||||
if ($result < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$errmsg=$langs->trans($nuser->error);
|
||||
setEventMessage($langs->trans($nuser->error), 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$errmsg=$object->error;
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,13 +209,13 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
|
||||
if ($result < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$errmsg=$langs->trans($company->error);
|
||||
$errmsgs=$company->errors;
|
||||
setEventMessage($langs->trans($company->error), 'errors');
|
||||
setEventMessage($company->errors, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$errmsg=$object->error;
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,7 +229,7 @@ if ($action == 'confirm_sendinfo' && $confirm == 'yes')
|
||||
$result=$object->send_an_email($langs->transnoentitiesnoconv("ThisIsContentOfYourCard")."\n\n%INFOS%\n\n",$langs->transnoentitiesnoconv("CardContent"));
|
||||
|
||||
$langs->load("mails");
|
||||
$mesg=$langs->trans("MailSuccessfulySent", $from, $object->email);
|
||||
setEventMessage($langs->trans("MailSuccessfulySent", $from, $object->email));
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,12 +250,12 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
|
||||
if ($morphy != 'mor' && empty($lastname)) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname"))."<br>\n";
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname")), 'errors');
|
||||
}
|
||||
if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Firstname"))."<br>\n";
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Firstname")), 'errors');
|
||||
}
|
||||
|
||||
// Create new object
|
||||
@ -343,7 +341,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
|
||||
$newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']);
|
||||
if (! dol_move_uploaded_file($_FILES['photo']['tmp_name'],$newfile,1,0,$_FILES['photo']['error']) > 0)
|
||||
{
|
||||
$message .= '<div class="error">'.$langs->trans("ErrorFailedToSaveFile").'</div>';
|
||||
setEventMessage($langs->trans("ErrorFailedToSaveFile"), 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -359,7 +357,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
|
||||
}
|
||||
else
|
||||
{
|
||||
$errmsgs[] = "ErrorBadImageFormat";
|
||||
setEventMessage("ErrorBadImageFormat", 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -387,8 +385,11 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->error) $errmsg=$object->error;
|
||||
else $errmsgs=$object->errors;
|
||||
if ($object->error) {
|
||||
setEventMessage($object->error, 'errors');
|
||||
} else {
|
||||
setEventMessage($object->errors, 'errors');
|
||||
}
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
@ -472,14 +473,14 @@ if ($action == 'add' && $user->rights->adherent->creer)
|
||||
// Check parameters
|
||||
if (empty($morphy) || $morphy == "-1") {
|
||||
$error++;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Nature"))."<br>\n";
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Nature")), 'errors');
|
||||
}
|
||||
// Test si le login existe deja
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
if (empty($login)) {
|
||||
$error++;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->trans("Login"))."<br>\n";
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Login")), 'errors');
|
||||
}
|
||||
else {
|
||||
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape($login)."'";
|
||||
@ -490,32 +491,32 @@ if ($action == 'add' && $user->rights->adherent->creer)
|
||||
if ($num) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$errmsg .= $langs->trans("ErrorLoginAlreadyExists",$login)."<br>\n";
|
||||
setEventMessage($langs->trans("ErrorLoginAlreadyExists",$login), 'errors');
|
||||
}
|
||||
}
|
||||
if (empty($pass)) {
|
||||
$error++;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Password"))."<br>\n";
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Password")), 'errors');
|
||||
}
|
||||
}
|
||||
if ($morphy != 'mor' && empty($lastname)) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname"))."<br>\n";
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname")), 'errors');
|
||||
}
|
||||
if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Firstname"))."<br>\n";
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Firstname")), 'errors');
|
||||
}
|
||||
if (! ($typeid > 0)) { // Keep () before !
|
||||
$error++;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type"))."<br>\n";
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
|
||||
}
|
||||
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! isValidEMail($email)) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$errmsg .= $langs->trans("ErrorBadEMail",$email)."<br>\n";
|
||||
setEventMessage($langs->trans("ErrorBadEMail",$email), 'errors');
|
||||
}
|
||||
$public=0;
|
||||
if (isset($public)) $public=1;
|
||||
@ -536,8 +537,11 @@ if ($action == 'add' && $user->rights->adherent->creer)
|
||||
{
|
||||
$db->rollback();
|
||||
|
||||
if ($object->error) $errmsg=$object->error;
|
||||
else $errmsgs=$object->errors;
|
||||
if ($object->error) {
|
||||
setEventMessage($object->error, 'errors');
|
||||
} else {
|
||||
setEventMessage($object->errors, 'errors');
|
||||
}
|
||||
|
||||
$action = 'create';
|
||||
}
|
||||
@ -589,15 +593,18 @@ if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm ==
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
$errmsg.=$object->error;
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
if ($object->error) $errmsg=$object->error;
|
||||
else $errmsgs=$object->errors;
|
||||
if ($object->error) {
|
||||
setEventMessage($object->error, 'errors');
|
||||
} else {
|
||||
setEventMessage($object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -613,6 +620,8 @@ if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm ==
|
||||
|
||||
if ($user->rights->adherent->supprimer && $action == 'confirm_resign')
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
if ($confirm == 'yes')
|
||||
{
|
||||
$adht = new AdherentType($db);
|
||||
@ -628,17 +637,23 @@ if ($user->rights->adherent->supprimer && $action == 'confirm_resign')
|
||||
}
|
||||
if ($result < 0)
|
||||
{
|
||||
$errmsg.=$object->error;
|
||||
$error++;
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->error) $errmsg=$object->error;
|
||||
else $errmsgs=$object->errors;
|
||||
$error++;
|
||||
|
||||
if ($object->error) {
|
||||
setEventMessage($object->error, 'errors');
|
||||
} else {
|
||||
setEventMessage($object->errors, 'errors');
|
||||
}
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
if (! empty($backtopage) && ! $errmsg)
|
||||
if (! empty($backtopage) && ! $error)
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
@ -652,7 +667,7 @@ if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $conf
|
||||
{
|
||||
if (!$mailmanspip->del_to_spip($object))
|
||||
{
|
||||
$errmsg.= $langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error."<BR>\n";
|
||||
setEventMessage($langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -663,7 +678,7 @@ if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm
|
||||
{
|
||||
if (!$mailmanspip->add_to_spip($object))
|
||||
{
|
||||
$errmsg.= $langs->trans('AddIntoSpipError').': '.$mailmanspip->error."<BR>\n";
|
||||
setEventMessage($langs->trans('AddIntoSpipError').': '.$mailmanspip->error, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -725,9 +740,6 @@ else
|
||||
|
||||
print_fiche_titre($langs->trans("NewMember"));
|
||||
|
||||
dol_htmloutput_mesg($errmsg,$errmsgs,'error');
|
||||
dol_htmloutput_mesg($mesg,$mesgs);
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
@ -952,9 +964,6 @@ else
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
|
||||
|
||||
dol_htmloutput_errors($errmsg,$errmsgs);
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
@ -1168,8 +1177,6 @@ else
|
||||
|
||||
if ($rowid && $action != 'edit')
|
||||
{
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Mode affichage */
|
||||
@ -1199,8 +1206,6 @@ else
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
|
||||
|
||||
dol_htmloutput_errors($errmsg,$errmsgs);
|
||||
|
||||
// Confirm create user
|
||||
if ($action == 'create_user')
|
||||
{
|
||||
|
||||
@ -282,8 +282,6 @@ if ($rowid && $action != 'edit')
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("Subscription"), '', 'payment');
|
||||
|
||||
if ($msg) print '<div class="error">'.$msg.'</div>';
|
||||
|
||||
// Confirmation to delete subscription
|
||||
if ($action == 'delete')
|
||||
{
|
||||
|
||||
@ -237,8 +237,6 @@ if ($action == 'create')
|
||||
|
||||
print_fiche_titre($langs->trans("NewMemberType"));
|
||||
|
||||
if ($mesg) print '<div class="error">'.$mesg.'</div>';
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -46,8 +46,6 @@ static $tmpstatut2label=array(
|
||||
$statut2label=array('');
|
||||
foreach ($tmpstatut2label as $key => $val) $statut2label[$key]=$langs->trans($val);
|
||||
|
||||
$mesg = '';
|
||||
|
||||
$object = new Fiscalyear($db);
|
||||
|
||||
$date_start=dol_mktime(0,0,0,GETPOST('fiscalyearmonth','int'),GETPOST('fiscalyearday','int'),GETPOST('fiscalyearyear','int'));
|
||||
@ -67,7 +65,7 @@ if ($action == 'confirm_delete' && $confirm == "yes")
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$object->error;
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,12 +85,12 @@ else if ($action == 'add')
|
||||
|
||||
if (empty($object->date_start) && empty($object->date_end))
|
||||
{
|
||||
$mesg.=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date"));
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($object->label))
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Label")).'</div>';
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Label")), 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -107,7 +105,7 @@ else if ($action == 'add')
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$object->error;
|
||||
setEventMessage($object->error, 'errors');
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
@ -144,7 +142,7 @@ else if ($action == 'update')
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$object->error;
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -169,8 +167,6 @@ if ($action == 'create')
|
||||
{
|
||||
print_fiche_titre($langs->trans("NewFiscalYear"));
|
||||
|
||||
dol_htmloutput_errors($mesg);
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
@ -209,8 +205,6 @@ else if ($id)
|
||||
$result = $object->fetch($id);
|
||||
if ($result > 0)
|
||||
{
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
$head = fiscalyear_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("FiscalYearCard"), 0, 'cron');
|
||||
|
||||
@ -427,7 +427,7 @@ if (function_exists("ldap_connect"))
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$ldap->error.'</div>';
|
||||
setEventMessage($ldap->error, 'errors');
|
||||
}
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
@ -43,7 +43,7 @@ if ($action == 'update')
|
||||
|| $_POST["MAIN_MAX_DECIMALS_SHOWN"] > $MAXDEC)
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorDecimalLargerThanAreForbidden",$MAXDEC).'</div>';
|
||||
setEventMessage($langs->trans("ErrorDecimalLargerThanAreForbidden",$MAXDEC), 'errors');
|
||||
}
|
||||
|
||||
if ($_POST["MAIN_MAX_DECIMALS_UNIT"] < 0
|
||||
@ -52,7 +52,7 @@ if ($action == 'update')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorNegativeValueNotAllowed").'</div>';
|
||||
setEventMessage($langs->trans("ErrorNegativeValueNotAllowed"), 'errors');
|
||||
}
|
||||
|
||||
if ($_POST["MAIN_ROUNDING_RULE_TOT"])
|
||||
@ -61,7 +61,7 @@ if ($action == 'update')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT").'</div>';
|
||||
setEventMessage($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,8 +94,6 @@ print_fiche_titre($langs->trans("LimitsSetup"),'','setup');
|
||||
print $langs->trans("LimitsDesc")."<br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
if ($mesg) print $mesg.'<br>';
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
@ -653,9 +653,13 @@ else
|
||||
if ($result) print '<div class="ok">'.$langs->trans("ServerAvailableOnIPOrPort",$server,$port).'</div>';
|
||||
else
|
||||
{
|
||||
print '<div class="error">'.$langs->trans("ServerNotAvailableOnIPOrPort",$server,$port);
|
||||
if ($mail->error) print ' - '.$mail->error;
|
||||
print '</div>';
|
||||
$errormsg = $langs->trans("ServerNotAvailableOnIPOrPort",$server,$port);
|
||||
|
||||
if ($mail->error) {
|
||||
$errormsg .= ' - '.$mail->error;
|
||||
}
|
||||
|
||||
setEventMessage($errormsg, 'errors');
|
||||
}
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ if ($conf->use_javascript_ajax)
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<div class="error">'.$langs->trans("ErrorFeatureNeedJavascript").'</div>';
|
||||
setEventMessage($langs->trans("ErrorFeatureNeedJavascript"), 'errors');
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
|
||||
@ -95,11 +95,10 @@ if ($db->type == 'pgsql')
|
||||
{
|
||||
// Check option standard_conforming_strings is on
|
||||
$paramarray=$db->getServerParametersValues('standard_conforming_strings');
|
||||
if ($paramarray['standard_conforming_strings'] != 'on' && $paramarray['standard_conforming_strings'] != 1)
|
||||
{
|
||||
$langs->load("errors");
|
||||
//print '<div class="error">'.$langs->trans("ErrorDatabaseParameterWrong",'standard_conforming_strings','on').'</div>';
|
||||
}
|
||||
// if ($paramarray['standard_conforming_strings'] != 'on' && $paramarray['standard_conforming_strings'] != 1)
|
||||
// {
|
||||
// $langs->load("errors");
|
||||
// }
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
|
||||
@ -30,7 +30,9 @@ $langs->load("other");
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
if (GETPOST('msg','alpha')) $message='<div class="error">'.GETPOST('msg','alpha').'</div>';
|
||||
if (GETPOST('msg','alpha')) {
|
||||
setEventMessage(GETPOST('msg','alpha'), 'errors');
|
||||
}
|
||||
|
||||
|
||||
$urldolibarr='http://www.dolibarr.org/downloads/';
|
||||
@ -148,7 +150,7 @@ if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE))
|
||||
else
|
||||
{
|
||||
$message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
|
||||
print '<div class="warning">'.$message.'</div>';
|
||||
setEventMessage($message, 'warnings');
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -50,6 +50,8 @@ $backtopage=GETPOST('backtopage','alpha');
|
||||
|
||||
if ($action == 'add' || $action == 'addproduct' || $action == 'update')
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
if (GETPOST("cancel"))
|
||||
{
|
||||
if (empty($backtopage)) $backtopage=(GETPOST("urlsource")?GETPOST("urlsource"):((! empty($url))?$url:DOL_URL_ROOT.'/bookmarks/liste.php'));
|
||||
@ -57,8 +59,6 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
|
||||
exit;
|
||||
}
|
||||
|
||||
$mesg='';
|
||||
|
||||
$bookmark=new Bookmark($db);
|
||||
if ($action == 'update') $bookmark->fetch($_POST["id"]);
|
||||
$bookmark->fk_user=$userid;
|
||||
@ -67,10 +67,17 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
|
||||
$bookmark->target=$target;
|
||||
$bookmark->position=$position;
|
||||
|
||||
if (! $title) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("BookmarkTitle"));
|
||||
if (! $url) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("UrlOrLink"));
|
||||
if (! $title) {
|
||||
$error++;
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("BookmarkTitle")), 'errors');
|
||||
}
|
||||
|
||||
if (! $mesg)
|
||||
if (! $url) {
|
||||
$error++;
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("UrlOrLink")), 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$bookmark->favicon='none';
|
||||
|
||||
@ -88,18 +95,17 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
|
||||
if ($bookmark->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg='<div class="warning">'.$langs->trans("WarningBookmarkAlreadyExists").'</div>';
|
||||
setEventMessage($langs->trans("WarningBookmarkAlreadyExists"), 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$bookmark->error.'</div>';
|
||||
setEventMessage($bookmark->error, 'errors');
|
||||
}
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$mesg.'</div>';
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
@ -121,7 +127,7 @@ if ($action == 'delete')
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$bookmark->error.'</div>';
|
||||
setEventMessage($bookmark->error, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,8 +155,6 @@ if ($action == 'create')
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark');
|
||||
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("BookmarkTitle").'</td><td><input class="flat" name="title" size="30" value="'.$title.'"></td><td class="hideonsmartphone">'.$langs->trans("SetHereATitleForLink").'</td></tr>';
|
||||
|
||||
@ -58,7 +58,7 @@ if ($_GET["action"] == 'delete')
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$bookmark->error.'</div>';
|
||||
$setEventMessage($bookmark->error, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,8 +73,6 @@ llxHeader();
|
||||
|
||||
print_fiche_titre($langs->trans("Bookmarks"));
|
||||
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
$sql = "SELECT b.fk_soc as rowid, b.dateb, b.rowid as bid, b.fk_user, b.url, b.target, b.title, b.favicon, b.position,";
|
||||
$sql.= " u.login, u.lastname, u.firstname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b LEFT JOIN ".MAIN_DB_PREFIX."user as u ON b.fk_user=u.rowid";
|
||||
|
||||
@ -94,7 +94,7 @@ $cancel != $langs->trans("Cancel") &&
|
||||
else
|
||||
{
|
||||
$action = 'add';
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ $cancel != $langs->trans("Cancel") &&
|
||||
else
|
||||
{
|
||||
$action = 'edit';
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,10 +153,6 @@ else $title=$langs->trans("Category");
|
||||
$head = categories_prepare_head($object,$type);
|
||||
dol_fiche_head($head, 'translation', $title, 0, 'category');
|
||||
|
||||
if (! empty($mesg)) {
|
||||
dol_htmloutput_mesg($mesg);
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Reference
|
||||
|
||||
@ -32,7 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
$langs->load("categories");
|
||||
|
||||
$mesg = '';
|
||||
$id=GETPOST('id','int');
|
||||
$ref=GETPOST('ref');
|
||||
$type=GETPOST('type');
|
||||
@ -117,7 +116,7 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,8 +130,6 @@ $form = new Form($db);
|
||||
|
||||
llxHeader("","",$langs->trans("Categories"));
|
||||
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
if ($type == 0) $title=$langs->trans("ProductsCategoryShort");
|
||||
elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort");
|
||||
elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort");
|
||||
|
||||
@ -62,7 +62,6 @@ $result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|
|
||||
if ($user->societe_id && $socid) $result = restrictedArea($user,'societe',$socid);
|
||||
|
||||
$error=GETPOST("error");
|
||||
$mesg='';
|
||||
|
||||
$cactioncomm = new CActionComm($db);
|
||||
$object = new ActionComm($db);
|
||||
@ -116,14 +115,14 @@ if ($action == 'add_action')
|
||||
{
|
||||
$error++;
|
||||
$action = 'create';
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")).'</div>';
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors');
|
||||
}
|
||||
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! GETPOST('label'))
|
||||
{
|
||||
$error++;
|
||||
$action = 'create';
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Title")).'</div>';
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Title")), 'errors');
|
||||
}
|
||||
|
||||
// Initialisation objet cactioncomm
|
||||
@ -131,7 +130,7 @@ if ($action == 'add_action')
|
||||
{
|
||||
$error++;
|
||||
$action = 'create';
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -201,14 +200,14 @@ if ($action == 'add_action')
|
||||
{
|
||||
$error++;
|
||||
$action = 'create';
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")).'</div>';
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors');
|
||||
}
|
||||
|
||||
if (! GETPOST('apyear') && ! GETPOST('adyear'))
|
||||
{
|
||||
$error++;
|
||||
$action = 'create';
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")).'</div>';
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors');
|
||||
}
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
@ -458,8 +457,6 @@ if ($action == 'create')
|
||||
if (GETPOST("actioncode") == 'AC_RDV') print_fiche_titre($langs->trans("AddActionRendezVous"));
|
||||
else print_fiche_titre($langs->trans("AddAnAction"));
|
||||
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Type d'action actifs
|
||||
@ -644,10 +641,6 @@ if ($id > 0)
|
||||
{
|
||||
dol_htmloutput_errors($error);
|
||||
}
|
||||
if ($mesg)
|
||||
{
|
||||
dol_htmloutput_mesg($mesg);
|
||||
}
|
||||
|
||||
$result=$object->fetch($id);
|
||||
$object->fetch_optionals($id,$extralabels);
|
||||
|
||||
@ -65,17 +65,17 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
|
||||
if (! $res > 0)
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFailedToLoadDiscount").'</div>';
|
||||
setEventMessage($langs->trans("ErrorFailedToLoadDiscount"), 'errors');
|
||||
}
|
||||
if (! $error && price2num($_POST["amount_ttc_1"]+$_POST["amount_ttc_2"]) != $discount->amount_ttc)
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("TotalOfTwoDiscountMustEqualsOriginal").'</div>';
|
||||
setEventMessage($langs->trans("TotalOfTwoDiscountMustEqualsOriginal"), 'errors');
|
||||
}
|
||||
if (! $error && $discount->fk_facture_line)
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorCantSplitAUsedDiscount").'</div>';
|
||||
setEventMessage($langs->trans("ErrorCantSplitAUsedDiscount"), 'errors');
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
@ -140,7 +140,7 @@ if ($action == 'setremise')
|
||||
$error=0;
|
||||
if (empty($_POST["desc"]))
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("ReasonDiscount")).'</div>';
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("ReasonDiscount")), 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -166,13 +166,13 @@ if ($action == 'setremise')
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$soc->error.'</div>';
|
||||
setEventMessage($soc->error, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldFormat",$langs->trans("NewGlobalDiscount")).'</div>';
|
||||
setEventMessage($langs->trans("ErrorFieldFormat",$langs->trans("NewGlobalDiscount")), 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ if (GETPOST("action") == 'confirm_remove' && GETPOST("confirm")=='yes')
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$discount->error.'</div>';
|
||||
setEventMessage($discount->error, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
@ -211,8 +211,6 @@ llxHeader('',$langs->trans("GlobalDiscount"));
|
||||
|
||||
if ($socid > 0)
|
||||
{
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
// On recupere les donnees societes par l'objet
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->id=$socid;
|
||||
|
||||
@ -69,11 +69,11 @@ if ($action == 'addcontact' && $user->rights->commande->creer)
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -132,7 +132,6 @@ $userstatic=new User($db);
|
||||
/* Mode vue et edition */
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
|
||||
@ -65,8 +65,6 @@ $lineid = GETPOST('lineid', 'int');
|
||||
$origin = GETPOST('origin', 'alpha');
|
||||
$originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility
|
||||
|
||||
$mesg = GETPOST('mesg');
|
||||
|
||||
// PDF
|
||||
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
||||
$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
|
||||
@ -108,7 +106,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->
|
||||
{
|
||||
if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
|
||||
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -201,7 +199,7 @@ else if ($action == 'add' && $user->rights->commande->creer) {
|
||||
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
|
||||
|
||||
if ($datecommande == '') {
|
||||
$mesg = '<div class="error">' . $langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')) . '</div>';
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')), 'errors');
|
||||
$action = 'create';
|
||||
$error ++;
|
||||
}
|
||||
@ -340,11 +338,11 @@ else if ($action == 'add' && $user->rights->commande->creer) {
|
||||
if ($reshook < 0)
|
||||
$error ++;
|
||||
} else {
|
||||
$mesg = $srcobject->error;
|
||||
setEventMessage($srcobject->error, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
} else {
|
||||
$mesg = $object->error;
|
||||
setEventMessage($object->error, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
} else {
|
||||
@ -378,7 +376,7 @@ else if ($action == 'add' && $user->rights->commande->creer) {
|
||||
if (GETPOST('contactidp')) {
|
||||
$result = $object->add_contact(GETPOST('contactidp'), 'CUSTOMER', 'external');
|
||||
if ($result < 0) {
|
||||
$mesg = '<div class="error">' . $langs->trans("ErrorFailedToAddContact") . '</div>';
|
||||
setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors');
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
@ -395,8 +393,7 @@ else if ($action == 'add' && $user->rights->commande->creer) {
|
||||
} else {
|
||||
$db->rollback();
|
||||
$action = 'create';
|
||||
if (! $mesg)
|
||||
$mesg = '<div class="error">' . $object->error . '</div>';
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -435,7 +432,7 @@ else if ($action == 'setdate' && $user->rights->commande->creer) {
|
||||
|
||||
$result = $object->set_date($user, $date);
|
||||
if ($result < 0) {
|
||||
$mesg = '<div class="error">' . $object->error . '</div>';
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -445,7 +442,7 @@ else if ($action == 'setdate_livraison' && $user->rights->commande->creer) {
|
||||
|
||||
$result = $object->set_date_livraison($user, $datelivraison);
|
||||
if ($result < 0) {
|
||||
$mesg = '<div class="error">' . $object->error . '</div>';
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -884,7 +881,7 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->co
|
||||
if (! $idwarehouse || $idwarehouse == -1)
|
||||
{
|
||||
$error++;
|
||||
$mesgs[]='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")).'</div>';
|
||||
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
@ -929,7 +926,7 @@ else if ($action == 'confirm_modif' && $user->rights->commande->creer) {
|
||||
if (! $idwarehouse || $idwarehouse == -1)
|
||||
{
|
||||
$error++;
|
||||
$mesgs[]='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")).'</div>';
|
||||
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
@ -982,7 +979,7 @@ else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->comm
|
||||
if (! $idwarehouse || $idwarehouse == -1)
|
||||
{
|
||||
$error++;
|
||||
$mesgs[]='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")).'</div>';
|
||||
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
@ -1221,12 +1218,13 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
|
||||
$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, - 1);
|
||||
if ($mailfile->error) {
|
||||
$mesg = '<div class="error">' . $mailfile->error . '</div>';
|
||||
setEventMessage($mailfile->error, 'errors');
|
||||
} else {
|
||||
$result = $mailfile->sendfile();
|
||||
if ($result) {
|
||||
$mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2)); // Must not
|
||||
// contains "
|
||||
//Must not contain quotes
|
||||
$mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2));
|
||||
setEventMessage($mesg);
|
||||
|
||||
$error = 0;
|
||||
|
||||
@ -1253,19 +1251,19 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
|
||||
} else {
|
||||
// Redirect here
|
||||
// This avoid sending mail twice if going out and then back to page
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&mesg=' . urlencode($mesg));
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
|
||||
exit();
|
||||
}
|
||||
} else {
|
||||
$langs->load("other");
|
||||
$mesg = '<div class="error">';
|
||||
if ($mailfile->error) {
|
||||
$mesg .= $langs->trans('ErrorFailedToSendMail', $from, $sendto);
|
||||
$mesg .= '<br>' . $mailfile->error;
|
||||
} else {
|
||||
$mesg .= 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
|
||||
}
|
||||
$mesg .= '</div>';
|
||||
|
||||
setEventMessage($mesg, 'errors');
|
||||
}
|
||||
}
|
||||
/* }
|
||||
@ -1278,12 +1276,12 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
|
||||
}*/
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">' . $langs->trans('ErrorCantReadFile', $file) . '</div>';
|
||||
setEventMessage($langs->trans('ErrorCantReadFile', $file), 'errors');
|
||||
dol_syslog('Failed to read file: ' . $file);
|
||||
}
|
||||
} else {
|
||||
$langs->load("other");
|
||||
$mesg = '<div class="error">' . $langs->trans('ErrorFailedToReadEntity', $langs->trans("Order")) . '</div>';
|
||||
setEventMessage($langs->trans('ErrorFailedToReadEntity', $langs->trans("Order")), 'errors');
|
||||
dol_syslog($langs->trans('ErrorFailedToReadEntity', $langs->trans("Order")));
|
||||
}
|
||||
}
|
||||
@ -1301,9 +1299,9 @@ if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->righ
|
||||
} else {
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">' . $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType") . '</div>';
|
||||
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
|
||||
} else {
|
||||
$mesg = '<div class="error">' . $object->error . '</div>';
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1350,8 +1348,6 @@ $formorder = new FormOrder($db);
|
||||
if ($action == 'create' && $user->rights->commande->creer) {
|
||||
print_fiche_titre($langs->trans('CreateOrder'));
|
||||
|
||||
dol_htmloutput_mesg($mesg, $mesgs, 'error');
|
||||
|
||||
$soc = new Societe($db);
|
||||
if ($socid > 0)
|
||||
$res = $soc->fetch($socid);
|
||||
@ -1671,8 +1667,6 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
$now = dol_now();
|
||||
|
||||
if ($object->id > 0) {
|
||||
dol_htmloutput_mesg($mesg, $mesgs);
|
||||
|
||||
$product_static = new Product($db);
|
||||
|
||||
$soc = new Societe($db);
|
||||
|
||||
@ -58,6 +58,8 @@ $sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$viewstatut = GETPOST('viewstatut');
|
||||
|
||||
$error = 0;
|
||||
|
||||
if (! $sortfield) $sortfield='c.rowid';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
@ -71,7 +73,8 @@ if ($action == 'create')
|
||||
{
|
||||
if (is_array($selected) == false)
|
||||
{
|
||||
$mesgs = array('<div class="error">'.$langs->trans('Error_OrderNotChecked').'</div>');
|
||||
$error++;
|
||||
setEventMessage($langs->trans('Error_OrderNotChecked'), 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -90,7 +93,7 @@ $hookmanager->initHooks(array('orderstoinvoice'));
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (($action == 'create' || $action == 'add') && empty($mesgs))
|
||||
if (($action == 'create' || $action == 'add') && !$error)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
@ -244,7 +247,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesgs[]=$discount->error;
|
||||
setEventMessage($discount->error, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
@ -313,7 +316,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesgs[]=$objectsrc->error;
|
||||
setEventMessage($objectsrc->error, 'errors');
|
||||
$error++;
|
||||
}
|
||||
$ii++;
|
||||
@ -321,7 +324,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesgs[]=$object->error;
|
||||
setEventMessage($object->error, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -341,7 +344,8 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
|
||||
$action='create';
|
||||
$_GET["origin"]=$_POST["origin"];
|
||||
$_GET["originid"]=$_POST["originid"];
|
||||
$mesgs[]='<div class="error">'.$object->error.'</div>';
|
||||
setEventMessage($object->error, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -357,7 +361,7 @@ $formfile = new FormFile($db);
|
||||
$companystatic = new Societe($db);
|
||||
|
||||
// Mode creation
|
||||
if ($action == 'create' && empty($mesgs))
|
||||
if ($action == 'create' && !$error)
|
||||
{
|
||||
$facturestatic=new Facture($db);
|
||||
|
||||
@ -497,7 +501,7 @@ if ($action == 'create' && empty($mesgs))
|
||||
|
||||
|
||||
//Mode liste
|
||||
if (($action != 'create' && $action != 'add') || ! empty($mesgs))
|
||||
if (($action != 'create' && $action != 'add') || !$error)
|
||||
{
|
||||
llxHeader();
|
||||
?>
|
||||
@ -693,7 +697,5 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs))
|
||||
|
||||
}
|
||||
|
||||
dol_htmloutput_mesg($mesg,$mesgs);
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -289,7 +289,7 @@ if ($result < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFailedToCreateDir").'</div>';
|
||||
setEventMessage($langs->trans("ErrorFailedToCreateDir"), 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -79,7 +79,7 @@ if ($action == 'update' && ! $_POST["cancel"])
|
||||
}
|
||||
else
|
||||
{
|
||||
$message='<div class="error">'.$account->error.'</div>';
|
||||
setEventMessage($account->error, 'errors');
|
||||
$action='edit'; // Force chargement page edition
|
||||
}
|
||||
}
|
||||
@ -304,8 +304,6 @@ if ($_GET["id"] && $action == 'edit' && $user->rights->banque->configurer)
|
||||
print_fiche_titre($langs->trans("EditFinancialAccount"));
|
||||
print "<br>";
|
||||
|
||||
dol_htmloutput_mesg($message);
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$account->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
@ -181,7 +181,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
||||
}
|
||||
else
|
||||
{
|
||||
$message='<div class="error">'.$account->error.'</div>';
|
||||
setEventMessage($account->error, 'errors');
|
||||
$action='edit'; // Force chargement page edition
|
||||
}
|
||||
}
|
||||
@ -220,8 +220,6 @@ if ($action == 'create')
|
||||
|
||||
print_fiche_titre($langs->trans("NewFinancialAccount"));
|
||||
|
||||
dol_htmloutput_mesg($message);
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
@ -510,8 +508,6 @@ else
|
||||
print_fiche_titre($langs->trans("EditFinancialAccount"));
|
||||
print "<br>";
|
||||
|
||||
if ($message) { print "$message<br>\n"; }
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
|
||||
@ -46,7 +46,6 @@ $result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fie
|
||||
$account=$_GET["account"];
|
||||
$mode='standard';
|
||||
if (isset($_GET["mode"]) && $_GET["mode"] == 'showalltime') $mode='showalltime';
|
||||
$mesg = '';
|
||||
$error=0;
|
||||
|
||||
|
||||
@ -82,7 +81,7 @@ if ($result < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFailedToCreateDir").'</div>';
|
||||
setEventMessage($langs->trans("ErrorFailedToCreateDir"), 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -756,8 +755,6 @@ else
|
||||
$head=bank_prepare_head($acct);
|
||||
dol_fiche_head($head,'graph',$langs->trans("FinancialAccount"),0,'account');
|
||||
|
||||
if ($mesg) print $mesg.'<br>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
@ -99,7 +99,7 @@ if ($user->rights->banque->modifier && $action == "update")
|
||||
|
||||
if ($ac->courant == 2 && $_POST['value'] != 'LIQ')
|
||||
{
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorCashAccountAcceptsOnlyCashMoney").'</div>';
|
||||
setEventMessage($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ if ($user->rights->banque->modifier && $action == "update")
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$mesg=$langs->trans("RecordSaved");
|
||||
setEventMessage($langs->trans("RecordSaved"));
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
@ -161,7 +161,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action ==
|
||||
// Check parameters
|
||||
if ($rappro && empty($num_rel))
|
||||
{
|
||||
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountStatement"));
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountStatement")), 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action ==
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$mesg=$langs->trans("RecordSaved");
|
||||
setEventMessage($langs->trans("RecordSaved"));
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
@ -235,8 +235,6 @@ $tabs = array(
|
||||
|
||||
dol_fiche_head($tabs, 0, $langs->trans('LineRecord'), 0, 'account');
|
||||
|
||||
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,";
|
||||
$sql.= " b.emetteur,b.banque";
|
||||
|
||||
@ -69,7 +69,7 @@ if ($action == 'rappro' && $user->rights->banque->consolidate)
|
||||
$result=$bankline->update_conciliation($user,$_POST["cat"]);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg.=$bankline->error;
|
||||
setEventMessage($bankline->error, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
@ -81,7 +81,7 @@ if ($action == 'rappro' && $user->rights->banque->consolidate)
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorPleaseTypeBankTransactionReportName").'</div>';
|
||||
setEventMessage($langs->trans("ErrorPleaseTypeBankTransactionReportName"), 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -183,8 +183,6 @@ if ($resql)
|
||||
print_fiche_titre($langs->trans("Reconciliation").': <a href="account.php?account='.$acct->id.'">'.$acct->label.'</a>');
|
||||
print '<br>';
|
||||
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
// Show last bank receipts
|
||||
$nbmax=5;
|
||||
$liste="";
|
||||
|
||||
@ -49,10 +49,6 @@ $result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fie
|
||||
$vline=isset($_GET["vline"])?$_GET["vline"]:$_POST["vline"];
|
||||
$page=isset($_GET["page"])?$_GET["page"]:0;
|
||||
|
||||
$mesg='';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -115,10 +111,6 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
if ($mesg) print '<div class="error">'.$mesg.'</div>';
|
||||
|
||||
|
||||
$solde = $acct->solde(0);
|
||||
|
||||
/*
|
||||
|
||||
@ -115,9 +115,9 @@ include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include
|
||||
|
||||
// Action clone object
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->creer) {
|
||||
if (1 == 0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) {
|
||||
$mesgs [] = '<div class="error">' . $langs->trans("NoCloneOptionsSpecified") . '</div>';
|
||||
} else {
|
||||
// if (1 == 0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) {
|
||||
// $mesgs [] = '<div class="error">' . $langs->trans("NoCloneOptionsSpecified") . '</div>';
|
||||
// } else {
|
||||
if ($object->fetch($id) > 0) {
|
||||
$result = $object->createFromClone($socid);
|
||||
if ($result > 0) {
|
||||
@ -128,7 +128,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->c
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
// Change status of invoice
|
||||
@ -216,13 +216,13 @@ else if ($action == 'valid' && $user->rights->facture->creer) {
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE) {
|
||||
// Si avoir, le signe doit etre negatif
|
||||
if ($object->total_ht >= 0) {
|
||||
$mesgs [] = '<div class="error">' . $langs->trans("ErrorInvoiceAvoirMustBeNegative") . '</div>';
|
||||
setEventMessage($langs->trans("ErrorInvoiceAvoirMustBeNegative"), 'errors');
|
||||
$action = '';
|
||||
}
|
||||
} else {
|
||||
// Si non avoir, le signe doit etre positif
|
||||
if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ht < 0) {
|
||||
$mesgs [] = '<div class="error">' . $langs->trans("ErrorInvoiceOfThisTypeMustBePositive") . '</div>';
|
||||
setEventMessage($langs->trans("ErrorInvoiceOfThisTypeMustBePositive"), 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
@ -319,7 +319,7 @@ else if ($action == "setabsolutediscount" && $user->rights->facture->creer) {
|
||||
if ($ret > 0) {
|
||||
$result = $object->insert_discount($_POST["remise_id"]);
|
||||
if ($result < 0) {
|
||||
$mesgs [] = '<div class="error">' . $object->error . '</div>';
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db, $object->error);
|
||||
@ -332,7 +332,7 @@ else if ($action == "setabsolutediscount" && $user->rights->facture->creer) {
|
||||
|
||||
$result = $discount->link_to_invoice(0, $id);
|
||||
if ($result < 0) {
|
||||
$mesgs [] = '<div class="error">' . $discount->error . '</div>';
|
||||
setEventMessage($discount->error, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -571,7 +571,6 @@ else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->righ
|
||||
$result = $object->set_paid($user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
//$mesgs[]='OK'.$discount->id;
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
@ -642,8 +641,9 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
||||
$object->type = Facture::TYPE_REPLACEMENT;
|
||||
|
||||
$id = $object->createFromCurrent($user);
|
||||
if ($id <= 0)
|
||||
$mesgs [] = $object->error;
|
||||
if ($id <= 0) {
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -888,7 +888,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
||||
$amountdeposit = ($totalamount * $valuedeposit) / 100;
|
||||
}
|
||||
} else {
|
||||
$mesgs [] = $srcobject->error;
|
||||
setEventMessage($srcobject->error, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
@ -955,7 +955,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
||||
if ($discountid > 0) {
|
||||
$result = $object->insert_discount($discountid); // This include link_to_invoice
|
||||
} else {
|
||||
$mesgs [] = $discount->error;
|
||||
setEventMessage($discount->error, 'errors');
|
||||
$error ++;
|
||||
break;
|
||||
}
|
||||
@ -1016,12 +1016,12 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
||||
if ($reshook < 0)
|
||||
$error ++;
|
||||
} else {
|
||||
$mesgs [] = $srcobject->error;
|
||||
setEventMessage($srcobject->error, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$mesgs [] = $object->error;
|
||||
setEventMessage($object->error, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
} // If some invoice's lines already known
|
||||
@ -1054,7 +1054,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
||||
$action = 'create';
|
||||
$_GET ["origin"] = $_POST["origin"];
|
||||
$_GET ["originid"] = $_POST["originid"];
|
||||
$mesgs [] = '<div class="error">' . $object->error . '</div>';
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1606,7 +1606,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
|
||||
$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, - 1);
|
||||
if ($mailfile->error) {
|
||||
$mesgs [] = '<div class="error">' . $mailfile->error . '</div>';
|
||||
setEventMessage($mailfile->error, 'errors');
|
||||
} else {
|
||||
$result = $mailfile->sendfile();
|
||||
if ($result) {
|
||||
@ -1642,15 +1642,15 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
}
|
||||
} else {
|
||||
$langs->load("other");
|
||||
$mesg = '<div class="error">';
|
||||
|
||||
if ($mailfile->error) {
|
||||
$mesg .= $langs->trans('ErrorFailedToSendMail', $from, $sendto);
|
||||
$mesg .= '<br>' . $mailfile->error;
|
||||
} else {
|
||||
$mesg .= 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
|
||||
}
|
||||
$mesg .= '</div>';
|
||||
$mesgs [] = $mesg;
|
||||
|
||||
setEventMessage($mesg, 'errors');
|
||||
}
|
||||
}
|
||||
/* }
|
||||
@ -1662,12 +1662,12 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
}*/
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
$mesgs [] = '<div class="error">' . $langs->trans('ErrorCantReadFile', $file) . '</div>';
|
||||
setEventMessage($langs->trans('ErrorCantReadFile', $file), 'errors');
|
||||
dol_syslog('Failed to read file: ' . $file);
|
||||
}
|
||||
} else {
|
||||
$langs->load("other");
|
||||
$mesgs [] = '<div class="error">' . $langs->trans('ErrorFailedToReadEntity', $langs->trans("Invoice")) . '</div>';
|
||||
setEventMessage($langs->trans('ErrorFailedToReadEntity', $langs->trans("Invoice")), 'errors');
|
||||
dol_syslog('Impossible de lire les donnees de la facture. Le fichier facture n\'a peut-etre pas ete genere.');
|
||||
}
|
||||
|
||||
@ -1749,9 +1749,9 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture-
|
||||
} else {
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
$langs->load("errors");
|
||||
$mesgs [] = '<div class="error">' . $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType") . '</div>';
|
||||
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
|
||||
} else {
|
||||
$mesgs [] = '<div class="error">' . $object->error . '</div>';
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3764,7 +3764,5 @@ if ($action == 'create')
|
||||
}
|
||||
}
|
||||
|
||||
dol_htmloutput_mesg('', $mesgs);
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user