From ff83dd9afeffda4c41328b27ade5ec20a0222bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 2 Mar 2016 11:08:57 +0100 Subject: [PATCH] Replaced account type comparisons with TYPE constants --- htdocs/compta/bank/account.php | 2 +- htdocs/compta/bank/class/account.class.php | 6 +++--- htdocs/compta/bank/ligne.php | 2 +- htdocs/compta/bank/virement.php | 2 +- htdocs/core/lib/bank.lib.php | 2 +- htdocs/core/menus/standard/auguria.lib.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 0973ece78d3..880ff92d3d5 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -489,7 +489,7 @@ if ($id > 0 || ! empty($ref)) $form->select_date($dateop,'op',0,0,0,'transaction'); print ''; print ''; - $form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == 2 ? 'LIQ' : '')),'operation','1,2',2,1); + $form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')),'operation','1,2',2,1); print ''; print ''; print ''; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index ca6ad0c37ce..a3f8ea61274 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -242,7 +242,7 @@ class Account extends CommonObject global $conf; if (empty($this->rappro)) return -1; - if ($this->courant == 2 && empty($conf->global->BANK_CAN_RECONCILIATE_CASHACCOUNT)) return -2; + if ($this->courant == Account::TYPE_CASH && empty($conf->global->BANK_CAN_RECONCILIATE_CASHACCOUNT)) return -2; if ($this->clos) return -3; return 1; } @@ -399,7 +399,7 @@ class Account extends CommonObject $this->error="this->rowid not defined"; return -2; } - if ($this->courant == 2 && $oper != 'LIQ') + if ($this->courant == Account::TYPE_CASH && $oper != 'LIQ') { $this->error="ErrorCashAccountAcceptsOnlyCashMoney"; return -3; @@ -1240,7 +1240,7 @@ class Account extends CommonObject $this->ref = 'MBA'; $this->label = 'My Bank account'; $this->bank = 'MyBank'; - $this->courant = 1; + $this->courant = Account::TYPE_CURRENT; $this->clos = Account::STATUS_OPEN; $this->code_banque = '123'; $this->code_guichet = '456'; diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index 13b65f0baf1..a01d7d0684b 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -102,7 +102,7 @@ if ($user->rights->banque->modifier && $action == "update") $ac = new Account($db); $ac->fetch($id); - if ($ac->courant == 2 && $_POST['value'] != 'LIQ') + if ($ac->courant == Account::TYPE_CASH && $_POST['value'] != 'LIQ') { setEventMessages($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), null, 'errors'); $error++; diff --git a/htdocs/compta/bank/virement.php b/htdocs/compta/bank/virement.php index 1a3294a2f15..146ed4759c4 100644 --- a/htdocs/compta/bank/virement.php +++ b/htdocs/compta/bank/virement.php @@ -93,7 +93,7 @@ if ($action == 'add') // By default, electronic transfert from bank to bank $typefrom='PRE'; $typeto='VIR'; - if ($accountto->courant == 2 || $accountfrom->courant == 2) + if ($accountto->courant == Account::TYPE_CASH || $accountfrom->courant == Account::TYPE_CASH) { // This is transfert of change $typefrom='LIQ'; diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 3c5d57fdaf6..ceb8a87bb30 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -64,7 +64,7 @@ function bank_prepare_head(Account $object) $head[$h][2] = 'graph'; $h++; - if ($object->courant != 2) + if ($object->courant != Account::TYPE_CASH) { $head[$h][0] = DOL_URL_ROOT."/compta/bank/releve.php?account=".$object->id; $head[$h][1] = $langs->trans("AccountStatements"); diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index a24a2d32baa..cbd4b035c4e 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -281,7 +281,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM { $objp = $db->fetch_object($resql); $newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); - if ($objp->rappro && $objp->courant != 2 && empty($objp->clos)) // If not cash account and not closed and can be reconciliate + if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate { $newmenu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index a849d9ac40a..d3666031839 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1342,7 +1342,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $objp = $db->fetch_object($resql); $newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); - if ($objp->rappro && $objp->courant != 2 && empty($objp->clos)) // If not cash account and not closed and can be reconciliate + if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate { $newmenu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); }