Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2014-07-20 05:14:45 +02:00
commit ecd99608c3
114 changed files with 597 additions and 918 deletions

View File

@ -68,11 +68,11 @@ if ($action == 'update' || $action == 'add')
if (! $error) if (! $error)
{ {
$mesg = '<div class="ok">'.$langs->trans("SetupSaved").'</div>'; setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
$mesg = '<div class="error">'.$langs->trans("Error").'</div>'; setEventMessage($langs->trans("Error"), 'errors');
} }
} }
@ -117,10 +117,6 @@ $head = member_admin_prepare_head();
dol_fiche_head($head, 'general', $langs->trans("Members"), 0, 'user'); dol_fiche_head($head, 'general', $langs->trans("Members"), 0, 'user');
dol_htmloutput_mesg($mesg);
print_fiche_titre($langs->trans("MemberMainOptions"),'',''); print_fiche_titre($langs->trans("MemberMainOptions"),'','');
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';

View File

@ -60,11 +60,11 @@ if ($action == 'update')
if (! $error) if (! $error)
{ {
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; setEventMessage($langs->trans("Error"), 'errors');
} }
} }
@ -86,8 +86,6 @@ $head = member_admin_prepare_head();
dol_fiche_head($head, 'public', $langs->trans("Members"), 0, 'user'); dol_fiche_head($head, 'public', $langs->trans("Members"), 0, 'user');
dol_htmloutput_mesg($mesg);
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript" language="javascript">';

View File

