mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
[Qual] Uniformize code
This commit is contained in:
parent
d06a445e01
commit
12c5d02a7a
|
|
@ -152,13 +152,13 @@ if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banqu
|
|||
$insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user);
|
||||
if ($insertid > 0)
|
||||
{
|
||||
setEventMessage($langs->trans("RecordSaved"));
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id."&action=addline");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ if ($result < 0)
|
|||
{
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
setEventMessage($langs->trans("ErrorFailedToCreateDir"), 'errors');
|
||||
setEventMessages($langs->trans("ErrorFailedToCreateDir"), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -102,19 +102,19 @@ if ($_POST["action"] == 'add')
|
|||
|
||||
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number))
|
||||
{
|
||||
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), 'error');
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'error');
|
||||
$action='create'; // Force chargement page en mode creation
|
||||
$error++;
|
||||
}
|
||||
if (empty($account->ref))
|
||||
{
|
||||
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), 'errors');
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors');
|
||||
$action='create'; // Force chargement page en mode creation
|
||||
$error++;
|
||||
}
|
||||
if (empty($account->label))
|
||||
{
|
||||
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), 'errors');
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
|
||||
$action='create'; // Force chargement page en mode creation
|
||||
$error++;
|
||||
}
|
||||
|
|
@ -130,7 +130,7 @@ if ($_POST["action"] == 'add')
|
|||
$_GET["id"]=$id; // Force chargement page en mode visu
|
||||
}
|
||||
else {
|
||||
setEventMessage($account->error,'errors');
|
||||
setEventMessages($account->error, $account->errors, 'errors');
|
||||
$action='create'; // Force chargement page en mode creation
|
||||
}
|
||||
}
|
||||
|
|
@ -177,19 +177,19 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
|||
|
||||
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number))
|
||||
{
|
||||
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), 'error');
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'error');
|
||||
$action='edit'; // Force chargement page en mode creation
|
||||
$error++;
|
||||
}
|
||||
if (empty($account->ref))
|
||||
{
|
||||
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), 'errors');
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors');
|
||||
$action='edit'; // Force chargement page en mode creation
|
||||
$error++;
|
||||
}
|
||||
if (empty($account->label))
|
||||
{
|
||||
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), 'errors');
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
|
||||
$action='edit'; // Force chargement page en mode creation
|
||||
$error++;
|
||||
}
|
||||
|
|
@ -206,7 +206,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
|||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($account->error, 'errors');
|
||||
setEventMessages($account->error, $account->errors, 'errors');
|
||||
$action='edit'; // Force chargement page edition
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,9 +133,9 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes') {
|
|||
|
||||
$ret = dol_delete_file($file, 0, 0, 0, $object);
|
||||
if ($ret) {
|
||||
setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
||||
setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
||||
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
||||
}
|
||||
|
||||
Header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ if ($result < 0)
|
|||
{
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
setEventMessage($langs->trans("ErrorFailedToCreateDir"), 'errors');
|
||||
setEventMessages($langs->trans("ErrorFailedToCreateDir"), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -113,7 +113,7 @@ else
|
|||
|
||||
if ($mode == 'standard')
|
||||
{
|
||||
// Chargement du tableau $amounts
|
||||
// Loading table $amounts
|
||||
$amounts = array();
|
||||
|
||||
$monthnext = $month+1;
|
||||
|
|
@ -153,7 +153,7 @@ else
|
|||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// Calcul de $solde avant le debut du graphe
|
||||
// Calculation of $solde before the start of the graph
|
||||
$solde = 0;
|
||||
|
||||
$sql = "SELECT SUM(b.amount)";
|
||||
|
|
@ -265,7 +265,7 @@ else
|
|||
|
||||
if ($mode == 'standard')
|
||||
{
|
||||
// Chargement du tableau $amounts
|
||||
// Loading table $amounts
|
||||
$amounts = array();
|
||||
$sql = "SELECT date_format(b.datev,'%Y%m%d')";
|
||||
$sql.= ", SUM(b.amount)";
|
||||
|
|
@ -296,7 +296,7 @@ else
|
|||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// Calcul de $solde avant le debut du graphe
|
||||
// Calculation of $solde before the start of the graph
|
||||
$solde = 0;
|
||||
|
||||
$sql = "SELECT SUM(b.amount)";
|
||||
|
|
@ -403,7 +403,7 @@ else
|
|||
|
||||
if ($mode == 'showalltime')
|
||||
{
|
||||
// Chargement du tableau $amounts
|
||||
// Loading table $amounts
|
||||
$amounts = array();
|
||||
|
||||
$sql = "SELECT date_format(b.datev,'%Y%m%d')";
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ foreach ($accounts as $key=>$type)
|
|||
{
|
||||
$result=$acc->load_board($user,$acc->id);
|
||||
if ($result<0) {
|
||||
setEventMessage($acc->error, 'errors');
|
||||
setEventMessages($acc->error, $acc->errors, 'errors');
|
||||
} else {
|
||||
print $result->nbtodo;
|
||||
if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
|
||||
|
|
@ -229,7 +229,7 @@ foreach ($accounts as $key=>$type)
|
|||
{
|
||||
$result=$acc->load_board($user,$acc->id);
|
||||
if ($result<0) {
|
||||
setEventMessage($acc->error, 'errors');
|
||||
setEventMessages($acc->error, $acc->errors, 'errors');
|
||||
} else {
|
||||
print $result->nbtodo;
|
||||
if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ if ($user->rights->banque->modifier && $action == "update")
|
|||
|
||||
if ($ac->courant == 2 && $_POST['value'] != 'LIQ')
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), 'errors');
|
||||
setEventMessages($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ if ($user->rights->banque->modifier && $action == "update")
|
|||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
setEventMessage($langs->trans("RecordSaved"));
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
|
|
@ -184,7 +184,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action ==
|
|||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
setEventMessage($langs->trans("RecordSaved"));
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
|
|
@ -205,7 +205,7 @@ $form = new Form($db);
|
|||
|
||||
llxHeader();
|
||||
|
||||
// On initialise la liste des categories
|
||||
// The list of categories is initialized
|
||||
$sql = "SELECT rowid, label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_categ";
|
||||
$sql.= " ORDER BY label";
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ if ($action == 'rappro' && $user->rights->banque->consolidate)
|
|||
$result=$bankline->update_conciliation($user,$_POST["cat"]);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessage($bankline->error, 'errors');
|
||||
setEventMessages($bankline->error, $bankline->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ if ($action == 'rappro' && $user->rights->banque->consolidate)
|
|||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->trans("ErrorPleaseTypeBankTransactionReportName"), 'errors');
|
||||
setEventMessages($langs->trans("ErrorPleaseTypeBankTransactionReportName"), null, 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
|
|
|
|||
|
|
@ -113,18 +113,18 @@ if ($action == 'add')
|
|||
if (! $error)
|
||||
{
|
||||
$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));
|
||||
setEventMessage($mesgs);
|
||||
setEventMessages($mesgs, null, 'mesgs');
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($accountfrom->error.' '.$accountto->error, 'errors');
|
||||
setEventMessages($accountfrom->error.' '.$accountto->error, null, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFromToAccountsMustDiffers"), 'errors');
|
||||
setEventMessages($langs->trans("ErrorFromToAccountsMustDiffers"), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -132,7 +132,7 @@ if ($action == 'add')
|
|||
|
||||
|
||||
/*
|
||||
* Affichage
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user