diff --git a/ChangeLog b/ChangeLog index 5520f1e4452..084246050cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ $Id$ ***** ChangeLog for 3.1 compared to 3.0 ***** For users: +- New: Support BSB code for bank account in australia. - New: Can set date of payment for autocreate invoice/payment when creating a foundation subscription. - New: task #10969 : Add checkbox to close automatically invoice to "payed" diff --git a/htdocs/langs/en_AU/bills.lang b/htdocs/langs/en_AU/bills.lang new file mode 100755 index 00000000000..f07f078f0d9 --- /dev/null +++ b/htdocs/langs/en_AU/bills.lang @@ -0,0 +1,3 @@ +# Dolibarr language file - en_AU - bills +CHARSET=UTF-8 +BankCode=Bank code or BSB \ No newline at end of file diff --git a/htdocs/langs/en_AU/withdrawals.lang b/htdocs/langs/en_AU/withdrawals.lang new file mode 100755 index 00000000000..396ef704f9d --- /dev/null +++ b/htdocs/langs/en_AU/withdrawals.lang @@ -0,0 +1,3 @@ +# Dolibarr language file - en_AU - withdrawals +CHARSET=UTF-8 +ThirdPartyBankCode=Third party bank code or BSB \ No newline at end of file diff --git a/htdocs/lib/bank.lib.php b/htdocs/lib/bank.lib.php index 7dd56149ca9..5374d9b964b 100644 --- a/htdocs/lib/bank.lib.php +++ b/htdocs/lib/bank.lib.php @@ -81,13 +81,9 @@ function bank_prepare_head($obj) /** - * \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 + * Check account number informations for a bank account + * @param account A bank account + * @return int True if informations are valid, false otherwise */ function checkBanForAccount($account) { @@ -132,22 +128,25 @@ function checkBanForAccount($account) if ($country_code == 'ES') // Spanish rules { $CCC = strtolower(trim($account->number)); - $rib = strtolower(trim($account->code_banque).trim($account->code_guichet)); - $cle_rib=strtolower(CheckES($rib,$CCC)); - if ($cle_rib == strtolower($account->cle)) { return true; } return false; } + if ($country_code == 'AU') // Australian + { + if (strlen($account->code_banque) > 7) return false; // Sould be 6 but can be 123-456 + else if (strlen($account->code_banque) < 6) return false; // Sould be 6 + else return true; + } // 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)) + if (empty($account->number)) { return false; } @@ -160,7 +159,7 @@ function checkBanForAccount($account) * Returns the key for Spanish Banks Accounts * @return string Key */ -Function CheckES($IentOfi,$InumCta) +function CheckES($IentOfi,$InumCta) { $APesos = Array(1,2,4,8,5,10,9,7,3,6); // Array de "pesos" $DC1=0; diff --git a/htdocs/lib/pdf.lib.php b/htdocs/lib/pdf.lib.php index aa5adfb6002..73fbb92cc2d 100644 --- a/htdocs/lib/pdf.lib.php +++ b/htdocs/lib/pdf.lib.php @@ -341,8 +341,16 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0) if (empty($onlynumber)) $pdf->line($curx+1, $cury+1, $curx+1, $cury+8 ); - $fieldstoshow=array('bank','desk','number','key'); - if ($conf->global->BANK_SHOW_ORDER_OPTION==1) $fieldstoshow=array('bank','desk','key','number'); + if ($usedetailedbban == 1) + { + $fieldstoshow=array('bank','desk','number','key'); + if ($conf->global->BANK_SHOW_ORDER_OPTION==1) $fieldstoshow=array('bank','desk','key','number'); + } + else if ($usedetailedbban == 2) + { + $fieldstoshow=array('bank','number'); + } + else dol_print_error('','Value returned by function useDetailedBBAN not managed'); foreach ($fieldstoshow as $val) { @@ -943,7 +951,7 @@ function pdf_getTotalQty($object,$type='',$outputlangs) { $total=0; $nblignes=sizeof($object->lines); - + // Loop on each lines for ($i = 0 ; $i < $nblignes ; $i++) { @@ -967,7 +975,7 @@ function pdf_getTotalQty($object,$type='',$outputlangs) } } } - + return $total; } diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 0b052868c19..efa154c828f 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -20,14 +20,17 @@ /* * \files htdocs/societe/class/companybankaccount.class.php * \ingroup societe - * \brief File of class to manage bank accounts description + * \brief File of class to manage bank accounts description of third parties * \version $Id$ */ +require_once(DOL_DOCUMENT_ROOT ."/compta/bank/class/account.class.php"); + + /** - * \brief Class to manage bank accounts description + * \brief Class to manage bank accounts description of third parties */ -class CompanyBankAccount +class CompanyBankAccount extends Account { var $rowid; var $socid; @@ -188,84 +191,6 @@ class CompanyBankAccount return $this->error; } - - /** - * - * - */ - function verif() - { - require_once DOL_DOCUMENT_ROOT . '/lib/bank.lib.php'; - - // Call function to check BAN - if (! checkBanForAccount($this)) - { - $this->error_number = 12; - $this->error_message = 'RIBControlError'; - } - - if ($this->error_number == 0) - { - return 1; - } - else - { - return 0; - } - } - - /** - * Return account country code. - * Use this->iban and this->socid. - * @return String country code - */ - function getCountryCode() - { - if (! empty($this->iban)) - { - // If IBAN defined, we can know country of account from it - if (preg_match("/^[a-z]{2}/i",$this->iban,$reg)) return $reg[1]; - } - - // We return country code - $company=new Societe($this->db); - $result=$company->fetch($this->socid); - if (! empty($company->pays_code)) return $company->pays_code; - - return ''; - } - - /** - * Return if a bank account is defined with detailed information (bank code, desk code, number and key) - * @return boolean true or false - */ - function useDetailedBBAN() - { - if ($this->getCountryCode() == 'FR') return true; - if ($this->getCountryCode() == 'ES') return true; - return false; - } - - /** - * Initialize properties with test values - */ - function initAsSpecimen() - { - $this->bank = 'MyBank'; - $this->courant = 1; - $this->clos = 0; - $this->code_banque = '123'; - $this->code_guichet = '456'; - $this->number = 'ABC12345'; - $this->cle_rib = 50; - $this->bic = 'AA12'; - $this->iban = 'FR999999999'; - $this->iban_prefix = 'FR'; // deprecated - $this->domiciliation = 'The bank addresse'; - $this->proprio = 'Owner'; - $this->adresse_proprio = 'Owner address'; - } - } ?> diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 8b8f5c50292..b4f5f6aea66 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -119,7 +119,7 @@ if ($_GET["socid"] && $_GET["action"] != 'edit') print '