@ -52,7 +52,6 @@ $object = new Adherent($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$adht = new AdherentType($db); $adht = new AdherentType($db);
$errmsg=''; $errmsg='';
$errmsgs=array();
$defaultdelay=1; $defaultdelay=1;
$defaultdelayunit='y'; $defaultdelayunit='y';
@ -108,7 +107,7 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
{ {
$langs->load("errors"); $langs->load("errors");
$errmsg=$langs->trans($company->error); $errmsg=$langs->trans($company->error);
$errmsgs=$company->errors; setEventMessage($company->errors, 'errors');
} }
else else
{ {
@ -129,7 +128,7 @@ if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights
if ($_POST["userid"] != $user->id && $_POST["userid"] != $object->user_id) if ($_POST["userid"] != $user->id && $_POST["userid"] != $object->user_id)
{ {
$error++; $error++;
$mesg='<div class="error">'.$langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly").'</div>'; setEventMessage($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), 'errors');
} }
} }
@ -165,7 +164,7 @@ if ($action == 'setsocid')
$thirdparty=new Societe($db); $thirdparty=new Societe($db);
$thirdparty->fetch(GETPOST('socid','int')); $thirdparty->fetch(GETPOST('socid','int'));
$error++; $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');
} }
} }
@ -282,7 +281,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
{ {
$error++; $error++;
$errmsg=$object->error; $errmsg=$object->error;
$errmsgs=$object->errors; setEventMessage($object->errors, 'errors');
} }
if (! $error) if (! $error)
@ -444,7 +443,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
if (! ($bank_line_id > 0)) if (! ($bank_line_id > 0))
{ {
$errmsg=$paiement->error; $errmsg=$paiement->error;
$errmsgs=$paiement->errors; setEventMessage($paiement->errors, 'errors');
$error++; $error++;
} }
} }
@ -689,7 +688,7 @@ if ($rowid)
dol_fiche_end(); dol_fiche_end();
dol_htmloutput_errors($errmsg,$errmsgs); dol_htmloutput_errors($errmsg);
/* /*

View File

@ -81,8 +81,6 @@ if (! empty($canvas))
// Security check // Security check
$result=restrictedArea($user,'adherent',$rowid,'','','fk_soc', 'rowid', $objcanvas); $result=restrictedArea($user,'adherent',$rowid,'','','fk_soc', 'rowid', $objcanvas);
$errmsg=''; $errmsgs=array();
if ($rowid > 0) if ($rowid > 0)
{ {
// Load member // Load member
@ -128,7 +126,7 @@ if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights
if ($userid != $user->id && $userid != $object->user_id) if ($userid != $user->id && $userid != $object->user_id)
{ {
$error++; $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=new Societe($db);
$thirdparty->fetch($socid); $thirdparty->fetch($socid);
$error++; $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) if ($result < 0)
{ {
$langs->load("errors"); $langs->load("errors");
$errmsg=$langs->trans($nuser->error); setEventMessage($langs->trans($nuser->error), 'errors');
} }
} }
else else
{ {
$errmsg=$object->error; setEventMessage($object->error, 'errors');
} }
} }
@ -211,13 +209,13 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
if ($result < 0) if ($result < 0)
{ {
$langs->load("errors"); $langs->load("errors");
$errmsg=$langs->trans($company->error); setEventMessage($langs->trans($company->error), 'errors');
$errmsgs=$company->errors; setEventMessage($company->errors, 'errors');
} }
} }
else 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")); $result=$object->send_an_email($langs->transnoentitiesnoconv("ThisIsContentOfYourCard")."\n\n%INFOS%\n\n",$langs->transnoentitiesnoconv("CardContent"));
$langs->load("mails"); $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)) { if ($morphy != 'mor' && empty($lastname)) {
$error++; $error++;
$langs->load("errors"); $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=='')) { if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Firstname"))."<br>\n"; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Firstname")), 'errors');
} }
// Create new object // Create new object
@ -343,7 +341,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
$newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']);
if (! dol_move_uploaded_file($_FILES['photo']['tmp_name'],$newfile,1,0,$_FILES['photo']['error']) > 0) 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 else
{ {
@ -359,7 +357,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
} }
else else
{ {
$errmsgs[] = "ErrorBadImageFormat"; setEventMessage("ErrorBadImageFormat", 'errors');
} }
} }
else else
@ -387,8 +385,11 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
} }
else else
{ {
if ($object->error) $errmsg=$object->error; if ($object->error) {
else $errmsgs=$object->errors; setEventMessage($object->error, 'errors');
} else {
setEventMessage($object->errors, 'errors');
}
$action=''; $action='';
} }
} }
@ -472,14 +473,14 @@ if ($action == 'add' && $user->rights->adherent->creer)
// Check parameters // Check parameters
if (empty($morphy) || $morphy == "-1") { if (empty($morphy) || $morphy == "-1") {
$error++; $error++;
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Nature"))."<br>\n"; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Nature")), 'errors');
} }
// Test si le login existe deja // Test si le login existe deja
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{ {
if (empty($login)) { if (empty($login)) {
$error++; $error++;
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->trans("Login"))."<br>\n"; setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Login")), 'errors');
} }
else { else {
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape($login)."'"; $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) { if ($num) {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$errmsg .= $langs->trans("ErrorLoginAlreadyExists",$login)."<br>\n"; setEventMessage($langs->trans("ErrorLoginAlreadyExists",$login), 'errors');
} }
} }
if (empty($pass)) { if (empty($pass)) {
$error++; $error++;
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Password"))."<br>\n"; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Password")), 'errors');
} }
} }
if ($morphy != 'mor' && empty($lastname)) { if ($morphy != 'mor' && empty($lastname)) {
$error++; $error++;
$langs->load("errors"); $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=='')) { if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) {
$error++; $error++;
$langs->load("errors"); $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 ! if (! ($typeid > 0)) { // Keep () before !
$error++; $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)) { if ($conf->global->ADHERENT_MAIL_REQUIRED && ! isValidEMail($email)) {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$errmsg .= $langs->trans("ErrorBadEMail",$email)."<br>\n"; setEventMessage($langs->trans("ErrorBadEMail",$email), 'errors');
} }
$public=0; $public=0;
if (isset($public)) $public=1; if (isset($public)) $public=1;
@ -536,8 +537,11 @@ if ($action == 'add' && $user->rights->adherent->creer)
{ {
$db->rollback(); $db->rollback();
if ($object->error) $errmsg=$object->error; if ($object->error) {
else $errmsgs=$object->errors; setEventMessage($object->error, 'errors');
} else {
setEventMessage($object->errors, 'errors');
}
$action = 'create'; $action = 'create';
} }
@ -589,15 +593,18 @@ if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm ==
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
$errmsg.=$object->error; setEventMessage($object->error, 'errors');
} }
} }
} }
else else
{ {
$error++; $error++;
if ($object->error) $errmsg=$object->error; if ($object->error) {
else $errmsgs=$object->errors; setEventMessage($object->error, 'errors');
} else {
setEventMessage($object->errors, 'errors');
}
} }
if (! $error) if (! $error)
@ -613,6 +620,8 @@ if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm ==
if ($user->rights->adherent->supprimer && $action == 'confirm_resign') if ($user->rights->adherent->supprimer && $action == 'confirm_resign')
{ {
$error = 0;
if ($confirm == 'yes') if ($confirm == 'yes')
{ {
$adht = new AdherentType($db); $adht = new AdherentType($db);
@ -628,17 +637,23 @@ if ($user->rights->adherent->supprimer && $action == 'confirm_resign')
} }
if ($result < 0) if ($result < 0)
{ {
$errmsg.=$object->error; $error++;
setEventMessage($object->error, 'errors');
} }
} }
else else
{ {
if ($object->error) $errmsg=$object->error; $error++;
else $errmsgs=$object->errors;
if ($object->error) {
setEventMessage($object->error, 'errors');
} else {
setEventMessage($object->errors, 'errors');
}
$action=''; $action='';
} }
} }
if (! empty($backtopage) && ! $errmsg) if (! empty($backtopage) && ! $error)
{ {
header("Location: ".$backtopage); header("Location: ".$backtopage);
exit; exit;
@ -652,7 +667,7 @@ if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $conf
{ {
if (!$mailmanspip->del_to_spip($object)) 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)) 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")); print_fiche_titre($langs->trans("NewMember"));
dol_htmloutput_mesg($errmsg,$errmsgs,'error');
dol_htmloutput_mesg($mesg,$mesgs);
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript" language="javascript">';
@ -952,9 +964,6 @@ else
dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user'); dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
dol_htmloutput_errors($errmsg,$errmsgs);
dol_htmloutput_mesg($mesg);
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript" language="javascript">';
@ -1168,8 +1177,6 @@ else
if ($rowid && $action != 'edit') if ($rowid && $action != 'edit')
{ {
dol_htmloutput_mesg($mesg);
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* Mode affichage */ /* Mode affichage */
@ -1199,8 +1206,6 @@ else
dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user'); dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
dol_htmloutput_errors($errmsg,$errmsgs);
// Confirm create user // Confirm create user
if ($action == 'create_user') if ($action == 'create_user')
{ {

View File

@ -282,8 +282,6 @@ if ($rowid && $action != 'edit')
dol_fiche_head($head, 'general', $langs->trans("Subscription"), '', 'payment'); dol_fiche_head($head, 'general', $langs->trans("Subscription"), '', 'payment');
if ($msg) print '<div class="error">'.$msg.'</div>';
// Confirmation to delete subscription // Confirmation to delete subscription
if ($action == 'delete') if ($action == 'delete')
{ {

View File

@ -60,8 +60,6 @@ if (! $result)
if ($action == 'dolibarr2ldap') if ($action == 'dolibarr2ldap')
{ {
$message="";
$db->begin(); $db->begin();
$ldap=new Ldap(); $ldap=new Ldap();
@ -75,12 +73,12 @@ if ($action == 'dolibarr2ldap')
if ($result >= 0) if ($result >= 0)
{ {
$message.='<div class="ok">'.$langs->trans("MemberSynchronized").'</div>'; setEventMessage($langs->trans("MemberSynchronized"));
$db->commit(); $db->commit();
} }
else else
{ {
$message.='<div class="error">'.$ldap->error.'</div>'; setEventMessage($ldap->error, 'errors');
$db->rollback(); $db->rollback();
} }
} }
@ -157,10 +155,6 @@ print '</table>';
print '</div>'; print '</div>';
dol_htmloutput_mesg($message);
/* /*
* Barre d'actions * Barre d'actions
*/ */

View File

@ -237,8 +237,6 @@ if ($action == 'create')
print_fiche_titre($langs->trans("NewMemberType")); print_fiche_titre($langs->trans("NewMemberType"));
if ($mesg) print '<div class="error">'.$mesg.'</div>';
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">'; print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';

View File

@ -34,7 +34,6 @@ if (! $user->admin) accessforbidden();
$rowid = GETPOST('rowid','int'); $rowid = GETPOST('rowid','int');
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$errmesg='';
// Define possible position of boxes // Define possible position of boxes
$pos_name = getStaticMember('InfoBox','listOfPages'); $pos_name = getStaticMember('InfoBox','listOfPages');
@ -80,7 +79,7 @@ if ($action == 'add')
} }
else else
{ {
$errmesg=$db->lasterror(); setEventMessage($db->lasterror(), 'errors');
$error++; $error++;
} }
} }
@ -116,7 +115,7 @@ if ($action == 'add')
$resql = $db->query($sql); $resql = $db->query($sql);
if (! $resql) if (! $resql)
{ {
$errmesg=$db->lasterror(); setEventMessage($db->lasterror(), 'errors');
$error++; $error++;
} }
} }
@ -217,9 +216,6 @@ print_fiche_titre($langs->trans("Boxes"),'','setup');
print $langs->trans("BoxesDesc")." ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n"; print $langs->trans("BoxesDesc")." ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n";
dol_htmloutput_errors($errmesg);
/* /*
* Recherche des boites actives par defaut pour chaque position possible * Recherche des boites actives par defaut pour chaque position possible
* On stocke les boites actives par defaut dans $boxes[position][id_boite]=1 * On stocke les boites actives par defaut dans $boxes[position][id_boite]=1

View File

@ -105,7 +105,6 @@ if ($action == 'add' || GETPOST("modify"))
if ($result1 && $result2) if ($result1 && $result2)
{ {
$db->commit(); $db->commit();
//$mesg='<div class="ok">'.$langs->trans("Success").'</div>';
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} }
@ -171,7 +170,6 @@ if ($_POST["delete"])
if ($result1 && $result2) if ($result1 && $result2)
{ {
$db->commit(); $db->commit();
//$mesg='<div class="ok">'.$langs->trans("Success").'</div>';
header("Location: external_rss.php"); header("Location: external_rss.php");
exit; exit;
} }

View File

@ -120,7 +120,10 @@ $var=true;
if (empty($conf->use_javascript_ajax)) if (empty($conf->use_javascript_ajax))
{ {
dol_htmloutput_errors('',array($langs->trans("NotAvailable"),$langs->trans("JavascriptDisabled")),1); setEventMessage(array(
$langs->trans("NotAvailable"),
$langs->trans("JavascriptDisabled")
), 'errors');
} }
else else
{ {

View File

@ -43,7 +43,6 @@ static $tmpstatut2label=array(
$statut2label=array(''); $statut2label=array('');
foreach ($tmpstatut2label as $key => $val) $statut2label[$key]=$langs->trans($val); foreach ($tmpstatut2label as $key => $val) $statut2label[$key]=$langs->trans($val);
$mesg='';
$errors=array(); $errors=array();
$object = new Fiscalyear($db); $object = new Fiscalyear($db);
@ -64,8 +63,6 @@ $title = $langs->trans('FiscalYears');
print_fiche_titre($langs->trans('FiscalYears')); print_fiche_titre($langs->trans('FiscalYears'));
dol_htmloutput_errors($mesg);
$sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut, f.entity"; $sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut, f.entity";
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear as f"; $sql.= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear as f";
$sql.= " WHERE f.entity = ".$conf->entity; $sql.= " WHERE f.entity = ".$conf->entity;

View File

@ -46,8 +46,6 @@ static $tmpstatut2label=array(
$statut2label=array(''); $statut2label=array('');
foreach ($tmpstatut2label as $key => $val) $statut2label[$key]=$langs->trans($val); foreach ($tmpstatut2label as $key => $val) $statut2label[$key]=$langs->trans($val);
$mesg = '';
$object = new Fiscalyear($db); $object = new Fiscalyear($db);
$date_start=dol_mktime(0,0,0,GETPOST('fiscalyearmonth','int'),GETPOST('fiscalyearday','int'),GETPOST('fiscalyearyear','int')); $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 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)) 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++; $error++;
} }
if (empty($object->label)) if (empty($object->label))
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Label")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Label")), 'errors');
$error++; $error++;
} }
@ -107,7 +105,7 @@ else if ($action == 'add')
} }
else else
{ {
$mesg=$object->error; setEventMessage($object->error, 'errors');
$action='create'; $action='create';
} }
} }
@ -144,7 +142,7 @@ else if ($action == 'update')
} }
else else
{ {
$mesg=$object->error; setEventMessage($object->error, 'errors');
} }
} }
else else
@ -169,8 +167,6 @@ if ($action == 'create')
{ {
print_fiche_titre($langs->trans("NewFiscalYear")); print_fiche_titre($langs->trans("NewFiscalYear"));
dol_htmloutput_errors($mesg);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
@ -209,8 +205,6 @@ else if ($id)
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result > 0) if ($result > 0)
{ {
dol_htmloutput_mesg($mesg);
$head = fiscalyear_prepare_head($object); $head = fiscalyear_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("FiscalYearCard"), 0, 'cron'); dol_fiche_head($head, 'card', $langs->trans("FiscalYearCard"), 0, 'cron');

View File

@ -427,7 +427,7 @@ if (function_exists("ldap_connect"))
} }
else else
{ {
$mesg='<div class="error">'.$ldap->error.'</div>'; setEventMessage($ldap->error, 'errors');
} }
print "<br>\n"; print "<br>\n";

View File

@ -43,7 +43,7 @@ if ($action == 'update')
|| $_POST["MAIN_MAX_DECIMALS_SHOWN"] > $MAXDEC) || $_POST["MAIN_MAX_DECIMALS_SHOWN"] > $MAXDEC)
{ {
$error++; $error++;
$mesg='<div class="error">'.$langs->trans("ErrorDecimalLargerThanAreForbidden",$MAXDEC).'</div>'; setEventMessage($langs->trans("ErrorDecimalLargerThanAreForbidden",$MAXDEC), 'errors');
} }
if ($_POST["MAIN_MAX_DECIMALS_UNIT"] < 0 if ($_POST["MAIN_MAX_DECIMALS_UNIT"] < 0
@ -52,7 +52,7 @@ if ($action == 'update')
{ {
$langs->load("errors"); $langs->load("errors");
$error++; $error++;
$mesg='<div class="error">'.$langs->trans("ErrorNegativeValueNotAllowed").'</div>'; setEventMessage($langs->trans("ErrorNegativeValueNotAllowed"), 'errors');
} }
if ($_POST["MAIN_ROUNDING_RULE_TOT"]) if ($_POST["MAIN_ROUNDING_RULE_TOT"])
@ -61,7 +61,7 @@ if ($action == 'update')
{ {
$langs->load("errors"); $langs->load("errors");
$error++; $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 $langs->trans("LimitsDesc")."<br>\n";
print "<br>\n"; print "<br>\n";
if ($mesg) print $mesg.'<br>';
if ($action == 'edit') if ($action == 'edit')
{ {
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -653,9 +653,13 @@ else
if ($result) print '<div class="ok">'.$langs->trans("ServerAvailableOnIPOrPort",$server,$port).'</div>'; if ($result) print '<div class="ok">'.$langs->trans("ServerAvailableOnIPOrPort",$server,$port).'</div>';
else else
{ {
print '<div class="error">'.$langs->trans("ServerNotAvailableOnIPOrPort",$server,$port); $errormsg = $langs->trans("ServerNotAvailableOnIPOrPort",$server,$port);
if ($mail->error) print ' - '.$mail->error;
print '</div>'; if ($mail->error) {
$errormsg .= ' - '.$mail->error;
}
setEventMessage($errormsg, 'errors');
} }
print '<br>'; print '<br>';
} }

View File

@ -49,8 +49,6 @@ foreach($dirmenus as $dirmenu)
} }
$error=0; $error=0;
$errmsgs=array();
// Cette page peut etre longue. On augmente le delai autorise. // Cette page peut etre longue. On augmente le delai autorise.
// Ne fonctionne que si on est pas en safe_mode. // Ne fonctionne que si on est pas en safe_mode.
@ -105,7 +103,8 @@ if ($action == 'update' && empty($_POST["cancel"]))
else else
{ {
$error++; $error++;
$errmsgs[]='Failed to initialize menu '.$key.'.'; //TODO: Translate
setEventMessage('Failed to initialize menu '.$key.'.', 'errors');
$db->rollback(); $db->rollback();
} }
} }
@ -268,10 +267,6 @@ else
print '</div>'; print '</div>';
dol_htmloutput_errors('',$errmsgs);
if ($action != 'edit') if ($action != 'edit')
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';

View File

@ -39,7 +39,6 @@ $dirsmartphone = "/core/menus/smartphone";
$dirmenu = array($dirstandard,$dirsmartphone); $dirmenu = array($dirstandard,$dirsmartphone);
$action=GETPOST('action'); $action=GETPOST('action');
$mesg=GETPOST('mesg');
$menu_handler_top=$conf->global->MAIN_MENU_STANDARD; $menu_handler_top=$conf->global->MAIN_MENU_STANDARD;
$menu_handler_smartphone=$conf->global->MAIN_MENU_SMARTPHONE; $menu_handler_smartphone=$conf->global->MAIN_MENU_SMARTPHONE;
@ -79,16 +78,16 @@ if ($action == 'update')
$result=$menu->update($user); $result=$menu->update($user);
if ($result > 0) if ($result > 0)
{ {
$mesg='<div class="ok">'.$langs->trans("RecordModifiedSuccessfully").'</div>'; setEventMessage($langs->trans("RecordModifiedSuccessfully"));
} }
else else
{ {
$mesg='<div class="error">'.$menu->error.'</div>'; setEventMessage($menu->error, 'errors');
} }
} }
else else
{ {
$mesg='<div class="error">'.$menu->error.'</div>'; setEventMessage($menu->error, 'errors');
} }
$_GET["menuId"] = $_POST['menuId']; $_GET["menuId"] = $_POST['menuId'];
$action = "edit"; $action = "edit";
@ -136,37 +135,37 @@ if ($action == 'add')
$error=0; $error=0;
if (! $error && ! $_POST['menu_handler']) if (! $error && ! $_POST['menu_handler'])
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("MenuHandler")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("MenuHandler")), 'errors');
$action = 'create'; $action = 'create';
$error++; $error++;
} }
if (! $error && ! $_POST['type']) if (! $error && ! $_POST['type'])
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Type")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Type")), 'errors');
$action = 'create'; $action = 'create';
$error++; $error++;
} }
if (! $error && ! $_POST['url']) if (! $error && ! $_POST['url'])
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Url")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Url")), 'errors');
$action = 'create'; $action = 'create';
$error++; $error++;
} }
if (! $error && ! $_POST['titre']) if (! $error && ! $_POST['titre'])
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Title")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Title")), 'errors');
$action = 'create'; $action = 'create';
$error++; $error++;
} }
if (! $error && $_POST['menuId'] && $_POST['type'] == 'top') if (! $error && $_POST['menuId'] && $_POST['type'] == 'top')
{ {
$mesg='<div class="error">'.$langs->trans("ErrorTopMenuMustHaveAParentWithId0").'</div>'; setEventMessage($langs->trans("ErrorTopMenuMustHaveAParentWithId0"), 'errors');
$action = 'create'; $action = 'create';
$error++; $error++;
} }
if (! $error && empty($_POST['menuId']) && $_POST['type'] == 'left') if (! $error && empty($_POST['menuId']) && $_POST['type'] == 'left')
{ {
$mesg='<div class="error">'.$langs->trans("ErrorLeftMenuMustHaveAParentId").'</div>'; setEventMessage($langs->trans("ErrorLeftMenuMustHaveAParentId"), 'errors');
$action = 'create'; $action = 'create';
$error++; $error++;
} }
@ -205,7 +204,7 @@ if ($action == 'add')
else else
{ {
$action = 'create'; $action = 'create';
$mesg='<div class="error">'.$menu->error.'</div>'; setEventMessage($menu->error, 'errors');
} }
} }
} }
@ -223,7 +222,7 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == 'yes')
$this->db->commit(); $this->db->commit();
llxHeader(); llxHeader();
print '<div class="ok">'.$langs->trans("MenuDeleted").'</div>'; setEventMessage($langs->trans("MenuDeleted"));
llxFooter(); llxFooter();
exit ; exit ;
} }
@ -375,8 +374,6 @@ if ($action == 'create')
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
print '</form>'; print '</form>';
dol_htmloutput_mesg($mesg);
} }
elseif ($action == 'edit') elseif ($action == 'edit')
{ {
@ -463,8 +460,6 @@ elseif ($action == 'edit')
print '</form>'; print '</form>';
print '<br>'; print '<br>';
dol_htmloutput_mesg($mesg);
} }

View File

@ -43,7 +43,6 @@ foreach($dirmenus as $dirmenu)
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$confirm=GETPOST('confirm','alpha'); $confirm=GETPOST('confirm','alpha');
$mesg=GETPOST('mesg');
$menu_handler_top=$conf->global->MAIN_MENU_STANDARD; $menu_handler_top=$conf->global->MAIN_MENU_STANDARD;
$menu_handler_smartphone=$conf->global->MAIN_MENU_SMARTPHONE; $menu_handler_smartphone=$conf->global->MAIN_MENU_SMARTPHONE;
@ -187,7 +186,9 @@ elseif ($action == 'confirm_delete' && $confirm == 'yes')
{ {
$db->commit(); $db->commit();
header("Location: ".DOL_URL_ROOT.'/admin/menus/index.php?menu_handler='.$menu_handler.'&mesg='.urlencode($langs->trans("MenuDeleted"))); setEventMessage($langs->trans("MenuDeleted"));
header("Location: ".DOL_URL_ROOT.'/admin/menus/index.php?menu_handler='.$menu_handler);
exit ; exit ;
} }
else else
@ -216,9 +217,6 @@ llxHeader('',$langs->trans("Menus"),'','',0,0,$arrayofjs,$arrayofcss);
print_fiche_titre($langs->trans("Menus"),'','setup'); print_fiche_titre($langs->trans("Menus"),'','setup');
dol_htmloutput_mesg($mesg);
$h = 0; $h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/menus.php"; $head[$h][0] = DOL_URL_ROOT."/admin/menus.php";
@ -360,7 +358,7 @@ if ($conf->use_javascript_ajax)
else else
{ {
$langs->load("errors"); $langs->load("errors");
print '<div class="error">'.$langs->trans("ErrorFeatureNeedJavascript").'</div>'; setEventMessage($langs->trans("ErrorFeatureNeedJavascript"), 'errors');
} }
print '<br>'; print '<br>';

View File

@ -95,11 +95,10 @@ if ($db->type == 'pgsql')
{ {
// Check option standard_conforming_strings is on // Check option standard_conforming_strings is on
$paramarray=$db->getServerParametersValues('standard_conforming_strings'); $paramarray=$db->getServerParametersValues('standard_conforming_strings');
if ($paramarray['standard_conforming_strings'] != 'on' && $paramarray['standard_conforming_strings'] != 1) // if ($paramarray['standard_conforming_strings'] != 'on' && $paramarray['standard_conforming_strings'] != 1)
{ // {
$langs->load("errors"); // $langs->load("errors");
//print '<div class="error">'.$langs->trans("ErrorDatabaseParameterWrong",'standard_conforming_strings','on').'</div>'; // }
}
} }
print '<br>'; print '<br>';

View File

@ -30,7 +30,9 @@ $langs->load("other");
if (! $user->admin) accessforbidden(); 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/'; $urldolibarr='http://www.dolibarr.org/downloads/';
@ -54,7 +56,7 @@ if (GETPOST('action','alpha')=='install')
if (! $original_file) if (! $original_file)
{ {
$langs->load("Error"); $langs->load("Error");
$mesg = '<div class="warning">'.$langs->trans("ErrorFileRequired").'</div>'; setEventMessage($langs->trans("ErrorFileRequired"), 'warnings');
$error++; $error++;
} }
else else
@ -62,7 +64,7 @@ if (GETPOST('action','alpha')=='install')
if (! preg_match('/\.zip/i',$original_file)) if (! preg_match('/\.zip/i',$original_file))
{ {
$langs->load("errors"); $langs->load("errors");
$mesg = '<div class="error">'.$langs->trans("ErrorFileMustBeADolibarrPackage",$original_file).'</div>'; setEventMessage($langs->trans("ErrorFileMustBeADolibarrPackage",$original_file), 'errors');
$error++; $error++;
} }
} }
@ -80,12 +82,11 @@ if (GETPOST('action','alpha')=='install')
if (! empty($result['error'])) if (! empty($result['error']))
{ {
$langs->load("errors"); $langs->load("errors");
$mesg = '<div class="error">'.$langs->trans($result['error'],$original_file).'</div>'; setEventMessage($langs->trans($result['error'],$original_file), 'errors');
} }
else else
{ {
$mesg = '<div class="ok">'.$langs->trans("SetupIsReadyForUse").'</div>'; setEventMessage($langs->trans("SetupIsReadyForUse"));
} }
} }
} }
@ -107,9 +108,6 @@ print $langs->trans("CurrentVersion").' : <b>'.DOL_VERSION.'</b><br>';
print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("FeatureNotYetAvailable").'</b><br>'; print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("FeatureNotYetAvailable").'</b><br>';
print '<br>'; print '<br>';
//dol_htmloutput_errors($mesg);
dol_htmloutput_mesg($mesg);
print $langs->trans("Upgrade").'<br>'; print $langs->trans("Upgrade").'<br>';
print '<hr>'; print '<hr>';
print $langs->trans("ThisIsProcessToFollow").'<br>'; print $langs->trans("ThisIsProcessToFollow").'<br>';
@ -152,7 +150,7 @@ if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE))
else else
{ {
$message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); $message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
print '<div class="warning">'.$message.'</div>'; setEventMessage($message, 'warnings');
} }
} }
else else

View File

@ -57,8 +57,6 @@ print_fiche_titre($langs->trans("TranslationSetup"),'','setup');
print $langs->trans("TranslationDesc")."<br>\n"; print $langs->trans("TranslationDesc")."<br>\n";
print "<br>\n"; print "<br>\n";
dol_htmloutput_mesg($message);
print $langs->trans("CurrentUserLanguage").': <strong>'.$langs->defaultlang.'</strong><br>'; print $langs->trans("CurrentUserLanguage").': <strong>'.$langs->defaultlang.'</strong><br>';
print img_warning().' '.$langs->trans("SomeTranslationAreUncomplete").'<br>'; print img_warning().' '.$langs->trans("SomeTranslationAreUncomplete").'<br>';

View File

@ -37,8 +37,6 @@ $forbarcode=GETPOST('forbarcode');
$fk_barcode_type=GETPOST('fk_barcode_type'); $fk_barcode_type=GETPOST('fk_barcode_type');
$eraseallbarcode=GETPOST('eraseallbarcode'); $eraseallbarcode=GETPOST('eraseallbarcode');
$mesg='';
$action=GETPOST('action'); $action=GETPOST('action');
$producttmp=new Product($db); $producttmp=new Product($db);
@ -198,8 +196,6 @@ print '<br>';
print $langs->trans("MassBarcodeInitDesc").'<br>'; print $langs->trans("MassBarcodeInitDesc").'<br>';
print '<br>'; print '<br>';
dol_htmloutput_errors($mesg);
//print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>'; //print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>';
//print '<br>'; //print '<br>';

View File

@ -42,12 +42,12 @@ if ($action == 'setvalue')
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
$db->rollback(); $db->rollback();
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; setEventMessage($langs->trans("Error"), 'errors');
} }
} }
@ -82,8 +82,6 @@ print '<input size="3" type="text" name="BOOKMARKS_SHOW_IN_MENU" value="'.$conf-
print '</td></tr>'; print '</td></tr>';
print '</table><br /><center><input type="submit" class="button" value="'.$langs->trans("Modify").'"></center></form>'; print '</table><br /><center><input type="submit" class="button" value="'.$langs->trans("Modify").'"></center></form>';
dol_htmloutput_mesg($mesg);
$db->close(); $db->close();
llxFooter(); llxFooter();

View File

@ -50,6 +50,8 @@ $backtopage=GETPOST('backtopage','alpha');
if ($action == 'add' || $action == 'addproduct' || $action == 'update') if ($action == 'add' || $action == 'addproduct' || $action == 'update')
{ {
$error = 0;
if (GETPOST("cancel")) if (GETPOST("cancel"))
{ {
if (empty($backtopage)) $backtopage=(GETPOST("urlsource")?GETPOST("urlsource"):((! empty($url))?$url:DOL_URL_ROOT.'/bookmarks/liste.php')); 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; exit;
} }
$mesg='';
$bookmark=new Bookmark($db); $bookmark=new Bookmark($db);
if ($action == 'update') $bookmark->fetch($_POST["id"]); if ($action == 'update') $bookmark->fetch($_POST["id"]);
$bookmark->fk_user=$userid; $bookmark->fk_user=$userid;
@ -67,10 +67,17 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
$bookmark->target=$target; $bookmark->target=$target;
$bookmark->position=$position; $bookmark->position=$position;
if (! $title) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("BookmarkTitle")); if (! $title) {
if (! $url) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("UrlOrLink")); $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'; $bookmark->favicon='none';
@ -88,18 +95,17 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
if ($bookmark->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS') if ($bookmark->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{ {
$langs->load("errors"); $langs->load("errors");
$mesg='<div class="warning">'.$langs->trans("WarningBookmarkAlreadyExists").'</div>'; setEventMessage($langs->trans("WarningBookmarkAlreadyExists"), 'warnings');
} }
else else
{ {
$mesg='<div class="error">'.$bookmark->error.'</div>'; setEventMessage($bookmark->error, 'errors');
} }
$action='create'; $action='create';
} }
} }
else else
{ {
$mesg='<div class="error">'.$mesg.'</div>';
$action='create'; $action='create';
} }
} }
@ -121,7 +127,7 @@ if ($action == 'delete')
} }
else 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_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark');
dol_htmloutput_mesg($mesg);
print '<table class="border" width="100%">'; 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>'; 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>';

View File

@ -58,7 +58,7 @@ if ($_GET["action"] == 'delete')
} }
else else
{ {
$mesg='<div class="error">'.$bookmark->error.'</div>'; $setEventMessage($bookmark->error, 'errors');
} }
} }
@ -73,8 +73,6 @@ llxHeader();
print_fiche_titre($langs->trans("Bookmarks")); 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 = "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.= " 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"; $sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b LEFT JOIN ".MAIN_DB_PREFIX."user as u ON b.fk_user=u.rowid";

View File

@ -56,7 +56,7 @@ if (GETPOST('save','alpha'))
if ($i >= 4) if ($i >= 4)
{ {
$db->commit(); $db->commit();
$mesg = "<font class=\"ok\">".$langs->trans("OSCommerceSetupSaved")."</font>"; setEventMessage($langs->trans("OSCommerceSetupSaved"));
} }
else else
{ {
@ -88,28 +88,29 @@ elseif (GETPOST('test','alpha'))
$sql.=" WHERE configuration_key='STORE_NAME'"; $sql.=" WHERE configuration_key='STORE_NAME'";
$resql=$oscommercedb->query($sql); $resql=$oscommercedb->query($sql);
if ($resql) { if ($resql) {
$mesg ="<div class=\"ok\">".$langs->trans("OSCommerceTestOk",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbname','alpha'),GETPOST('oscommerce_dbuser','alpha')); $mesg = $langs->trans("OSCommerceTestOk",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbname','alpha'),GETPOST('oscommerce_dbuser','alpha'));
$mesg.="</div>"; setEventMessage($mesg);
} }
else { else {
$mesg ="<div class=\"error\">".$langs->trans("OSCommerceErrorConnectOkButWrongDatabase",'STORE_NAME',GETPOST('oscommerce_db_table_prefix','alpha')."configuration"); $mesg = $langs->trans("OSCommerceErrorConnectOkButWrongDatabase",'STORE_NAME',GETPOST('oscommerce_db_table_prefix','alpha')."configuration");
$mesg.="</div>"; setEventMessage($mesg, 'errors');
} }
//$oscommercedb->close(); Ne pas fermer car la conn de webcal est la meme que dolibarr si parametre host/user/pass identique //$oscommercedb->close(); Ne pas fermer car la conn de webcal est la meme que dolibarr si parametre host/user/pass identique
} }
elseif ($oscommercedb->connected == 1 && $oscommercedb->database_selected != 1) elseif ($oscommercedb->connected == 1 && $oscommercedb->database_selected != 1)
{ {
$mesg ="<div class=\"error\">".$langs->trans("OSCommerceTestKo1",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbname','alpha')); $mesg = $langs->trans("OSCommerceTestKo1",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbname','alpha'));
$mesg.="<br>".$oscommercedb->error(); $mesg.="<br>".$oscommercedb->error();
$mesg.="</div>";
setEventMessage($mesg, 'errors');
//$oscommercedb->close(); Ne pas fermer car la conn de webcal est la meme que dolibarr si parametre host/user/pass identique //$oscommercedb->close(); Ne pas fermer car la conn de webcal est la meme que dolibarr si parametre host/user/pass identique
} }
else else
{ {
$mesg ="<div class=\"error\">".$langs->trans("OSCommerceTestKo2",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbuser','alpha')); $mesg = $langs->trans("OSCommerceTestKo2",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbuser','alpha'));
$mesg.="<br>".$oscommercedb->error(); $mesg.="<br>".$oscommercedb->error();
$mesg.="</div>"; setEventMessage($mesg, 'errors');
} }
//$resql=$db->query("select count(*) from ".MAIN_DB_PREFIX."const"); //$resql=$db->query("select count(*) from ".MAIN_DB_PREFIX."const");
@ -198,9 +199,6 @@ print "</center>";
print "</form>\n"; print "</form>\n";
dol_htmloutput_mesg($mesg);
$db->close(); $db->close();
llxFooter(); llxFooter();

View File

@ -67,12 +67,12 @@ if (GETPOST('action','alpha') == 'set')
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
$db->rollback(); $db->rollback();
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; setEventMessage($langs->trans("Error"), 'errors');
} }
} }
@ -152,8 +152,6 @@ print '<center><input type="submit" class="button" value="'.$langs->trans("Save"
print "</form>\n"; print "</form>\n";
dol_htmloutput_mesg($mesg);
$db->close(); $db->close();
llxFooter(); llxFooter();

View File

@ -80,12 +80,12 @@ if ($action == 'update' && $user->rights->categorie->creer)
if (empty($categorie->label)) if (empty($categorie->label))
{ {
$action = 'create'; $action = 'create';
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")), 'errors');
} }
if (empty($categorie->description)) if (empty($categorie->description))
{ {
$action = 'create'; $action = 'create';
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Description")); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Description")), 'errors');
} }
if (empty($categorie->error)) if (empty($categorie->error))
{ {
@ -98,12 +98,12 @@ if ($action == 'update' && $user->rights->categorie->creer)
} }
else else
{ {
$mesg=$categorie->error; setEventMessage($categorie->error, 'errors');
} }
} }
else else
{ {
$mesg=$categorie->error; setEventMessage($categorie->error, 'errors');
} }
} }
@ -117,10 +117,6 @@ llxHeader("","",$langs->trans("Categories"));
print_fiche_titre($langs->trans("ModifCat")); print_fiche_titre($langs->trans("ModifCat"));
dol_htmloutput_errors($mesg);
$object->fetch($id); $object->fetch($id);
$form = new Form($db); $form = new Form($db);

View File

@ -131,7 +131,7 @@ if ($action == 'add' && $user->rights->categorie->creer)
if (! $object->label) if (! $object->label)
{ {
$error++; $error++;
$errors[] = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")), 'errors');
$action = 'create'; $action = 'create';
} }
@ -224,8 +224,6 @@ if ($user->rights->categorie->creer)
print_fiche_titre($langs->trans("CreateCat")); print_fiche_titre($langs->trans("CreateCat"));
dol_htmloutput_errors('',$errors);
print '<table width="100%" class="border">'; print '<table width="100%" class="border">';
// Ref // Ref

View File

@ -94,7 +94,7 @@ $cancel != $langs->trans("Cancel") &&
else else
{ {
$action = 'add'; $action = 'add';
$mesg = '<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
@ -127,7 +127,7 @@ $cancel != $langs->trans("Cancel") &&
else else
{ {
$action = 'edit'; $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); $head = categories_prepare_head($object,$type);
dol_fiche_head($head, 'translation', $title, 0, 'category'); dol_fiche_head($head, 'translation', $title, 0, 'category');
if (! empty($mesg)) {
dol_htmloutput_mesg($mesg);
}
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Reference // Reference

View File

@ -32,7 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->load("categories"); $langs->load("categories");
$mesg = '';
$id=GETPOST('id','int'); $id=GETPOST('id','int');
$ref=GETPOST('ref'); $ref=GETPOST('ref');
$type=GETPOST('type'); $type=GETPOST('type');
@ -117,7 +116,7 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi
} }
else else
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
@ -131,8 +130,6 @@ $form = new Form($db);
llxHeader("","",$langs->trans("Categories")); llxHeader("","",$langs->trans("Categories"));
dol_htmloutput_mesg($mesg);
if ($type == 0) $title=$langs->trans("ProductsCategoryShort"); if ($type == 0) $title=$langs->trans("ProductsCategoryShort");
elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort");
elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort"); elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort");

View File

@ -156,8 +156,6 @@ llxHeader('',$langs->trans("Agenda"),$help_url);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
dol_htmloutput_mesg($mesg,$mesgs);
if ($object->fetch($id,$ref) > 0) if ($object->fetch($id,$ref) > 0)
{ {

View File

@ -62,7 +62,6 @@ $result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|
if ($user->societe_id && $socid) $result = restrictedArea($user,'societe',$socid); if ($user->societe_id && $socid) $result = restrictedArea($user,'societe',$socid);
$error=GETPOST("error"); $error=GETPOST("error");
$mesg='';
$cactioncomm = new CActionComm($db); $cactioncomm = new CActionComm($db);
$object = new ActionComm($db); $object = new ActionComm($db);
@ -116,14 +115,14 @@ if ($action == 'add_action')
{ {
$error++; $error++;
$action = 'create'; $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')) if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! GETPOST('label'))
{ {
$error++; $error++;
$action = 'create'; $action = 'create';
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Title")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Title")), 'errors');
} }
// Initialisation objet cactioncomm // Initialisation objet cactioncomm
@ -131,7 +130,7 @@ if ($action == 'add_action')
{ {
$error++; $error++;
$action = 'create'; $action = 'create';
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
} }
else else
{ {
@ -201,14 +200,14 @@ if ($action == 'add_action')
{ {
$error++; $error++;
$action = 'create'; $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')) if (! GETPOST('apyear') && ! GETPOST('adyear'))
{ {
$error++; $error++;
$action = 'create'; $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 // 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")); if (GETPOST("actioncode") == 'AC_RDV') print_fiche_titre($langs->trans("AddActionRendezVous"));
else print_fiche_titre($langs->trans("AddAnAction")); else print_fiche_titre($langs->trans("AddAnAction"));
dol_htmloutput_mesg($mesg);
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Type d'action actifs // Type d'action actifs
@ -644,10 +641,6 @@ if ($id > 0)
{ {
dol_htmloutput_errors($error); dol_htmloutput_errors($error);
} }
if ($mesg)
{
dol_htmloutput_mesg($mesg);
}
$result=$object->fetch($id); $result=$object->fetch($id);
$object->fetch_optionals($id,$extralabels); $object->fetch_optionals($id,$extralabels);

View File

@ -37,9 +37,6 @@ $action=GETPOST('action','alpha');
$month=GETPOST('month'); $month=GETPOST('month');
$year=GETPOST('year'); $year=GETPOST('year');
$mesg='';
$mesgs=array();
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
@ -64,7 +61,7 @@ if ($action == 'builddoc')
$result=$cat->write_file(GETPOST('id','int')); $result=$cat->write_file(GETPOST('id','int'));
if ($result < 0) if ($result < 0)
{ {
$mesg=$cat->error; setEventMessage($cat->error, 'errors');
} }
} }
@ -97,8 +94,6 @@ if ($resql)
print_barre_liste($langs->trans("Actions"), $page, "index.php",'',$sortfield,$sortorder,'',$num); print_barre_liste($langs->trans("Actions"), $page, "index.php",'',$sortfield,$sortorder,'',$num);
dol_htmloutput_mesg($mesg,$mesgs);
$i = 0; $i = 0;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';

View File

@ -106,7 +106,7 @@ if ($action == 'add' || $action == 'update')
} }
else else
{ {
$mesg = $object->error; setEventMessage($object->error, 'errors');
$action='create'; $action='create';
} }
} }
@ -147,7 +147,7 @@ if ($action == 'add' || $action == 'update')
else else
{ {
$reload = 0; $reload = 0;
$mesg = $object->error; setEventMessage($object->error, 'errors');
$actino= "edit"; $actino= "edit";
} }
} }
@ -181,9 +181,6 @@ $form = new Form($db);
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; $countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
dol_htmloutput_errors($mesg);
if ($action == 'create') if ($action == 'create')
{ {
if ($user->rights->societe->creer) if ($user->rights->societe->creer)

View File

@ -87,7 +87,7 @@ if ($action == 'setcustomeraccountancycode')
$result=$object->update($object->id,$user,1,1,0); $result=$object->update($object->id,$user,1,1,0);
if ($result < 0) if ($result < 0)
{ {
$mesgs[]=join(',',$object->errors); setEventMessage($object->errors, 'errors');
} }
$action=""; $action="";
} }
@ -926,8 +926,6 @@ else
dol_print_error($db,'Bad value for socid parameter'); dol_print_error($db,'Bad value for socid parameter');
} }
dol_htmloutput_mesg('',$mesgs);
// End of page // End of page
llxFooter(); llxFooter();

View File

@ -38,8 +38,6 @@ $langs->load("mails");
if (! $user->rights->mailing->lire || $user->societe_id > 0) accessforbidden(); if (! $user->rights->mailing->lire || $user->societe_id > 0) accessforbidden();
$mesg = '';
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
@ -222,8 +220,6 @@ if ($object->fetch($id) >= 0)
print "</div>"; print "</div>";
dol_htmloutput_mesg($mesg);
$var=!$var; $var=!$var;
$allowaddtarget=($object->statut == 0); $allowaddtarget=($object->statut == 0);

View File

@ -107,7 +107,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
{ {
if (empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) if (empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
{ {
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>'; setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
} }
else else
{ {
@ -119,7 +119,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
} }
else else
{ {
$mesg=$object->error; setEventMessage($object->error, 'errors');
} }
} }
$action=''; $action='';
@ -130,16 +130,17 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
{ {
if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) if (empty($conf->global->MAILING_LIMIT_SENDBYWEB))
{ {
//TODO: What is this for?
// Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM,
// on affiche donc juste un message // on affiche donc juste un message
$mesg='<div class="warning">'.$langs->trans("MailingNeedCommand").'</div>'; setEventMessage($langs->trans("MailingNeedCommand"), 'warnings');
$mesg.='<br><textarea cols="70" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>'; setEventMessage('<textarea cols="70" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', 'warnings');
$mesg.='<br><br><div class="warning">'.$langs->trans("MailingNeedCommand2").'</div>'; setEventMessage($langs->trans("MailingNeedCommand2"), 'warnings');
$action=''; $action='';
} }
else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0)
{ {
$mesg='<div class="warning">'.$langs->trans("NotEnoughPermissions").'</div>'; setEventMessage($langs->trans("NotEnoughPermissions"), 'warnings');
$action=''; $action='';
} }
else else
@ -390,7 +391,7 @@ if ($action == 'send' && empty($_POST["cancel"]))
$object->sendto = $_POST["sendto"]; $object->sendto = $_POST["sendto"];
if (! $object->sendto) if (! $object->sendto)
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("MailTo")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("MailTo")), 'errors');
$error++; $error++;
} }
@ -430,11 +431,11 @@ if ($action == 'send' && empty($_POST["cancel"]))
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();
if ($result) if ($result)
{ {
$mesg='<div class="ok">'.$langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($object->email_from,2),$mailfile->getValidAddress($object->sendto,2)).'</div>'; setEventMessage($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($object->email_from,2),$mailfile->getValidAddress($object->sendto,2)));
} }
else else
{ {
$mesg='<div class="error">'.$langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result.'</div>'; setEventMessage($langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result, 'errors');
} }
$action=''; $action='';
@ -444,6 +445,8 @@ if ($action == 'send' && empty($_POST["cancel"]))
// Action add emailing // Action add emailing
if ($action == 'add') if ($action == 'add')
{ {
$mesgs = array();
$object->email_from = trim($_POST["from"]); $object->email_from = trim($_POST["from"]);
$object->email_replyto = trim($_POST["replyto"]); $object->email_replyto = trim($_POST["replyto"]);
$object->email_errorsto = trim($_POST["errorsto"]); $object->email_errorsto = trim($_POST["errorsto"]);
@ -453,21 +456,27 @@ if ($action == 'add')
$object->bgcolor = trim($_POST["bgcolor"]); $object->bgcolor = trim($_POST["bgcolor"]);
$object->bgimage = trim($_POST["bgimage"]); $object->bgimage = trim($_POST["bgimage"]);
if (! $object->titre) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTitle")); if (! $object->titre) {
if (! $object->sujet) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTopic")); $mesgs[] = $langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTitle"));
if (! $object->body) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailMessage")); }
if (! $object->sujet) {
$mesgs[] = $langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTopic"));
}
if (! $object->body) {
$mesgs[] = $langs->trans("ErrorFieldRequired",$langs->transnoentities("MailMessage"));
}
if (! $mesg) if (!count($mesgs))
{ {
if ($object->create($user) >= 0) if ($object->create($user) >= 0)
{ {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit; exit;
} }
$mesg=$object->error; $mesgs[] = $object->error;
} }
$mesg='<div class="error">'.$mesg.'</div>'; setEventMessage($mesgs, 'errors');
$action="create"; $action="create";
} }
@ -480,9 +489,12 @@ if ($action == 'settitre' || $action == 'setemail_from' || $actino == 'setreplyt
else if ($action == 'setemail_from') $object->email_from = trim(GETPOST('email_from','alpha')); else if ($action == 'setemail_from') $object->email_from = trim(GETPOST('email_from','alpha'));
else if ($action == 'setemail_replyto') $object->email_replyto = trim(GETPOST('email_replyto','alpha')); else if ($action == 'setemail_replyto') $object->email_replyto = trim(GETPOST('email_replyto','alpha'));
else if ($action == 'setemail_errorsto') $object->email_errorsto = trim(GETPOST('email_errorsto','alpha')); else if ($action == 'setemail_errorsto') $object->email_errorsto = trim(GETPOST('email_errorsto','alpha'));
else if ($action == 'settitre' && empty($object->titre)) {
else if ($action == 'settitre' && empty($object->titre)) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTitle")); $mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTitle"));
else if ($action == 'setfrom' && empty($object->email_from)) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailFrom")); }
else if ($action == 'setfrom' && empty($object->email_from)) {
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("MailFrom"));
}
if (! $mesg) if (! $mesg)
{ {
@ -491,10 +503,10 @@ if ($action == 'settitre' || $action == 'setemail_from' || $actino == 'setreplyt
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit; exit;
} }
$mesg=$object->error; $mesg = $object->error;
} }
$mesg='<div class="error">'.$mesg.'</div>'; setEventMessage($mesg, 'errors');
$action=""; $action="";
} }
@ -534,25 +546,31 @@ if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"
if (! $isupload) if (! $isupload)
{ {
$mesgs = array();
$object->sujet = trim($_POST["sujet"]); $object->sujet = trim($_POST["sujet"]);
$object->body = trim($_POST["body"]); $object->body = trim($_POST["body"]);
$object->bgcolor = trim($_POST["bgcolor"]); $object->bgcolor = trim($_POST["bgcolor"]);
$object->bgimage = trim($_POST["bgimage"]); $object->bgimage = trim($_POST["bgimage"]);
if (! $object->sujet) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTopic")); if (! $object->sujet) {
if (! $object->body) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailMessage")); $mesgs[] = $langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTopic"));
}
if (! $object->body) {
$mesgs[] = $langs->trans("ErrorFieldRequired",$langs->transnoentities("MailMessage"));
}
if (! $mesg) if (!count($mesgs))
{ {
if ($object->update($user) >= 0) if ($object->update($user) >= 0)
{ {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit; exit;
} }
$mesg=$object->error; $mesgs[] =$object->error;
} }
$mesg='<div class="error">'.$mesg.'</div>'; setEventMessage($mesgs, 'errors');
$action="edit"; $action="edit";
} }
else else
@ -598,7 +616,7 @@ if ($action == 'confirm_reset' && $confirm == 'yes')
} }
else else
{ {
$mesg=$object->error; setEventMessage($object->error, 'errors');
$db->rollback(); $db->rollback();
} }
} }
@ -646,8 +664,6 @@ if ($action == 'create')
print_fiche_titre($langs->trans("NewMailing")); print_fiche_titre($langs->trans("NewMailing"));
dol_htmloutput_mesg($mesg);
print '<table class="border" width="100%">'; 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("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>'; 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>';
@ -731,9 +747,9 @@ else
{ {
// Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM,
// on affiche donc juste un message // on affiche donc juste un message
$mesgembedded.='<div class="warning">'.$langs->trans("MailingNeedCommand").'</div>'; setEventMessage($langs->trans("MailingNeedCommand"), 'warnings');
$mesgembedded.='<br><textarea cols="60" rows="'.ROWS_1.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>'; setEventMessage('<textarea cols="60" rows="'.ROWS_1.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', 'warnings');
$mesgembedded.='<br><br><div class="warning">'.$langs->trans("MailingNeedCommand2").'</div>'; setEventMessage($langs->trans("MailingNeedCommand2"), 'warnings');
$_GET["action"]=''; $_GET["action"]='';
} }
else else
@ -829,9 +845,6 @@ else
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneEMailing'),$langs->trans('ConfirmCloneEMailing',$object->ref),'confirm_clone',$formquestion,'yes',2,240); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneEMailing'),$langs->trans('ConfirmCloneEMailing',$object->ref),'confirm_clone',$formquestion,'yes',2,240);
} }
dol_htmloutput_mesg($mesg);
/* /*
* Boutons d'action * Boutons d'action
*/ */
@ -916,12 +929,6 @@ else
print '<br><br></div>'; print '<br><br></div>';
} }
if (! empty($mesgembedded))
{
dol_htmloutput_mesg($mesgembedded,'','warning',1);
print '<br>';
}
// Affichage formulaire de TEST // Affichage formulaire de TEST
if ($action == 'test') if ($action == 'test')
{ {
@ -1017,8 +1024,6 @@ else
* Mailing en mode edition * Mailing en mode edition
*/ */
dol_htmloutput_mesg($mesg);
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref

View File

@ -1645,7 +1645,7 @@ if ($action == 'create') {
$numref = $object->getNextNumRef($soc); $numref = $object->getNextNumRef($soc);
if (empty($numref)) { if (empty($numref)) {
$error ++; $error ++;
dol_htmloutput_errors($object->error); setEventMessage($object->error, 'errors');
} }
} else { } else {
$numref = $object->ref; $numref = $object->ref;

View File

@ -71,7 +71,7 @@ if (GETPOST("action") == 'setremise')
} }
else else
{ {
$errmesg=$soc->error; setEventMessage($soc->error, 'errors');
} }
} }
@ -97,8 +97,6 @@ if ($socid > 0)
$objsoc->id=$socid; $objsoc->id=$socid;
$objsoc->fetch($socid); $objsoc->fetch($socid);
dol_htmloutput_errors($errmesg);
$head = societe_prepare_head($objsoc); $head = societe_prepare_head($objsoc);
dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"),0,'company'); dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"),0,'company');

