FIX Check on bank info for sepa must be done on iban/swift not on ban

This commit is contained in:
Laurent Destailleur 2017-10-12 00:38:59 +02:00
parent 31ab73ff3c
commit 15bcbc8b43
4 changed files with 25 additions and 14 deletions

View File

@ -1337,7 +1337,7 @@ class Account extends CommonObject
/**
* Return if an account has valid information
* Return if an account has valid information for Direct debit payment
*
* @return int 1 if correct, <=0 if wrong
*/
@ -1348,11 +1348,17 @@ class Account extends CommonObject
$this->error_number = 0;
// Call function to check BAN
if (! checkBanForAccount($this))
if (! checkIbanForAccount($bac) || ! checkSwiftForAccount($bac))
{
$this->error_number = 12;
$this->error_message = 'IBANSWIFTControlError';
}
/*if (! checkBanForAccount($this))
{
$this->error_number = 12;
$this->error_message = 'RIBControlError';
}
$this->error_message = 'BANControlError';
}*/
if ($this->error_number == 0)
{

View File

@ -851,8 +851,7 @@ class BonPrelevement extends CommonObject
$bac = new CompanyBankAccount($this->db);
$bac->fetch(0, $soc->id);
if ($bac->verif() >= 1)
//if (true)
if ($bac->verif() >= 1)
{
$factures_prev[$i] = $fac;
/* second tableau necessaire pour BonPrelevement */
@ -861,9 +860,9 @@ class BonPrelevement extends CommonObject
}
else
{
dol_syslog(__METHOD__."::Check RIB Error on default bank number RIB/IBAN for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_ERR);
$this->invoice_in_error[$fac[0]]="Error on default bank number RIB/IBAN for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
$this->thirdparty_in_error[$soc->id]="Error on default bank number RIB/IBAN for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
dol_syslog(__METHOD__."::Check RIB Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_ERR);
$this->invoice_in_error[$fac[0]]="Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
$this->thirdparty_in_error[$soc->id]="Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
}
}
else
@ -1525,9 +1524,9 @@ class BonPrelevement extends CommonObject
* @param string $row_zip soc.zip
* @param string $row_town soc.town
* @param string $row_country_code c.code AS country,
* @param string $row_cb pl.code_banque AS cb,
* @param string $row_cg pl.code_guichet AS cg,
* @param string $row_cc pl.number AS cc,
* @param string $row_cb pl.code_banque AS cb, Not used for SEPA
* @param string $row_cg pl.code_guichet AS cg, Not used for SEPA
* @param string $row_cc pl.number AS cc, Not used for SEPA
* @param string $row_somme pl.amount AS somme,
* @param string $row_facnumber f.facnumber
* @param string $row_idfac pf.fk_facture AS idfac,

View File

@ -28,6 +28,7 @@ require('../../main.inc.php');
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
@ -208,13 +209,13 @@ if ($resql)
// Thirdparty
print '<td>';
$thirdpartystatic->fetch($obj->socid);
print $thirdpartystatic->getNomUrl(1,'card');
print $thirdpartystatic->getNomUrl(1,'ban');
print '</td>';
// RIB
print '<td>';
print $thirdpartystatic->display_rib();
$bac->fetch(0, $obj->socid);
if ($bac->verif() <= 0) print img_warning('Error on default bank number RIB/IBAN');
if ($bac->verif() <= 0) print img_warning('Error on default bank number for IBAN : '.$bac->error_message);
print '</td>';
// RUM
print '<td>';

View File

@ -1903,6 +1903,11 @@ class Societe extends CommonObject
$label.= '<u>' . $langs->trans("ShowContacts") . '</u>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/contact.php?socid='.$this->id;
}
else if ($option == 'ban')
{
$label.= '<u>' . $langs->trans("ShowBan") . '</u>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/rib.php?socid='.$this->id;
}
// By default
if (empty($linkstart))