diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index b33b0438552f177d6ce54da859156ba1a0fd212f..e6721e1b73dbe085b6b79e20c391ff7fe6eec342 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 '<tr><td>'.$langs->trans($ibankey).'</td>'; @@ -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 450441cf54c50bce83bc423c4829b0dac340f223..4ee00555b853f1c1a156debe3760145b986071a4 100644 --- a/htdocs/core/class/html.formbank.class.php +++ b/htdocs/core/class/html.formbank.class.php @@ -1,6 +1,7 @@ <?php /* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> + * Copyright (C) 2016 Marcos GarcĂa <marcosgdf@gmail.com> * * 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 a952159b8744fd0028c365d7e5f2a544d5fd8302..d9a6fea21315d58db4945b473895a87a05104793 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -749,8 +749,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