diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php
index b33b0438552..e6721e1b73d 100644
--- a/htdocs/compta/bank/card.php
+++ b/htdocs/compta/bank/card.php
@@ -447,9 +447,8 @@ if ($action == 'create')
}
}
}
- $ibankey="IBANNumber";
+ $ibankey = FormBank::getIBANLabel($account);
$bickey="BICNumber";
- if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
// IBAN
@@ -711,9 +710,8 @@ else
}
}
- $ibankey="IBANNumber";
+ $ibankey = FormBank::getIBANLabel($account);
$bickey="BICNumber";
- if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
print '
| '.$langs->trans($ibankey).' | ';
@@ -1000,9 +998,8 @@ else
}
}
- $ibankey="IBANNumber";
+ $ibankey = FormBank::getIBANLabel($account);
$bickey="BICNumber";
- if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
// IBAN
diff --git a/htdocs/core/class/html.formbank.class.php b/htdocs/core/class/html.formbank.class.php
index 450441cf54c..4ee00555b85 100644
--- a/htdocs/core/class/html.formbank.class.php
+++ b/htdocs/core/class/html.formbank.class.php
@@ -1,6 +1,7 @@
* Copyright (C) 2015 Alexandre Spangaro
+ * Copyright (C) 2016 Marcos GarcĂa
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -56,5 +57,19 @@ class FormBank
print Form::selectarray($htmlname, $account->type_lib, $selected);
}
+ /**
+ * Returns the name of the Iban label. India uses 'IFSC' and the rest of the world 'IBAN' name.
+ *
+ * @param Account $account Account object
+ * @return string
+ */
+ public static function getIBANLabel(Account $account)
+ {
+ if ($account->getCountryCode() == 'IN') {
+ return 'IFSC';
+ }
+
+ return 'IBANNumber';
+ }
}
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index a952159b874..9c70635a957 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -602,6 +602,8 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
*/
function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default_font_size=10)
{
+ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php';
+
global $mysoc, $conf;
$diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE);
@@ -749,8 +751,8 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
else if (! $usedetailedbban) $cury+=1;
// Use correct name of bank id according to country
- $ibankey="IBANNumber";
- if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
+ $ibankey = FormBank::getIBANLabel($account);
+
if (! empty($account->iban))
{
//Remove whitespaces to ensure we are dealing with the format we expect