Replaced account type comparisons with TYPE constants

This commit is contained in:
Marcos García de La Fuente
2016-03-02 11:08:57 +01:00
parent dcde7773a3
commit ff83dd9afe
7 changed files with 9 additions and 9 deletions

View File

@@ -489,7 +489,7 @@ if ($id > 0 || ! empty($ref))
$form->select_date($dateop,'op',0,0,0,'transaction');
print '</td>';
print '<td class="nowrap">';
$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 '</td><td>';
print '<input name="num_chq" class="flat" type="text" size="4" value="'.GETPOST("num_chq").'"></td>';
print '<td colspan="2">';

View File

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

View File

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

View File

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

View File

@@ -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");

View File

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

View File

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