From 69bb4b7b0bbf826de823a711bb99e2d799663a5f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= <frederic.france@free.fr>
Date: Sun, 18 Jan 2015 23:00:26 +0100
Subject: [PATCH] Use account defined in invoice for pdf doc

---
 htdocs/compta/facture.php | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index d64a849e663..c4ea066f801 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1577,8 +1577,11 @@ if (empty($reshook))
 		// 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');
+        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;
-- 
GitLab