2
0
forked from Wavyzz/dolibarr

Merge pull request #4855 from marcosgdf/account-oop

NEW Created FormBank::getIBANLabel function to get the label of "IBAN" depending on bank account country
This commit is contained in:
Laurent Destailleur
2016-03-25 17:41:39 +01:00
3 changed files with 22 additions and 8 deletions

View File

@@ -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

View File

@@ -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';
}
}

View File

@@ -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