From 3475433eaf117bbf4cc936e5b8216a8bf7303757 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Mon, 2 Mar 2015 02:59:59 +0100 Subject: [PATCH] Fix: the bank information were visible into pdf but were not using correct setup to decide which bank to show. --- htdocs/comm/propal.php | 5 ++++ htdocs/commande/card.php | 14 +++++----- htdocs/compta/facture.php | 26 +++++++++---------- .../commande/doc/pdf_einstein.modules.php | 21 ++++++++------- 4 files changed, 37 insertions(+), 29 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 3739b59c338..2ef03929a7e 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -957,6 +957,11 @@ if (empty($reshook)) if (GETPOST('model')) { $object->setDocModel($user, GETPOST('model')); } + if (GETPOST('fk_bank')) { // this field may come from an external module + $object->fk_bank = GETPOST('fk_bank'); + } else { + $object->fk_bank = $object->fk_account; + } // Define output language $outputlangs = $langs; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index eb5767b173a..12150f9a61e 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -94,6 +94,7 @@ $hookmanager->initHooks(array('ordercard','globalcard')); $permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php + /* * Actions */ @@ -1072,18 +1073,19 @@ if (empty($reshook)) exit(); } + // Generate order document (define into /core/modules/commande/modules_commande.php) else if ($action == 'builddoc') // In get or post { - /* - * Generate order document - * define into /core/modules/commande/modules_commande.php - */ - // Save last template used to generate document if (GETPOST('model')) $object->setDocModel($user, GETPOST('model', 'alpha')); + if (GETPOST('fk_bank')) { // this field may come from an external module + $object->fk_bank = GETPOST('fk_bank'); + } else { + $object->fk_bank = $object->fk_account; + } - // Define output language + // Define output language $outputlangs = $langs; $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 3d7a71f8133..87cbbec398b 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3601,13 +3601,13 @@ if ($action == 'create') $formmail->withdeliveryreceipt = 1; $formmail->withcancel = 1; // Tableau des substitutions - $formmail->substit ['__FACREF__'] = $object->ref; - $formmail->substit ['__SIGNATURE__'] = $user->signature; - $formmail->substit ['__REFCLIENT__'] = $object->ref_client; - $formmail->substit ['__THIRPARTY_NAME__'] = $object->thirdparty->name; - $formmail->substit ['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); - $formmail->substit ['__PERSONALIZED__'] = ''; - $formmail->substit ['__CONTACTCIVNAME__'] = ''; + $formmail->substit['__FACREF__'] = $object->ref; + $formmail->substit['__SIGNATURE__'] = $user->signature; + $formmail->substit['__REFCLIENT__'] = $object->ref_client; + $formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name; + $formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); + $formmail->substit['__PERSONALIZED__'] = ''; + $formmail->substit['__CONTACTCIVNAME__'] = ''; // Find the good contact adress $custcontact = ''; @@ -3616,7 +3616,7 @@ if ($action == 'create') if (is_array($contactarr) && count($contactarr) > 0) { foreach ($contactarr as $contact) { - if ($contact ['libelle'] == $langs->trans('TypeContact_facture_external_BILLING')) { // TODO Use code and not label + if ($contact['libelle'] == $langs->trans('TypeContact_facture_external_BILLING')) { // TODO Use code and not label require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; @@ -3627,15 +3627,15 @@ if ($action == 'create') } if (! empty($custcontact)) { - $formmail->substit ['__CONTACTCIVNAME__'] = $custcontact; + $formmail->substit['__CONTACTCIVNAME__'] = $custcontact; } } // Tableau des parametres complementaires du post - $formmail->param ['action'] = $action; - $formmail->param ['models'] = $modelmail; - $formmail->param ['facid'] = $object->id; - $formmail->param ['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id; + $formmail->param['action'] = $action; + $formmail->param['models'] = $modelmail; + $formmail->param['facid'] = $object->id; + $formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id; // Init list of files if (GETPOST("mode") == 'init') { diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index f6d28a4f135..cbe711ab7df 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -718,19 +718,20 @@ class pdf_einstein extends ModelePDFCommandes // 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)) - { - $account = new Account($this->db); - $account->fetch($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($bankid); - $curx=$this->marge_gauche; - $cury=$posy; + $curx=$this->marge_gauche; + $cury=$posy; - $posy=pdf_bank($pdf,$outputlangs,$curx,$cury,$account,0,$default_font_size); + $posy=pdf_bank($pdf,$outputlangs,$curx,$cury,$account,0,$default_font_size); - $posy+=2; - } - } + $posy+=2; + } + } return $posy; } -- GitLab