mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge pull request #4858 from marcosgdf/oop-refactor-bankaccount-tostring
NEW Created Account::__toString, Account::getFieldsToShow and Account::getAccountNumberOrder to refactor the way account number was shown
This commit is contained in:
commit
d40e659b30
|
|
@ -92,10 +92,10 @@ print "</tr>\n";
|
|||
|
||||
$bankorder[0][0]=$langs->trans("BankOrderGlobal");
|
||||
$bankorder[0][1]=$langs->trans("BankOrderGlobalDesc");
|
||||
$bankorder[0][2]='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
$bankorder[0][2]='BankCode DeskCode BankAccountNumber BankAccountNumberKey';
|
||||
$bankorder[1][0]=$langs->trans("BankOrderES");
|
||||
$bankorder[1][1]=$langs->trans("BankOrderESDesc");
|
||||
$bankorder[1][2]='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
$bankorder[1][2]='BankCode DeskCode BankAccountNumberKey BankAccountNumber';
|
||||
|
||||
$var = true;
|
||||
$i=0;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* 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
|
||||
|
|
@ -387,65 +388,28 @@ if ($action == 'create')
|
|||
print '</tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
foreach ($account->getFieldsToShow() as $val) {
|
||||
if ($val == 'BankCode') {
|
||||
$name = 'code_banque';
|
||||
$size = 8;
|
||||
$content = $account->code_banque;
|
||||
} elseif ($val == 'DeskCode') {
|
||||
$name = 'code_guichet';
|
||||
$size = 8;
|
||||
$content = $account->code_guichet;
|
||||
} elseif ($val == 'BankAccountNumber') {
|
||||
$name = 'number';
|
||||
$size = 18;
|
||||
$content = $account->number;
|
||||
} elseif ($val == 'BankAccountNumberKey') {
|
||||
$name = 'cle_rib';
|
||||
$size = 3;
|
||||
$content = $account->cle_rib;
|
||||
}
|
||||
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td><input size="18" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
print '<td>'.$langs->trans($val).'</td>';
|
||||
print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$ibankey = FormBank::getIBANLabel($account);
|
||||
$bickey="BICNumber";
|
||||
|
|
@ -650,64 +614,20 @@ else
|
|||
print '<td colspan="3">'.$account->bank.'</td></tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_banque.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_guichet.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
foreach ($account->getFieldsToShow() as $val) {
|
||||
if ($val == 'BankCode') {
|
||||
$content = $account->code_banque;
|
||||
} elseif ($val == 'DeskCode') {
|
||||
$content = $account->code_guichet;
|
||||
} elseif ($val == 'BankAccountNumber') {
|
||||
$content = $account->number;
|
||||
} elseif ($val == 'BankAccountNumberKey') {
|
||||
$content = $account->cle_rib;
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_banque.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td colspan="3">'.$account->number.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td colspan="3">'.$account->cle_rib.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
print '<tr><td>'.$langs->trans($val).'</td>';
|
||||
print '<td colspan="3">'.$content.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
$ibankey = FormBank::getIBANLabel($account);
|
||||
|
|
@ -937,65 +857,28 @@ else
|
|||
print '</tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
foreach ($account->getFieldsToShow() as $val) {
|
||||
if ($val == 'BankCode') {
|
||||
$name = 'code_banque';
|
||||
$size = 8;
|
||||
$content = $account->code_banque;
|
||||
} elseif ($val == 'DeskCode') {
|
||||
$name = 'code_guichet';
|
||||
$size = 8;
|
||||
$content = $account->code_guichet;
|
||||
} elseif ($val == 'BankAccountNumber') {
|
||||
$name = 'number';
|
||||
$size = 18;
|
||||
$content = $account->number;
|
||||
} elseif ($val == 'BankAccountNumberKey') {
|
||||
$name = 'cle_rib';
|
||||
$size = 3;
|
||||
$content = $account->cle_rib;
|
||||
}
|
||||
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td><input size="18" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
print '<tr><td>'.$langs->trans($val).'</td>';
|
||||
print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
$ibankey = FormBank::getIBANLabel($account);
|
||||
|
|
|
|||
|
|
@ -238,6 +238,31 @@ class Account extends CommonObject
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the account number in the appropiate format
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
$string = '';
|
||||
|
||||
foreach ($this->getFieldsToShow() as $val) {
|
||||
|
||||
if ($val == 'BankCode') {
|
||||
$string .= $this->code_banque.' ';
|
||||
} elseif ($val == 'BankAccountNumber') {
|
||||
$string .= $this->number.' ';
|
||||
} elseif ($val == 'DeskCode') {
|
||||
$string .= $this->code_guichet.' ';
|
||||
} elseif ($val == 'BankAccountNumberKey') {
|
||||
$string .= $this->cle_rib.' ';
|
||||
}
|
||||
}
|
||||
|
||||
return trim($string);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return if a bank account need to be conciliated
|
||||
|
|
@ -1230,6 +1255,83 @@ class Account extends CommonObject
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the fields in order that this bank account should show to the user
|
||||
* Will return an array with the following values:
|
||||
* - BankAccountNumber
|
||||
* - BankCode
|
||||
* - BankAccountNumberKey
|
||||
* - DeskCode
|
||||
*
|
||||
* Some countries show less or more bank account properties to the user
|
||||
*
|
||||
* @return array
|
||||
* @see useDetailedBBAN
|
||||
*/
|
||||
public function getFieldsToShow()
|
||||
{
|
||||
//Get the required properties depending on the country
|
||||
$detailedBBAN = $this->useDetailedBBAN();
|
||||
|
||||
if ($detailedBBAN == 0) {
|
||||
return array(
|
||||
'BankAccountNumber'
|
||||
);
|
||||
} elseif ($detailedBBAN == 2) {
|
||||
return array(
|
||||
'BankCode',
|
||||
'BankAccountNumber'
|
||||
);
|
||||
}
|
||||
|
||||
//Get the order the properties are shown
|
||||
return self::getAccountNumberOrder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the components of the bank account in order.
|
||||
* Will return an array with the following values:
|
||||
* - BankAccountNumber
|
||||
* - BankCode
|
||||
* - BankAccountNumberKey
|
||||
* - DeskCode
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getAccountNumberOrder()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$fieldlists = array(
|
||||
'BankCode',
|
||||
'DeskCode',
|
||||
'BankAccountNumber',
|
||||
'BankAccountNumberKey'
|
||||
);
|
||||
|
||||
if (!empty($conf->global->BANK_SHOW_ORDER_OPTION)) {
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION)) {
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') {
|
||||
$fieldlists = array(
|
||||
'BankCode',
|
||||
'DeskCode',
|
||||
'BankAccountNumberKey',
|
||||
'BankAccountNumber'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
//Replace the old AccountNumber key with the new BankAccountNumber key
|
||||
$fieldlists = explode(
|
||||
' ',
|
||||
preg_replace('/ ?[^Bank]AccountNumber ?/', 'BankAccountNumber',
|
||||
$conf->global->BANK_SHOW_ORDER_OPTION)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $fieldlists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialise an instance with random values.
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
* Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015-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
|
||||
|
|
@ -648,64 +648,42 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
|
|||
// key = check control key used only when $usedetailedbban = 1
|
||||
if (empty($onlynumber)) $pdf->line($curx+1, $cury+1, $curx+1, $cury+6);
|
||||
|
||||
if ($usedetailedbban == 1)
|
||||
{
|
||||
$fieldstoshow=array('bank','desk','number','key');
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == 1) $fieldstoshow=array('bank','desk','key','number');
|
||||
}
|
||||
else if ($usedetailedbban == 2)
|
||||
{
|
||||
$fieldstoshow=array('bank','number');
|
||||
}
|
||||
else dol_print_error('','Value returned by function useDetailedBBAN not managed');
|
||||
|
||||
foreach ($fieldstoshow as $val)
|
||||
{
|
||||
if ($val == 'bank')
|
||||
{
|
||||
// Bank code
|
||||
$tmplength=18;
|
||||
$pdf->SetXY($curx, $cury+4);
|
||||
$pdf->SetFont('','',$default_font_size - 3);$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->code_banque), 0, 'C', 0);
|
||||
$pdf->SetXY($curx, $cury+1);
|
||||
$curx+=$tmplength;
|
||||
$pdf->SetFont('','B',$default_font_size - 4);$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankCode"), 0, 'C', 0);
|
||||
if (empty($onlynumber)) $pdf->line($curx, $cury+1, $curx, $cury+7);
|
||||
}
|
||||
if ($val == 'desk')
|
||||
{
|
||||
// Desk
|
||||
$tmplength=18;
|
||||
$pdf->SetXY($curx, $cury+4);
|
||||
$pdf->SetFont('','',$default_font_size - 3);$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->code_guichet), 0, 'C', 0);
|
||||
$pdf->SetXY($curx, $cury+1);
|
||||
$curx+=$tmplength;
|
||||
$pdf->SetFont('','B',$default_font_size - 4);$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("DeskCode"), 0, 'C', 0);
|
||||
if (empty($onlynumber)) $pdf->line($curx, $cury+1, $curx, $cury+7);
|
||||
}
|
||||
if ($val == 'number')
|
||||
{
|
||||
// Number
|
||||
$tmplength=24;
|
||||
$pdf->SetXY($curx, $cury+4);
|
||||
$pdf->SetFont('','',$default_font_size - 3);$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->number), 0, 'C', 0);
|
||||
$pdf->SetXY($curx, $cury+1);
|
||||
$curx+=$tmplength;
|
||||
$pdf->SetFont('','B',$default_font_size - 4);$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankAccountNumber"), 0, 'C', 0);
|
||||
if (empty($onlynumber)) $pdf->line($curx, $cury+1, $curx, $cury+7);
|
||||
}
|
||||
if ($val == 'key')
|
||||
{
|
||||
// Key
|
||||
$tmplength=13;
|
||||
$pdf->SetXY($curx, $cury+4);
|
||||
$pdf->SetFont('','',$default_font_size - 3);$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->cle_rib), 0, 'C', 0);
|
||||
$pdf->SetXY($curx, $cury+1);
|
||||
$curx+=$tmplength;
|
||||
$pdf->SetFont('','B',$default_font_size - 4);$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankAccountNumberKey"), 0, 'C', 0);
|
||||
if (empty($onlynumber)) $pdf->line($curx, $cury+1, $curx, $cury+7);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($account->getFieldsToShow() as $val)
|
||||
{
|
||||
$pdf->SetXY($curx, $cury+4);
|
||||
$pdf->SetFont('','',$default_font_size - 3);
|
||||
|
||||
if ($val == 'BankCode') {
|
||||
// Bank code
|
||||
$tmplength = 18;
|
||||
$content = $account->code_banque;
|
||||
} elseif ($val == 'DeskCode') {
|
||||
// Desk
|
||||
$tmplength = 18;
|
||||
$content = $account->code_guichet;
|
||||
} elseif ($val == 'BankAccountNumber') {
|
||||
// Number
|
||||
$tmplength = 24;
|
||||
$content = $account->number;
|
||||
} elseif ($val == 'BankAccountNumberKey') {
|
||||
// Key
|
||||
$tmplength = 13;
|
||||
$content = $account->cle_rib;
|
||||
} else {
|
||||
dol_print_error($this->db, 'Unexpected value for getFieldsToShow: '.$val);
|
||||
break;
|
||||
}
|
||||
|
||||
$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($content), 0, 'C', 0);
|
||||
$pdf->SetXY($curx, $cury + 1);
|
||||
$curx += $tmplength;
|
||||
$pdf->SetFont('', 'B', $default_font_size - 4);
|
||||
$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities($val), 0, 'C', 0);
|
||||
if (empty($onlynumber)) {
|
||||
$pdf->line($curx, $cury + 1, $curx, $cury + 7);
|
||||
}
|
||||
}
|
||||
|
||||
$curx=$savcurx;
|
||||
$cury+=8;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
* Copyright (C) 2010-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
|
||||
* 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
|
||||
|
|
@ -60,7 +61,7 @@ class CompanyBankAccount extends Account
|
|||
/**
|
||||
* Create bank information record
|
||||
*
|
||||
* @param Object $user User
|
||||
* @param User $user User
|
||||
* @return int <0 if KO, >= 0 if OK
|
||||
*/
|
||||
function create($user='')
|
||||
|
|
@ -222,79 +223,27 @@ class CompanyBankAccount extends Account
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return RIB
|
||||
*
|
||||
* @param boolean $displayriblabel Prepend or Hide Label
|
||||
* @return string RIB
|
||||
*/
|
||||
function getRibLabel($displayriblabel = true)
|
||||
{
|
||||
global $langs,$conf;
|
||||
/**
|
||||
* Return RIB
|
||||
*
|
||||
* @param boolean $displayriblabel Prepend or Hide Label
|
||||
* @return string RIB
|
||||
*/
|
||||
public function getRibLabel($displayriblabel = true)
|
||||
{
|
||||
$rib = '';
|
||||
|
||||
if ($this->code_banque || $this->code_guichet || $this->number || $this->cle_rib)
|
||||
{
|
||||
if ($this->label && $displayriblabel) $rib = $this->label." : ";
|
||||
if ($this->code_banque || $this->code_guichet || $this->number || $this->cle_rib) {
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
if ($this->label && $displayriblabel) {
|
||||
$rib = $this->label." : ";
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($this->useDetailedBBAN() == 1)
|
||||
{
|
||||
$rib.=$this->code_banque.' ';
|
||||
}
|
||||
}
|
||||
$rib .= (string) $this;
|
||||
}
|
||||
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($this->useDetailedBBAN() == 1)
|
||||
{
|
||||
$rib.=$this->code_guichet.' ';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($this->useDetailedBBAN() == 2)
|
||||
{
|
||||
$rib.=$this->code_banque.' ';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
$rib.=$this->number.' ';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($this->useDetailedBBAN() == 1)
|
||||
{
|
||||
$rib.=$this->cle_rib.' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$rib='';
|
||||
}
|
||||
|
||||
return $rib;
|
||||
}
|
||||
return $rib;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set RIB as Default
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015-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
|
||||
|
|
@ -254,64 +254,22 @@ if ($socid && $action != 'edit' && $action != "create")
|
|||
print '<td colspan="4">'.$account->bank.'</td></tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
|
||||
foreach($account->getFieldsToShow() as $val)
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_banque.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_guichet.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
if ($val == 'BankCode') {
|
||||
$content = $account->code_banque;
|
||||
} elseif ($val == 'DeskCode') {
|
||||
$content = $account->code_guichet;
|
||||
} elseif ($val == 'BankAccountNumber') {
|
||||
$content = $account->number;
|
||||
} elseif ($val == 'BankAccountNumberKey') {
|
||||
$content = $account->cle_rib;
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_banque.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td colspan="3">'.$account->number.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td colspan="3">'.$account->cle_rib.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
print '<tr><td>'.$langs->trans($val).'</td>';
|
||||
print '<td colspan="3">'.$content.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("IBAN").'</td>';
|
||||
|
|
@ -473,65 +431,28 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer)
|
|||
print '<td><input size="30" type="text" name="bank" value="'.$account->bank.'"></td></tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
foreach ($account->getFieldsToShow() as $val) {
|
||||
if ($val == 'BankCode') {
|
||||
$name = 'code_banque';
|
||||
$size = 8;
|
||||
$content = $account->code_banque;
|
||||
} elseif ($val == 'DeskCode') {
|
||||
$name = 'code_guichet';
|
||||
$size = 8;
|
||||
$content = $account->code_guichet;
|
||||
} elseif ($val == 'BankAccountNumber') {
|
||||
$name = 'number';
|
||||
$size = 18;
|
||||
$content = $account->number;
|
||||
} elseif ($val == 'BankAccountNumberKey') {
|
||||
$name = 'cle_rib';
|
||||
$size = 3;
|
||||
$content = $account->cle_rib;
|
||||
}
|
||||
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<td class="fieldrequired">'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td><input size="18" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
print '<tr><td>'.$langs->trans($val).'</td>';
|
||||
print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// IBAN
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -149,64 +149,20 @@ if ($id && $action != 'edit')
|
|||
print '<td colspan="4">'.$account->bank.'</td></tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_banque.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_guichet.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
foreach ($account->getFieldsToShow() as $val) {
|
||||
if ($val == 'BankCode') {
|
||||
$content = $account->code_banque;
|
||||
} elseif ($val == 'DeskCode') {
|
||||
$content = $account->code_guichet;
|
||||
} elseif ($val == 'BankAccountNumber') {
|
||||
$content = $account->number;
|
||||
} elseif ($val == 'BankAccountNumberKey') {
|
||||
$content = $account->cle_rib;
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_banque.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td colspan="3">'.$account->number.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td colspan="3">'.$account->cle_rib.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
print '<tr><td>'.$langs->trans($val).'</td>';
|
||||
print '<td colspan="3">'.$content.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("IBAN").'</td>';
|
||||
|
|
@ -290,65 +246,28 @@ if ($id && $action == 'edit' && $user->rights->user->user->creer)
|
|||
print '<td><input size="30" type="text" name="bank" value="'.$account->bank.'"></td></tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
foreach ($account->getFieldsToShow() as $val) {
|
||||
if ($val == 'BankCode') {
|
||||
$name = 'code_banque';
|
||||
$size = 8;
|
||||
$content = $account->code_banque;
|
||||
} elseif ($val == 'DeskCode') {
|
||||
$name = 'code_guichet';
|
||||
$size = 8;
|
||||
$content = $account->code_guichet;
|
||||
} elseif ($val == 'BankAccountNumber') {
|
||||
$name = 'number';
|
||||
$size = 18;
|
||||
$content = $account->number;
|
||||
} elseif ($val == 'BankAccountNumberKey') {
|
||||
$name = 'cle_rib';
|
||||
$size = 3;
|
||||
$content = $account->cle_rib;
|
||||
}
|
||||
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<td class="fieldrequired">'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td><input size="18" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
print '<td>'.$langs->trans($val).'</td>';
|
||||
print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// IBAN
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
|
||||
* 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
|
||||
|
|
@ -57,7 +58,7 @@ class UserBankAccount extends Account
|
|||
/**
|
||||
* Create bank information record
|
||||
*
|
||||
* @param Object $user User
|
||||
* @param User $user User
|
||||
* @return int <0 if KO, >= 0 if OK
|
||||
*/
|
||||
function create($user='')
|
||||
|
|
@ -177,78 +178,26 @@ class UserBankAccount extends Account
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return RIB
|
||||
*
|
||||
* @param boolean $displayriblabel Prepend or Hide Label
|
||||
* @return string RIB
|
||||
*/
|
||||
function getRibLabel($displayriblabel = true)
|
||||
{
|
||||
global $langs,$conf;
|
||||
/**
|
||||
* Return RIB
|
||||
*
|
||||
* @param boolean $displayriblabel Prepend or Hide Label
|
||||
* @return string RIB
|
||||
*/
|
||||
public function getRibLabel($displayriblabel = true)
|
||||
{
|
||||
$rib = '';
|
||||
|
||||
if ($this->code_banque || $this->code_guichet || $this->number || $this->cle_rib)
|
||||
{
|
||||
if ($this->label && $displayriblabel) $rib = $this->label." : ";
|
||||
if ($this->code_banque || $this->code_guichet || $this->number || $this->cle_rib) {
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
if ($this->label && $displayriblabel) {
|
||||
$rib = $this->label." : ";
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($this->useDetailedBBAN() == 1)
|
||||
{
|
||||
$rib.=$this->code_banque.' ';
|
||||
}
|
||||
}
|
||||
$rib .= (string) $this;
|
||||
}
|
||||
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($this->useDetailedBBAN() == 1)
|
||||
{
|
||||
$rib.=$this->code_guichet.' ';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($this->useDetailedBBAN() == 2)
|
||||
{
|
||||
$rib.=$this->code_banque.' ';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
$rib.=$this->number.' ';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($this->useDetailedBBAN() == 1)
|
||||
{
|
||||
$rib.=$this->cle_rib.' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$rib='';
|
||||
}
|
||||
|
||||
return $rib;
|
||||
}
|
||||
return $rib;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user