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][0]=$langs->trans("BankOrderGlobal");
|
||||||
$bankorder[0][1]=$langs->trans("BankOrderGlobalDesc");
|
$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][0]=$langs->trans("BankOrderES");
|
||||||
$bankorder[1][1]=$langs->trans("BankOrderESDesc");
|
$bankorder[1][1]=$langs->trans("BankOrderESDesc");
|
||||||
$bankorder[1][2]='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
$bankorder[1][2]='BankCode DeskCode BankAccountNumberKey BankAccountNumber';
|
||||||
|
|
||||||
$var = true;
|
$var = true;
|
||||||
$i=0;
|
$i=0;
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* 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
|
* 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
|
||||||
@ -387,65 +388,28 @@ if ($action == 'create')
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Show fields of bank account
|
// Show fields of bank account
|
||||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
foreach ($account->getFieldsToShow() as $val) {
|
||||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
if ($val == 'BankCode') {
|
||||||
{
|
$name = 'code_banque';
|
||||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
$size = 8;
|
||||||
{
|
$content = $account->code_banque;
|
||||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
} elseif ($val == 'DeskCode') {
|
||||||
}
|
$name = 'code_guichet';
|
||||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
$size = 8;
|
||||||
}
|
$content = $account->code_guichet;
|
||||||
$fieldlistsarray=explode(' ',$fieldlists);
|
} elseif ($val == 'BankAccountNumber') {
|
||||||
|
$name = 'number';
|
||||||
foreach($fieldlistsarray as $val)
|
$size = 18;
|
||||||
{
|
$content = $account->number;
|
||||||
if ($val == 'BankCode')
|
} elseif ($val == 'BankAccountNumberKey') {
|
||||||
{
|
$name = 'cle_rib';
|
||||||
if ($account->useDetailedBBAN() == 1)
|
$size = 3;
|
||||||
{
|
$content = $account->cle_rib;
|
||||||
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 == 'DeskCode')
|
print '<td>'.$langs->trans($val).'</td>';
|
||||||
{
|
print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>';
|
||||||
if ($account->useDetailedBBAN() == 1)
|
print '</tr>';
|
||||||
{
|
|
||||||
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>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$ibankey = FormBank::getIBANLabel($account);
|
$ibankey = FormBank::getIBANLabel($account);
|
||||||
$bickey="BICNumber";
|
$bickey="BICNumber";
|
||||||
@ -650,64 +614,20 @@ else
|
|||||||
print '<td colspan="3">'.$account->bank.'</td></tr>';
|
print '<td colspan="3">'.$account->bank.'</td></tr>';
|
||||||
|
|
||||||
// Show fields of bank account
|
// Show fields of bank account
|
||||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
foreach ($account->getFieldsToShow() as $val) {
|
||||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
if ($val == 'BankCode') {
|
||||||
{
|
$content = $account->code_banque;
|
||||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
} elseif ($val == 'DeskCode') {
|
||||||
{
|
$content = $account->code_guichet;
|
||||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
} elseif ($val == 'BankAccountNumber') {
|
||||||
}
|
$content = $account->number;
|
||||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
} elseif ($val == 'BankAccountNumberKey') {
|
||||||
}
|
$content = $account->cle_rib;
|
||||||
$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')
|
print '<tr><td>'.$langs->trans($val).'</td>';
|
||||||
{
|
print '<td colspan="3">'.$content.'</td>';
|
||||||
if ($account->useDetailedBBAN() == 2)
|
print '</tr>';
|
||||||
{
|
|
||||||
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>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$ibankey = FormBank::getIBANLabel($account);
|
$ibankey = FormBank::getIBANLabel($account);
|
||||||
@ -937,65 +857,28 @@ else
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Show fields of bank account
|
// Show fields of bank account
|
||||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
foreach ($account->getFieldsToShow() as $val) {
|
||||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
if ($val == 'BankCode') {
|
||||||
{
|
$name = 'code_banque';
|
||||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
$size = 8;
|
||||||
{
|
$content = $account->code_banque;
|
||||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
} elseif ($val == 'DeskCode') {
|
||||||
}
|
$name = 'code_guichet';
|
||||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
$size = 8;
|
||||||
}
|
$content = $account->code_guichet;
|
||||||
$fieldlistsarray=explode(' ',$fieldlists);
|
} elseif ($val == 'BankAccountNumber') {
|
||||||
|
$name = 'number';
|
||||||
foreach($fieldlistsarray as $val)
|
$size = 18;
|
||||||
{
|
$content = $account->number;
|
||||||
if ($val == 'BankCode')
|
} elseif ($val == 'BankAccountNumberKey') {
|
||||||
{
|
$name = 'cle_rib';
|
||||||
if ($account->useDetailedBBAN() == 1)
|
$size = 3;
|
||||||
{
|
$content = $account->cle_rib;
|
||||||
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 == 'DeskCode')
|
print '<tr><td>'.$langs->trans($val).'</td>';
|
||||||
{
|
print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>';
|
||||||
if ($account->useDetailedBBAN() == 1)
|
print '</tr>';
|
||||||
{
|
|
||||||
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>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$ibankey = FormBank::getIBANLabel($account);
|
$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
|
* 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.
|
* Initialise an instance with random values.
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
* Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||||
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
|
* 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
|
* 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
|
||||||
@ -648,64 +648,42 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
|
|||||||
// key = check control key used only when $usedetailedbban = 1
|
// key = check control key used only when $usedetailedbban = 1
|
||||||
if (empty($onlynumber)) $pdf->line($curx+1, $cury+1, $curx+1, $cury+6);
|
if (empty($onlynumber)) $pdf->line($curx+1, $cury+1, $curx+1, $cury+6);
|
||||||
|
|
||||||
if ($usedetailedbban == 1)
|
|
||||||
{
|
foreach ($account->getFieldsToShow() as $val)
|
||||||
$fieldstoshow=array('bank','desk','number','key');
|
{
|
||||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == 1) $fieldstoshow=array('bank','desk','key','number');
|
$pdf->SetXY($curx, $cury+4);
|
||||||
}
|
$pdf->SetFont('','',$default_font_size - 3);
|
||||||
else if ($usedetailedbban == 2)
|
|
||||||
{
|
if ($val == 'BankCode') {
|
||||||
$fieldstoshow=array('bank','number');
|
// Bank code
|
||||||
}
|
$tmplength = 18;
|
||||||
else dol_print_error('','Value returned by function useDetailedBBAN not managed');
|
$content = $account->code_banque;
|
||||||
|
} elseif ($val == 'DeskCode') {
|
||||||
foreach ($fieldstoshow as $val)
|
// Desk
|
||||||
{
|
$tmplength = 18;
|
||||||
if ($val == 'bank')
|
$content = $account->code_guichet;
|
||||||
{
|
} elseif ($val == 'BankAccountNumber') {
|
||||||
// Bank code
|
// Number
|
||||||
$tmplength=18;
|
$tmplength = 24;
|
||||||
$pdf->SetXY($curx, $cury+4);
|
$content = $account->number;
|
||||||
$pdf->SetFont('','',$default_font_size - 3);$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->code_banque), 0, 'C', 0);
|
} elseif ($val == 'BankAccountNumberKey') {
|
||||||
$pdf->SetXY($curx, $cury+1);
|
// Key
|
||||||
$curx+=$tmplength;
|
$tmplength = 13;
|
||||||
$pdf->SetFont('','B',$default_font_size - 4);$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankCode"), 0, 'C', 0);
|
$content = $account->cle_rib;
|
||||||
if (empty($onlynumber)) $pdf->line($curx, $cury+1, $curx, $cury+7);
|
} else {
|
||||||
}
|
dol_print_error($this->db, 'Unexpected value for getFieldsToShow: '.$val);
|
||||||
if ($val == 'desk')
|
break;
|
||||||
{
|
}
|
||||||
// Desk
|
|
||||||
$tmplength=18;
|
$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($content), 0, 'C', 0);
|
||||||
$pdf->SetXY($curx, $cury+4);
|
$pdf->SetXY($curx, $cury + 1);
|
||||||
$pdf->SetFont('','',$default_font_size - 3);$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->code_guichet), 0, 'C', 0);
|
$curx += $tmplength;
|
||||||
$pdf->SetXY($curx, $cury+1);
|
$pdf->SetFont('', 'B', $default_font_size - 4);
|
||||||
$curx+=$tmplength;
|
$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities($val), 0, 'C', 0);
|
||||||
$pdf->SetFont('','B',$default_font_size - 4);$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("DeskCode"), 0, 'C', 0);
|
if (empty($onlynumber)) {
|
||||||
if (empty($onlynumber)) $pdf->line($curx, $cury+1, $curx, $cury+7);
|
$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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$curx=$savcurx;
|
$curx=$savcurx;
|
||||||
$cury+=8;
|
$cury+=8;
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2010-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2010-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
|
* 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
|
* 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
|
||||||
@ -60,7 +61,7 @@ class CompanyBankAccount extends Account
|
|||||||
/**
|
/**
|
||||||
* Create bank information record
|
* Create bank information record
|
||||||
*
|
*
|
||||||
* @param Object $user User
|
* @param User $user User
|
||||||
* @return int <0 if KO, >= 0 if OK
|
* @return int <0 if KO, >= 0 if OK
|
||||||
*/
|
*/
|
||||||
function create($user='')
|
function create($user='')
|
||||||
@ -222,79 +223,27 @@ class CompanyBankAccount extends Account
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return RIB
|
* Return RIB
|
||||||
*
|
*
|
||||||
* @param boolean $displayriblabel Prepend or Hide Label
|
* @param boolean $displayriblabel Prepend or Hide Label
|
||||||
* @return string RIB
|
* @return string RIB
|
||||||
*/
|
*/
|
||||||
function getRibLabel($displayriblabel = true)
|
public function getRibLabel($displayriblabel = true)
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
$rib = '';
|
||||||
|
|
||||||
if ($this->code_banque || $this->code_guichet || $this->number || $this->cle_rib)
|
if ($this->code_banque || $this->code_guichet || $this->number || $this->cle_rib) {
|
||||||
{
|
|
||||||
if ($this->label && $displayriblabel) $rib = $this->label." : ";
|
|
||||||
|
|
||||||
// Show fields of bank account
|
if ($this->label && $displayriblabel) {
|
||||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
$rib = $this->label." : ";
|
||||||
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)
|
$rib .= (string) $this;
|
||||||
{
|
}
|
||||||
if ($val == 'BankCode')
|
|
||||||
{
|
|
||||||
if ($this->useDetailedBBAN() == 1)
|
|
||||||
{
|
|
||||||
$rib.=$this->code_banque.' ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($val == 'DeskCode')
|
return $rib;
|
||||||
{
|
}
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set RIB as Default
|
* Set RIB as Default
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
|
* 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
|
* 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
|
||||||
@ -254,64 +254,22 @@ if ($socid && $action != 'edit' && $action != "create")
|
|||||||
print '<td colspan="4">'.$account->bank.'</td></tr>';
|
print '<td colspan="4">'.$account->bank.'</td></tr>';
|
||||||
|
|
||||||
// Show fields of bank account
|
// 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 ($val == 'BankCode') {
|
||||||
{
|
$content = $account->code_banque;
|
||||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
} elseif ($val == 'DeskCode') {
|
||||||
}
|
$content = $account->code_guichet;
|
||||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
} elseif ($val == 'BankAccountNumber') {
|
||||||
}
|
$content = $account->number;
|
||||||
$fieldlistsarray=explode(' ',$fieldlists);
|
} elseif ($val == 'BankAccountNumberKey') {
|
||||||
|
$content = $account->cle_rib;
|
||||||
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')
|
print '<tr><td>'.$langs->trans($val).'</td>';
|
||||||
{
|
print '<td colspan="3">'.$content.'</td>';
|
||||||
if ($account->useDetailedBBAN() == 2)
|
print '</tr>';
|
||||||
{
|
|
||||||
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 valign="top">'.$langs->trans("IBAN").'</td>';
|
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>';
|
print '<td><input size="30" type="text" name="bank" value="'.$account->bank.'"></td></tr>';
|
||||||
|
|
||||||
// Show fields of bank account
|
// Show fields of bank account
|
||||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
foreach ($account->getFieldsToShow() as $val) {
|
||||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
if ($val == 'BankCode') {
|
||||||
{
|
$name = 'code_banque';
|
||||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
$size = 8;
|
||||||
{
|
$content = $account->code_banque;
|
||||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
} elseif ($val == 'DeskCode') {
|
||||||
}
|
$name = 'code_guichet';
|
||||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
$size = 8;
|
||||||
}
|
$content = $account->code_guichet;
|
||||||
$fieldlistsarray=explode(' ',$fieldlists);
|
} elseif ($val == 'BankAccountNumber') {
|
||||||
|
$name = 'number';
|
||||||
foreach($fieldlistsarray as $val)
|
$size = 18;
|
||||||
{
|
$content = $account->number;
|
||||||
if ($val == 'BankCode')
|
} elseif ($val == 'BankAccountNumberKey') {
|
||||||
{
|
$name = 'cle_rib';
|
||||||
if ($account->useDetailedBBAN() == 1)
|
$size = 3;
|
||||||
{
|
$content = $account->cle_rib;
|
||||||
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 == 'DeskCode')
|
print '<tr><td>'.$langs->trans($val).'</td>';
|
||||||
{
|
print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>';
|
||||||
if ($account->useDetailedBBAN() == 1)
|
print '</tr>';
|
||||||
{
|
|
||||||
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>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IBAN
|
// IBAN
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
|
* 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>
|
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@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
|
||||||
@ -149,64 +149,20 @@ if ($id && $action != 'edit')
|
|||||||
print '<td colspan="4">'.$account->bank.'</td></tr>';
|
print '<td colspan="4">'.$account->bank.'</td></tr>';
|
||||||
|
|
||||||
// Show fields of bank account
|
// Show fields of bank account
|
||||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
foreach ($account->getFieldsToShow() as $val) {
|
||||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
if ($val == 'BankCode') {
|
||||||
{
|
$content = $account->code_banque;
|
||||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
} elseif ($val == 'DeskCode') {
|
||||||
{
|
$content = $account->code_guichet;
|
||||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
} elseif ($val == 'BankAccountNumber') {
|
||||||
}
|
$content = $account->number;
|
||||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
} elseif ($val == 'BankAccountNumberKey') {
|
||||||
}
|
$content = $account->cle_rib;
|
||||||
$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')
|
print '<tr><td>'.$langs->trans($val).'</td>';
|
||||||
{
|
print '<td colspan="3">'.$content.'</td>';
|
||||||
if ($account->useDetailedBBAN() == 2)
|
print '</tr>';
|
||||||
{
|
|
||||||
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 valign="top">'.$langs->trans("IBAN").'</td>';
|
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>';
|
print '<td><input size="30" type="text" name="bank" value="'.$account->bank.'"></td></tr>';
|
||||||
|
|
||||||
// Show fields of bank account
|
// Show fields of bank account
|
||||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
foreach ($account->getFieldsToShow() as $val) {
|
||||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
if ($val == 'BankCode') {
|
||||||
{
|
$name = 'code_banque';
|
||||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
$size = 8;
|
||||||
{
|
$content = $account->code_banque;
|
||||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
} elseif ($val == 'DeskCode') {
|
||||||
}
|
$name = 'code_guichet';
|
||||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
$size = 8;
|
||||||
}
|
$content = $account->code_guichet;
|
||||||
$fieldlistsarray=explode(' ',$fieldlists);
|
} elseif ($val == 'BankAccountNumber') {
|
||||||
|
$name = 'number';
|
||||||
foreach($fieldlistsarray as $val)
|
$size = 18;
|
||||||
{
|
$content = $account->number;
|
||||||
if ($val == 'BankCode')
|
} elseif ($val == 'BankAccountNumberKey') {
|
||||||
{
|
$name = 'cle_rib';
|
||||||
if ($account->useDetailedBBAN() == 1)
|
$size = 3;
|
||||||
{
|
$content = $account->cle_rib;
|
||||||
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 == 'DeskCode')
|
print '<td>'.$langs->trans($val).'</td>';
|
||||||
{
|
print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>';
|
||||||
if ($account->useDetailedBBAN() == 1)
|
print '</tr>';
|
||||||
{
|
|
||||||
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>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IBAN
|
// IBAN
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
|
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
|
||||||
* 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
|
||||||
@ -57,7 +58,7 @@ class UserBankAccount extends Account
|
|||||||
/**
|
/**
|
||||||
* Create bank information record
|
* Create bank information record
|
||||||
*
|
*
|
||||||
* @param Object $user User
|
* @param User $user User
|
||||||
* @return int <0 if KO, >= 0 if OK
|
* @return int <0 if KO, >= 0 if OK
|
||||||
*/
|
*/
|
||||||
function create($user='')
|
function create($user='')
|
||||||
@ -177,78 +178,26 @@ class UserBankAccount extends Account
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return RIB
|
* Return RIB
|
||||||
*
|
*
|
||||||
* @param boolean $displayriblabel Prepend or Hide Label
|
* @param boolean $displayriblabel Prepend or Hide Label
|
||||||
* @return string RIB
|
* @return string RIB
|
||||||
*/
|
*/
|
||||||
function getRibLabel($displayriblabel = true)
|
public function getRibLabel($displayriblabel = true)
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
$rib = '';
|
||||||
|
|
||||||
if ($this->code_banque || $this->code_guichet || $this->number || $this->cle_rib)
|
if ($this->code_banque || $this->code_guichet || $this->number || $this->cle_rib) {
|
||||||
{
|
|
||||||
if ($this->label && $displayriblabel) $rib = $this->label." : ";
|
|
||||||
|
|
||||||
// Show fields of bank account
|
if ($this->label && $displayriblabel) {
|
||||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
$rib = $this->label." : ";
|
||||||
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)
|
$rib .= (string) $this;
|
||||||
{
|
}
|
||||||
if ($val == 'BankCode')
|
|
||||||
{
|
|
||||||
if ($this->useDetailedBBAN() == 1)
|
|
||||||
{
|
|
||||||
$rib.=$this->code_banque.' ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($val == 'DeskCode')
|
return $rib;
|
||||||
{
|
}
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user