New: Prepare code to be able to choose bank account to show when

building pdf and payment mode is withdraw.
This commit is contained in:
Laurent Destailleur 2013-02-22 12:04:38 +01:00
parent c4c5e247af
commit 327f4062c7
3 changed files with 7 additions and 7 deletions

View File

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

View File

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

View File

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