Migrated old message notifications to the """new""" system

This commit is contained in:
Marcos García de La Fuente 2014-07-20 00:10:40 +02:00
parent 2564413a70
commit 434bb1bec7
26 changed files with 156 additions and 274 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

@ -75,12 +75,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();
} }
} }

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

@ -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

@ -54,7 +54,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 +62,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 +80,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 +106,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>';

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='';
@ -467,7 +468,7 @@ if ($action == 'add')
$mesg=$object->error; $mesg=$object->error;
} }
$mesg='<div class="error">'.$mesg.'</div>'; setEventMessage($mesg, 'errors');
$action="create"; $action="create";
} }
@ -494,7 +495,7 @@ if ($action == 'settitre' || $action == 'setemail_from' || $actino == 'setreplyt
$mesg=$object->error; $mesg=$object->error;
} }
$mesg='<div class="error">'.$mesg.'</div>'; setEventMessage($mesg, 'errors');
$action=""; $action="";
} }
@ -552,7 +553,7 @@ if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"
$mesg=$object->error; $mesg=$object->error;
} }
$mesg='<div class="error">'.$mesg.'</div>'; setEventMessage($mesg, 'errors');
$action="edit"; $action="edit";
} }
else else
@ -598,7 +599,7 @@ if ($action == 'confirm_reset' && $confirm == 'yes')
} }
else else
{ {
$mesg=$object->error; setEventMessage($object->error, 'errors');
$db->rollback(); $db->rollback();
} }
} }
@ -646,8 +647,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>';
@ -829,9 +828,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
*/ */
@ -1017,8 +1013,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

@ -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

@ -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>';
} }
} }
} }
@ -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>';
} }
} }
} }

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

@ -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

@ -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

@ -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

@ -91,7 +91,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 +118,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;
} }

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

