[Qual] Uniformize code

This commit is contained in:
philippe grand 2015-11-21 05:20:08 +01:00
parent 928c44b04f
commit 32f420eefa
7 changed files with 51 additions and 52 deletions

View File

@ -291,12 +291,12 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
{
// write mail to IMAP Server
$movemail = $mailboxconfig->putMail($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$folder,$deliveryreceipt,$mailfile);
if ($movemail) setEventMessage($langs->trans("MailMovedToImapFolder",$folder),'mesgs');
else setEventMessage($langs->trans("MailMovedToImapFolder_Warning",$folder),'warnings');
if ($movemail) setEventMessages($langs->trans("MailMovedToImapFolder",$folder), null, 'mesgs');
else setEventMessages($langs->trans("MailMovedToImapFolder_Warning",$folder), null, 'warnings');
}
}
// Initialisation donnees
// Initialisation of datas
$object->socid = $sendtosocid; // To link to a company
$object->sendtoid = $sendtoid; // To link to a contact/address
$object->actiontypecode = $actiontypecode;
@ -305,14 +305,14 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$object->fk_element = $object->id;
$object->elementtype = $object->element;
// Appel des triggers
// Call of triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers
// End call of triggers
if ($error)
{

View File

@ -37,7 +37,7 @@ if (! $user->admin)
$actionsave=GETPOST("save");
// Sauvegardes parametres
// Save parameters
if (!empty($actionsave))
{
$i=0;
@ -49,12 +49,12 @@ if (!empty($actionsave))
if ($i >= 1)
{
$db->commit();
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
$db->rollback();
setEventMessage($langs->trans("Error"), 'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}

View File

@ -49,7 +49,7 @@ if (!empty($id))
$result=$object->fetch($id);
if ($result < 0)
{
setEventMessage($object->error,'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -73,7 +73,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->cron->del
if ($result < 0)
{
setEventMessage($object->error,'errors');
setEventMessages($object->error, $object->errors, 'errors');
$action='edit';
}
else
@ -90,7 +90,7 @@ if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->ex
if ($result < 0)
{
setEventMessage($object->error,'errors');
setEventMessages($object->error, $object->errors, 'errors');
$action='';
}
else
@ -98,13 +98,13 @@ if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->ex
$res = $object->reprogram_jobs($user->login);
if ($res > 0)
{
if ($object->lastresult > 0) setEventMessage($langs->trans("JobFinished"),'warnings');
else setEventMessage($langs->trans("JobFinished"),'mesgs');
if ($object->lastresult > 0) setEventMessages($langs->trans("JobFinished"), null, 'warnings');
else setEventMessages($langs->trans("JobFinished"), null, 'mesgs');
$action='';
}
else
{
setEventMessage($object->error,'errors');
setEventMessages($object->error, $object->errors, 'errors');
$action='';
}
}
@ -134,11 +134,11 @@ if ($action=='add')
// test du Resultat de la requete
if ($result < 0) {
setEventMessage($object->error,'errors');
setEventMessages($object->error, $object->errors, 'errors');
$action='create';
}
else {
setEventMessage($langs->trans('CronSaveSucess'),'mesgs');
setEventMessages($langs->trans('CronSaveSucess'), null, 'mesgs');
$action='';
}
}
@ -168,11 +168,11 @@ if ($action=='update')
// test du Resultat de la requete
if ($result < 0) {
setEventMessage($object->error,'errors');
setEventMessages($object->error, $object->errors, 'errors');
$action='edit';
}
else {
setEventMessage($langs->trans('CronSaveSucess'),'mesgs');
setEventMessages($langs->trans('CronSaveSucess'), null, 'mesgs');
$action='';
}
}
@ -186,11 +186,11 @@ if ($action=='activate')
// test du Resultat de la requete
if ($result < 0) {
setEventMessage($object->error,'errors');
setEventMessages($object->error, $object->errors, 'errors');
$action='edit';
}
else {
setEventMessage($langs->trans('CronSaveSucess'),'mesgs');
setEventMessages($langs->trans('CronSaveSucess'), null, 'mesgs');
$action='';
}
}
@ -204,11 +204,11 @@ if ($action=='inactive')
// test du Resultat de la requete
if ($result < 0) {
setEventMessage($object->error,'errors');
setEventMessages($object->error, $object->errors, 'errors');
$action='edit';
}
else {
setEventMessage($langs->trans('CronSaveSucess'),'mesgs');
setEventMessages($langs->trans('CronSaveSucess'), null, 'mesgs');
$action='';
}
}
@ -277,7 +277,7 @@ if ($action == 'execute'){
if (empty($object->status) && $action != 'create')
{
setEventMessage($langs->trans("CronTaskInactive"), 'warnings');
setEventMessages($langs->trans("CronTaskInactive"), null, 'warnings');
}
if (($action=="create") || ($action=="edit"))

View File

@ -85,7 +85,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->cron->del
$result = $object->delete($user);
if ($result < 0) {
setEventMessage($object->error,'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -98,20 +98,20 @@ if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->ex
$result = $object->run_jobs($user->login);
if ($result < 0) {
setEventMessage($object->error,'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
else
{
$res = $object->reprogram_jobs($user->login);
if ($res > 0)
{
if ($object->lastresult > 0) setEventMessage($langs->trans("JobFinished"),'warnings');
else setEventMessage($langs->trans("JobFinished"),'mesgs');
if ($object->lastresult > 0) setEventMessages($langs->trans("JobFinished"), null, 'warnings');
else setEventMessages($langs->trans("JobFinished"), null, 'mesgs');
$action='';
}
else
{
setEventMessage($object->error,'errors');
setEventMessages($object->error, $object->errors, 'errors');
$action='';
}
}
@ -147,12 +147,12 @@ if ($action == 'execute')
}
// liste des jobs creer
// list of jobs created
$object = new Cronjob($db);
$result=$object->fetch_all($sortorder, $sortfield, $limit, $offset, $status, $filter);
if ($result < 0)
{
setEventMessage($object->error,'errors');
setEventMessages($object->error, $object->errors, 'errors');
}

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@ -71,13 +71,13 @@ if ($action == 'specimen')
}
else
{
setEventMessage($obj->error,'errors');
setEventMessages($obj->error, $obj->errors, 'errors');
dol_syslog($obj->error, LOG_ERR);
}
}
else
{
setEventMessage($langs->trans("ErrorModuleNotFound"),'errors');
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
}
@ -126,11 +126,11 @@ if ($action == 'set_DONATION_ACCOUNTINGACCOUNT')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -144,11 +144,11 @@ if ($action == 'set_DONATION_MESSAGE')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -160,9 +160,9 @@ else if ($action == 'setart200') {
$error ++;
if (! $error) {
setEventMessage($langs->trans("SetupSaved"), 'mesgs');
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessage($langs->trans("Error"), 'mesgs');
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
else if ($action == 'setart238') {
@ -172,9 +172,9 @@ else if ($action == 'setart238') {
$error ++;
if (! $error) {
setEventMessage($langs->trans("SetupSaved"), 'mesgs');
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessage($langs->trans("Error"), 'mesgs');
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
else if ($action == 'setart885') {
@ -184,9 +184,9 @@ else if ($action == 'setart885') {
$error ++;
if (! $error) {
setEventMessage($langs->trans("SetupSaved"), 'mesgs');
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessage($langs->trans("Error"), 'mesgs');
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}

View File

@ -192,8 +192,7 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights-
else
{
dol_syslog($object->error,LOG_DEBUG);
setEventMessage($object->error,'errors');
setEventMessage($object->errors,'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
if ($action == 'valid_promesse')
@ -204,7 +203,7 @@ if ($action == 'valid_promesse')
exit;
}
else {
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
if ($action == 'set_cancel')
@ -215,7 +214,7 @@ if ($action == 'set_cancel')
exit;
}
else {
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
if ($action == 'set_paid')
@ -226,7 +225,7 @@ if ($action == 'set_paid')
exit;
}
else {
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
// Remove file in doc form
@ -243,8 +242,8 @@ if ($action == 'remove_file')
$upload_dir = $conf->don->dir_output;
$file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
$action='';
}
}

View File

@ -66,7 +66,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->don->supp
}
else
{
setEventMessage($payment->error, 'errors');
setEventMessages($payment->error, $payment->errors, 'errors');
$db->rollback();
}
}
@ -104,7 +104,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->don->cree
}
else
{
setEventMessage($payment->error);
setEventMessages($payment->error, $payment->errors, 'errors');
$db->rollback();
}
}