View File

@ -65,17 +65,17 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
if (! $res > 0) if (! $res > 0)
{ {
$error++; $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) if (! $error && price2num($_POST["amount_ttc_1"]+$_POST["amount_ttc_2"]) != $discount->amount_ttc)
{ {
$error++; $error++;
$mesg='<div class="error">'.$langs->trans("TotalOfTwoDiscountMustEqualsOriginal").'</div>'; setEventMessage($langs->trans("TotalOfTwoDiscountMustEqualsOriginal"), 'errors');
} }
if (! $error && $discount->fk_facture_line) if (! $error && $discount->fk_facture_line)
{ {
$error++; $error++;
$mesg='<div class="error">'.$langs->trans("ErrorCantSplitAUsedDiscount").'</div>'; setEventMessage($langs->trans("ErrorCantSplitAUsedDiscount"), 'errors');
} }
if (! $error) if (! $error)
{ {
@ -140,7 +140,7 @@ if ($action == 'setremise')
$error=0; $error=0;
if (empty($_POST["desc"])) if (empty($_POST["desc"]))
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("ReasonDiscount")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("ReasonDiscount")), 'errors');
$error++; $error++;
} }
@ -166,13 +166,13 @@ if ($action == 'setremise')
else else
{ {
$error++; $error++;
$mesg='<div class="error">'.$soc->error.'</div>'; setEventMessage($soc->error, 'errors');
} }
} }
} }
else 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 else
{ {
$mesg='<div class="error">'.$discount->error.'</div>'; setEventMessage($discount->error, 'errors');
$db->rollback(); $db->rollback();
} }
} }
@ -211,8 +211,6 @@ llxHeader('',$langs->trans("GlobalDiscount"));
if ($socid > 0) if ($socid > 0)
{ {
dol_htmloutput_mesg($mesg);
// On recupere les donnees societes par l'objet // On recupere les donnees societes par l'objet
$objsoc = new Societe($db); $objsoc = new Societe($db);
$objsoc->id=$socid; $objsoc->id=$socid;

View File

@ -69,11 +69,11 @@ if ($action == 'addcontact' && $user->rights->commande->creer)
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{ {
$langs->load("errors"); $langs->load("errors");
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>'; setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
} }
else else
{ {
$mesg = '<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
} }
@ -132,7 +132,6 @@ $userstatic=new User($db);
/* Mode vue et edition */ /* Mode vue et edition */
/* */ /* */
/* *************************************************************************** */ /* *************************************************************************** */
dol_htmloutput_mesg($mesg);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {

View File

@ -65,8 +65,6 @@ $lineid = GETPOST('lineid', 'int');
$origin = GETPOST('origin', 'alpha'); $origin = GETPOST('origin', 'alpha');
$originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility $originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility
$mesg = GETPOST('mesg');
// PDF // PDF
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); $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)); $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')) if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
{ {
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>'; setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
} }
else 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')); $datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
if ($datecommande == '') { if ($datecommande == '') {
$mesg = '<div class="error">' . $langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')) . '</div>'; setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')), 'errors');
$action = 'create'; $action = 'create';
$error ++; $error ++;
} }
@ -340,11 +338,11 @@ else if ($action == 'add' && $user->rights->commande->creer) {
if ($reshook < 0) if ($reshook < 0)
$error ++; $error ++;
} else { } else {
$mesg = $srcobject->error; setEventMessage($srcobject->error, 'errors');
$error ++; $error ++;
} }
} else { } else {
$mesg = $object->error; setEventMessage($object->error, 'errors');
$error ++; $error ++;
} }
} else { } else {
@ -378,7 +376,7 @@ else if ($action == 'add' && $user->rights->commande->creer) {
if (GETPOST('contactidp')) { if (GETPOST('contactidp')) {
$result = $object->add_contact(GETPOST('contactidp'), 'CUSTOMER', 'external'); $result = $object->add_contact(GETPOST('contactidp'), 'CUSTOMER', 'external');
if ($result < 0) { if ($result < 0) {
$mesg = '<div class="error">' . $langs->trans("ErrorFailedToAddContact") . '</div>'; setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors');
$error ++; $error ++;
} }
} }
@ -395,8 +393,7 @@ else if ($action == 'add' && $user->rights->commande->creer) {
} else { } else {
$db->rollback(); $db->rollback();
$action = 'create'; $action = 'create';
if (! $mesg) setEventMessage($object->error, 'errors');
$mesg = '<div class="error">' . $object->error . '</div>';
} }
} }
} }
@ -435,7 +432,7 @@ else if ($action == 'setdate' && $user->rights->commande->creer) {
$result = $object->set_date($user, $date); $result = $object->set_date($user, $date);
if ($result < 0) { 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); $result = $object->set_date_livraison($user, $datelivraison);
if ($result < 0) { 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) if (! $idwarehouse || $idwarehouse == -1)
{ {
$error++; $error++;
$mesgs[]='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")).'</div>'; setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), 'errors');
$action=''; $action='';
} }
} }
@ -929,7 +926,7 @@ else if ($action == 'confirm_modif' && $user->rights->commande->creer) {
if (! $idwarehouse || $idwarehouse == -1) if (! $idwarehouse || $idwarehouse == -1)
{ {
$error++; $error++;
$mesgs[]='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")).'</div>'; setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), 'errors');
$action=''; $action='';
} }
} }
@ -982,7 +979,7 @@ else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->comm
if (! $idwarehouse || $idwarehouse == -1) if (! $idwarehouse || $idwarehouse == -1)
{ {
$error++; $error++;
$mesgs[]='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")).'</div>'; setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), 'errors');
$action=''; $action='';
} }
} }
@ -1221,12 +1218,13 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, - 1); $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, - 1);
if ($mailfile->error) { if ($mailfile->error) {
$mesg = '<div class="error">' . $mailfile->error . '</div>'; setEventMessage($mailfile->error, 'errors');
} else { } else {
$result = $mailfile->sendfile(); $result = $mailfile->sendfile();
if ($result) { if ($result) {
$mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2)); // Must not //Must not contain quotes
// contains " $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2));
setEventMessage($mesg);
$error = 0; $error = 0;
@ -1253,19 +1251,19 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
} else { } else {
// Redirect here // Redirect here
// This avoid sending mail twice if going out and then back to page // 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(); exit();
} }
} else { } else {
$langs->load("other"); $langs->load("other");
$mesg = '<div class="error">';
if ($mailfile->error) { if ($mailfile->error) {
$mesg .= $langs->trans('ErrorFailedToSendMail', $from, $sendto); $mesg .= $langs->trans('ErrorFailedToSendMail', $from, $sendto);
$mesg .= '<br>' . $mailfile->error; $mesg .= '<br>' . $mailfile->error;
} else { } else {
$mesg .= 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; $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 { } else {
$langs->load("errors"); $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); dol_syslog('Failed to read file: ' . $file);
} }
} else { } else {
$langs->load("other"); $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"))); dol_syslog($langs->trans('ErrorFailedToReadEntity', $langs->trans("Order")));
} }
} }
@ -1301,9 +1299,9 @@ if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->righ
} else { } else {
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("errors"); $langs->load("errors");
$mesg = '<div class="error">' . $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType") . '</div>'; setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
} else { } 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) { if ($action == 'create' && $user->rights->commande->creer) {
print_fiche_titre($langs->trans('CreateOrder')); print_fiche_titre($langs->trans('CreateOrder'));
dol_htmloutput_mesg($mesg, $mesgs, 'error');
$soc = new Societe($db); $soc = new Societe($db);
if ($socid > 0) if ($socid > 0)
$res = $soc->fetch($socid); $res = $soc->fetch($socid);
@ -1671,8 +1667,6 @@ if ($action == 'create' && $user->rights->commande->creer) {
$now = dol_now(); $now = dol_now();
if ($object->id > 0) { if ($object->id > 0) {
dol_htmloutput_mesg($mesg, $mesgs);
$product_static = new Product($db); $product_static = new Product($db);
$soc = new Societe($db); $soc = new Societe($db);

View File

@ -58,6 +58,8 @@ $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$viewstatut = GETPOST('viewstatut'); $viewstatut = GETPOST('viewstatut');
$error = 0;
if (! $sortfield) $sortfield='c.rowid'; if (! $sortfield) $sortfield='c.rowid';
if (! $sortorder) $sortorder='DESC'; if (! $sortorder) $sortorder='DESC';
@ -71,7 +73,8 @@ if ($action == 'create')
{ {
if (is_array($selected) == false) if (is_array($selected) == false)
{ {
$mesgs = array('<div class="error">'.$langs->trans('Error_OrderNotChecked').'</div>'); $error++;
setEventMessage($langs->trans('Error_OrderNotChecked'), 'errors');
} }
else else
{ {
@ -90,7 +93,7 @@ $hookmanager->initHooks(array('orderstoinvoice'));
* Actions * 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/modules/facture/modules_facture.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
@ -244,7 +247,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
} }
else else
{ {
$mesgs[]=$discount->error; setEventMessage($discount->error, 'errors');
$error++; $error++;
break; break;
} }
@ -313,7 +316,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
} }
else else
{ {
$mesgs[]=$objectsrc->error; setEventMessage($objectsrc->error, 'errors');
$error++; $error++;
} }
$ii++; $ii++;
@ -321,7 +324,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
} }
else else
{ {
$mesgs[]=$object->error; setEventMessage($object->error, 'errors');
$error++; $error++;
} }
} }
@ -341,7 +344,8 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
$action='create'; $action='create';
$_GET["origin"]=$_POST["origin"]; $_GET["origin"]=$_POST["origin"];
$_GET["originid"]=$_POST["originid"]; $_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); $companystatic = new Societe($db);
// Mode creation // Mode creation
if ($action == 'create' && empty($mesgs)) if ($action == 'create' && !$error)
{ {
$facturestatic=new Facture($db); $facturestatic=new Facture($db);
@ -497,7 +501,7 @@ if ($action == 'create' && empty($mesgs))
//Mode liste //Mode liste
if (($action != 'create' && $action != 'add') || ! empty($mesgs)) if (($action != 'create' && $action != 'add') || !$error)
{ {
llxHeader(); llxHeader();
?> ?>
@ -693,7 +697,5 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs))
} }
dol_htmloutput_mesg($mesg,$mesgs);
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -72,8 +72,6 @@ if ($negpage)
if ($page > GETPOST("nbpage")) $page = GETPOST("nbpage"); if ($page > GETPOST("nbpage")) $page = GETPOST("nbpage");
} }
$mesg='';
$object = new Account($db); $object = new Account($db);
/* /*
@ -83,6 +81,8 @@ $dateop=-1;
if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banque->modifier) if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banque->modifier)
{ {
$error = 0;
if (price2num($_POST["credit"]) > 0) if (price2num($_POST["credit"]) > 0)
{ {
$amount = price2num($_POST["credit"]); $amount = price2num($_POST["credit"]);
@ -98,11 +98,20 @@ if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banqu
$label=$_POST["label"]; $label=$_POST["label"];
$cat1=$_POST["cat1"]; $cat1=$_POST["cat1"];
if (! $dateop) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Date")); if (! $dateop) {
if (! $operation) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); $error++;
if (! $amount) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Amount")); setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Date")), 'errors');
}
if (! $operation) {
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Type")), 'errors');
}
if (! $amount) {
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Amount")), 'errors');
}
if (! $mesg) if (! $error)
{ {
$object->fetch($id); $object->fetch($id);
$insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user); $insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user);
@ -114,7 +123,7 @@ if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banqu
} }
else else
{ {
$mesg=$object->error; setEventMessage($object->error, 'errors');
} }
} }
else else
@ -295,8 +304,6 @@ if ($id > 0 || ! empty($ref))
print '<br>'; print '<br>';
dol_htmloutput_errors($mesg);
/** /**
* Search form * Search form
*/ */

