Fix: Detection of country of bank account failed
New: Can change order of fields in bank info
This commit is contained in:
parent
ea47cebe6f
commit
eacc9361ea
@ -2883,7 +2883,7 @@ class Facture extends CommonObject
|
|||||||
$this->cond_reglement_id = 1;
|
$this->cond_reglement_id = 1;
|
||||||
$this->cond_reglement_code = 'RECEP';
|
$this->cond_reglement_code = 'RECEP';
|
||||||
$this->mode_reglement_id = 7;
|
$this->mode_reglement_id = 7;
|
||||||
$this->mode_reglement_code = 'CHQ';
|
$this->mode_reglement_code = ''; // No particular payment mode defined
|
||||||
$this->note_public='SPECIMEN';
|
$this->note_public='SPECIMEN';
|
||||||
// Lines
|
// Lines
|
||||||
$nbp = 5;
|
$nbp = 5;
|
||||||
|
|||||||
@ -26,11 +26,11 @@ create table llx_societe_rib
|
|||||||
datec datetime,
|
datec datetime,
|
||||||
tms timestamp,
|
tms timestamp,
|
||||||
label varchar(30),
|
label varchar(30),
|
||||||
bank varchar(255),
|
bank varchar(255), -- bank name
|
||||||
code_banque varchar(7),
|
code_banque varchar(7), -- bank code
|
||||||
code_guichet varchar(6),
|
code_guichet varchar(6), -- desk code
|
||||||
number varchar(255),
|
number varchar(255), -- account number
|
||||||
cle_rib varchar(5),
|
cle_rib varchar(5), -- key of bank account
|
||||||
bic varchar(10),
|
bic varchar(10),
|
||||||
iban_prefix varchar(34), -- 34 according to ISO 13616
|
iban_prefix varchar(34), -- 34 according to ISO 13616
|
||||||
domiciliation varchar(255),
|
domiciliation varchar(255),
|
||||||
|
|||||||
@ -781,7 +781,7 @@ SimpleNumRefModelDesc=Return the reference number with format %syymm-nnnn where
|
|||||||
ListOfEntities=List of entities
|
ListOfEntities=List of entities
|
||||||
AddEntity=Add entity
|
AddEntity=Add entity
|
||||||
EditEntity=Edit entity
|
EditEntity=Edit entity
|
||||||
ShowProfIdInAddress=Show professionnal id into addresses on documents
|
ShowProfIdInAddress=Show professionnal id with addresses on documents
|
||||||
|
|
||||||
##### Module password generation
|
##### Module password generation
|
||||||
PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase.
|
PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase.
|
||||||
|
|||||||
@ -201,35 +201,67 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account)
|
|||||||
|
|
||||||
if ($usedetailedbban)
|
if ($usedetailedbban)
|
||||||
{
|
{
|
||||||
|
$savcurx=$curx;
|
||||||
|
|
||||||
$pdf->SetFont('','',6);
|
$pdf->SetFont('','',6);
|
||||||
$pdf->SetXY ($curx, $cury);
|
$pdf->SetXY ($curx, $cury);
|
||||||
$pdf->MultiCell(90, 3, $outputlangs->transnoentities("Bank").': ' . $outputlangs->convToOutputCharset($account->bank), 0, 'L', 0);
|
$pdf->MultiCell(90, 3, $outputlangs->transnoentities("Bank").': ' . $outputlangs->convToOutputCharset($account->bank), 0, 'L', 0);
|
||||||
$cury+=3;
|
$cury+=3;
|
||||||
|
|
||||||
$pdf->SetFont('','B',6);
|
|
||||||
$pdf->line($curx+1, $cury+1, $curx+1, $cury+10 );
|
$pdf->line($curx+1, $cury+1, $curx+1, $cury+10 );
|
||||||
$pdf->SetXY ($curx, $cury+1);
|
|
||||||
$pdf->MultiCell(18, 3, $outputlangs->transnoentities("BankCode"), 0, 'C', 0);
|
|
||||||
$pdf->line($curx+18, $cury+1, $curx+18, $cury+10 );
|
|
||||||
$pdf->SetXY ($curx+18, $cury+1);
|
|
||||||
$pdf->MultiCell(18, 3, $outputlangs->transnoentities("DeskCode"), 0, 'C', 0);
|
|
||||||
$pdf->line($curx+36, $cury+1, $curx+36, $cury+10 );
|
|
||||||
$pdf->SetXY ($curx+36, $cury+1);
|
|
||||||
$pdf->MultiCell(24, 3, $outputlangs->transnoentities("BankAccountNumber"), 0, 'C', 0);
|
|
||||||
$pdf->line($curx+60, $cury+1, $curx+60, $cury+10 );
|
|
||||||
$pdf->SetXY ($curx+60, $cury+1);
|
|
||||||
$pdf->MultiCell(13, 3, $outputlangs->transnoentities("BankAccountNumberKey"), 0, 'C', 0);
|
|
||||||
$pdf->line($curx+73, $cury+1, $curx+73, $cury+10 );
|
|
||||||
|
|
||||||
$pdf->SetFont('','',8);
|
$fieldstoshow=array('bank','desk','number','key');
|
||||||
|
//if ($account->pays_code == 'ES') $fieldstoshow=array('bank','desk','key','number');
|
||||||
|
|
||||||
|
foreach ($fieldstoshow as $val)
|
||||||
|
{
|
||||||
|
if ($val == 'bank')
|
||||||
|
{
|
||||||
|
// Bank code
|
||||||
|
$tmplength=18;
|
||||||
$pdf->SetXY ($curx, $cury+6);
|
$pdf->SetXY ($curx, $cury+6);
|
||||||
$pdf->MultiCell(18, 3, $outputlangs->convToOutputCharset($account->code_banque), 0, 'C', 0);
|
$pdf->SetFont('','',8);$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->code_banque), 0, 'C', 0);
|
||||||
$pdf->SetXY ($curx+18, $cury+6);
|
$pdf->SetXY ($curx, $cury+1);
|
||||||
$pdf->MultiCell(18, 3, $outputlangs->convToOutputCharset($account->code_guichet), 0, 'C', 0);
|
$curx+=$tmplength;
|
||||||
$pdf->SetXY ($curx+36, $cury+6);
|
$pdf->SetFont('','B',6);$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankCode"), 0, 'C', 0);
|
||||||
$pdf->MultiCell(24, 3, $outputlangs->convToOutputCharset($account->number), 0, 'C', 0);
|
$pdf->line($curx, $cury+1, $curx, $cury+10 );
|
||||||
$pdf->SetXY ($curx+60, $cury+6);
|
}
|
||||||
$pdf->MultiCell(13, 3, $outputlangs->convToOutputCharset($account->cle_rib), 0, 'C', 0);
|
if ($val == 'desk')
|
||||||
|
{
|
||||||
|
// Desk
|
||||||
|
$tmplength=18;
|
||||||
|
$pdf->SetXY ($curx, $cury+6);
|
||||||
|
$pdf->SetFont('','',8);$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->code_guichet), 0, 'C', 0);
|
||||||
|
$pdf->SetXY ($curx, $cury+1);
|
||||||
|
$curx+=$tmplength;
|
||||||
|
$pdf->SetFont('','B',6);$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("DeskCode"), 0, 'C', 0);
|
||||||
|
$pdf->line($curx, $cury+1, $curx, $cury+10 );
|
||||||
|
}
|
||||||
|
if ($val == 'number')
|
||||||
|
{
|
||||||
|
// Number
|
||||||
|
$tmplength=24;
|
||||||
|
$pdf->SetXY ($curx, $cury+6);
|
||||||
|
$pdf->SetFont('','',8);$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->number), 0, 'C', 0);
|
||||||
|
$pdf->SetXY ($curx, $cury+1);
|
||||||
|
$curx+=$tmplength;
|
||||||
|
$pdf->SetFont('','B',6);$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankAccountNumber"), 0, 'C', 0);
|
||||||
|
$pdf->line($curx, $cury+1, $curx, $cury+10 );
|
||||||
|
}
|
||||||
|
if ($val == 'key')
|
||||||
|
{
|
||||||
|
// Key
|
||||||
|
$tmplength=13;
|
||||||
|
$pdf->SetXY ($curx, $cury+6);
|
||||||
|
$pdf->SetFont('','',8);$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->cle_rib), 0, 'C', 0);
|
||||||
|
$pdf->SetXY ($curx, $cury+1);
|
||||||
|
$curx+=$tmplength;
|
||||||
|
$pdf->SetFont('','B',6);$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankAccountNumberKey"), 0, 'C', 0);
|
||||||
|
$pdf->line($curx, $cury+1, $curx, $cury+10 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$curx=$savcurx;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -243,6 +275,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account)
|
|||||||
$pdf->MultiCell(90, 3, $outputlangs->transnoentities("BankAccountNumber").': ' . $outputlangs->convToOutputCharset($account->number), 0, 'L', 0);
|
$pdf->MultiCell(90, 3, $outputlangs->transnoentities("BankAccountNumber").': ' . $outputlangs->convToOutputCharset($account->number), 0, 'L', 0);
|
||||||
$cury-=9;
|
$cury-=9;
|
||||||
}
|
}
|
||||||
|
$pdf->SetXY ($curx, $cury+1);
|
||||||
|
|
||||||
// Use correct name of bank id according to country
|
// Use correct name of bank id according to country
|
||||||
$ibankey="IBANNumber";
|
$ibankey="IBANNumber";
|
||||||
|
|||||||
@ -140,19 +140,20 @@ class CompanyBankAccount
|
|||||||
{
|
{
|
||||||
if (empty($id) && empty($socid)) return -1;
|
if (empty($id) && empty($socid)) return -1;
|
||||||
|
|
||||||
$sql = "SELECT rowid, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio, adresse_proprio";
|
$sql = "SELECT rowid, fk_soc, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio, adresse_proprio";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe_rib";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe_rib";
|
||||||
if ($id) $sql.= " WHERE rowid = ".$id;
|
if ($id) $sql.= " WHERE rowid = ".$id;
|
||||||
if ($socid) $sql.= " WHERE fk_soc = ".$socid;
|
if ($socid) $sql.= " WHERE fk_soc = ".$socid;
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($result)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if ($this->db->num_rows($result))
|
if ($this->db->num_rows($resql))
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
|
$this->socid = $obj->fk_soc;
|
||||||
$this->bank = $obj->bank;
|
$this->bank = $obj->bank;
|
||||||
$this->courant = $obj->courant;
|
$this->courant = $obj->courant;
|
||||||
$this->clos = $obj->clos;
|
$this->clos = $obj->clos;
|
||||||
@ -214,8 +215,9 @@ class CompanyBankAccount
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return account country code
|
* Return account country code.
|
||||||
* \return String country code
|
* Use this->iban and this->socid.
|
||||||
|
* @return String country code
|
||||||
*/
|
*/
|
||||||
function getCountryCode()
|
function getCountryCode()
|
||||||
{
|
{
|
||||||
@ -234,8 +236,8 @@ class CompanyBankAccount
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return if a bank account is defined with detailed information (bank code, desk code, number and key)
|
* Return if a bank account is defined with detailed information (bank code, desk code, number and key)
|
||||||
* \return boolean true or false
|
* @return boolean true or false
|
||||||
*/
|
*/
|
||||||
function useDetailedBBAN()
|
function useDetailedBBAN()
|
||||||
{
|
{
|
||||||
@ -245,8 +247,7 @@ class CompanyBankAccount
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Initialize properties with test values
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function initAsSpecimen()
|
function initAsSpecimen()
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user