From 66313f584b88b0c3500b37a66bc3f016c7686f27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 2 Mar 2016 10:45:40 +0100 Subject: [PATCH 1/2] Removed deprecated usage of Account::account_currency_code and started using Account::canBeReconciliated --- htdocs/commande/class/commande.class.php | 4 ---- htdocs/compta/bank/account.php | 4 ++-- htdocs/compta/bank/card.php | 6 +++--- htdocs/compta/bank/class/account.class.php | 7 +++++++ htdocs/compta/bank/releve.php | 3 +-- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 8f8edcf15a3..c1f16d850cc 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -140,10 +140,6 @@ class Commande extends CommonOrder */ var $lines = array(); - // Pour board - var $nbtodo; - var $nbtodolate; - // Multicurrency var $fk_multicurrency; var $multicurrency_code; diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 0973ece78d3..80bf481e859 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -397,7 +397,7 @@ if ($id > 0 || ! empty($ref)) } } - if ($object->type != 2 && $object->rappro) + if ($object->canBeConciliated()) { // If not cash account and can be reconciliate if ($user->rights->banque->consolidate) @@ -529,7 +529,7 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("Credit").''; print ''.$langs->trans("BankBalance").''; print ''; - if ($object->type != 2 && $object->rappro) print $langs->trans("AccountStatementShort"); + if ($object->canBeConciliated()) print $langs->trans("AccountStatementShort"); else print ' '; print ''; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index cccf16f0467..ad704e050a7 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -292,7 +292,7 @@ if ($action == 'create') // Currency print ''.$langs->trans("Currency").''; print ''; - $selectedcode=$account->account_currency_code; + $selectedcode=$account->currency_code; if (! $selectedcode) $selectedcode=$conf->currency; print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code'); //print $langs->trans("Currency".$conf->currency); @@ -583,7 +583,7 @@ else // Currency print ''.$langs->trans("Currency").''; print ''; - $selectedcode=$account->account_currency_code; + $selectedcode=$account->currency_code; if (! $selectedcode) $selectedcode=$conf->currency; print $langs->trans("Currency".$selectedcode); print ''; @@ -851,7 +851,7 @@ else print ''; print ''; print ''; - $selectedcode=$account->account_currency_code; + $selectedcode=$account->currency_code; if (! $selectedcode) $selectedcode=$conf->currency; print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code'); //print $langs->trans("Currency".$conf->currency); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index a5e108a2c96..74142ca6c0d 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -154,6 +154,13 @@ class Account extends CommonObject */ public $currency_code; + /** + * Currency code + * @var string + * @deprecated Use currency_code instead + */ + public $account_currency_code; + /** * Authorized minimum balance * @var float diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 43587cfa6a0..4b4b9d4707b 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -144,8 +144,7 @@ if (empty($num)) print '
'; - if ($object->type != 2 && $object->rappro) - { + if ($object->canBeConciliated()) { // If not cash account and can be reconciliate if ($user->rights->banque->consolidate) { From 6184c71181516fcab3aff7b372e08b342a48fa5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 5 Mar 2016 14:05:00 +0100 Subject: [PATCH 2/2] Corrected comparison of Account::canBeConciliated output --- htdocs/compta/bank/account.php | 19 +++++++++---------- htdocs/compta/bank/releve.php | 13 +++++-------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 80bf481e859..611b41eccf1 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -397,15 +397,11 @@ if ($id > 0 || ! empty($ref)) } } - if ($object->canBeConciliated()) - { + if ($object->canBeConciliated() > 0) { // If not cash account and can be reconciliate - if ($user->rights->banque->consolidate) - { - print ''.$langs->trans("Conciliate").''; - } - else - { + if ($user->rights->banque->consolidate) { + print ''.$langs->trans("Conciliate").''; + } else { print ''.$langs->trans("Conciliate").''; } } @@ -529,8 +525,11 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("Credit").''; print ''.$langs->trans("BankBalance").''; print ''; - if ($object->canBeConciliated()) print $langs->trans("AccountStatementShort"); - else print ' '; + if ($object->canBeConciliated() > 0) { + print $langs->trans("AccountStatementShort"); + } else { + print ' '; + } print ''; print '
'; diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 4b4b9d4707b..8ef53f26203 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -143,15 +143,12 @@ if (empty($num)) dol_fiche_end(); print '
'; - - if ($object->canBeConciliated()) { + + if ($object->canBeConciliated() > 0) { // If not cash account and can be reconciliate - if ($user->rights->banque->consolidate) - { - print ''.$langs->trans("Conciliate").''; - } - else - { + if ($user->rights->banque->consolidate) { + print ''.$langs->trans("Conciliate").''; + } else { print ''.$langs->trans("Conciliate").''; } }