View File

@ -289,7 +289,7 @@ if ($result < 0)
{ {
$langs->load("errors"); $langs->load("errors");
$error++; $error++;
$mesg='<div class="error">'.$langs->trans("ErrorFailedToCreateDir").'</div>'; setEventMessage($langs->trans("ErrorFailedToCreateDir"), 'errors');
} }
else else
{ {

View File

@ -79,7 +79,7 @@ if ($action == 'update' && ! $_POST["cancel"])
} }
else else
{ {
$message='<div class="error">'.$account->error.'</div>'; setEventMessage($account->error, 'errors');
$action='edit'; // Force chargement page edition $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_fiche_titre($langs->trans("EditFinancialAccount"));
print "<br>"; print "<br>";
dol_htmloutput_mesg($message);
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$account->id.'" method="post">'; 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="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';

View File

@ -181,7 +181,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
} }
else else
{ {
$message='<div class="error">'.$account->error.'</div>'; setEventMessage($account->error, 'errors');
$action='edit'; // Force chargement page edition $action='edit'; // Force chargement page edition
} }
} }
@ -220,8 +220,6 @@ if ($action == 'create')
print_fiche_titre($langs->trans("NewFinancialAccount")); print_fiche_titre($langs->trans("NewFinancialAccount"));
dol_htmloutput_mesg($message);
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript" language="javascript">';
@ -510,8 +508,6 @@ else
print_fiche_titre($langs->trans("EditFinancialAccount")); print_fiche_titre($langs->trans("EditFinancialAccount"));
print "<br>"; print "<br>";
if ($message) { print "$message<br>\n"; }
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript" language="javascript">';

View File

