diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 1753eb4b75a..2d6f804d3d0 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1615,11 +1615,9 @@ else if ($action == 'builddoc') // En get ou en post $object->fetch($id); $object->fetch_thirdparty(); - if (GETPOST('model')) - { - $object->setDocModel($user, GETPOST('model')); - } - + if (GETPOST('model')) $object->setDocModel($user, GETPOST('model')); + if (GETPOST('fk_bank')) $object->fk_bank=GETPOST('fk_bank'); + // Define output language $outputlangs = $langs; $newlang=''; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 8618c729592..fd3bb85a69b 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -100,6 +100,7 @@ class Facture extends CommonInvoice var $cond_reglement_code; // Code in llx_c_paiement var $mode_reglement_id; // Id in llx_c_paiement var $mode_reglement_code; // Code in llx_c_paiement + var $fk_bank; // Field to store bank id to use when payment mode is withdraw var $modelpdf; var $products=array(); // deprecated var $lines=array(); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index ca247b5ab99..69939154dba 100755 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -775,10 +775,11 @@ class pdf_crabe extends ModelePDFFactures // If payment mode not forced or forced to VIR, show payment with BAN if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') { - if (! empty($conf->global->FACTURE_RIB_NUMBER)) + if (! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER)) { + $bankid=(empty($object->fk_bank)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_bank); $account = new Account($this->db); - $account->fetch($conf->global->FACTURE_RIB_NUMBER); + $account->fetch($bankid); $curx=$this->marge_gauche; $cury=$posy;