Fix: [ bug #1167 ] Supplier IBAN account number set but no account

specified warning
This commit is contained in:
Laurent Destailleur 2013-12-04 18:20:58 +01:00
parent f2ba1a538b
commit 24ce511671
4 changed files with 73 additions and 11 deletions

View File

@ -99,7 +99,7 @@ function checkBanForAccount($account)
if (empty($account->number)) $account->number=$account->num_compte;
if (empty($account->cle)) $account->cle=$account->cle_rib;
dol_syslog("Bank.lib::checkBanForAccount account->code_banque=".$account->code_banque." account->code_guichet=".$account->code_guichet." account->number=".$account->number." account->cle=".$account->cle." account->iban=".$account->iban." country_code=".$country_code, LOG_DEBUG);
dol_syslog("bank.lib::checkBanForAccount account->code_banque=".$account->code_banque." account->code_guichet=".$account->code_guichet." account->number=".$account->number." account->cle=".$account->cle." account->iban=".$account->iban." country_code=".$country_code, LOG_DEBUG);
if ($country_code == 'FR') // France rules
{

View File

@ -241,23 +241,72 @@ class CompanyBankAccount extends Account
/**
* Return RIB
*
* @param boolean $displayriblabel Show or Hide Label
* @param boolean $displayriblabel Prepend or Hide Label
* @return string RIB
*/
function getRibLabel($displayriblabel = true)
{
global $langs;
global $langs,$conf;
if ($this->code_banque || $this->code_guichet || $this->number || $this->cle_rib)
{
if ($this->label && $displayriblabel)
$rib = $this->label." : ";
$rib.= $this->code_banque." ".$this->code_guichet." ".$this->number;
$rib.=($this->cle_rib?" (".$this->cle_rib.")":"");
if ($this->label && $displayriblabel) $rib = $this->label." : ";
// 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 ($this->useDetailedBBAN() == 1)
{
$rib.=$this->code_banque.' ';
}
}
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=$langs->trans("NoRIB");
$rib='';
}
return $rib;

View File

@ -1751,7 +1751,7 @@ class Societe extends CommonObject
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
$bac = new CompanyBankAccount($this->db);
$bac->fetch(0,$this->id);
return $bac->getRibLabel();
return $bac->getRibLabel(true);
}
/**

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
*
@ -317,13 +317,16 @@ if ($socid && $action != 'edit' && $action != "create")
$rib_list = $soc->get_all_rib();
$var = false;
if (is_array($rib_list)) {
if (is_array($rib_list))
{
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("LabelRIB"));
print_liste_field_titre($langs->trans("Bank"));
print_liste_field_titre($langs->trans("RIB"));
print_liste_field_titre($langs->trans("IBAN"));
print_liste_field_titre($langs->trans("BIC"));
print_liste_field_titre($langs->trans("DefaultRIB"), '', '', '', '', 'align="center"');
print '<td width="40"></td>';
print '</tr>';
@ -331,9 +334,17 @@ if ($socid && $action != 'edit' && $action != "create")
foreach ($rib_list as $rib)
{
print "<tr $bc[$var]>";
// Label
print '<td>'.$rib->label.'</td>';
// Bank name
print '<td>'.$rib->bank.'</td>';
// Account number
print '<td>'.$rib->getRibLabel(false).'</td>';
// IBAN
print '<td>'.$rib->iban.'</td>';
// BIC
print '<td>'.$rib->bic.'</td>';
// Default
print '<td align="center" width="70">';
if (!$rib->default_rib) {
print '<a href="'.DOL_URL_ROOT.'/societe/rib.php?socid='.$soc->id.'&ribid='.$rib->id.'&action=setasdefault">';
@ -343,6 +354,8 @@ if ($socid && $action != 'edit' && $action != "create")
print img_picto($langs->trans("Enabled"),'on');
}
print '</td>';
// Edit/Delete
print '<td align="right">';
if ($user->rights->societe->creer)
{