New: English bank account need a bank code (called sort code) to

identify an account.
This commit is contained in:
Laurent Destailleur 2012-10-31 00:22:13 +01:00
parent 42d2a0a2d1
commit 1d7820c5ac
6 changed files with 33 additions and 17 deletions

View File

@ -56,6 +56,7 @@ For users:
- New: Update libs/tools/logo for DoliWamp (now use PHP 5.3). - New: Update libs/tools/logo for DoliWamp (now use PHP 5.3).
- New: Added ODT Template tag {object_total_discount} - New: Added ODT Template tag {object_total_discount}
- New: Add new import options: Third parties bank details, warehouses and stocks, categories and suppliers prices - New: Add new import options: Third parties bank details, warehouses and stocks, categories and suppliers prices
- New: English bank account need a bank code (called sort code) to identify an account.
New experimental modules: New experimental modules:
- New: Add margin management module. - New: Add margin management module.

View File

@ -975,18 +975,19 @@ class Account extends CommonObject
} }
/** /**
* Return if a bank account is defined with detailed information (bank code, desk code, number and key) * Return if a bank account is defined with detailed information (bank code, desk code, number and key).
* More information on codes used by countries on page http://en.wikipedia.org/wiki/Bank_code
* *
* @return int 0=Use only an account number * @return int 0=Use only an account number
* 1=Need Bank, Desk, Number and Key (France, Spain, ...) * 1=Need Bank, Desk, Number and Key (France, Spain, ...)
* 2=Neek Bank only (BSB for Australia) * 2=Neek Bank only (Sort code for Great Britain, BSB for Australia)
*/ */
function useDetailedBBAN() function useDetailedBBAN()
{ {
$country_code=$this->getCountryCode(); $country_code=$this->getCountryCode();
if (in_array($country_code,array('FR','ES','GA'))) return 1; // France, Spain, Gabon if (in_array($country_code,array('FR','ES','GA'))) return 1; // France, Spain, Gabon
if (in_array($country_code,array('AU'))) return 2; // Australia if (in_array($country_code,array('AU','GB'))) return 2; // Australia, Great Britain
return 0; return 0;
} }

View File

@ -78,17 +78,22 @@ if ($_POST["action"] == 'add')
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number)) if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number))
{ {
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountancyCode")).'</div>'; setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), 'error');
$action='create'; // Force chargement page en mode creation $action='create'; // Force chargement page en mode creation
$error++; $error++;
} }
if (empty($account->ref))
if (empty($account->label))
{ {
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("LabelBankCashAccount")).'</div>'; setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), 'errors');
$action='create'; // Force chargement page en mode creation $action='create'; // Force chargement page en mode creation
$error++; $error++;
} }
if (empty($account->label))
{
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), 'errors');
$action='create'; // Force chargement page en mode creation
$error++;
}
if (! $error) if (! $error)
{ {
@ -98,7 +103,7 @@ if ($_POST["action"] == 'add')
$_GET["id"]=$id; // Force chargement page en mode visu $_GET["id"]=$id; // Force chargement page en mode visu
} }
else { else {
$message='<div class="error">'.$account->error.'</div>'; setEventMessage($account->error,'errors');
$action='create'; // Force chargement page en mode creation $action='create'; // Force chargement page en mode creation
} }
} }
@ -144,17 +149,22 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number)) if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number))
{ {
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountancyCode")).'</div>'; setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), 'error');
$action='edit'; // Force chargement page en mode creation $action='edit'; // Force chargement page en mode creation
$error++; $error++;
} }
if (empty($account->ref))
if (empty($account->label))
{ {
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("LabelBankCashAccount")).'</div>'; setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), 'errors');
$action='edit'; // Force chargement page en mode creation $action='edit'; // Force chargement page en mode creation
$error++; $error++;
} }
if (empty($account->label))
{
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), 'errors');
$action='edit'; // Force chargement page en mode creation
$error++;
}
if (! $error) if (! $error)
{ {
@ -256,7 +266,7 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
// Country // Country
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Country").'</td>'; print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("BankAccountCountry").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
$selectedcode=''; $selectedcode='';
if (isset($_POST["account_country_id"])) if (isset($_POST["account_country_id"]))
@ -396,7 +406,7 @@ else
print '<td colspan="3">'.$account->getLibStatut(4).'</td></tr>'; print '<td colspan="3">'.$account->getLibStatut(4).'</td></tr>';
// Country // Country
print '<tr><td>'.$langs->trans("Country").'</td><td>'; print '<tr><td>'.$langs->trans("BankAccountCountry").'</td><td>';
if ($account->fk_pays > 0) if ($account->fk_pays > 0)
{ {
$img=picto_from_langcode($account->country_code); $img=picto_from_langcode($account->country_code);

View File

@ -2879,8 +2879,8 @@ class Facture extends CommonInvoice
$this->cond_reglement_id = 1; $this->cond_reglement_id = 1;
$this->cond_reglement_code = 'RECEP'; $this->cond_reglement_code = 'RECEP';
$this->date_lim_reglement=$this->calculate_date_lim_reglement(); $this->date_lim_reglement=$this->calculate_date_lim_reglement();
$this->mode_reglement_id = 7; $this->mode_reglement_id = 0; // Not forced to show payment mode CHQ + VIR
$this->mode_reglement_code = 'CHQ'; $this->mode_reglement_code = ''; // Not forced to show payment mode CHQ + VIR
$this->note_public='This is a comment (public)'; $this->note_public='This is a comment (public)';
$this->note_private='This is a comment (private)'; $this->note_private='This is a comment (private)';
$this->note='This is a comment (private)'; $this->note='This is a comment (private)';

View File

@ -14,6 +14,7 @@ ChequesReceipts=Cheques receipts
ChequesArea=Cheques deposits area ChequesArea=Cheques deposits area
ChequeDeposits=Cheques deposits ChequeDeposits=Cheques deposits
Cheques=Cheques Cheques=Cheques
BankCode=Sort code
# PaymentConditions # PaymentConditions
PaymentConditionShortRECEP=Due on Receipt PaymentConditionShortRECEP=Due on Receipt

View File

@ -0,0 +1,3 @@
# Dolibarr language file - en_GB - exports
CHARSET=UTF-8
BankCode=Sort code