forked from Wavyzz/dolibarr
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user