Skip to content
Snippets Groups Projects
Commit 30aea901 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Merge pull request #4855 from marcosgdf/account-oop

NEW Created FormBank::getIBANLabel function to get the label of "IBAN" depending on bank account country
parents 34c197f2 7fbf16a2
No related branches found
No related tags found
No related merge requests found
...@@ -447,9 +447,8 @@ if ($action == 'create') ...@@ -447,9 +447,8 @@ if ($action == 'create')
} }
} }
} }
$ibankey="IBANNumber"; $ibankey = FormBank::getIBANLabel($account);
$bickey="BICNumber"; $bickey="BICNumber";
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
// IBAN // IBAN
...@@ -711,9 +710,8 @@ else ...@@ -711,9 +710,8 @@ else
} }
} }
$ibankey="IBANNumber"; $ibankey = FormBank::getIBANLabel($account);
$bickey="BICNumber"; $bickey="BICNumber";
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
print '<tr><td>'.$langs->trans($ibankey).'</td>'; print '<tr><td>'.$langs->trans($ibankey).'</td>';
...@@ -1000,9 +998,8 @@ else ...@@ -1000,9 +998,8 @@ else
} }
} }
$ibankey="IBANNumber"; $ibankey = FormBank::getIBANLabel($account);
$bickey="BICNumber"; $bickey="BICNumber";
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
// IBAN // IBAN
......
<?php <?php
/* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * 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 * 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 * it under the terms of the GNU General Public License as published by
...@@ -56,5 +57,19 @@ class FormBank ...@@ -56,5 +57,19 @@ class FormBank
print Form::selectarray($htmlname, $account->type_lib, $selected); 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';
}
} }
...@@ -602,6 +602,8 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text) ...@@ -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) 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; global $mysoc, $conf;
$diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE); $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 ...@@ -749,8 +751,8 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
else if (! $usedetailedbban) $cury+=1; else if (! $usedetailedbban) $cury+=1;
// Use correct name of bank id according to country // Use correct name of bank id according to country
$ibankey="IBANNumber"; $ibankey = FormBank::getIBANLabel($account);
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
if (! empty($account->iban)) if (! empty($account->iban))
{ {
//Remove whitespaces to ensure we are dealing with the format we expect //Remove whitespaces to ensure we are dealing with the format we expect
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment