New: Support BSB code for bank account in australia
This commit is contained in:
parent
4536ff2cdc
commit
b94ea03aa3
@ -5,6 +5,7 @@ $Id$
|
|||||||
|
|
||||||
***** ChangeLog for 3.1 compared to 3.0 *****
|
***** ChangeLog for 3.1 compared to 3.0 *****
|
||||||
For users:
|
For users:
|
||||||
|
- New: Support BSB code for bank account in australia.
|
||||||
- New: Can set date of payment for autocreate invoice/payment when
|
- New: Can set date of payment for autocreate invoice/payment when
|
||||||
creating a foundation subscription.
|
creating a foundation subscription.
|
||||||
- New: task #10969 : Add checkbox to close automatically invoice to "payed"
|
- New: task #10969 : Add checkbox to close automatically invoice to "payed"
|
||||||
|
|||||||
3
htdocs/langs/en_AU/bills.lang
Executable file
3
htdocs/langs/en_AU/bills.lang
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
# Dolibarr language file - en_AU - bills
|
||||||
|
CHARSET=UTF-8
|
||||||
|
BankCode=Bank code or BSB
|
||||||
3
htdocs/langs/en_AU/withdrawals.lang
Executable file
3
htdocs/langs/en_AU/withdrawals.lang
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
# Dolibarr language file - en_AU - withdrawals
|
||||||
|
CHARSET=UTF-8
|
||||||
|
ThirdPartyBankCode=Third party bank code or BSB
|
||||||
@ -81,13 +81,9 @@ function bank_prepare_head($obj)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Check account number informations for a bank account
|
* Check account number informations for a bank account
|
||||||
* \param code_banque code banque
|
* @param account A bank account
|
||||||
* \param code_guichet code guichet
|
* @return int True if informations are valid, false otherwise
|
||||||
* \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)
|
function checkBanForAccount($account)
|
||||||
{
|
{
|
||||||
@ -132,22 +128,25 @@ function checkBanForAccount($account)
|
|||||||
if ($country_code == 'ES') // Spanish rules
|
if ($country_code == 'ES') // Spanish rules
|
||||||
{
|
{
|
||||||
$CCC = strtolower(trim($account->number));
|
$CCC = strtolower(trim($account->number));
|
||||||
|
|
||||||
$rib = strtolower(trim($account->code_banque).trim($account->code_guichet));
|
$rib = strtolower(trim($account->code_banque).trim($account->code_guichet));
|
||||||
|
|
||||||
$cle_rib=strtolower(CheckES($rib,$CCC));
|
$cle_rib=strtolower(CheckES($rib,$CCC));
|
||||||
|
|
||||||
if ($cle_rib == strtolower($account->cle))
|
if ($cle_rib == strtolower($account->cle))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
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
|
// No particular rule
|
||||||
// If account is CompanyBankAccount class, we use number
|
// If account is CompanyBankAccount class, we use number
|
||||||
// If account is Account class, we use num_compte
|
// If account is Account class, we use num_compte
|
||||||
if (empty($account->num_compte) && empty($account->number))
|
if (empty($account->number))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -160,7 +159,7 @@ function checkBanForAccount($account)
|
|||||||
* Returns the key for Spanish Banks Accounts
|
* Returns the key for Spanish Banks Accounts
|
||||||
* @return string Key
|
* @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"
|
$APesos = Array(1,2,4,8,5,10,9,7,3,6); // Array de "pesos"
|
||||||
$DC1=0;
|
$DC1=0;
|
||||||
|
|||||||
@ -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 );
|
if (empty($onlynumber)) $pdf->line($curx+1, $cury+1, $curx+1, $cury+8 );
|
||||||
|
|
||||||
$fieldstoshow=array('bank','desk','number','key');
|
if ($usedetailedbban == 1)
|
||||||
if ($conf->global->BANK_SHOW_ORDER_OPTION==1) $fieldstoshow=array('bank','desk','key','number');
|
{
|
||||||
|
$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)
|
foreach ($fieldstoshow as $val)
|
||||||
{
|
{
|
||||||
@ -943,7 +951,7 @@ function pdf_getTotalQty($object,$type='',$outputlangs)
|
|||||||
{
|
{
|
||||||
$total=0;
|
$total=0;
|
||||||
$nblignes=sizeof($object->lines);
|
$nblignes=sizeof($object->lines);
|
||||||
|
|
||||||
// Loop on each lines
|
// Loop on each lines
|
||||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
for ($i = 0 ; $i < $nblignes ; $i++)
|
||||||
{
|
{
|
||||||
@ -967,7 +975,7 @@ function pdf_getTotalQty($object,$type='',$outputlangs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $total;
|
return $total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,14 +20,17 @@
|
|||||||
/*
|
/*
|
||||||
* \files htdocs/societe/class/companybankaccount.class.php
|
* \files htdocs/societe/class/companybankaccount.class.php
|
||||||
* \ingroup societe
|
* \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$
|
* \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 $rowid;
|
||||||
var $socid;
|
var $socid;
|
||||||
@ -188,84 +191,6 @@ class CompanyBankAccount
|
|||||||
return $this->error;
|
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';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -119,7 +119,7 @@ if ($_GET["socid"] && $_GET["action"] != 'edit')
|
|||||||
print '<tr><td valign="top">'.$langs->trans("Bank").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("Bank").'</td>';
|
||||||
print '<td colspan="4">'.$account->bank.'</td></tr>';
|
print '<td colspan="4">'.$account->bank.'</td></tr>';
|
||||||
|
|
||||||
if ($account->useDetailedBBAN())
|
if ($account->useDetailedBBAN() == 1)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||||
print '<td colspan="3">'.$account->code_banque.'</td>';
|
print '<td colspan="3">'.$account->code_banque.'</td>';
|
||||||
@ -129,12 +129,18 @@ if ($_GET["socid"] && $_GET["action"] != 'edit')
|
|||||||
print '<td colspan="3">'.$account->code_guichet.'</td>';
|
print '<td colspan="3">'.$account->code_guichet.'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
if ($account->useDetailedBBAN() == 2)
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||||
|
print '<td colspan="3">'.$account->code_banque.'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("BankAccountNumber").'</td>';
|
print '<tr><td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||||
print '<td colspan="3">'.$account->number.'</td>';
|
print '<td colspan="3">'.$account->number.'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if ($account->useDetailedBBAN())
|
if ($account->useDetailedBBAN() == 1)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
print '<tr><td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||||
print '<td colspan="3">'.$account->cle_rib.'</td>';
|
print '<td colspan="3">'.$account->cle_rib.'</td>';
|
||||||
@ -204,7 +210,7 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer
|
|||||||
print '<td colspan="4"><input size="30" type="text" name="bank" value="'.$account->bank.'"></td></tr>';
|
print '<td colspan="4"><input size="30" type="text" name="bank" value="'.$account->bank.'"></td></tr>';
|
||||||
|
|
||||||
// BBAN
|
// BBAN
|
||||||
if ($account->useDetailedBBAN())
|
if ($account->useDetailedBBAN() == 1)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||||
@ -214,12 +220,18 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer
|
|||||||
print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>';
|
print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
if ($account->useDetailedBBAN() == 2)
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||||
|
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
print '<td>'.$langs->trans("BankAccountNumber").'</td>';
|
print '<td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||||
print '<td><input size="15" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
|
print '<td><input size="15" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if ($account->useDetailedBBAN())
|
if ($account->useDetailedBBAN() == 1)
|
||||||
{
|
{
|
||||||
print '<td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
print '<td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||||
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>';
|
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user