From 2d5331b8f860e3cc03b8b57d3f1d37abce7633da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?=
 <marcosgdf@gmail.com>
Date: Tue, 1 Sep 2015 16:25:34 +0200
Subject: [PATCH] FIX [ #3460 ] Selected bank account was not saved when an
 error happened when trying to create a customer invoice

Close #3460
---
 ChangeLog                 | 1 +
 htdocs/compta/facture.php | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index cf99ec9012f..e70e48a493a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,7 @@ FIX [ bug #3288 ] Tasks box is not properly drawn
 FIX [ bug #3211 ] Outstading bill amount of a client showed wrong amounts
 FIX [ bug #3321 ] Users with certain permissions were shown a "forbidden access" page even if they had the rights
 FIX [ bug #3426 ] Unable to create an invoice from a contract with extrafields
+FIX [ bug #3460 ] Bank account is not saved when creating a customer invoice and facing an error message
 
 NEW: Created new ContratLigne::insert function
 
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index b360f6b6315..dc04004653f 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -2121,6 +2121,10 @@ if ($action == 'create')
 	print '</td></tr>';
 
     // Bank Account
+	if (isset($_POST['fk_account'])) {
+		$fk_account = $_POST['fk_account'];
+	}
+
     print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">';
     $form->select_comptes($fk_account, 'fk_account', 0, '', 1);
     print '</td></tr>';
-- 
GitLab