@ -46,7 +46,6 @@ $result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fie
$account=$_GET["account"]; $account=$_GET["account"];
$mode='standard'; $mode='standard';
if (isset($_GET["mode"]) && $_GET["mode"] == 'showalltime') $mode='showalltime'; if (isset($_GET["mode"]) && $_GET["mode"] == 'showalltime') $mode='showalltime';
$mesg = '';
$error=0; $error=0;
@ -82,7 +81,7 @@ if ($result < 0)
{ {
$langs->load("errors"); $langs->load("errors");
$error++; $error++;
$mesg='<div class="error">'.$langs->trans("ErrorFailedToCreateDir").'</div>'; setEventMessage($langs->trans("ErrorFailedToCreateDir"), 'errors');
} }
else else
{ {
@ -756,8 +755,6 @@ else
$head=bank_prepare_head($acct); $head=bank_prepare_head($acct);
dol_fiche_head($head,'graph',$langs->trans("FinancialAccount"),0,'account'); dol_fiche_head($head,'graph',$langs->trans("FinancialAccount"),0,'account');
if ($mesg) print $mesg.'<br>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';

View File

@ -99,7 +99,7 @@ if ($user->rights->banque->modifier && $action == "update")
if ($ac->courant == 2 && $_POST['value'] != 'LIQ') if ($ac->courant == 2 && $_POST['value'] != 'LIQ')
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorCashAccountAcceptsOnlyCashMoney").'</div>'; setEventMessage($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), 'errors');
$error++; $error++;
} }
@ -141,7 +141,7 @@ if ($user->rights->banque->modifier && $action == "update")
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$mesg=$langs->trans("RecordSaved"); setEventMessage($langs->trans("RecordSaved"));
$db->commit(); $db->commit();
} }
else else
@ -161,7 +161,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action ==
// Check parameters // Check parameters
if ($rappro && empty($num_rel)) if ($rappro && empty($num_rel))
{ {
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountStatement")); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountStatement")), 'errors');
$error++; $error++;
} }
@ -179,7 +179,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action ==
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$mesg=$langs->trans("RecordSaved"); setEventMessage($langs->trans("RecordSaved"));
$db->commit(); $db->commit();
} }
else else
@ -235,8 +235,6 @@ $tabs = array(
dol_fiche_head($tabs, 0, $langs->trans('LineRecord'), 0, 'account'); 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 = "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.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"; $sql.= " b.emetteur,b.banque";

View File

@ -69,7 +69,7 @@ if ($action == 'rappro' && $user->rights->banque->consolidate)
$result=$bankline->update_conciliation($user,$_POST["cat"]); $result=$bankline->update_conciliation($user,$_POST["cat"]);
if ($result < 0) if ($result < 0)
{ {
$mesg.=$bankline->error; setEventMessage($bankline->error, 'errors');
$error++; $error++;
break; break;
} }
@ -81,7 +81,7 @@ if ($action == 'rappro' && $user->rights->banque->consolidate)
{ {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$mesg='<div class="error">'.$langs->trans("ErrorPleaseTypeBankTransactionReportName").'</div>'; setEventMessage($langs->trans("ErrorPleaseTypeBankTransactionReportName"), 'errors');
} }
if (! $error) 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_fiche_titre($langs->trans("Reconciliation").': <a href="account.php?account='.$acct->id.'">'.$acct->label.'</a>');
print '<br>'; print '<br>';
dol_htmloutput_mesg($mesg);
// Show last bank receipts // Show last bank receipts
$nbmax=5; $nbmax=5;
$liste=""; $liste="";

View File

@ -49,10 +49,6 @@ $result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fie
$vline=isset($_GET["vline"])?$_GET["vline"]:$_POST["vline"]; $vline=isset($_GET["vline"])?$_GET["vline"]:$_POST["vline"];
$page=isset($_GET["page"])?$_GET["page"]:0; $page=isset($_GET["page"])?$_GET["page"]:0;
$mesg='';
/* /*
* View * View
*/ */
@ -115,10 +111,6 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
print '<br>'; print '<br>';
if ($mesg) print '<div class="error">'.$mesg.'</div>';
$solde = $acct->solde(0); $solde = $acct->solde(0);
/* /*

View File

@ -45,7 +45,6 @@ if ($action == 'add')
{ {
$langs->load("errors"); $langs->load("errors");
$mesg='';
$dateo = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int')); $dateo = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
$label = GETPOST('label','alpha'); $label = GETPOST('label','alpha');
$amount= GETPOST('amount','int'); $amount= GETPOST('amount','int');
@ -53,22 +52,22 @@ if ($action == 'add')
if (! $label) if (! $label)
{ {
$error=1; $error=1;
$mesg.="<div class=\"error\">".$langs->trans("ErrorFieldRequired",$langs->transnoentities("Description"))."</div>"; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Description")), 'errors');
} }
if (! $amount) if (! $amount)
{ {
$error=1; $error=1;
$mesg.="<div class=\"error\">".$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"))."</div>"; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")), 'errors');
} }
if (! GETPOST('account_from','int')) if (! GETPOST('account_from','int'))
{ {
$error=1; $error=1;
$mesg.="<div class=\"error\">".$langs->trans("ErrorFieldRequired",$langs->transnoentities("TransferFrom"))."</div>"; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("TransferFrom")), 'errors');
} }
if (! GETPOST('account_to','int')) if (! GETPOST('account_to','int'))
{ {
$error=1; $error=1;
$mesg.="<div class=\"error\">".$langs->trans("ErrorFieldRequired",$langs->transnoentities("TransferTo"))."</div>"; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("TransferTo")), 'errors');
} }
if (! $error) if (! $error)
{ {
@ -111,20 +110,19 @@ if ($action == 'add')
if (! $error) if (! $error)
{ {
$mesg.="<div class=\"ok\">"; $mesgs = $langs->trans("TransferFromToDone","<a href=\"account.php?account=".$accountfrom->id."\">".$accountfrom->label."</a>","<a href=\"account.php?account=".$accountto->id."\">".$accountto->label."</a>",$amount,$langs->transnoentities("Currency".$conf->currency));
$mesg.=$langs->trans("TransferFromToDone","<a href=\"account.php?account=".$accountfrom->id."\">".$accountfrom->label."</a>","<a href=\"account.php?account=".$accountto->id."\">".$accountto->label."</a>",$amount,$langs->transnoentities("Currency".$conf->currency)); setEventMessage($mesgs);
$mesg.="</div>";
$db->commit(); $db->commit();
} }
else else
{ {
$mesg.="<div class=\"error\">".$accountfrom->error.' '.$accountto->error."</div>"; setEventMessage($accountfrom->error.' '.$accountto->error, 'errors');
$db->rollback(); $db->rollback();
} }
} }
else else
{ {
$mesg.="<div class=\"error\">".$langs->trans("ErrorFromToAccountsMustDiffers")."</div>"; setEventMessage($langs->trans("ErrorFromToAccountsMustDiffers"), 'errors');
} }
} }
} }
@ -154,8 +152,6 @@ if($error)
print_fiche_titre($langs->trans("BankTransfer")); print_fiche_titre($langs->trans("BankTransfer"));
dol_htmloutput_mesg($mesg);
print $langs->trans("TransferDesc"); print $langs->trans("TransferDesc");
print "<br><br>"; print "<br><br>";

View File

@ -44,8 +44,6 @@ $result = restrictedArea($user, 'deplacement', $id,'');
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$confirm = GETPOST('confirm','alpha'); $confirm = GETPOST('confirm','alpha');
$mesg = '';
$object = new Deplacement($db); $object = new Deplacement($db);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
@ -73,7 +71,7 @@ if ($action == 'validate' && $user->rights->deplacement->creer)
} }
else else
{ {
$mesg=$object->error; setEventMessage($object->error, 'errors');
} }
} }
} }
@ -88,7 +86,7 @@ else if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->depl
} }
else else
{ {
$mesg=$object->error; setEventMessage($object->error, 'errors');
} }
} }
@ -109,17 +107,17 @@ else if ($action == 'add' && $user->rights->deplacement->creer)
if (! $object->date) if (! $object->date)
{ {
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors');
$error++; $error++;
} }
if ($object->type == '-1') // Otherwise it is TF_LUNCH,... if ($object->type == '-1') // Otherwise it is TF_LUNCH,...
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
$error++; $error++;
} }
if (! ($object->fk_user > 0)) if (! ($object->fk_user > 0))
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Person")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Person")), 'errors');
$error++; $error++;
} }
@ -134,7 +132,7 @@ else if ($action == 'add' && $user->rights->deplacement->creer)
} }
else else
{ {
$mesg=$object->error; setEventMessage($object->error, 'errors');
$action='create'; $action='create';
} }
} }
@ -174,7 +172,7 @@ else if ($action == 'update' && $user->rights->deplacement->creer)
} }
else else
{ {
$mesg=$object->error; setEventMessage($object->error, 'errors');
} }
} }
else else
@ -226,8 +224,6 @@ if ($action == 'create')
print_fiche_titre($langs->trans("NewTrip")); print_fiche_titre($langs->trans("NewTrip"));
dol_htmloutput_errors($mesg);
$datec = dol_mktime(12, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int')); $datec = dol_mktime(12, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int'));
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n"; print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
@ -299,8 +295,6 @@ else if ($id)
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result > 0) if ($result > 0)
{ {
dol_htmloutput_mesg($mesg);
$head = trip_prepare_head($object); $head = trip_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip'); dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip');

View File

@ -43,9 +43,6 @@ $action=GETPOST('action','alpha');
$cancel=GETPOST('cancel'); $cancel=GETPOST('cancel');
$amount=GETPOST('amount'); $amount=GETPOST('amount');
$mesg="";
$mesgs=array();
$don = new Don($db); $don = new Don($db);
$donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
@ -72,14 +69,14 @@ if ($action == 'update')
if (empty($donation_date)) if (empty($donation_date))
{ {
$mesgs[]=$langs->trans("ErrorFieldRequired",$langs->trans("Date")); setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Date")), 'errors');
$action = "create"; $action = "create";
$error++; $error++;
} }
if (empty($amount)) if (empty($amount))
{ {
$mesgs[]=$langs->trans("ErrorFieldRequired",$langs->trans("Amount")); $setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Amount")), 'errors');
$action = "create"; $action = "create";
$error++; $error++;
} }
@ -125,14 +122,14 @@ if ($action == 'add')
if (empty($donation_date)) if (empty($donation_date))
{ {
$mesgs[]=$langs->trans("ErrorFieldRequired",$langs->trans("Date")); setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Date")), 'errors');
$action = "create"; $action = "create";
$error++; $error++;
} }
if (empty($amount)) if (empty($amount))
{ {
$mesgs[]=$langs->trans("ErrorFieldRequired",$langs->trans("Amount")); setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Amount")), 'errors');
$action = "create"; $action = "create";
$error++; $error++;
} }
@ -182,7 +179,9 @@ if ($action == 'valid_promesse')
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit; exit;
} }
else $mesg=$don->error; else {
setEventMessage($don->error, 'errors');
}
} }
if ($action == 'set_cancel') if ($action == 'set_cancel')
{ {
@ -191,7 +190,9 @@ if ($action == 'set_cancel')
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit; exit;
} }
else $mesg=$don->error; else {
setEventMessage($don->error, 'errors');
}
} }
if ($action == 'set_paid') if ($action == 'set_paid')
{ {
@ -200,7 +201,9 @@ if ($action == 'set_paid')
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit; exit;
} }
else $mesg=$don->error; else {
setEventMessage($don->error, 'errors');
}
} }
if ($action == 'set_encaisse') if ($action == 'set_encaisse')
{ {
@ -209,7 +212,9 @@ if ($action == 'set_encaisse')
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit; exit;
} }
else $mesg=$don->error; else {
setEventMessage($don->error, 'errors');
}
} }
/* /*
@ -263,8 +268,6 @@ if ($action == 'create')
{ {
print_fiche_titre($langs->trans("AddDonation")); print_fiche_titre($langs->trans("AddDonation"));
dol_htmloutput_errors($mesg,$mesgs);
print '<form name="add" action="fiche.php" method="post">'; print '<form name="add" action="fiche.php" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';

View File

@ -115,9 +115,9 @@ include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include
// Action clone object // Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->creer) { if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->creer) {
if (1 == 0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) { // if (1 == 0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) {
$mesgs [] = '<div class="error">' . $langs->trans("NoCloneOptionsSpecified") . '</div>'; // $mesgs [] = '<div class="error">' . $langs->trans("NoCloneOptionsSpecified") . '</div>';
} else { // } else {
if ($object->fetch($id) > 0) { if ($object->fetch($id) > 0) {
$result = $object->createFromClone($socid); $result = $object->createFromClone($socid);
if ($result > 0) { if ($result > 0) {
@ -128,7 +128,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->c
$action = ''; $action = '';
} }
} }
} // }
} }
// Change status of invoice // Change status of invoice
@ -216,13 +216,13 @@ else if ($action == 'valid' && $user->rights->facture->creer) {
if ($object->type == Facture::TYPE_CREDIT_NOTE) { if ($object->type == Facture::TYPE_CREDIT_NOTE) {
// Si avoir, le signe doit etre negatif // Si avoir, le signe doit etre negatif
if ($object->total_ht >= 0) { if ($object->total_ht >= 0) {
$mesgs [] = '<div class="error">' . $langs->trans("ErrorInvoiceAvoirMustBeNegative") . '</div>'; setEventMessage($langs->trans("ErrorInvoiceAvoirMustBeNegative"), 'errors');
$action = ''; $action = '';
} }
} else { } else {
// Si non avoir, le signe doit etre positif // Si non avoir, le signe doit etre positif
if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ht < 0) { 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 = ''; $action = '';
} }
} }
@ -319,7 +319,7 @@ else if ($action == "setabsolutediscount" && $user->rights->facture->creer) {
if ($ret > 0) { if ($ret > 0) {
$result = $object->insert_discount($_POST["remise_id"]); $result = $object->insert_discount($_POST["remise_id"]);
if ($result < 0) { if ($result < 0) {
$mesgs [] = '<div class="error">' . $object->error . '</div>'; setEventMessage($object->error, 'errors');
} }
} else { } else {
dol_print_error($db, $object->error); 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); $result = $discount->link_to_invoice(0, $id);
if ($result < 0) { 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); $result = $object->set_paid($user);
if ($result >= 0) if ($result >= 0)
{ {
//$mesgs[]='OK'.$discount->id;
$db->commit(); $db->commit();
} }
else else
@ -642,8 +641,9 @@ else if ($action == 'add' && $user->rights->facture->creer)
$object->type = Facture::TYPE_REPLACEMENT; $object->type = Facture::TYPE_REPLACEMENT;
$id = $object->createFromCurrent($user); $id = $object->createFromCurrent($user);
if ($id <= 0) if ($id <= 0) {
$mesgs [] = $object->error; setEventMessage($object->error, 'errors');
}
} }
} }
@ -888,7 +888,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
$amountdeposit = ($totalamount * $valuedeposit) / 100; $amountdeposit = ($totalamount * $valuedeposit) / 100;
} }
} else { } else {
$mesgs [] = $srcobject->error; setEventMessage($srcobject->error, 'errors');
$error ++; $error ++;
} }
} }
@ -955,7 +955,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
if ($discountid > 0) { if ($discountid > 0) {
$result = $object->insert_discount($discountid); // This include link_to_invoice $result = $object->insert_discount($discountid); // This include link_to_invoice
} else { } else {
$mesgs [] = $discount->error; setEventMessage($discount->error, 'errors');
$error ++; $error ++;
break; break;
} }
@ -1016,12 +1016,12 @@ else if ($action == 'add' && $user->rights->facture->creer)
if ($reshook < 0) if ($reshook < 0)
$error ++; $error ++;
} else { } else {
$mesgs [] = $srcobject->error; setEventMessage($srcobject->error, 'errors');
$error ++; $error ++;
} }
} }
} else { } else {
$mesgs [] = $object->error; setEventMessage($object->error, 'errors');
$error ++; $error ++;
} }
} // If some invoice's lines already known } // If some invoice's lines already known
@ -1054,7 +1054,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
$action = 'create'; $action = 'create';
$_GET ["origin"] = $_POST["origin"]; $_GET ["origin"] = $_POST["origin"];
$_GET ["originid"] = $_POST["originid"]; $_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'; require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, - 1); $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, - 1);
if ($mailfile->error) { if ($mailfile->error) {
$mesgs [] = '<div class="error">' . $mailfile->error . '</div>'; setEventMessage($mailfile->error, 'errors');
} else { } else {
$result = $mailfile->sendfile(); $result = $mailfile->sendfile();
if ($result) { if ($result) {
@ -1642,15 +1642,15 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
} }
} else { } else {
$langs->load("other"); $langs->load("other");
$mesg = '<div class="error">';
if ($mailfile->error) { if ($mailfile->error) {
$mesg .= $langs->trans('ErrorFailedToSendMail', $from, $sendto); $mesg .= $langs->trans('ErrorFailedToSendMail', $from, $sendto);
$mesg .= '<br>' . $mailfile->error; $mesg .= '<br>' . $mailfile->error;
} else { } else {
$mesg .= 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; $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 { } else {
$langs->load("errors"); $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); dol_syslog('Failed to read file: ' . $file);
} }
} else { } else {
$langs->load("other"); $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.'); 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 { } else {
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("errors"); $langs->load("errors");
$mesgs [] = '<div class="error">' . $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType") . '</div>'; setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
} else { } else {
$mesgs [] = '<div class="error">' . $object->error . '</div>'; setEventMessage($object->error, 'errors');
} }
} }
} }
@ -3764,7 +3764,5 @@ if ($action == 'create')
} }
} }
dol_htmloutput_mesg('', $mesgs);
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -127,7 +127,6 @@ $userstatic=new User($db);
/* Mode vue et edition */ /* Mode vue et edition */
/* */ /* */
/* *************************************************************************** */ /* *************************************************************************** */
dol_htmloutput_mesg($mesg);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {

View File

@ -453,8 +453,6 @@ if ($resql)
print_fiche_titre($titre,$link); print_fiche_titre($titre,$link);
//print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',0); // We don't want pagination on this page //print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',0); // We don't want pagination on this page
dol_htmloutput_mesg($mesg);
print '<form id="form_unpaid" method="POST" action="'.$_SERVER["PHP_SELF"].'?sortfield='. $sortfield .'&sortorder='. $sortorder .'">'; print '<form id="form_unpaid" method="POST" action="'.$_SERVER["PHP_SELF"].'?sortfield='. $sortfield .'&sortorder='. $sortorder .'">';
if (! empty($mode) && $action == 'presend') if (! empty($mode) && $action == 'presend')

View File

@ -47,8 +47,6 @@ $fieldname = (! empty($ref)?'number':'rowid');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque','','',$fieldname); $result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque','','',$fieldname);
$mesg='';
$sortfield=GETPOST('sortfield', 'alpha'); $sortfield=GETPOST('sortfield', 'alpha');
$sortorder=GETPOST('sortorder', 'alpha'); $sortorder=GETPOST('sortorder', 'alpha');
$page=GETPOST('page', 'int'); $page=GETPOST('page', 'int');
@ -122,12 +120,12 @@ if ($action == 'setref' && $user->rights->banque->cheque)
$result=$object->set_number($user,$number); $result=$object->set_number($user,$number);
if ($result < 0) if ($result < 0)
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
else else
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
@ -337,9 +335,6 @@ else
} }
} }
dol_htmloutput_errors($mesg);
$accounts = array(); $accounts = array();
if ($action == 'new') if ($action == 'new')

View File

@ -45,8 +45,6 @@ if ($user->societe_id) $socid=$user->societe_id;
// TODO ajouter regle pour restreindre acces paiement // TODO ajouter regle pour restreindre acces paiement
//$result = restrictedArea($user, 'facture', $id,''); //$result = restrictedArea($user, 'facture', $id,'');
$mesg='';
$object = new Paiement($db); $object = new Paiement($db);
@ -67,7 +65,7 @@ if ($action == 'setnote' && $user->rights->facture->paiement)
} }
else else
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
$db->rollback(); $db->rollback();
} }
} }
@ -87,7 +85,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture->
else else
{ {
$langs->load("errors"); $langs->load("errors");
$mesg='<div class="error">'.$langs->trans($object->error).'</div>'; setEventMessage($langs->trans($object->error), 'errors');
$db->rollback(); $db->rollback();
} }
} }
@ -123,7 +121,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture->
else else
{ {
$langs->load("errors"); $langs->load("errors");
$mesg='<div class="error">'.$langs->trans($object->error).'</div>'; setEventMessage($langs->trans($object->error), 'errors');
$db->rollback(); $db->rollback();
} }
} }
@ -134,11 +132,11 @@ if ($action == 'setnum_paiement' && ! empty($_POST['num_paiement']))
$res = $object->update_num($_POST['num_paiement']); $res = $object->update_num($_POST['num_paiement']);
if ($res === 0) if ($res === 0)
{ {
$mesg = '<div class="ok">'.$langs->trans('PaymentNumberUpdateSucceeded').'</div>'; setEventMessage($langs->trans('PaymentNumberUpdateSucceeded'));
} }
else else
{ {
$mesg = '<div class="error">'.$langs->trans('PaymentNumberUpdateFailed').'</div>'; setEventMessage($langs->trans('PaymentNumberUpdateFailed'), 'errors');
} }
} }
@ -149,11 +147,11 @@ if ($action == 'setdatep' && ! empty($_POST['datepday']))
$res = $object->update_date($datepaye); $res = $object->update_date($datepaye);
if ($res === 0) if ($res === 0)
{ {
$mesg = '<div class="ok">'.$langs->trans('PaymentDateUpdateSucceeded').'</div>'; setEventMessage($langs->trans('PaymentDateUpdateSucceeded'));
} }
else else
{ {
$mesg = '<div class="error">'.$langs->trans('PaymentDateUpdateFailed').'</div>'; setEventMessage($langs->trans('PaymentDateUpdateFailed'), 'errors');
} }
} }
@ -198,10 +196,6 @@ if ($action == 'valide')
} }
dol_htmloutput_mesg($mesg);
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref

View File

