From 67c9db6a5147181f73142ba08a0ec152c46d1ede Mon Sep 17 00:00:00 2001 From: philippe grand Date: Fri, 6 Nov 2015 09:36:16 +0100 Subject: [PATCH] [Qual] Uniformize code --- htdocs/categories/edit.php | 4 +-- htdocs/categories/traduction.php | 4 +-- htdocs/categories/viewcat.php | 6 ++-- htdocs/comm/action/rapport/index.php | 2 +- htdocs/comm/mailing/card.php | 48 ++++++++++++++-------------- htdocs/comm/mailing/cibles.php | 8 ++--- 6 files changed, 36 insertions(+), 36 deletions(-) diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 0a13c3e7fab..9ffd7ac6401 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -101,12 +101,12 @@ if ($action == 'update' && $user->rights->categorie->creer) } else { - setEventMessage($categorie->error, 'errors'); + setEventMessages($categorie->error, $categorie->errors, 'errors'); } } else { - setEventMessage($categorie->error, 'errors'); + setEventMessages($categorie->error, $categorie->errors, 'errors'); } } diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 94570d48f3e..98f02c7a742 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -95,7 +95,7 @@ $cancel != $langs->trans("Cancel") && else { $action = 'add'; - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -128,7 +128,7 @@ $cancel != $langs->trans("Cancel") && else { $action = 'edit'; - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index bf86c1d496c..39f8d62fb7b 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -122,7 +122,7 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -137,13 +137,13 @@ if ($type == Categorie::TYPE_PRODUCT && $elemid && $action == 'addintocategory' $result=$object->add_type($newobject,$elementtype); if ($result >= 0) { - setEventMessage($langs->trans("WasAddedSuccessfully",$newobject->ref)); + setEventMessages($langs->trans("WasAddedSuccessfully",$newobject->ref), null, 'mesgs'); } else { if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - setEventMessage($langs->trans("ObjectAlreadyLinkedToCategory"),'warnings'); + setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings'); } else { diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 24eb117684f..066df5fb39e 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -62,7 +62,7 @@ if ($action == 'builddoc') $result=$cat->write_file(GETPOST('id','int')); if ($result < 0) { - setEventMessage($cat->error, 'errors'); + setEventMessages($cat->error, $cat->errors, 'errors'); } } diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 2ff7796bfae..2a892033865 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -117,7 +117,7 @@ if (empty($reshook)) { if (empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) { - setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); + setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); } else { @@ -129,7 +129,7 @@ if (empty($reshook)) } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } $action=''; @@ -141,14 +141,14 @@ if (empty($reshook)) if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) { // As security measure, we don't allow send from the GUI - setEventMessage($langs->trans("MailingNeedCommand"), 'warnings'); - setEventMessage('', 'warnings'); - setEventMessage($langs->trans("MailingNeedCommand2"), 'warnings'); + setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings'); + setEventMessages('', null, 'warnings'); + setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); $action=''; } else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) { - setEventMessage($langs->trans("NotEnoughPermissions"), 'warnings'); + setEventMessages($langs->trans("NotEnoughPermissions"), null, 'warnings'); $action=''; } else @@ -351,27 +351,27 @@ if (empty($reshook)) } else { - setEventMessage($langs->transnoentitiesnoconv("NoMoreRecipientToSendTo")); + setEventMessages($langs->transnoentitiesnoconv("NoMoreRecipientToSendTo"), null, 'mesgs'); } // Loop finished, set global statut of mail if ($nbko > 0) { $statut=2; // Status 'sent partially' (because at least one error) - if ($nbok > 0) setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok)); - else setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok)); + if ($nbok > 0) setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs'); + else setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs'); } else { if ($nbok >= $num) { $statut=3; // Send to everybody - setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok)); + setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs'); } else { $statut=2; // Status 'sent partially' (because not send to everybody) - setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok)); + setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs'); } } @@ -443,11 +443,11 @@ if (empty($reshook)) $result=$mailfile->sendfile(); if ($result) { - setEventMessage($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($object->email_from,2),$mailfile->getValidAddress($object->sendto,2))); + setEventMessages($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($object->email_from,2),$mailfile->getValidAddress($object->sendto,2)), null, 'mesgs'); } else { - setEventMessage($langs->trans("ResultKo").'
'.$mailfile->error.' '.$result, 'errors'); + setEventMessages($langs->trans("ResultKo").'
'.$mailfile->error.' '.$result, null, 'errors'); } $action=''; @@ -488,7 +488,7 @@ if (empty($reshook)) $mesgs[] = $object->error; } - setEventMessage($mesgs, 'errors'); + setEventMessages($mesg, $mesgs, 'errors'); $action="create"; } @@ -518,7 +518,7 @@ if (empty($reshook)) $mesg = $object->error; } - setEventMessage($mesg, 'errors'); + setEventMessages($mesg, $mesgs, 'errors'); $action=""; } @@ -582,7 +582,7 @@ if (empty($reshook)) $mesgs[] =$object->error; } - setEventMessage($mesgs, 'errors'); + setEventMessages($mesg, $mesgs, 'errors'); $action="edit"; } else @@ -597,7 +597,7 @@ if (empty($reshook)) if ($object->id > 0) { $object->valid($user); - setEventMessage($langs->trans("MailingSuccessfullyValidated")); + setEventMessages($langs->trans("MailingSuccessfullyValidated"), null, 'mesgs'); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } @@ -628,7 +628,7 @@ if (empty($reshook)) } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } } @@ -764,18 +764,18 @@ else // You ensure that every user is using its own SMTP server. $linktoadminemailbefore=''; $linktoadminemailend=''; - setEventMessage($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), 'warnings'); - setEventMessage($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), 'warnings'); - if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessage($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), 'warnings'); + setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings'); + setEventMessages($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), null, 'warnings'); + if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings'); $_GET["action"]=''; } else if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) { // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, // on affiche donc juste un message - setEventMessage($langs->trans("MailingNeedCommand"), 'warnings'); - setEventMessage('', 'warnings'); - setEventMessage($langs->trans("MailingNeedCommand2"), 'warnings'); + setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings'); + setEventMessages('', null, 'warnings'); + setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); $_GET["action"]=''; } else diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index cd3ff7b00ee..92b9f5446ca 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -100,24 +100,24 @@ if ($action == 'add') } if ($result > 0) { - setEventMessage($langs->trans("XTargetsAdded",$result),'mesgs'); + setEventMessages($langs->trans("XTargetsAdded",$result), null, 'mesgs'); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } if ($result == 0) { - setEventMessage($langs->trans("WarningNoEMailsAdded"),'warnings'); + setEventMessages($langs->trans("WarningNoEMailsAdded"), null, 'warnings'); } if ($result < 0) { - setEventMessage($langs->trans("Error").($obj->error?' '.$obj->error:''),'errors'); + setEventMessages($langs->trans("Error").($obj->error?' '.$obj->error:''), null, 'errors'); } } if (GETPOST('clearlist')) { - // Chargement de la classe + // Loading Class $obj = new MailingTargets($db); $obj->clear_target($id);