';
diff --git a/htdocs/compta/prelevement/bon-prelevement.class.php b/htdocs/compta/prelevement/bon-prelevement.class.php
index 3940a0035de..949688d23e8 100644
--- a/htdocs/compta/prelevement/bon-prelevement.class.php
+++ b/htdocs/compta/prelevement/bon-prelevement.class.php
@@ -1152,22 +1152,6 @@ class BonPrelevement extends CommonObject
{
$result = -2;
}
- /*
- $nbfactures = sizeof($this->factures);
- for ($i = 0 ; $i < $nbfactures ; $i++)
- {
- $fac = new Facture($this->db);
- $fac->fetch($this->factures[$i]);
- $fac->fetch_client();
- $fac->client->rib();
- if ($fac->client->bank_account->verif()) {
- $this->total = $this->total + $fac->total_ttc;
- $this->EnregDestinataire($fac);
- }else{
- print $fac->client->bank_account->error_message;
- print $fac->client->nom; }
- }
- */
/*
* Pied de page total
diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php
index 9319897cdd5..1e38fbbc92f 100644
--- a/htdocs/facture.class.php
+++ b/htdocs/facture.class.php
@@ -2422,7 +2422,8 @@ class Facture extends CommonObject
$soc = new Societe($this->db);
$soc->id = $this->socid;
- $soc->rib();
+ $soc->load_ban();
+
if ($this->statut > 0 && $this->paye == 0 && $this->mode_reglement_id == 3)
{
$sql = 'SELECT count(*) FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang
index 155fbd1307f..5c149def123 100644
--- a/htdocs/langs/en_US/banks.lang
+++ b/htdocs/langs/en_US/banks.lang
@@ -27,7 +27,7 @@ CurrentBalance=Current balance
FutureBalance=Future balance
ShowAllTimeBalance=Show balance from start
Reconciliation=Reconciliation
-RIB=RIB
+RIB=Bank Account Number
IBAN=IBAN number
BIC=BIC/SWIFT number
StandingOrders=Standing orders
@@ -43,7 +43,7 @@ IOMonthlyReporting=Monthly reporting
BankAccountDomiciliation=Account address
BankAccountOwner=Account owner name
BankAccountOwnerAddress=Account owner address
-RIBControlError=Control of key says informations for this account number are not complete or wrong.
+RIBControlError=Inetgrity checks of values fails. This means information for this account number are not complete or wrong (check country, numbers and IBAN).
CreateAccount=Create account
StandingOrderToProcess=To process
StandingOrderProcessed=Processed
diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang
index 4e4a823d465..123224c55d6 100644
--- a/htdocs/langs/en_US/companies.lang
+++ b/htdocs/langs/en_US/companies.lang
@@ -106,7 +106,7 @@ ProfId4PT=Prof Id 4 (Conservatory)
ProfId1TN=Prof Id 1 (RC)
ProfId2TN=Prof Id 2 (Fiscal matricule)
ProfId3TN=Prof Id 3 (Douane code)
-ProfId4TN=Prof Id 4 (RIB)
+ProfId4TN=Prof Id 4 (BAN)
VATIntra=VAT number
VATIntraShort=VAT number
VATIntraVeryShort=VAT
@@ -226,7 +226,7 @@ ProspectsByStatus=Prospects by status
BillingContact=Billing contact
NbOfAttachedFiles=Number of attached files
AttachANewFile=Attach a new file
-NoRIB=No RIB defined
+NoRIB=No BAN defined
NoParentCompany=None
ExportImport=Import-Export
ExportCardToFormat=Export card to format
diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang
index 7b9a2afe7ea..0a84ba83bb2 100755
--- a/htdocs/langs/en_US/withdrawals.lang
+++ b/htdocs/langs/en_US/withdrawals.lang
@@ -29,5 +29,5 @@ LastWithdrawalReceipt=Last %s withdrawing receipts
MakeWithdrawRequest=Make a withdraw request
ThirdPartyBankCode=Third party bank code
ThirdPartyDeskCode=Third party desk code
-NoInvoiceCouldBeWithdrawed=No invoice withdrawed with success. Check that invoice are on companies with a valid RIB.
+NoInvoiceCouldBeWithdrawed=No invoice withdrawed with success. Check that invoice are on companies with a valid BAN.
ClassCredited=Classer crédité
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index c4552d5f523..64456e2d96d 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -663,7 +663,7 @@ ForceInvoiceDate=Forcer la date de facture
DisableRepeatable=Désactiver les factures récurrentes
SuggestedPaymentModesIfNotDefinedInInvoice=Modes de paiements suggérés par défaut si non défini au niveau de la facture
EnableEditDeleteValidInvoice=Activer la possibilité de rééditer/supprimer une facture validée sans paiement
-SuggestPaymentByRIBOnAccount=Proposer paiement par RIB sur le compte
+SuggestPaymentByRIBOnAccount=Proposer paiement par virement sur le compte
SuggestPaymentByChequeToAddress=Proposer paiement par chèque à l'ordre et adresse de
FreeLegalTextOnInvoices=Mention complémentaire sur les factures
WatermarkOnDraftInvoices=Filigrane sur les brouillons de factures (aucun si vide)
diff --git a/htdocs/langs/fr_FR/banks.lang b/htdocs/langs/fr_FR/banks.lang
index d0d01b9431e..9c58d485ce1 100644
--- a/htdocs/langs/fr_FR/banks.lang
+++ b/htdocs/langs/fr_FR/banks.lang
@@ -27,7 +27,7 @@ CurrentBalance=Solde actuel
FutureBalance=Solde futur
ShowAllTimeBalance=Afficher solde depuis début
Reconciliation=Rapprochement
-RIB=RIB
+RIB=Numéro compte
IBAN=Identifiant IBAN
BIC=Identifiant BIC/SWIFT
StandingOrders=Prélèvements
@@ -43,7 +43,7 @@ IOMonthlyReporting=Rapport mensuel E/S
BankAccountDomiciliation=Domiciliation du compte
BankAccountOwner=Nom du propriétaire du compte
BankAccountOwnerAddress=Adresse du propriétaire du compte
-RIBControlError=Le contrôle de la clé indique que les informations de ce compte bancaire sont incomplètes ou incorrectes.
+RIBControlError=Les contrôles indiquent que les informations de ce compte bancaire sont incomplètes ou incorrectes (vérifier le pays, les numéros de compte ou IBAN).
CreateAccount=Créer compte
StandingOrderToProcess=À traiter
StandingOrderProcessed=Traités
diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang
index 69f73af0c02..7f709bb3927 100644
--- a/htdocs/langs/fr_FR/companies.lang
+++ b/htdocs/langs/fr_FR/companies.lang
@@ -106,7 +106,7 @@ ProfId4PT=Id prof. 4 (Conservatory)
ProfId1TN=Id prof. 1 (RC)
ProfId2TN=Id prof. 2 (Matricule fiscale)
ProfId3TN=Id prof. 3 (Code en douane)
-ProfId4TN=Id prof. 4 (RIB)
+ProfId4TN=Id prof. 4 (BAN)
VATIntra=Numéro de TVA
VATIntraShort=Num TVA
VATIntraVeryShort=N° TVA
@@ -226,7 +226,7 @@ ProspectsByStatus=Prospects par
BillingContact=Contact facturation
NbOfAttachedFiles=Nombre de fichiers joints
AttachANewFile=Joindre un nouveau fichier
-NoRIB=Aucun RIB défini
+NoRIB=Aucun BAN (RIB) défini
NoParentCompany=Aucune
ExportImport=Import-Export
ExportCardToFormat=Exporter fiche au format
diff --git a/htdocs/langs/fr_FR/withdrawals.lang b/htdocs/langs/fr_FR/withdrawals.lang
index a4b12aea10c..b045c211105 100755
--- a/htdocs/langs/fr_FR/withdrawals.lang
+++ b/htdocs/langs/fr_FR/withdrawals.lang
@@ -29,5 +29,5 @@ LastWithdrawalReceipt=Les %s derniers bons de pr
MakeWithdrawRequest=Faire une demande de prélèvement
ThirdPartyBankCode=Code banque du tiers
ThirdPartyDeskCode=Code guichet du tiers
-NoInvoiceCouldBeWithdrawed=Aucune facture prélevable, prélevé avec succès. Vérifiez que les factures sont sur des sociétés dont le RIB est correctement renseigné.
+NoInvoiceCouldBeWithdrawed=Aucune facture prélevable, prélevé avec succès. Vérifiez que les factures sont sur des sociétés dont le BAN(RIB) est correctement renseigné.
ClassCredited=Classer crédité
\ No newline at end of file
diff --git a/htdocs/lib/bank.lib.php b/htdocs/lib/bank.lib.php
index b3de1af521d..a2842320904 100644
--- a/htdocs/lib/bank.lib.php
+++ b/htdocs/lib/bank.lib.php
@@ -81,29 +81,32 @@ function bank_prepare_head($obj)
/**
- \brief Verifie le RIB d'un compte bancaire grace à sa clé
- \param code_banque code banque
- \param code_guichet code guichet
- \param num_compte numero de compte
- \param cle cle
- \param iban Ne sert pas pour le calcul de cle mais sert pour determiner le pays
- \return int true si les infos sont bonnes, false si la clé ne correspond pas
-*/
-function verif_rib($code_banque , $code_guichet , $num_compte , $cle, $iban)
+ * \brief Check account number informations for a bank account
+ * \param code_banque code banque
+ * \param code_guichet code guichet
+ * \param num_compte numero de compte
+ * \param cle cle
+ * \param iban Ne sert pas pour le calcul de cle mais sert pour determiner le pays
+ * \return int true si les infos sont bonnes, false si erreur
+ */
+function checkBanForAccount($account)
{
- if (eregi("^FR",$iban))
+ $country_code=$account->getCountryCode();
+
+ dolibarr_syslog("Bank.lib::checkBanForAccount account->iban=".$account->iban." country_code=".$country_code, LOG_DEBUG);
+
+
+ if ($country_code == 'FR')
{ // Cas de la France
$coef = array(62, 34, 3) ;
// Concatenation des differents codes.
- $rib = strtolower(trim($code_banque).trim($code_guichet).trim($num_compte).trim($cle));
+ $rib = strtolower(trim($account->code_banque).trim($account->code_guichet).trim($account->num_compte).trim($account->cle));
// On remplace les eventuelles lettres par des chiffres.
- //Ne marche pas
- //$rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz","12345678912345678912345678");
-
+ //$rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz","12345678912345678912345678"); //Ne marche pas
$rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz","12345678912345678923456789");
// Separation du rib en 3 groupes de 7 + 1 groupe de 2.
@@ -124,7 +127,19 @@ function verif_rib($code_banque , $code_guichet , $num_compte , $cle, $iban)
return false;
}
+
+ if ($country_code == 'BE') // Belgium rules
+ {
+ }
+ // No particular rule
+ // If account is CompanyBankAccount class, we use number
+ // If account is Account class, we use num_compte
+ if (empty($account->num_compte) && empty($account->number))
+ {
+ return false;
+ }
+
return true;
}
diff --git a/htdocs/soc.php b/htdocs/soc.php
index 5a53fd81d6c..07896165cfe 100644
--- a/htdocs/soc.php
+++ b/htdocs/soc.php
@@ -36,6 +36,7 @@ require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
$langs->load("companies");
$langs->load("commercial");
$langs->load("bills");
+$langs->load("banks");
// Security check
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
@@ -1154,7 +1155,7 @@ else
$soc->typent= $arr[$soc->typent_code];
print '