diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 675aeb965e7..7642898b952 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -210,12 +210,13 @@ if ($id > 0 || $ref) { print '
'; print ''; - if ($object->fk_bank_account > 0) { - $acc = new Account($db); - $result = $acc->fetch($object->fk_bank_account); - } else { // For backward compatibility - $acc = new Account($db); - $fk_bank_account = ($object->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT); + // Get bank account for the payment + $acc = new Account($db); + $fk_bank_account = $object->fk_bank_account; + if (empty($fk_bank_account)) { + $fk_bank_account = ($object->type == 'bank-transfer' ? getDolGlobalInt('PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT') : getDolGlobalInt('PRELEVEMENT_ID_BANKACCOUNT')); + } + if ($fk_bank_account > 0) { $result = $acc->fetch($fk_bank_account); } diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index cc416d7d530..6b7c1aca8e9 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -129,8 +129,15 @@ if ($id > 0 || $ref) { print '
'; print '
'; + // Get bank account for the payment $acc = new Account($db); - $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT); + $fk_bank_account = $object->fk_bank_account; + if (empty($fk_bank_account)) { + $fk_bank_account = ($object->type == 'bank-transfer' ? getDolGlobalInt('PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT') : getDolGlobalInt('PRELEVEMENT_ID_BANKACCOUNT')); + } + if ($fk_bank_account > 0) { + $result = $acc->fetch($fk_bank_account); + } print '
'; $labelofbankfield = "BankToReceiveWithdraw"; diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index de9eb46631c..a14038e3d93 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -124,8 +124,15 @@ if ($id > 0 || $ref) { print '
'; print ''; + // Get bank account for the payment $acc = new Account($db); - $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT); + $fk_bank_account = $object->fk_bank_account; + if (empty($fk_bank_account)) { + $fk_bank_account = ($object->type == 'bank-transfer' ? getDolGlobalInt('PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT') : getDolGlobalInt('PRELEVEMENT_ID_BANKACCOUNT')); + } + if ($fk_bank_account > 0) { + $result = $acc->fetch($fk_bank_account); + } print '
'; $labelofbankfield = "BankToReceiveWithdraw"; diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index 3b15676792e..8898ebafd65 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -118,8 +118,15 @@ if ($id > 0 || $ref) { print '
'; print ''; + // Get bank account for the payment $acc = new Account($db); - $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT); + $fk_bank_account = $object->fk_bank_account; + if (empty($fk_bank_account)) { + $fk_bank_account = ($object->type == 'bank-transfer' ? getDolGlobalInt('PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT') : getDolGlobalInt('PRELEVEMENT_ID_BANKACCOUNT')); + } + if ($fk_bank_account > 0) { + $result = $acc->fetch($fk_bank_account); + } print '
'; $labelofbankfield = "BankToReceiveWithdraw";