Fix: the bank information were visible into pdf but were not using

correct setup to decide which bank to show.
This commit is contained in:
Laurent Destailleur 2015-03-02 02:59:59 +01:00
parent 8a67a3af10
commit 3475433eaf
4 changed files with 37 additions and 29 deletions

View File

@ -956,6 +956,11 @@ if (empty($reshook))
else if ($action == 'builddoc' && $user->rights->propal->creer) { else if ($action == 'builddoc' && $user->rights->propal->creer) {
if (GETPOST('model')) { if (GETPOST('model')) {
$object->setDocModel($user, 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 // Define output language

View File

@ -94,6 +94,7 @@ $hookmanager->initHooks(array('ordercard','globalcard'));
$permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php $permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php
/* /*
* Actions * Actions
*/ */
@ -1072,16 +1073,17 @@ if (empty($reshook))
exit(); exit();
} }
// Generate order document (define into /core/modules/commande/modules_commande.php)
else if ($action == 'builddoc') // In get or post 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 // Save last template used to generate document
if (GETPOST('model')) if (GETPOST('model'))
$object->setDocModel($user, GETPOST('model', 'alpha')); $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; $outputlangs = $langs;

View File

@ -3601,13 +3601,13 @@ if ($action == 'create')
$formmail->withdeliveryreceipt = 1; $formmail->withdeliveryreceipt = 1;
$formmail->withcancel = 1; $formmail->withcancel = 1;
// Tableau des substitutions // Tableau des substitutions
$formmail->substit ['__FACREF__'] = $object->ref; $formmail->substit['__FACREF__'] = $object->ref;
$formmail->substit ['__SIGNATURE__'] = $user->signature; $formmail->substit['__SIGNATURE__'] = $user->signature;
$formmail->substit ['__REFCLIENT__'] = $object->ref_client; $formmail->substit['__REFCLIENT__'] = $object->ref_client;
$formmail->substit ['__THIRPARTY_NAME__'] = $object->thirdparty->name; $formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name;
$formmail->substit ['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
$formmail->substit ['__PERSONALIZED__'] = ''; $formmail->substit['__PERSONALIZED__'] = '';
$formmail->substit ['__CONTACTCIVNAME__'] = ''; $formmail->substit['__CONTACTCIVNAME__'] = '';
// Find the good contact adress // Find the good contact adress
$custcontact = ''; $custcontact = '';
@ -3616,7 +3616,7 @@ if ($action == 'create')
if (is_array($contactarr) && count($contactarr) > 0) { if (is_array($contactarr) && count($contactarr) > 0) {
foreach ($contactarr as $contact) { 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'; require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
@ -3627,15 +3627,15 @@ if ($action == 'create')
} }
if (! empty($custcontact)) { if (! empty($custcontact)) {
$formmail->substit ['__CONTACTCIVNAME__'] = $custcontact; $formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
} }
} }
// Tableau des parametres complementaires du post // Tableau des parametres complementaires du post
$formmail->param ['action'] = $action; $formmail->param['action'] = $action;
$formmail->param ['models'] = $modelmail; $formmail->param['models'] = $modelmail;
$formmail->param ['facid'] = $object->id; $formmail->param['facid'] = $object->id;
$formmail->param ['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id; $formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
// Init list of files // Init list of files
if (GETPOST("mode") == 'init') { if (GETPOST("mode") == 'init') {

View File

@ -718,10 +718,11 @@ class pdf_einstein extends ModelePDFCommandes
// If payment mode not forced or forced to VIR, show payment with BAN // 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($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 = new Account($this->db);
$account->fetch($conf->global->FACTURE_RIB_NUMBER); $account->fetch($bankid);
$curx=$this->marge_gauche; $curx=$this->marge_gauche;
$cury=$posy; $cury=$posy;