@ -104,8 +104,6 @@ if ($result)
print_barre_liste($langs->trans("SalariesPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines); print_barre_liste($langs->trans("SalariesPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines);
dol_htmloutput_mesg($mesg);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';

View File

@ -69,7 +69,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes')
} }
else else
{ {
$mesg='<div class="error">'.$chargesociales->error.'</div>'; setEventMessage($chargesociales->error, 'errors');
} }
} }
@ -81,22 +81,22 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
$dateperiod=@dol_mktime($_POST["periodhour"],$_POST["periodmin"],$_POST["periodsec"],$_POST["periodmonth"],$_POST["periodday"],$_POST["periodyear"]); $dateperiod=@dol_mktime($_POST["periodhour"],$_POST["periodmin"],$_POST["periodsec"],$_POST["periodmonth"],$_POST["periodday"],$_POST["periodyear"]);
if (! $dateech) if (! $dateech)
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")), 'errors');
$action = 'create'; $action = 'create';
} }
elseif (! $dateperiod) elseif (! $dateperiod)
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Period")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Period")), 'errors');
$action = 'create'; $action = 'create';
} }
elseif (! $_POST["actioncode"] > 0) elseif (! $_POST["actioncode"] > 0)
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Type")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Type")), 'errors');
$action = 'create'; $action = 'create';
} }
elseif (! $_POST["amount"]) elseif (! $_POST["amount"])
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")), 'errors');
$action = 'create'; $action = 'create';
} }
else else
@ -110,13 +110,9 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
$chargesociales->amount=$_POST["amount"]; $chargesociales->amount=$_POST["amount"];
$id=$chargesociales->create($user); $id=$chargesociales->create($user);
if ($id > 0) if ($id <= 0)
{ {
//$mesg='<div class="ok">'.$langs->trans("SocialContributionAdded").'</div>'; setEventMessage($chargesociales->error, 'errors');
}
else
{
$mesg='<div class="error">'.$chargesociales->error.'</div>';
} }
} }
} }
@ -128,12 +124,12 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr
$dateperiod=dol_mktime($_POST["periodhour"],$_POST["periodmin"],$_POST["periodsec"],$_POST["periodmonth"],$_POST["periodday"],$_POST["periodyear"]); $dateperiod=dol_mktime($_POST["periodhour"],$_POST["periodmin"],$_POST["periodsec"],$_POST["periodmonth"],$_POST["periodday"],$_POST["periodyear"]);
if (! $dateech) if (! $dateech)
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")), 'errors');
$action = 'edit'; $action = 'edit';
} }
elseif (! $dateperiod) elseif (! $dateperiod)
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Period")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Period")), 'errors');
$action = 'edit'; $action = 'edit';
} }
else else
@ -146,13 +142,9 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr
$chargesociales->periode=$dateperiod; $chargesociales->periode=$dateperiod;
$result=$chargesociales->update($user); $result=$chargesociales->update($user);
if ($result > 0) if ($result <= 0)
{ {
//$mesg='<div class="ok">'.$langs->trans("SocialContributionAdded").'</div>'; setEventMessage($chargesociales->error, 'errors');
}
else
{
$mesg='<div class="error">'.$chargesociales->error.'</div>';
} }
} }
} }
@ -176,8 +168,6 @@ if ($action == 'create')
print_fiche_titre($langs->trans("NewSocialContribution")); print_fiche_titre($langs->trans("NewSocialContribution"));
print "<br>\n"; print "<br>\n";
dol_htmloutput_mesg($mesg);
$var=false; $var=false;
print '<form name="charge" method="post" action="'.$_SERVER["PHP_SELF"].'">'; print '<form name="charge" method="post" action="'.$_SERVER["PHP_SELF"].'">';
@ -246,8 +236,6 @@ if ($id > 0)
if ($result > 0) if ($result > 0)
{ {
dol_htmloutput_mesg($mesg);
$head=tax_prepare_head($object); $head=tax_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("SocialContribution"),0,'bill'); dol_fiche_head($head, 'card', $langs->trans("SocialContribution"),0,'bill');

View File

@ -127,10 +127,6 @@ if ($resql)
print_barre_liste($langs->trans("SocialContributions"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines); print_barre_liste($langs->trans("SocialContributions"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines);
} }
dol_htmloutput_mesg($mesg);
if (empty($mysoc->country_id) && empty($mysoc->country_code)) if (empty($mysoc->country_id) && empty($mysoc->country_code))
{ {
print '<div class="error">'; print '<div class="error">';

View File

@ -102,8 +102,6 @@ if ($result)
print_barre_liste($langs->trans("VATPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines); print_barre_liste($langs->trans("VATPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines);
dol_htmloutput_mesg($mesg);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';

View File

@ -49,8 +49,6 @@ $contact->fetch($id, $user);
if ($action == 'dolibarr2ldap') if ($action == 'dolibarr2ldap')
{ {
$message="";
$db->begin(); $db->begin();
$ldap=new Ldap(); $ldap=new Ldap();
@ -64,12 +62,12 @@ if ($action == 'dolibarr2ldap')
if ($result >= 0) if ($result >= 0)
{ {
$message.='<div class="ok">'.$langs->trans("ContactSynchronized").'</div>'; setEventMessage($langs->trans("ContactSynchronized"));
$db->commit(); $db->commit();
} }
else else
{ {
$message.='<div class="error">'.$ldap->error.'</div>'; setEventMessage($ldap->error, 'errors');
$db->rollback(); $db->rollback();
} }
} }
@ -136,10 +134,6 @@ print '</table>';
print '</div>'; print '</div>';
dol_htmloutput_mesg($message);
/* /*
* Barre d'actions * Barre d'actions
*/ */

View File

@ -67,15 +67,14 @@ if ($action == 'addcontact' && $user->rights->contrat->creer)
} }
else else
{ {
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
{
$langs->load("errors"); $langs->load("errors");
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>'; $msg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType");
} } else {
else $mesg = $object->error;
{
$mesg = '<div class="error">'.$object->error.'</div>';
} }
setEventMessage($mesg, 'errors');
} }
} }
@ -117,8 +116,6 @@ $formcompany= new FormCompany($db);
$contactstatic=new Contact($db); $contactstatic=new Contact($db);
$userstatic=new User($db); $userstatic=new User($db);
dol_htmloutput_mesg($mesg);
/* *************************************************************************** */ /* *************************************************************************** */
/* */ /* */
/* Mode vue et edition */ /* Mode vue et edition */
@ -129,8 +126,6 @@ if ($id > 0 || ! empty($ref))
{ {
if ($object->fetch($id, $ref) > 0) if ($object->fetch($id, $ref) > 0)
{ {
dol_htmloutput_mesg($mesg);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$head = contract_prepare_head($object); $head = contract_prepare_head($object);

View File

@ -64,8 +64,6 @@ $form = new Form($db);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
dol_htmloutput_mesg($mesg);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$head = contract_prepare_head($object); $head = contract_prepare_head($object);

View File

@ -137,8 +137,6 @@ class mailing_xinputfile extends MailingTargets
{ {
$cpt=0; $cpt=0;
//$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
//print_r($_FILES);
$file=$upload_dir . "/" . $_FILES['username']['name']; $file=$upload_dir . "/" . $_FILES['username']['name'];
$handle = @fopen($file, "r"); $handle = @fopen($file, "r");
if ($handle) if ($handle)

View File

@ -269,7 +269,7 @@ if ($action == 'execute'){
if (empty($object->status) && $action != 'create') if (empty($object->status) && $action != 'create')
{ {
dol_htmloutput_mesg($langs->trans("CronTaskInactive"),'','warning',1); setEventMessage($langs->trans("CronTaskInactive"), 'warnings');
} }
if (($action=="create") || ($action=="edit")) if (($action=="create") || ($action=="edit"))

View File

@ -110,8 +110,6 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
$resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),0, 0, $_FILES['userfile']['error']); $resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),0, 0, $_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0) if (is_numeric($resupload) && $resupload > 0)
{ {
//$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
//print_r($_FILES);
$result=$ecmdir->changeNbOfFiles('+'); $result=$ecmdir->changeNbOfFiles('+');
} }
else else
@ -134,7 +132,7 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
else else
{ {
$langs->load("errors"); $langs->load("errors");
$mesg = '<div class="error">'.$langs->trans("ErrorFailToCreateDir",$upload_dir).'</div>'; setEventMessage($langs->trans("ErrorFailToCreateDir",$upload_dir), 'errors');
} }
} }
} }
@ -156,7 +154,7 @@ if ($action == 'add' && $user->rights->ecm->setup)
} }
else else
{ {
$mesg='<div class="error">Error '.$langs->trans($ecmdir->error).'</div>'; setEventMessage('Error '.$langs->trans($ecmdir->error), 'errors');
$action = "create"; $action = "create";
} }
@ -198,7 +196,7 @@ if ($action == 'confirm_deletefile')
if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes') if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes')
{ {
$result=$ecmdir->delete($user); $result=$ecmdir->delete($user);
$mesg = '<div class="ok">'.$langs->trans("ECMSectionWasRemoved", $ecmdir->label).'</div>'; setEventMessage($langs->trans("ECMSectionWasRemoved", $ecmdir->label));
clearstatcache(); clearstatcache();
} }
@ -324,7 +322,6 @@ if ($action == 'refreshmanual')
$dirtotest=$conf->ecm->dir_output.'/'.$dirdesc['fullrelativename']; $dirtotest=$conf->ecm->dir_output.'/'.$dirdesc['fullrelativename'];
if (! dol_is_dir($dirtotest)) if (! dol_is_dir($dirtotest))
{ {
$mesg.=$dirtotest." not found onto disk. We delete from database dir with id=".$dirdesc['id']."<br>\n";
$ecmdirtmp->id=$dirdesc['id']; $ecmdirtmp->id=$dirdesc['id'];
$ecmdirtmp->delete($user,'databaseonly'); $ecmdirtmp->delete($user,'databaseonly');
//exit; //exit;
@ -440,9 +437,6 @@ if ($action == 'delete' && empty($conf->use_javascript_ajax))
} }
dol_htmloutput_mesg($mesg);
if (! empty($conf->use_javascript_ajax)) $classviewhide='hidden'; if (! empty($conf->use_javascript_ajax)) $classviewhide='hidden';
else $classviewhide='visible'; else $classviewhide='visible';

View File

@ -110,8 +110,6 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
$resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),0, 0, $_FILES['userfile']['error']); $resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),0, 0, $_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0) if (is_numeric($resupload) && $resupload > 0)
{ {
//$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
//print_r($_FILES);
$result=$ecmdir->changeNbOfFiles('+'); $result=$ecmdir->changeNbOfFiles('+');
} }
else else
@ -134,7 +132,7 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
else else
{ {
$langs->load("errors"); $langs->load("errors");
$mesg = '<div class="error">'.$langs->trans("ErrorFailToCreateDir",$upload_dir).'</div>'; setEventMessage($langs->trans("ErrorFailToCreateDir",$upload_dir), 'errors');
} }
} }
} }
@ -156,7 +154,8 @@ if ($action == 'add' && $user->rights->ecm->setup)
} }
else else
{ {
$mesg='<div class="error">Error '.$langs->trans($ecmdir->error).'</div>'; //TODO: Translate
setEventMessage('Error '.$langs->trans($ecmdir->error), 'errors');
$action = "create"; $action = "create";
} }
@ -198,7 +197,7 @@ if ($action == 'confirm_deletefile')
if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes') if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes')
{ {
$result=$ecmdir->delete($user); $result=$ecmdir->delete($user);
$mesg = '<div class="ok">'.$langs->trans("ECMSectionWasRemoved", $ecmdir->label).'</div>'; setEventMessage($langs->trans("ECMSectionWasRemoved", $ecmdir->label));
clearstatcache(); clearstatcache();
} }
@ -324,7 +323,6 @@ if ($action == 'refreshmanual')
$dirtotest=$conf->ecm->dir_output.'/'.$dirdesc['fullrelativename']; $dirtotest=$conf->ecm->dir_output.'/'.$dirdesc['fullrelativename'];
if (! dol_is_dir($dirtotest)) if (! dol_is_dir($dirtotest))
{ {
$mesg.=$dirtotest." not found onto disk. We delete from database dir with id=".$dirdesc['id']."<br>\n";
$ecmdirtmp->id=$dirdesc['id']; $ecmdirtmp->id=$dirdesc['id'];
$ecmdirtmp->delete($user,'databaseonly'); $ecmdirtmp->delete($user,'databaseonly');
//exit; //exit;
@ -436,9 +434,6 @@ if ($action == 'delete' && empty($conf->use_javascript_ajax))
} }
dol_htmloutput_mesg($mesg);
if (! empty($conf->use_javascript_ajax)) $classviewhide='hidden'; if (! empty($conf->use_javascript_ajax)) $classviewhide='hidden';
else $classviewhide='visible'; else $classviewhide='visible';

View File

@ -87,15 +87,14 @@ if ($action == 'addcontact' && $user->rights->expedition->creer)
} }
else else
{ {
if ($objectsrc->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') if ($objectsrc->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
{
$langs->load("errors"); $langs->load("errors");
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>'; $mesg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType");
} } else {
else $mesg = $objectsrc->error;
{
$mesg = '<div class="error">'.$objectsrc->error.'</div>';
} }
setEventMessage($mesg, 'errors');
} }
} }
@ -146,7 +145,6 @@ $userstatic=new User($db);
/* Mode vue et edition */ /* Mode vue et edition */
/* */ /* */
/* *************************************************************************** */ /* *************************************************************************** */
dol_htmloutput_mesg($mesg);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {

View File

@ -166,6 +166,8 @@ if ($action=='selectfield')
} }
//print_r($array_selected); //print_r($array_selected);
$_SESSION["export_selected_fields"]=$array_selected; $_SESSION["export_selected_fields"]=$array_selected;
setEventMessage($warnings, 'warnings');
} }
} }
@ -488,9 +490,6 @@ if ($step == 2 && $datatoexport)
print '</table>'; print '</table>';
print '<br>'; print '<br>';
if ($warnings) dol_htmloutput_mesg('',$warnings,'warning');
// Combo list of export models // Combo list of export models
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';

View File

@ -59,12 +59,12 @@ if ($action == 'update')
if ($i >= 2) if ($i >= 2)
{ {
$db->commit(); $db->commit();
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
$db->rollback(); $db->rollback();
$mesg="<div class=\"error\">".$db->lasterror()."</div>"; setEventMessage($db->lasterror(), 'errors');
} }
} }
@ -120,10 +120,6 @@ print "</center>";
print "</form>\n"; print "</form>\n";
dol_htmloutput_mesg($mesg);
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -64,15 +64,14 @@ if ($action == 'addcontact' && $user->rights->ficheinter->creer)
} }
else else
{ {
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
{
$langs->load("errors"); $langs->load("errors");
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>'; $mesg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType");
} } else {
else $mesg = $object->error;
{
$mesg = '<div class="error">'.$object->error.'</div>';
} }
setEventMessage($mesg, 'errors');
} }
} }
@ -109,9 +108,7 @@ $userstatic=new User($db);
llxHeader(); llxHeader();
// Mode vue et edition // Mode vue et edition
dol_htmloutput_mesg($mesg);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {

View File

@ -1117,7 +1117,7 @@ else if ($id > 0 || ! empty($ref))
if (empty($numref)) if (empty($numref))
{ {
$error++; $error++;
dol_htmloutput_errors($object->error); setEventMessage($object->error, 'errors');
} }
} }
else else

View File