@ -142,9 +142,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

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')
{ {

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

@ -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

@ -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

@ -45,7 +45,6 @@ $action = GETPOST('action','alpha');
$confirm = GETPOST('confirm','alpha'); $confirm = GETPOST('confirm','alpha');
$subaction = GETPOST('subaction','alpha'); $subaction = GETPOST('subaction','alpha');
$group = GETPOST("group","int",3); $group = GETPOST("group","int",3);
$message='';
// Define value to know what current user can do on users // Define value to know what current user can do on users
$canadduser=(! empty($user->admin) || $user->rights->user->user->creer); $canadduser=(! empty($user->admin) || $user->rights->user->user->creer);
@ -110,6 +109,8 @@ if ($action == 'confirm_disable' && $confirm == "yes" && $candisableuser)
} }
if ($action == 'confirm_enable' && $confirm == "yes" && $candisableuser) if ($action == 'confirm_enable' && $confirm == "yes" && $candisableuser)
{ {
$error = 0;
if ($id <> $user->id) if ($id <> $user->id)
{ {
$object->fetch($id); $object->fetch($id);
@ -119,11 +120,12 @@ if ($action == 'confirm_enable' && $confirm == "yes" && $candisableuser)
$nb = $object->getNbOfUsers("active"); $nb = $object->getNbOfUsers("active");
if ($nb >= $conf->file->main_limit_users) if ($nb >= $conf->file->main_limit_users)
{ {
$message='<div class="error">'.$langs->trans("YourQuotaOfUsersIsReached").'</div>'; $error++;
setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors');
} }
} }
if (! $message) if (! $error)
{ {
$object->setstatus(1); $object->setstatus(1);
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
@ -142,7 +144,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $candisableuser)
if ($result < 0) if ($result < 0)
{ {
$langs->load("errors"); $langs->load("errors");
$message='<div class="error">'.$langs->trans("ErrorUserCannotBeDelete").'</div>'; setEventMessage($langs->trans("ErrorUserCannotBeDelete"), 'errors');
} }
else else
{ {
@ -155,14 +157,18 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $candisableuser)
// Action ajout user // Action ajout user
if ($action == 'add' && $canadduser) if ($action == 'add' && $canadduser)
{ {
$error = 0;
if (! $_POST["lastname"]) if (! $_POST["lastname"])
{ {
$message='<div class="error">'.$langs->trans("NameNotDefined").'</div>'; $error++;
setEventMessage($langs->trans("NameNotDefined"), 'errors');
$action="create"; // Go back to create page $action="create"; // Go back to create page
} }
if (! $_POST["login"]) if (! $_POST["login"])
{ {
$message='<div class="error">'.$langs->trans("LoginNotDefined").'</div>'; $error++;
setEventMessage($langs->trans("LoginNotDefined"), 'errors');
$action="create"; // Go back to create page $action="create"; // Go back to create page
} }
@ -171,13 +177,13 @@ if ($action == 'add' && $canadduser)
$nb = $object->getNbOfUsers("active"); $nb = $object->getNbOfUsers("active");
if ($nb >= $conf->file->main_limit_users) if ($nb >= $conf->file->main_limit_users)
{ {
$message='<div class="error">'.$langs->trans("YourQuotaOfUsersIsReached").'</div>'; $error++;
setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors');
$action="create"; // Go back to create page $action="create"; // Go back to create page
} }
} }
if (! $message) if (!$error) {
{
$object->lastname = GETPOST("lastname",'alpha'); $object->lastname = GETPOST("lastname",'alpha');
$object->firstname = GETPOST("firstname",'alpha'); $object->firstname = GETPOST("firstname",'alpha');
$object->login = GETPOST("login",'alpha'); $object->login = GETPOST("login",'alpha');
@ -266,7 +272,7 @@ if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield)
} }
else else
{ {
$message.=$object->error; setEventMessage($object->error, 'errors');
} }
} }
} }
@ -281,13 +287,13 @@ if ($action == 'update' && ! $_POST["cancel"])
if (! $_POST["lastname"]) if (! $_POST["lastname"])
{ {
$message='<div class="error">'.$langs->trans("NameNotDefined").'</div>'; setEventMessage($langs->trans("NameNotDefined"), 'errors');
$action="edit"; // Go back to create page $action="edit"; // Go back to create page
$error++; $error++;
} }
if (! $_POST["login"]) if (! $_POST["login"])
{ {
$message='<div class="error">'.$langs->trans("LoginNotDefined").'</div>'; setEventMessage($langs->trans("LoginNotDefined"), 'errors');
$action="edit"; // Go back to create page $action="edit"; // Go back to create page
$error++; $error++;
} }
@ -304,7 +310,7 @@ if ($action == 'update' && ! $_POST["cancel"])
$result=$tmpuser->fetch(0, GETPOST("login")); $result=$tmpuser->fetch(0, GETPOST("login"));
if ($result > 0) if ($result > 0)
{ {
$message='<div class="error">'.$langs->trans("ErrorLoginAlreadyExists").'</div>'; setEventMessage($langs->trans("ErrorLoginAlreadyExists"), 'errors');
$action="edit"; // Go back to create page $action="edit"; // Go back to create page
$error++; $error++;
} }
@ -367,11 +373,11 @@ if ($action == 'update' && ! $_POST["cancel"])
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{ {
$langs->load("errors"); $langs->load("errors");
$message.='<div class="error">'.$langs->trans("ErrorLoginAlreadyExists",$object->login).'</div>'; setEventMessage($langs->trans("ErrorLoginAlreadyExists",$object->login), 'errors');
} }
else else
{ {
$message.='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
@ -395,12 +401,12 @@ if ($action == 'update' && ! $_POST["cancel"])
$sql.= " SET fk_socpeople=NULL, fk_societe=NULL"; $sql.= " SET fk_socpeople=NULL, fk_societe=NULL";
$sql.= " WHERE rowid=".$object->id; $sql.= " WHERE rowid=".$object->id;
} }
$resql=$db->query($sql);
dol_syslog("fiche::update", LOG_DEBUG); dol_syslog("fiche::update", LOG_DEBUG);
$resql=$db->query($sql);
if (! $resql) if (! $resql)
{ {
$error++; $error++;
$message.='<div class="error">'.$db->lasterror().'</div>'; setEventMessage($db->lasterror(), 'errors');
} }
} }
@ -427,7 +433,7 @@ if ($action == 'update' && ! $_POST["cancel"])
if (! $result > 0) if (! $result > 0)
{ {
$message .= '<div class="error">'.$langs->trans("ErrorFailedToSaveFile").'</div>'; setEventMessage($langs->trans("ErrorFailedToSaveFile"), 'errors');
} }
else else
{ {
@ -445,7 +451,7 @@ if ($action == 'update' && ! $_POST["cancel"])
if (! $error && ! count($object->errors)) if (! $error && ! count($object->errors))
{ {
$message.='<div class="ok">'.$langs->trans("UserModified").'</div>'; setEventMessage($langs->trans("UserModified"));
$db->commit(); $db->commit();
$login=$_SESSION["dol_login"]; $login=$_SESSION["dol_login"];
@ -469,7 +475,7 @@ if ($action == 'update' && ! $_POST["cancel"])
$ret=$object->setPassword($user,$_POST["password"]); $ret=$object->setPassword($user,$_POST["password"]);
if ($ret < 0) if ($ret < 0)
{ {
$message.='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
} }
@ -484,7 +490,7 @@ if ((($action == 'confirm_password' && $confirm == 'yes')
if ($newpassword < 0) if ($newpassword < 0)
{ {
// Echec // Echec
$message = '<div class="error">'.$langs->trans("ErrorFailedToSetNewPassword").'</div>'; setEventMessage($langs->trans("ErrorFailedToSetNewPassword"), 'errors');
} }
else else
{ {
@ -493,18 +499,16 @@ if ((($action == 'confirm_password' && $confirm == 'yes')
{ {
if ($object->send_password($user,$newpassword) > 0) if ($object->send_password($user,$newpassword) > 0)
{ {
$message = '<div class="ok">'.$langs->trans("PasswordChangedAndSentTo",$object->email).'</div>'; setEventMessage($langs->trans("PasswordChangedAndSentTo",$object->email));
//$message.=$newpassword;
} }
else else
{ {
$message = '<div class="ok">'.$langs->trans("PasswordChangedTo",$newpassword).'</div>'; setEventMessage($object->error, 'errors');
$message.= '<div class="error">'.$object->error.'</div>';
} }
} }
else else
{ {
$message = '<div class="ok">'.$langs->trans("PasswordChangedTo",$newpassword).'</div>'; setEventMessage($langs->trans("PasswordChangedTo",$newpassword), 'errors');
} }
} }
} }
@ -562,7 +566,7 @@ if ($action == 'adduserldap')
} }
else else
{ {
$message='<div class="error">'.$ldap->error.'</div>'; setEventMessage($ldap->error, 'errors');
} }
} }
@ -590,8 +594,6 @@ if (($action == 'create') || ($action == 'adduserldap'))
print "<br>"; print "<br>";
print "<br>"; print "<br>";
dol_htmloutput_mesg($message);
if (! empty($conf->ldap->enabled) && (isset($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr')) if (! empty($conf->ldap->enabled) && (isset($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr'))
{ {
/* /*
@ -648,12 +650,12 @@ if (($action == 'create') || ($action == 'adduserldap'))
} }
else else
{ {
$message='<div class="error">'.$ldap->error.'</div>'; setEventMessage($ldap->error, 'errors');
} }
} }
else else
{ {
$message='<div class="error">'.$ldap->error.'</div>'; setEventMessage($ldap->error, 'errors');
} }
// Si la liste des users est rempli, on affiche la liste deroulante // Si la liste des users est rempli, on affiche la liste deroulante
@ -977,7 +979,7 @@ else
$entries = $ldap->fetch($object->login,$userSearchFilter); $entries = $ldap->fetch($object->login,$userSearchFilter);
if (! $entries) if (! $entries)
{ {
$message .= $ldap->error; setEventMessage($ldap->error, 'errors');
} }
$passDoNotExpire = 0; $passDoNotExpire = 0;
@ -1056,8 +1058,6 @@ else
print $form->formconfirm("fiche.php?id=$object->id",$langs->trans("DeleteAUser"),$langs->trans("ConfirmDeleteUser",$object->login),"confirm_delete", '', 0, 1); print $form->formconfirm("fiche.php?id=$object->id",$langs->trans("DeleteAUser"),$langs->trans("ConfirmDeleteUser",$object->login),"confirm_delete", '', 0, 1);
} }
dol_htmloutput_mesg($message);
/* /*
* Fiche en mode visu * Fiche en mode visu
*/ */

View File

@ -48,7 +48,6 @@ $id=GETPOST('id', 'int');
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$confirm=GETPOST('confirm', 'alpha'); $confirm=GETPOST('confirm', 'alpha');
$userid=GETPOST('user', 'int'); $userid=GETPOST('user', 'int');
$message='';
// Security check // Security check
$result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', 'user'); $result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', 'user');
@ -76,7 +75,7 @@ if ($action == 'confirm_delete' && $confirm == "yes")
else else
{ {
$langs->load("errors"); $langs->load("errors");
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>'; setEventMessage($langs->trans('ErrorForbidden'), 'errors');
} }
} }
@ -87,14 +86,10 @@ if ($action == 'add')
{ {
if ($caneditperms) if ($caneditperms)
{ {
if (! $_POST["nom"]) if (! $_POST["nom"]) {
{ setEventMessage($langs->trans("NameNotDefined"), 'errors');
$message='<div class="error">'.$langs->trans("NameNotDefined").'</div>';
$action="create"; // Go back to create page $action="create"; // Go back to create page
} } else {
if (! $message)
{
$object->nom = trim($_POST["nom"]); $object->nom = trim($_POST["nom"]);
$object->note = trim($_POST["note"]); $object->note = trim($_POST["note"]);
@ -117,7 +112,7 @@ if ($action == 'add')
$db->rollback(); $db->rollback();
$langs->load("errors"); $langs->load("errors");
$message='<div class="error">'.$langs->trans("ErrorGroupAlreadyExists",$object->nom).'</div>'; setEventMessage($langs->trans("ErrorGroupAlreadyExists",$object->nom), 'errors');
$action="create"; // Go back to create page $action="create"; // Go back to create page
} }
} }
@ -125,7 +120,7 @@ if ($action == 'add')
else else
{ {
$langs->load("errors"); $langs->load("errors");
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>'; setEventMessage($langs->trans('ErrorForbidden'), 'errors');
} }
} }
@ -151,14 +146,14 @@ if ($action == 'adduser' || $action =='removeuser')
} }
else else
{ {
$message.=$edituser->error; setEventMessage($edituser->error, 'errors');
} }
} }
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>'; setEventMessage($langs->trans('ErrorForbidden'), 'errors');
} }
} }
@ -183,19 +178,19 @@ if ($action == 'update')
if ($ret >= 0 && ! count($object->errors)) if ($ret >= 0 && ! count($object->errors))
{ {
$message.='<div class="ok">'.$langs->trans("GroupModified").'</div>'; setEventMessage($langs->trans("GroupModified"));
$db->commit(); $db->commit();
} }
else else
{ {
$message.='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error);
$db->rollback(); $db->rollback();
} }
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>'; setEventMessage($langs->trans('ErrorForbidden'));
} }
} }
@ -214,8 +209,6 @@ if ($action == 'create')
{ {
print_fiche_titre($langs->trans("NewGroup")); print_fiche_titre($langs->trans("NewGroup"));
if ($message) { print $message."<br>"; }
print dol_set_focus('#nom'); print dol_set_focus('#nom');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
@ -340,9 +333,6 @@ else
print "</div>\n"; print "</div>\n";
print "<br>\n"; print "<br>\n";
dol_htmloutput_mesg($message);
/* /*
* Liste des utilisateurs dans le groupe * Liste des utilisateurs dans le groupe
*/ */

View File

@ -56,8 +56,6 @@ $fgroup->getrights();
if ($action == 'dolibarr2ldap') if ($action == 'dolibarr2ldap')
{ {
$message="";
$db->begin(); $db->begin();
$ldap=new Ldap(); $ldap=new Ldap();
@ -71,12 +69,12 @@ if ($action == 'dolibarr2ldap')
if ($result >= 0) if ($result >= 0)
{ {
$message.='<div class="ok">'.$langs->trans("GroupSynchronized").'</div>'; setEventMessage($langs->trans("GroupSynchronized"));
$db->commit(); $db->commit();
} }
else else
{ {
$message.='<div class="error">'.$ldap->error.'</div>'; setEventMessage($ldap->error);
$db->rollback(); $db->rollback();
} }
} }
@ -135,10 +133,6 @@ print "</table>\n";
print '</div>'; print '</div>';
dol_htmloutput_mesg($message);
/* /*
* Barre d'actions * Barre d'actions
*/ */

View File

@ -52,8 +52,6 @@ $fuser->getrights();
if ($_GET["action"] == 'dolibarr2ldap') if ($_GET["action"] == 'dolibarr2ldap')
{ {
$message="";
$db->begin(); $db->begin();
$ldap=new Ldap(); $ldap=new Ldap();
@ -67,12 +65,12 @@ if ($_GET["action"] == 'dolibarr2ldap')
if ($result >= 0) if ($result >= 0)
{ {
$message.='<div class="ok">'.$langs->trans("UserSynchronized").'</div>'; setEventMessage($langs->trans("UserSynchronized"));
$db->commit(); $db->commit();
} }
else else
{ {
$message.='<div class="error">'.$ldap->error.'</div>'; setEventMessage($ldap->error, 'errors');
$db->rollback(); $db->rollback();
} }
} }
@ -152,10 +150,6 @@ print '</table>';
print '</div>'; print '</div>';
dol_htmloutput_mesg($message);
/* /*
* Barre d'actions * Barre d'actions
*/ */