diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 93fa8b70a845b..9716939337665 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -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 { diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index fe1726ab345ea..13203c74dc952 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -241,23 +241,72 @@ function delete($user) /** * 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; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 4e50a0810797c..9692f13d89c8b 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1751,7 +1751,7 @@ function display_rib() 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); } /** diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 2d948509fc002..53a148cffc822 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Peter Fontaine * @@ -317,13 +317,16 @@ $rib_list = $soc->get_all_rib(); $var = false; - if (is_array($rib_list)) { + if (is_array($rib_list)) + { print ''; print ''; 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 ''; print ''; @@ -331,9 +334,17 @@ foreach ($rib_list as $rib) { print ""; + // Label print ''; + // Bank name print ''; + // Account number print ''; + // IBAN + print ''; + // BIC + print ''; + // Default print ''; + + // Edit/Delete print '
'.$rib->label.''.$rib->bank.''.$rib->getRibLabel(false).''.$rib->iban.''.$rib->bic.''; if (!$rib->default_rib) { print ''; @@ -343,6 +354,8 @@ print img_picto($langs->trans("Enabled"),'on'); } print ''; if ($user->rights->societe->creer) {