@ -60,8 +60,6 @@ $form = new Form($db);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
dol_htmloutput_mesg($mesg);
$societe = new Societe($db); $societe = new Societe($db);
if ($societe->fetch($object->socid)) if ($societe->fetch($object->socid))
{ {

View File

@ -69,11 +69,11 @@ if ($action == 'addcontact' && $user->rights->fournisseur->commande->creer)
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{ {
$langs->load("errors"); $langs->load("errors");
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>'; setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
} }
else else
{ {
$mesg = '<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
} }
@ -126,7 +126,6 @@ $userstatic=new User($db);
/* Mode vue et edition */ /* Mode vue et edition */
/* */ /* */
/* *************************************************************************** */ /* *************************************************************************** */
dol_htmloutput_mesg($mesg);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {

View File

@ -641,7 +641,7 @@ else if ($action == 'livraison' && $user->rights->fournisseur->commande->recepti
} }
else else
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Delivery")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Delivery")), 'errors');
} }
} }
@ -770,7 +770,7 @@ else if ($action == 'add' && $user->rights->fournisseur->commande->creer)
if ($socid <1) if ($socid <1)
{ {
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')).'</div>'; setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')), 'errors');
$action='create'; $action='create';
$error++; $error++;
} }
@ -801,7 +801,7 @@ else if ($action == 'add' && $user->rights->fournisseur->commande->creer)
{ {
$langs->load("errors"); $langs->load("errors");
$db->rollback(); $db->rollback();
$mesg='<div class="error">'.$langs->trans($object->error).'</div>'; setEventMessage($langs->trans($object->error), 'errors');
$action='create'; $action='create';
$_GET['socid']=$_POST['socid']; $_GET['socid']=$_POST['socid'];
} }
@ -1073,7 +1073,6 @@ if ($action=="create")
{ {
print_fiche_titre($langs->trans('NewOrder')); print_fiche_titre($langs->trans('NewOrder'));
dol_htmloutput_mesg($mesg);
dol_htmloutput_events(); dol_htmloutput_events();
$societe=''; $societe='';

View File

@ -69,11 +69,11 @@ if ($action == 'addcontact' && $user->rights->fournisseur->facture->creer)
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{ {
$langs->load("errors"); $langs->load("errors");
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>'; setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
} }
else else
{ {
$mesg = '<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
} }
@ -125,7 +125,6 @@ $userstatic=new User($db);
/* Mode vue et edition */ /* Mode vue et edition */
/* */ /* */
/* *************************************************************************** */ /* *************************************************************************** */
dol_htmloutput_mesg($mesg);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {

View File

@ -52,8 +52,6 @@ $langs->load('companies');
$langs->load('products'); $langs->load('products');
$langs->load('banks'); $langs->load('banks');
$mesg='';
$errors=array();
$id = (GETPOST('facid','int') ? GETPOST('facid','int') : GETPOST('id','int')); $id = (GETPOST('facid','int') ? GETPOST('facid','int') : GETPOST('id','int'));
$action = GETPOST("action"); $action = GETPOST("action");
$confirm = GETPOST("confirm"); $confirm = GETPOST("confirm");
@ -92,12 +90,12 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
// Action clone object // Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes') if ($action == 'confirm_clone' && $confirm == 'yes')
{ {
if (1==0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) // if (1==0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
{ // {
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>'; // $mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
} // }
else // else
{ // {
$result=$object->createFromClone($id); $result=$object->createFromClone($id);
if ($result > 0) if ($result > 0)
{ {
@ -107,10 +105,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
else else
{ {
$langs->load("errors"); $langs->load("errors");
$mesg='<div class="error">'.$langs->trans($object->error).'</div>'; setEventMessage($langs->trans($object->error), 'errors');
$action=''; $action='';
} }
} // }
} }
elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fournisseur->facture->valider) elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fournisseur->facture->valider)
@ -137,7 +135,7 @@ elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fourni
if (! $idwarehouse || $idwarehouse == -1) if (! $idwarehouse || $idwarehouse == -1)
{ {
$error++; $error++;
$errors[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")); setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), 'errors');
$action=''; $action='';
} }
} }
@ -165,7 +163,7 @@ elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fourn
} }
else else
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
@ -180,7 +178,7 @@ elseif ($action == 'confirm_delete_line' && $confirm == 'yes' && $user->rights->
} }
else else
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
/* Fix bug 1485 : Reset action to avoid asking again confirmation on failure */ /* Fix bug 1485 : Reset action to avoid asking again confirmation on failure */
$action=''; $action='';
} }
@ -258,7 +256,9 @@ elseif ($action == 'deletepaiement' && $user->rights->fournisseur->facture->cree
$paiementfourn = new PaiementFourn($db); $paiementfourn = new PaiementFourn($db);
$result=$paiementfourn->fetch(GETPOST('paiement_id')); $result=$paiementfourn->fetch(GETPOST('paiement_id'));
if ($result > 0) $result=$paiementfourn->delete(); // If fetch ok and found if ($result > 0) $result=$paiementfourn->delete(); // If fetch ok and found
if ($result < 0) $mesg='<div class="error">'.$paiementfourn->error.'</div>'; if ($result < 0) {
setEventMessage($paiementfourn->error, 'errors');
}
} }
} }
@ -272,21 +272,21 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
if (GETPOST('socid','int')<1) if (GETPOST('socid','int')<1)
{ {
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')).'</div>'; setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')), 'errors');
$action='create'; $action='create';
$error++; $error++;
} }
if ($datefacture == '') if ($datefacture == '')
{ {
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')).'</div>'; setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')), 'errors');
$action='create'; $action='create';
$_GET['socid']=$_POST['socid']; $_GET['socid']=$_POST['socid'];
$error++; $error++;
} }
if (! GETPOST('ref_supplier')) if (! GETPOST('ref_supplier'))
{ {
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('RefSupplier')).'</div>'; setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('RefSupplier')), 'errors');
$action='create'; $action='create';
$_GET['socid']=$_POST['socid']; $_GET['socid']=$_POST['socid'];
$error++; $error++;
@ -457,7 +457,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
{ {
$langs->load("errors"); $langs->load("errors");
$db->rollback(); $db->rollback();
$mesg='<div class="error">'.$langs->trans($object->error).'</div>'; setEventMessage($langs->trans($object->error), 'errors');
$action='create'; $action='create';
$_GET['socid']=$_POST['socid']; $_GET['socid']=$_POST['socid'];
} }
@ -631,14 +631,14 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
// Product not selected // Product not selected
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ProductOrService")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ProductOrService")), 'errors');
} }
if ($idprod == -1) if ($idprod == -1)
{ {
// Quantity too low // Quantity too low
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$mesg='<div class="error">'.$langs->trans("ErrorQtyTooLowForThisSupplier").'</div>'; setEventMessage($langs->trans("ErrorQtyTooLowForThisSupplier"), 'errors');
} }
} }
else if( GETPOST('price_ht')!=='' || GETPOST('price_ttc')!=='' ) else if( GETPOST('price_ht')!=='' || GETPOST('price_ttc')!=='' )
@ -732,10 +732,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
else else
{ {
$db->rollback(); $db->rollback();
if (empty($mesg)) setEventMessage($object->error, 'errors');
{
$mesg='<div class="error">'.$object->error.'</div>';
}
} }
$action = ''; $action = '';
@ -798,7 +795,7 @@ elseif ($action == 'reopen' && $user->rights->fournisseur->facture->creer)
} }
else else
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
} }
@ -948,7 +945,6 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
else else
{ {
$langs->load("other"); $langs->load("other");
$mesg='<div class="error">';
if ($mailfile->error) if ($mailfile->error)
{ {
$mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
@ -958,7 +954,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
{ {
$mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
} }
$mesg.='</div>'; setEventMessage($mesg, 'errors');
} }
} }
} }
@ -966,7 +962,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
else else
{ {
$langs->load("other"); $langs->load("other");
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').'</div>'; setEventMessage($langs->trans('ErrorMailRecipientIsEmpty'), 'errors');
dol_syslog('Recipient email is empty'); dol_syslog('Recipient email is empty');
} }
/* } /* }
@ -980,7 +976,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
else else
{ {
$langs->load("other"); $langs->load("other");
$mesg='<div class="error">'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")).'</div>'; setEventMessage($langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")), 'errors');
dol_syslog('Unable to read data from the invoice. The invoice file has perhaps not been generated.'); dol_syslog('Unable to read data from the invoice. The invoice file has perhaps not been generated.');
} }
@ -1064,11 +1060,11 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->fourniss
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{ {
$langs->load("errors"); $langs->load("errors");
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>'; setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
} }
else else
{ {
$mesg = '<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
} }
@ -1119,7 +1115,6 @@ if ($action == 'create')
{ {
print_fiche_titre($langs->trans('NewBill')); print_fiche_titre($langs->trans('NewBill'));
dol_htmloutput_mesg($mesg);
dol_htmloutput_events(); dol_htmloutput_events();
$societe=''; $societe='';
@ -1146,7 +1141,6 @@ if ($action == 'create')
$element = $subelement = 'commande'; $element = $subelement = 'commande';
} }
if ($element == 'propal') { if ($element == 'propal') {
dol_htmloutput_errors('',$errors);
$element = 'comm/propal'; $subelement = 'propal'; $element = 'comm/propal'; $subelement = 'propal';
} }
if ($element == 'contract') { if ($element == 'contract') {
@ -1479,9 +1473,6 @@ else
dol_fiche_head($head, 'card', $titre, 0, 'bill'); dol_fiche_head($head, 'card', $titre, 0, 'bill');
dol_htmloutput_mesg($mesg);
dol_htmloutput_errors('',$errors);
// Confirmation de la suppression d'une ligne produit // Confirmation de la suppression d'une ligne produit
if ($action == 'confirm_delete_line') if ($action == 'confirm_delete_line')
{ {

View File

@ -503,9 +503,6 @@ if (empty($action))
print_barre_liste($langs->trans('SupplierPayments'), $page, 'paiement.php',$paramlist,$sortfield,$sortorder,'',$num); print_barre_liste($langs->trans('SupplierPayments'), $page, 'paiement.php',$paramlist,$sortfield,$sortorder,'',$num);
if ($mesg) dol_htmloutput_mesg($mesg);
if ($errmsg) dol_htmloutput_errors($errmsg);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';

View File

@ -36,8 +36,6 @@ $langs->load('banks');
$langs->load('companies'); $langs->load('companies');
$langs->load("suppliers"); $langs->load("suppliers");
$mesg='';
$id = GETPOST('id','int'); $id = GETPOST('id','int');
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$confirm = GETPOST('confirm','alpha'); $confirm = GETPOST('confirm','alpha');
@ -61,7 +59,7 @@ if ($action == 'setnote' && $user->rights->fournisseur->facture->creer)
} }
else else
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
$db->rollback(); $db->rollback();
} }
} }
@ -80,7 +78,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisse
} }
else else
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
$db->rollback(); $db->rollback();
} }
} }
@ -98,7 +96,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->fournisse
} }
else else
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
$db->rollback(); $db->rollback();
} }
} }
@ -109,11 +107,11 @@ if ($action == 'setnum_paiement' && ! empty($_POST['num_paiement']))
$res = $object->update_num($_POST['num_paiement']); $res = $object->update_num($_POST['num_paiement']);
if ($res === 0) if ($res === 0)
{ {
$mesg = '<div class="ok">'.$langs->trans('PaymentNumberUpdateSucceeded').'</div>'; $setEventMessage($langs->trans('PaymentNumberUpdateSucceeded'));
} }
else else
{ {
$mesg = '<div class="error">'.$langs->trans('PaymentNumberUpdateFailed').'</div>'; setEventMessage($langs->trans('PaymentNumberUpdateFailed'), 'errors');
} }
} }
@ -124,11 +122,11 @@ if ($action == 'setdatep' && ! empty($_POST['datepday']))
$res = $object->update_date($datepaye); $res = $object->update_date($datepaye);
if ($res === 0) if ($res === 0)
{ {
$mesg = '<div class="ok">'.$langs->trans('PaymentDateUpdateSucceeded').'</div>'; setEventMessage($langs->trans('PaymentDateUpdateSucceeded'));
} }
else else
{ {
$mesg = '<div class="error">'.$langs->trans('PaymentDateUpdateFailed').'</div>'; setEventMessage($langs->trans('PaymentDateUpdateFailed'), 'errors');
} }
} }
@ -229,8 +227,6 @@ if ($result > 0)
print '</table>'; print '</table>';
dol_htmloutput_mesg($mesg);
print '<br>'; print '<br>';
/** /**

View File

@ -58,18 +58,17 @@ if ($action == 'add' || GETPOST('modify','alpha'))
$ftp_server = "FTP_SERVER_" . $entry; //$_POST["numero_entry"]; $ftp_server = "FTP_SERVER_" . $entry; //$_POST["numero_entry"];
$error=0; $error=0;
$mesg='';
if (! GETPOST("$ftp_name",'alpha')) if (! GETPOST("$ftp_name",'alpha'))
{ {
$error=1; $error=1;
$mesg.='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Label")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Label")), 'errors');
} }
if (! GETPOST("$ftp_server",'alpha')) if (! GETPOST("$ftp_server",'alpha'))
{ {
$error=1; $error=1;
$mesg.='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Server")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Server")), 'errors');
} }
if (! $error) if (! $error)
@ -91,7 +90,6 @@ if ($action == 'add' || GETPOST('modify','alpha'))
if ($result1 && $result2 && $result3 && $result4 && $result5 && $result6) if ($result1 && $result2 && $result3 && $result4 && $result5 && $result6)
{ {
$db->commit(); $db->commit();
//$mesg='<div class="ok">'.$langs->trans("Success").'</div>';
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} }
@ -119,7 +117,6 @@ if (GETPOST('delete','alpha'))
if ($result1 && $result2 && $result3 && $result4 && $result5 && $result6) if ($result1 && $result2 && $result3 && $result4 && $result5 && $result6)
{ {
$db->commit(); $db->commit();
//$mesg='<div class="ok">'.$langs->trans("Success").'</div>';
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} }
@ -301,9 +298,6 @@ else
} }
dol_htmloutput_mesg($mesg);
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -100,8 +100,6 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
$resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),0); $resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),0);
if (is_numeric($resupload) && $resupload > 0) if (is_numeric($resupload) && $resupload > 0)
{ {
//$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
//print_r($_FILES);
$result=$ecmdir->changeNbOfFiles('+'); $result=$ecmdir->changeNbOfFiles('+');
} }
else { else {
@ -124,7 +122,7 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{ {
// Echec transfert (fichier depassant la limite ?) // Echec transfert (fichier depassant la limite ?)
$langs->load("errors"); $langs->load("errors");
$mesg = '<div class="error">'.$langs->trans("ErrorFailToCreateDir",$upload_dir).'</div>'; setEventMessage($langs->trans("ErrorFailToCreateDir",$upload_dir), 'errors');
} }
} }
@ -143,7 +141,8 @@ if ($_POST["action"] == 'add' && $user->rights->ftp->setup)
} }
else else
{ {
$mesg='<div class="error">Error '.$langs->trans($ecmdir->error).'</div>'; //TODO: Translate
setEventMessage('Error '.$langs->trans($ecmdir->error));
$_GET["action"] = "create"; $_GET["action"] = "create";
} }
} }
@ -175,12 +174,12 @@ if ($_REQUEST['action'] == 'confirm_deletefile' && $_REQUEST['confirm'] == 'yes'
$result=@ftp_delete($conn_id, $newremotefileiso); $result=@ftp_delete($conn_id, $newremotefileiso);
if ($result) if ($result)
{ {
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",$file).'</div>'; setEventMessage($langs->trans("FileWasRemoved",$file));
} }
else else
{ {
dol_syslog("ftp/index.php ftp_delete", LOG_ERR); dol_syslog("ftp/index.php ftp_delete", LOG_ERR);
$mesg = '<div class="error">'.$langs->trans("FTPFailedToRemoveFile",$file).'</div>'; setEventMessage($langs->trans("FTPFailedToRemoveFile",$file), 'errors');
} }
//ftp_close($conn_id); Close later //ftp_close($conn_id); Close later
@ -225,12 +224,12 @@ if ($_POST["const"] && $_POST["delete"] && $_POST["delete"] == $langs->trans("De
$result=@ftp_delete($conn_id, $newremotefileiso); $result=@ftp_delete($conn_id, $newremotefileiso);
if ($result) if ($result)
{ {
$mesg .= '<div class="ok">'.$langs->trans("FileWasRemoved",$file).'</div>'; setEventMessage($langs->trans("FileWasRemoved",$file));
} }
else else
{ {
dol_syslog("ftp/index.php ftp_delete", LOG_ERR); dol_syslog("ftp/index.php ftp_delete", LOG_ERR);
$mesg .= '<div class="error">'.$langs->trans("FTPFailedToRemoveFile",$file).'</div>'; setEventMessage($langs->trans("FTPFailedToRemoveFile",$file), 'errors');
} }
//ftp_close($conn_id); Close later //ftp_close($conn_id); Close later
@ -269,11 +268,11 @@ if ($_REQUEST['action'] == 'confirm_deletesection' && $_REQUEST['confirm'] == 'y
$result=@ftp_rmdir($conn_id, $newremotefileiso); $result=@ftp_rmdir($conn_id, $newremotefileiso);
if ($result) if ($result)
{ {
$mesg = '<div class="ok">'.$langs->trans("DirWasRemoved",$file).'</div>'; setEventMessage($langs->trans("DirWasRemoved",$file));
} }
else else
{ {
$mesg = '<div class="error">'.$langs->trans("FTPFailedToRemoveDir",$file).'</div>'; setEventMessage($langs->trans("FTPFailedToRemoveDir",$file), 'errors');
} }
//ftp_close($conn_id); Close later //ftp_close($conn_id); Close later
@ -340,7 +339,8 @@ if ($_REQUEST['action'] == 'download')
} }
else else
{ {
$mesg='<div class="error">Failed to get file '.$remotefile.'</div>'; //TODO: Translate
setEventMessage('Failed to get file '.$remotefile, 'errors');
} }
} }
@ -444,9 +444,6 @@ else
print '<br>'; print '<br>';
print "<br>\n"; print "<br>\n";
if ($mesg) { print $mesg."<br>"; }
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="numero_ftp" value="'.$numero_ftp.'">'; print '<input type="hidden" name="numero_ftp" value="'.$numero_ftp.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -596,9 +593,6 @@ else
print "</table>"; print "</table>";
if (! $ok && $mesg) print $mesg;
// Actions // Actions
/* /*
if ($user->rights->ftp->write && ! empty($section)) if ($user->rights->ftp->write && ! empty($section))

View File

@ -59,7 +59,6 @@ $cp = new Holiday($db);
// Contrôle du formulaire // Contrôle du formulaire
if ($action == "add") if ($action == "add")
{ {
$message = '';
$error = 0; $error = 0;
// Option du groupe de validation // Option du groupe de validation
@ -142,9 +141,9 @@ if ($action == "add")
if ($error) if ($error)
{ {
$message = '<div class="error">'.$langs->trans('ErrorUpdateConfCP').'</div>'; setEventMessage($langs->trans('ErrorUpdateConfCP'), 'errors');
} else { } else {
$message = '<div class="ok">'.$langs->trans('UpdateConfCPOK').'</div>'; setEventMessage($langs->trans('UpdateConfCPOK'));
} }
// Si première mise à jour, prévenir l'utilisateur de mettre à jour le solde des congés payés // Si première mise à jour, prévenir l'utilisateur de mettre à jour le solde des congés payés
@ -156,12 +155,9 @@ if ($action == "add")
if($num < 1) if($num < 1)
{ {
$cp->createCPusers(); $cp->createCPusers();
$message.= '<br /><div class="warning">'.$langs->trans('AddCPforUsers').'</div>'; setEventMessage($langs->trans('AddCPforUsers'), 'warnings');
} }
dol_htmloutput_mesg($message);
// Si il s'agit de créer un event // Si il s'agit de créer un event
} }
elseif ($action == 'create_event') elseif ($action == 'create_event')
@ -173,12 +169,12 @@ elseif ($action == 'create_event')
if (! $optName) if (! $optName)
{ {
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name")), 'errors');
$error++; $error++;
} }
if (! $optValue > 0) if (! $optValue > 0)
{ {
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Value")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Value")), 'errors');
$error++; $error++;
} }
@ -190,17 +186,15 @@ elseif ($action == 'create_event')
$result = $cp->createEventCP($user); $result = $cp->createEventCP($user);
if($result > 0) if($result > 0)
{ {
$message = 'OkCreateEventCP'; setEventMessage('OkCreateEventCP');
$optName=''; $optName='';
$optValue=''; $optValue='';
} }
else else
{ {
$message = '<div class="error">'.$cp->error.'</div>'; setEventMessage($cp->error, 'errors');
} }
} }
dol_htmloutput_mesg($message);
} }
elseif($action == 'event' && isset($_POST['update_event'])) elseif($action == 'event' && isset($_POST['update_event']))
{ {
@ -234,15 +228,13 @@ elseif($action == 'event' && isset($_POST['update_event']))
// Mise à jour des congés de l'utilisateur // Mise à jour des congés de l'utilisateur
$update = $cp->updateEventCP($eventId,$eventName,$eventValue); $update = $cp->updateEventCP($eventId,$eventName,$eventValue);
if(!$update) { if(!$update) {
$message='ErrorUpdateEventCP'; setEventMessage('ErrorUpdateEventCP', 'errors');
} else { } else {
$message='UpdateEventOkCP'; setEventMessage('UpdateEventOkCP');
} }
} else { } else {
$message='ErrorUpdateEventCP'; setEventMessage('ErrorUpdateEventCP', 'errors');
} }
dol_htmloutput_mesg($message);
} }
elseif($action && isset($_POST['delete_event'])) elseif($action && isset($_POST['delete_event']))
{ {

View File

@ -84,10 +84,7 @@ if ($action == 'update' && isset($_POST['update_cp']))
dol_syslog('define_holiday update lastUpdate entry', LOG_DEBUG); dol_syslog('define_holiday update lastUpdate entry', LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
$mesg='<div class="ok">'.$langs->trans('UpdateConfCPOK').'</div>'; setEventMessage($langs->trans('UpdateConfCPOK'));
dol_htmloutput_mesg($mesg);
} }
elseif($action == 'add_event') elseif($action == 'add_event')
{ {
@ -105,7 +102,7 @@ elseif($action == 'add_event')
if ($error) if ($error)
{ {
$message = '<div class="error">'.$langs->trans('ErrorAddEventToUserCP').'</div>'; setEventMessage($langs->trans('ErrorAddEventToUserCP'), 'errors');
} }
else else
{ {
@ -118,10 +115,8 @@ elseif($action == 'add_event')
$holiday->updateSoldeCP($userCP,$new_holiday); $holiday->updateSoldeCP($userCP,$new_holiday);
$message = $langs->trans('AddEventToUserOkCP'); setEventMessage($langs->trans('AddEventToUserOkCP'));
} }
dol_htmloutput_mesg($message);
} }
$langs->load('users'); $langs->load('users');

View File

@ -705,7 +705,7 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
break; break;
} }
dol_htmloutput_mesg('',$errors,'error'); setEventMessage($errors, 'errors');
} }
@ -890,7 +890,7 @@ else
break; break;
} }
dol_htmloutput_mesg('',$errors,'error'); setEventMessage($errors, 'errors');
} }
// On vérifie si l'utilisateur à le droit de lire cette demande // On vérifie si l'utilisateur à le droit de lire cette demande

View File

@ -138,11 +138,11 @@ if ($action == 'builddoc')
$result=$objimport->build_file($user, GETPOST('model','alpha'), $datatoimport, $array_match_file_to_database); $result=$objimport->build_file($user, GETPOST('model','alpha'), $datatoimport, $array_match_file_to_database);
if ($result < 0) if ($result < 0)
{ {
$mesg='<div class="error">'.$objimport->error.'</div>'; setEventMessage($objimport->error, 'errors');
} }
else else
{ {
$mesg='<div class="ok">'.$langs->trans("FileSuccessfullyBuilt").'</div>'; setEventMessage($langs->trans("FileSuccessfullyBuilt"));
} }
} }
@ -175,21 +175,23 @@ if ($action == 'add_import_model')
$result = $objimport->create($user); $result = $objimport->create($user);
if ($result >= 0) if ($result >= 0)
{ {
$mesg='<div class="ok">'.$langs->trans("ImportModelSaved",$objimport->model_name).'</div>'; setEventMessage($langs->trans("ImportModelSaved",$objimport->model_name));
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
if ($objimport->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS') if ($objimport->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{ {
$mesg='<div class="error">'.$langs->trans("ErrorImportDuplicateProfil").'</div>'; setEventMessage($langs->trans("ErrorImportDuplicateProfil"), 'errors');
}
else {
setEventMessage($objimport->error, 'errors');
} }
else $mesg='<div class="error">'.$objimport->error.'</div>';
} }
} }
else else
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("ImportModelName")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("ImportModelName")), 'errors');
} }
} }
@ -385,8 +387,6 @@ if ($step == 1 || ! $datatoimport)
dol_fiche_end(); dol_fiche_end();
if ($mesg) print $mesg;
} }
@ -461,7 +461,6 @@ if ($step == 2 && $datatoimport)
dol_fiche_end(); dol_fiche_end();
if ($mesg) print $mesg;
} }
@ -597,10 +596,7 @@ if ($step == 3 && $datatoimport)
print '</table></form>'; print '</table></form>';
dol_fiche_end(); dol_fiche_end();
if ($mesg) print $mesg;
} }
@ -1010,9 +1006,6 @@ if ($step == 4 && $datatoimport)
print '</script>'."\n"; print '</script>'."\n";
} }
if ($mesg) print $mesg;
/* /*
* Barre d'action * Barre d'action
*/ */
@ -1438,8 +1431,6 @@ if ($step == 5 && $datatoimport)
} }
print '</center>'; print '</center>';
} }
if ($mesg) print $mesg;
} }
@ -1679,8 +1670,6 @@ if ($step == 6 && $datatoimport)
print $langs->trans("FileWasImported",$importid).'<br>'; print $langs->trans("FileWasImported",$importid).'<br>';
print $langs->trans("YouCanUseImportIdToFindRecord",$importid).'<br>'; print $langs->trans("YouCanUseImportIdToFindRecord",$importid).'<br>';
print '</center>'; print '</center>';
if ($mesg) print $mesg;
} }

