Some fix after merging bank account number form
This commit is contained in:
parent
40adbe5a72
commit
8e29dcdb79
@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
||||||
|
|
||||||
$langs->load("banks");
|
$langs->load("banks");
|
||||||
|
$langs->load("bills");
|
||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
@ -94,8 +95,8 @@ if ($_POST["action"] == 'add')
|
|||||||
$account->state_id = $_POST["account_state_id"];
|
$account->state_id = $_POST["account_state_id"];
|
||||||
$account->country_id = $_POST["account_country_id"];
|
$account->country_id = $_POST["account_country_id"];
|
||||||
|
|
||||||
$account->min_allowed = $_POST["account_min_allowed"];
|
$account->min_allowed = GETPOST("account_min_allowed",'int');
|
||||||
$account->min_desired = $_POST["account_min_desired"];
|
$account->min_desired = GETPOST("account_min_desired",'int');
|
||||||
$account->comment = trim($_POST["account_comment"]);
|
$account->comment = trim($_POST["account_comment"]);
|
||||||
|
|
||||||
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))
|
||||||
@ -169,8 +170,8 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
|||||||
$account->state_id = $_POST["account_state_id"];
|
$account->state_id = $_POST["account_state_id"];
|
||||||
$account->country_id = $_POST["account_country_id"];
|
$account->country_id = $_POST["account_country_id"];
|
||||||
|
|
||||||
$account->min_allowed = $_POST["account_min_allowed"];
|
$account->min_allowed = GETPOST("account_min_allowed",'int');
|
||||||
$account->min_desired = $_POST["account_min_desired"];
|
$account->min_desired = GETPOST("account_min_desired",'int');
|
||||||
$account->comment = trim($_POST["account_comment"]);
|
$account->comment = trim($_POST["account_comment"]);
|
||||||
|
|
||||||
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))
|
||||||
@ -251,9 +252,6 @@ if ($action == 'create')
|
|||||||
document.formsoc.action.value="create";
|
document.formsoc.action.value="create";
|
||||||
document.formsoc.submit();
|
document.formsoc.submit();
|
||||||
});
|
});
|
||||||
})'."\n";
|
|
||||||
|
|
||||||
print 'jQuery(document).ready(function () {
|
|
||||||
jQuery("#selectaccount_country_id").change(function() {
|
jQuery("#selectaccount_country_id").change(function() {
|
||||||
document.formsoc.action.value="create";
|
document.formsoc.action.value="create";
|
||||||
document.formsoc.submit();
|
document.formsoc.submit();
|
||||||
@ -275,7 +273,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
|
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
|
||||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="label" value="'.$_POST["label"].'"></td></tr>';
|
print '<td colspan="3"><input size="30" type="text" class="flat" name="label" value="'.GETPOST("label").'"></td></tr>';
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
||||||
@ -299,15 +297,17 @@ if ($action == 'create')
|
|||||||
print $form->selectarray("clos",array(0=>$account->status[0],1=>$account->status[1]),(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
|
print $form->selectarray("clos",array(0=>$account->status[0],1=>$account->status[1]),(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Country
|
// Country
|
||||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("BankAccountCountry").'</td>';
|
|
||||||
print '<td colspan="3">';
|
|
||||||
$selectedcode='';
|
$selectedcode='';
|
||||||
if (isset($_POST["account_country_id"]))
|
if (isset($_POST["account_country_id"]))
|
||||||
{
|
{
|
||||||
$selectedcode=$_POST["account_country_id"]?$_POST["account_country_id"]:$account->country_code;
|
$selectedcode=$_POST["account_country_id"]?$_POST["account_country_id"]:$account->country_code;
|
||||||
}
|
}
|
||||||
else if (empty($selectedcode)) $selectedcode=$mysoc->country_code;
|
else if (empty($selectedcode)) $selectedcode=$mysoc->country_code;
|
||||||
|
$account->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
|
||||||
|
|
||||||
|
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("BankAccountCountry").'</td>';
|
||||||
|
print '<td colspan="3">';
|
||||||
print $form->select_country($selectedcode,'account_country_id');
|
print $form->select_country($selectedcode,'account_country_id');
|
||||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -333,7 +333,7 @@ if ($action == 'create')
|
|||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
// Editor wysiwyg
|
// Editor wysiwyg
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor('account_comment',$account->comment,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70);
|
$doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$account->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,4,70);
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -353,7 +353,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
// Sold
|
// Sold
|
||||||
print '<tr><td valign="top" width="25%">'.$langs->trans("InitialBankBalance").'</td>';
|
print '<tr><td valign="top" width="25%">'.$langs->trans("InitialBankBalance").'</td>';
|
||||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="solde" value="'.($_POST["solde"]?$_POST["solde"]:price2num($account->solde)).'"></td></tr>';
|
print '<td colspan="3"><input size="12" type="text" class="flat" name="solde" value="'.(GETPOST("solde")?GETPOST("solde"):price2num($account->solde)).'"></td></tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("Date").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("Date").'</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
@ -445,10 +445,10 @@ if ($action == 'create')
|
|||||||
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
|
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
|
||||||
|
|
||||||
// IBAN
|
// IBAN
|
||||||
print '<tr><td valign="top">'.$langs->trans($ibankey).'</td>';
|
print '<tr><td>'.$langs->trans($ibankey).'</td>';
|
||||||
print '<td colspan="3"><input size="34" maxlength="34" type="text" class="flat" name="iban" value="'.$account->iban.'"></td></tr>';
|
print '<td colspan="3"><input size="34" maxlength="34" type="text" class="flat" name="iban" value="'.$account->iban.'"></td></tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans($bickey).'</td>';
|
print '<tr><td>'.$langs->trans($bickey).'</td>';
|
||||||
print '<td colspan="3"><input size="11" maxlength="11" type="text" class="flat" name="bic" value="'.$account->bic.'"></td></tr>';
|
print '<td colspan="3"><input size="11" maxlength="11" type="text" class="flat" name="bic" value="'.$account->bic.'"></td></tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
|
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
|
||||||
@ -474,19 +474,19 @@ if ($action == 'create')
|
|||||||
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED))
|
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED))
|
||||||
{
|
{
|
||||||
print '<tr><td valign="top" class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
print '<tr><td valign="top" class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||||
print '<td colspan="3"><input type="text" name="account_number" value="'.$account->account_number.'"></td></tr>';
|
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number'):$account->account_number).'"></td></tr>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr><td valign="top" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
print '<tr><td valign="top" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||||
print '<td colspan="3"><input type="text" name="account_number" value="'.$account->account_number.'"></td></tr>';
|
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number'):$account->account_number).'"></td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accountancy journal
|
// Accountancy journal
|
||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td valign="top">'.$langs->trans("AccountancyJournal").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("AccountancyJournal").'</td>';
|
||||||
print '<td colspan="3"><input type="text" name="accountancy_journal" value="'.$account->accountancy_journal.'"></td></tr>';
|
print '<td colspan="3"><input type="text" name="accountancy_journal" value="'.(GETPOST("accountancy_journal")?GETPOST('accountancy_journal'):$account->accountancy_journal).'"></td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -599,7 +599,7 @@ else
|
|||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
|
||||||
print '<td colspan="3">'.$account->comment.'</td></tr>';
|
print '<td colspan="3">'.dol_htmlentitiesbr($account->comment).'</td></tr>';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array('colspan' => 3);
|
$parameters=array('colspan' => 3);
|
||||||
@ -834,11 +834,13 @@ else
|
|||||||
|
|
||||||
// Country
|
// Country
|
||||||
$account->country_id=$account->country_id?$account->country_id:$mysoc->country_id;
|
$account->country_id=$account->country_id?$account->country_id:$mysoc->country_id;
|
||||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Country").'</td>';
|
|
||||||
print '<td colspan="3">';
|
|
||||||
$selectedcode=$account->country_code;
|
$selectedcode=$account->country_code;
|
||||||
if (isset($_POST["account_country_id"])) $selectedcode=$_POST["account_country_id"];
|
if (isset($_POST["account_country_id"])) $selectedcode=$_POST["account_country_id"];
|
||||||
else if (empty($selectedcode)) $selectedcode=$mysoc->country_code;
|
else if (empty($selectedcode)) $selectedcode=$mysoc->country_code;
|
||||||
|
$account->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
|
||||||
|
|
||||||
|
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Country").'</td>';
|
||||||
|
print '<td colspan="3">';
|
||||||
print $form->select_country($selectedcode,'account_country_id');
|
print $form->select_country($selectedcode,'account_country_id');
|
||||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -881,7 +883,7 @@ else
|
|||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
// Editor wysiwyg
|
// Editor wysiwyg
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor('account_comment',(isset($_POST["account_comment"])?$_POST["account_comment"]:$account->comment),'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70);
|
$doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$account->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,4,70);
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -513,8 +513,6 @@ class Account extends CommonObject
|
|||||||
global $langs,$conf, $hookmanager;
|
global $langs,$conf, $hookmanager;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (! $this->min_allowed) $this->min_allowed=0;
|
|
||||||
if (! $this->min_desired) $this->min_desired=0;
|
|
||||||
$this->state_id = ($this->state_id?$this->state_id:$this->state_id);
|
$this->state_id = ($this->state_id?$this->state_id:$this->state_id);
|
||||||
$this->country_id = ($this->country_id?$this->country_id:$this->country_id);
|
$this->country_id = ($this->country_id?$this->country_id:$this->country_id);
|
||||||
|
|
||||||
@ -558,8 +556,8 @@ class Account extends CommonObject
|
|||||||
|
|
||||||
$sql.= ",currency_code = '".$this->currency_code."'";
|
$sql.= ",currency_code = '".$this->currency_code."'";
|
||||||
|
|
||||||
$sql.= ",min_allowed = '".price2num($this->min_allowed)."'";
|
$sql.= ",min_allowed = ".($this->min_allowed != '' ? price2num($this->min_allowed) : "null");
|
||||||
$sql.= ",min_desired = '".price2num($this->min_desired)."'";
|
$sql.= ",min_desired = ".($this->min_desired != '' ? price2num($this->min_desired) : "null");
|
||||||
$sql.= ",comment = '".$this->db->escape($this->comment)."'";
|
$sql.= ",comment = '".$this->db->escape($this->comment)."'";
|
||||||
|
|
||||||
$sql.= ",state_id = ".($this->state_id>0?"'".$this->state_id."'":"null");
|
$sql.= ",state_id = ".($this->state_id>0?"'".$this->state_id."'":"null");
|
||||||
@ -1076,7 +1074,7 @@ class Account extends CommonObject
|
|||||||
*
|
*
|
||||||
* @return int 0=No bank code need + Account number is enough
|
* @return int 0=No bank code need + Account number is enough
|
||||||
* 1=Need 2 fields for bank code: Bank, Desk (France, Spain, ...) + Account number and key
|
* 1=Need 2 fields for bank code: Bank, Desk (France, Spain, ...) + Account number and key
|
||||||
* 2=Neek 1 field for bank code: Bank only (Sort code for Great Britain, BSB for Australia) + Account number
|
* 2=Need 1 field for bank code: Bank only (Sort code for Great Britain, BSB for Australia) + Account number
|
||||||
*/
|
*/
|
||||||
function useDetailedBBAN()
|
function useDetailedBBAN()
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user