View File

@ -67,7 +67,7 @@ if ($action == 'setvalue' && $user->admin)
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
$mesg='<div class="ok">'.$langs->trans("SetupSaved").'</div>'; setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
@ -227,8 +227,6 @@ if (! empty($conf->adherent->enabled))
print "<br>"; print "<br>";
print info_admin($langs->trans("YouCanAddTagOnUrl")); print info_admin($langs->trans("YouCanAddTagOnUrl"));
dol_htmloutput_mesg($mesg);
$db->close(); $db->close();
dol_fiche_end(); dol_fiche_end();
llxFooter(); llxFooter();

View File

@ -91,12 +91,12 @@ if ($action == 'setModuleOptions')
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
$db->rollback(); $db->rollback();
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; setEventMessage($langs->trans("Error"), 'errors');
} }
} }
@ -178,11 +178,11 @@ if($action)
if (! $error) if (! $error)
{ {
$mesg = '<font class="ok">'.$langs->trans("SetupSaved").'</font>'; setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
$mesg = '<font class="error">'.$langs->trans("Error").'</font>'; setEventMessage($langs->trans("Error"), 'errors');
} }
} }
@ -505,14 +505,13 @@ if (! empty($conf->global->PRODUCT_CANVAS_ABILITY))
} }
else else
{ {
//TODO: Translate
print "<tr><td><b>ERROR</b>: $dir is not a directory !</td></tr>\n"; print "<tr><td><b>ERROR</b>: $dir is not a directory !</td></tr>\n";
} }
print '</table>'; print '</table>';
} }
dol_htmloutput_mesg($mesg);
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -89,8 +89,6 @@ dol_fiche_head($head, 'attributes', $tab, 0, 'product');
print $langs->trans('DefineHereComplementaryAttributes', $tab).'<br>'."\n"; print $langs->trans('DefineHereComplementaryAttributes', $tab).'<br>'."\n";
print '<br>'; print '<br>';
dol_htmloutput_errors($mesg);
// Load attribute_label // Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype); $extrafields->fetch_name_optionals_label($elementtype);

View File

@ -49,8 +49,6 @@ $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid'); $fieldtype = (! empty($ref) ? 'ref' : 'rowid');
$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype);
$mesg = '';
$product = new Product($db); $product = new Product($db);
$productid=0; $productid=0;
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
@ -83,8 +81,11 @@ $cancel <> $langs->trans("Cancel") &&
{ {
$error++; $error++;
$action = 're-edit'; $action = 're-edit';
if ($product->error == "isFatherOfThis") $mesg = $langs->trans("ErrorAssociationIsFatherOfThis"); if ($product->error == "isFatherOfThis") {
else $mesg=$product->error; setEventMessage($langs->trans("ErrorAssociationIsFatherOfThis"), 'errors');
} else {
setEventMessage($product->error, 'errors');
}
} }
} }
else else
@ -97,7 +98,7 @@ $cancel <> $langs->trans("Cancel") &&
{ {
$error++; $error++;
$action = 're-edit'; $action = 're-edit';
$mesg=$product->error; setEventMessage($product->error, 'errors');
} }
} }
} }
@ -161,10 +162,6 @@ if ($action == 'search')
llxHeader("","",$langs->trans("CardProduct".$product->type)); llxHeader("","",$langs->trans("CardProduct".$product->type));
dol_htmloutput_errors($mesg);
$head=product_prepare_head($product, $user); $head=product_prepare_head($product, $user);
$titre=$langs->trans("CardProduct".$product->type); $titre=$langs->trans("CardProduct".$product->type);
$picto=($product->type==1?'service':'product'); $picto=($product->type==1?'service':'product');

View File

@ -43,7 +43,7 @@ $rowid=GETPOST('rowid','int');
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$socid=GETPOST('socid', 'int'); $socid=GETPOST('socid', 'int');
$backtopage=GETPOST('backtopage','alpha'); $backtopage=GETPOST('backtopage','alpha');
$error=0; $mesg = ''; $error=0;
// If socid provided by ajax company selector // If socid provided by ajax company selector
if (! empty($_REQUEST['search_fourn_id'])) if (! empty($_REQUEST['search_fourn_id']))
@ -92,7 +92,7 @@ if ($action == 'remove_pf')
{ {
$result=$product->remove_product_fournisseur_price($rowid); $result=$product->remove_product_fournisseur_price($rowid);
$action = ''; $action = '';
$mesg = '<div class="ok">'.$langs->trans("PriceRemoved").'.</div>'; setEventMessage($langs->trans("PriceRemoved"));
} }
} }
} }
@ -112,27 +112,27 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel"))
if ($tva_tx == '') if ($tva_tx == '')
{ {
$error++; $error++;
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("VATRateForSupplierProduct")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("VATRateForSupplierProduct")), 'errors');
} }
if (empty($quantity)) if (empty($quantity))
{ {
$error++; $error++;
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Qty")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Qty")), 'errors');
} }
if (empty($ref_fourn)) if (empty($ref_fourn))
{ {
$error++; $error++;
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("RefSupplier")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("RefSupplier")), 'errors');
} }
if ($id_fourn <= 0) if ($id_fourn <= 0)
{ {
$error++; $error++;
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Supplier")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Supplier")), 'errors');
} }
if ($_POST["price"] < 0 || $_POST["price"] == '') if ($_POST["price"] < 0 || $_POST["price"] == '')
{ {
$error++; $error++;
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Price")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Price")), 'errors');
} }
$product = new ProductFournisseur($db); $product = new ProductFournisseur($db);
@ -140,7 +140,7 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel"))
if ($result <= 0) if ($result <= 0)
{ {
$error++; $error++;
$mesg=$product->error; setEventMessage($product->error, 'errors');
} }
if (! $error) if (! $error)
@ -157,12 +157,12 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel"))
$product->fetch($product->product_id_already_linked); $product->fetch($product->product_id_already_linked);
$productLink = $product->getNomUrl(1,'supplier'); $productLink = $product->getNomUrl(1,'supplier');
$mesg='<div class="error">'.$langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct",$productLink).'</div>'; setEventMessage($langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct",$productLink), 'errors');
} }
else if ($ret < 0) else if ($ret < 0)
{ {
$error++; $error++;
$mesg='<div class="error">'.$product->error.'</div>'; setEventMessage($product->error, 'errors');
} }
} }
@ -177,7 +177,7 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel"))
if ($ret < 0) if ($ret < 0)
{ {
$error++; $error++;
$mesg='<div class="error">'.$product->error.'</div>'; setEventMessage($product->error, 'errors');
} }
} }
@ -264,10 +264,6 @@ if ($id || $ref)
print "</div>\n"; print "</div>\n";
dol_htmloutput_mesg($mesg);
// Form to add or update a price // Form to add or update a price
if (($action == 'add_price' || $action == 'updateprice' ) && ($user->rights->produit->creer || $user->rights->service->creer)) if (($action == 'add_price' || $action == 'updateprice' ) && ($user->rights->produit->creer || $user->rights->service->creer))
{ {

View File

@ -230,7 +230,9 @@ else
llxHeader('',$title,$helpurl,''); llxHeader('',$title,$helpurl,'');
// Displays product removal confirmation // Displays product removal confirmation
if (GETPOST('delprod')) dol_htmloutput_mesg($langs->trans("ProductDeleted",GETPOST('delprod'))); if (GETPOST('delprod')) {
setEventMessage($langs->trans("ProductDeleted", GETPOST('delprod')));
}
$param="&amp;sref=".$sref.($sbarcode?"&amp;sbarcode=".$sbarcode:"")."&amp;snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy; $param="&amp;sref=".$sref.($sbarcode?"&amp;sbarcode=".$sbarcode:"")."&amp;snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy;
$param.=($fourn_id?"&amp;fourn_id=".$fourn_id:""); $param.=($fourn_id?"&amp;fourn_id=".$fourn_id:"");

View File

@ -94,15 +94,16 @@ if ($action == 'update_price' && ! $_POST ["cancel"] && ($user->rights->produit-
if ($object->updatePrice($newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq) > 0) { if ($object->updatePrice($newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq) > 0) {
$action = ''; $action = '';
$mesg = '<div class="ok">' . $langs->trans("RecordSaved") . '</div>'; setEventMessage($langs->trans("RecordSaved"));
} else { } else {
$action = 'edit_price'; $action = 'edit_price';
$mesg = '<div class="error">' . $object->error . '</div>'; setEventMessage($object->error, 'errors');
} }
} else if ($action == 'delete' && $user->rights->produit->supprimer) { } else if ($action == 'delete' && $user->rights->produit->supprimer) {
$result = $object->log_price_delete($user, $_GET ["lineid"]); $result = $object->log_price_delete($user, $_GET ["lineid"]);
if ($result < 0) if ($result < 0) {
$mesg = '<div class="error">' . $object->error . '</div>'; setEventMessage($object->error, 'errors');
}
} }
/** /**
@ -136,11 +137,11 @@ if ($action == 'update_price_by_qty') { // Ajout / Mise à jour d'un prix par qu
if (empty($quantity)) { if (empty($quantity)) {
$error ++; $error ++;
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentities("Qty")) . '</div>'; setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("Qty")), 'errors');
} }
if (empty($newprice)) { if (empty($newprice)) {
$error ++; $error ++;
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentities("Price")) . '</div>'; setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("Price")), 'errors');
} }
if (! $error) { if (! $error) {
// Calcul du prix HT et du prix unitaire // Calcul du prix HT et du prix unitaire
@ -547,10 +548,6 @@ print "</table>\n";
print "</div>\n"; print "</div>\n";
if (! empty($mesg)) {
dol_htmloutput_mesg($mesg);
}
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* Barre d'action */ /* Barre d'action */

View File

@ -43,8 +43,6 @@ $id = GETPOST("id",'int');
if (! $sortfield) $sortfield="p.ref"; if (! $sortfield) $sortfield="p.ref";
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="DESC";
$mesg = '';
// Security check // Security check
$result=restrictedArea($user,'stock'); $result=restrictedArea($user,'stock');
@ -80,10 +78,10 @@ if ($action == 'add' && $user->rights->stock->creer)
} }
$action = 'create'; $action = 'create';
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
else { else {
$mesg='<div class="error">'.$langs->trans("ErrorWarehouseRefRequired").'</div>'; setEventMessage($langs->trans("ErrorWarehouseRefRequired"), 'errors');
$action="create"; // Force retour sur page creation $action="create"; // Force retour sur page creation
} }
} }
@ -101,7 +99,7 @@ if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->right
} }
else else
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
$action=''; $action='';
} }
} }
@ -124,18 +122,17 @@ if ($action == 'update' && $_POST["cancel"] <> $langs->trans("Cancel"))
if ( $object->update($id, $user) > 0) if ( $object->update($id, $user) > 0)
{ {
$action = ''; $action = '';
//$mesg = '<div class="ok">Fiche mise a jour</div>';
} }
else else
{ {
$action = 'edit'; $action = 'edit';
$mesg = '<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
else else
{ {
$action = 'edit'; $action = 'edit';
$mesg = '<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
@ -167,8 +164,6 @@ if ($action == 'create')
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="type" value="'.$type.'">'."\n"; print '<input type="hidden" name="type" value="'.$type.'">'."\n";
dol_htmloutput_mesg($mesg);
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
@ -219,8 +214,6 @@ else
$id=GETPOST("id",'int'); $id=GETPOST("id",'int');
if ($id) if ($id)
{ {
dol_htmloutput_mesg($mesg);
$object = new Entrepot($db); $object = new Entrepot($db);
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result < 0) if ($result < 0)
@ -496,7 +489,7 @@ else
*/ */
if (($action == 'edit' || $action == 're-edit') && 1) if (($action == 'edit' || $action == 're-edit') && 1)
{ {
print_fiche_titre($langs->trans("WarehouseEdit"), $mesg); $langs->trans("WarehouseEdit");
print '<form action="fiche.php" method="POST">'; print '<form action="fiche.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';

View File

@ -97,7 +97,7 @@ if ($action == 'addtime' && $user->rights->projet->creer)
} }
else else
{ {
$mesg='<div class="error">'.$langs->trans("ErrorTimeSpentIsEmpty").'</div>'; setEventMessage($langs->trans("ErrorTimeSpentIsEmpty"), 'errors');
} }
} }
@ -128,17 +128,9 @@ if ($id)
$tasksarray=$taskstatic->getTasksArray(0,0,($project->id?$project->id:$projectsListId),$socid,0); // We want to see all task of project i am allowed to see, not only mine. Later only mine will be editable later. $tasksarray=$taskstatic->getTasksArray(0,0,($project->id?$project->id:$projectsListId),$socid,0); // We want to see all task of project i am allowed to see, not only mine. Later only mine will be editable later.
$projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($user,0,($project->id?$project->id:$projectsListId),0); $projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($user,0,($project->id?$project->id:$projectsListId),0);
$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0,$user,($project->id?$project->id:$projectsListId),0); $tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0,$user,($project->id?$project->id:$projectsListId),0);
//var_dump($tasksarray);
//var_dump($projectsrole);
//var_dump($taskrole);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num);
dol_htmloutput_mesg($mesg);
print '<form name="addtime" method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$project->id.'">'; print '<form name="addtime" method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$project->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="addtime">'; print '<input type="hidden" name="action" value="addtime">';

View File

@ -60,11 +60,11 @@ if ($action == 'updateMask')
if (! $error) if (! $error)
{ {
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; setEventMessage($langs->trans("Error"), 'errors');
} }
} }
@ -79,11 +79,11 @@ if ($action == 'updateMaskTask')
if (! $error) if (! $error)
{ {
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; setEventMessage($langs->trans("Error"), 'errors');
} }
} }
@ -121,13 +121,13 @@ else if ($action == 'specimen')
} }
else else
{ {
$mesg='<div class="error">'.$obj->error.'</div>'; setEventMessage($obj->error, 'errors');
dol_syslog($obj->error, LOG_ERR); dol_syslog($obj->error, LOG_ERR);
} }
} }
else else
{ {
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>'; setEventMessage($langs->trans("ErrorModuleNotFound"), 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }
@ -166,13 +166,13 @@ else if ($action == 'specimentask')
} }
else else
{ {
$mesg='<div class="error">'.$obj->error.'</div>'; setEventMessage($obj->error, 'errors');
dol_syslog($obj->error, LOG_ERR); dol_syslog($obj->error, LOG_ERR);
} }
} }
else else
{ {
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>'; setEventMessage($langs->trans("ErrorModuleNotFound"), 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }
@ -786,8 +786,6 @@ foreach ($dirmodels as $reldir)
print '</table><br/>'; print '</table><br/>';
dol_htmloutput_mesg($mesg);
$db->close(); $db->close();
llxFooter(); llxFooter();

View File

@ -79,11 +79,11 @@ if ($action == 'addcontact' && $user->rights->projet->creer)
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{ {
$langs->load("errors"); $langs->load("errors");
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>'; setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
} }
else else
{ {
$mesg = '<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
} }
@ -137,7 +137,6 @@ $userstatic=new User($db);
/* Mode vue et edition */ /* Mode vue et edition */
/* */ /* */
/* *************************************************************************** */ /* *************************************************************************** */
dol_htmloutput_mesg($mesg);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {

Some files were not shown because too many files have changed in this diff Show More