diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php
index 204d84fddf6..0fcf52b888a 100644
--- a/htdocs/admin/bank.php
+++ b/htdocs/admin/bank.php
@@ -177,13 +177,13 @@ while ($i < $nbofbank)
if ($conf->global->BANK_SHOW_ORDER_OPTION == $i)
{
print '
';
- print img_picto($langs->trans("Activated"),'switch_on');
+ print img_picto($langs->trans("Activated"),'on');
print ' | ';
}
else
{
print '';
- print img_picto($langs->trans("Disabled"),'switch_off');
+ print img_picto($langs->trans("Disabled"),'off');
print ' | ';
}
print ' | ';
diff --git a/htdocs/compta/bank/bankid_fr.php b/htdocs/compta/bank/bankid_fr.php
index f27cef41cb4..6b5a4c2437b 100644
--- a/htdocs/compta/bank/bankid_fr.php
+++ b/htdocs/compta/bank/bankid_fr.php
@@ -131,7 +131,7 @@ if (($_GET["id"] || $_GET["ref"]) && $action != 'edit')
if ($action == 'delete')
{
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete");
-
+
}
@@ -171,38 +171,71 @@ if (($_GET["id"] || $_GET["ref"]) && $action != 'edit')
print '| '.$langs->trans("BankAccountCountry").' | ';
$img=picto_from_langcode($account->country_code);
print $img?$img.' ':'';
- print getCountry($account->getCountryCode(),0,$db);
+ print getCountry($account->getCountryCode(), 0, $db);
print " |
\n";
print '| '.$langs->trans("BankName").' | ';
print ''.$account->bank.' |
';
- if ($account->useDetailedBBAN() == 1)
+ // Show fields of bank account
+ $fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
+ if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
{
- print '| '.$langs->trans("BankCode").' | ';
- print ''.$account->code_banque.' | ';
- print '
';
-
- print '| '.$langs->trans("DeskCode").' | ';
- print ''.$account->code_guichet.' | ';
- print '
';
+ 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;
}
- if ($account->useDetailedBBAN() == 2)
- {
- print '| '.$langs->trans("BankCode").' | ';
- print ''.$account->code_banque.' | ';
- print '
';
- }
+ $fieldlistsarray=explode(' ',$fieldlists);
- print '| '.$langs->trans("BankAccountNumber").' | ';
- print ''.$account->number.' | ';
- print '
';
-
- if ($account->useDetailedBBAN() == 1)
+ foreach($fieldlistsarray as $val)
{
- print '| '.$langs->trans("BankAccountNumberKey").' | ';
- print ''.$account->cle_rib.' | ';
- print '
';
+ if ($val == 'BankCode')
+ {
+ if ($account->useDetailedBBAN() == 1)
+ {
+ print '| '.$langs->trans("BankCode").' | ';
+ print ''.$account->code_banque.' | ';
+ print '
';
+ }
+ }
+ if ($val == 'DeskCode')
+ {
+ if ($account->useDetailedBBAN() == 1)
+ {
+ print '| '.$langs->trans("DeskCode").' | ';
+ print ''.$account->code_guichet.' | ';
+ print '
';
+ }
+ }
+
+ if ($val == 'BankCode')
+ {
+ if ($account->useDetailedBBAN() == 2)
+ {
+ print '| '.$langs->trans("BankCode").' | ';
+ print ''.$account->code_banque.' | ';
+ print '
';
+ }
+ }
+
+ if ($val == 'AccountNumber')
+ {
+ print '| '.$langs->trans("BankAccountNumber").' | ';
+ print ''.$account->number.' | ';
+ print '
';
+ }
+
+ if ($val == 'BankAccountNumberKey')
+ {
+ if ($account->useDetailedBBAN() == 1)
+ {
+ print '| '.$langs->trans("BankAccountNumberKey").' | ';
+ print ''.$account->cle_rib.' | ';
+ print '
';
+ }
+ }
}
$ibankey="IBANNumber";
@@ -310,38 +343,77 @@ if ($_GET["id"] && $action == 'edit' && $user->rights->banque->configurer)
if ($account->type == 0 || $account->type == 1)
{
+ print '| '.$langs->trans("BankAccountCountry").' | ';
+ $img=picto_from_langcode($account->country_code);
+ print $img?$img.' ':'';
+ print getCountry($account->getCountryCode(), 0, $db);
+ print " |
\n";
+
// If bank account
print '| '.$langs->trans("BankName").' | ';
print ' | ';
print '
';
- // BBAN
- if ($account->useDetailedBBAN() == 1)
+ // Show fields of bank account
+ $fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
+ if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
{
- print '| '.$langs->trans("BankCode").' | ';
- print ' | ';
- print '
';
-
- print '| '.$langs->trans("DeskCode").' | ';
- print ' | ';
- print '
';
+ 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;
}
- if ($account->useDetailedBBAN() == 2)
- {
- print '| '.$langs->trans("BankCode").' | ';
- print ' | ';
- print '
';
- }
+ $fieldlistsarray=explode(' ',$fieldlists);
- print ''.$langs->trans("BankAccountNumber").' | ';
- print ' | ';
- print '';
-
- if ($account->useDetailedBBAN() == 1)
+ foreach($fieldlistsarray as $val)
{
- print ''.$langs->trans("BankAccountNumberKey").' | ';
- print ' | ';
- print '';
+ if ($val == 'BankCode')
+ {
+ if ($account->useDetailedBBAN() == 1)
+ {
+ print '| '.$langs->trans("BankCode").' | ';
+ print ' | ';
+ print '
';
+ }
+ }
+
+ if ($val == 'DeskCode')
+ {
+ if ($account->useDetailedBBAN() == 1)
+ {
+ print '| '.$langs->trans("DeskCode").' | ';
+ print ' | ';
+ print '
';
+ }
+ }
+
+ if ($val == 'BankCode')
+ {
+ if ($account->useDetailedBBAN() == 2)
+ {
+ print '| '.$langs->trans("BankCode").' | ';
+ print ' | ';
+ print '
';
+ }
+ }
+
+ if ($val == 'AccountNumber')
+ {
+ print ''.$langs->trans("BankAccountNumber").' | ';
+ print ' | ';
+ print '';
+ }
+
+ if ($val == 'BankAccountNumberKey')
+ {
+ if ($account->useDetailedBBAN() == 1)
+ {
+ print ''.$langs->trans("BankAccountNumberKey").' | ';
+ print ' | ';
+ print '';
+ }
+ }
}
$ibankey="IBANNumber";
@@ -361,10 +433,6 @@ if ($_GET["id"] && $action == 'edit' && $user->rights->banque->configurer)
print $account->domiciliation;
print "";
- print '| '.$langs->trans("BankAccountCountry").' | ';
- print getCountry($account->getCountryCode());
- print " |
\n";
-
print '| '.$langs->trans("BankAccountOwner").' | ';
print '';
print ' |
';
@@ -376,11 +444,15 @@ if ($_GET["id"] && $action == 'edit' && $user->rights->banque->configurer)
}
- print '| ';
- print ' ';
- print ' |
';
print '';
+ print '
';
+
+ print '';
+ print '';
+ print ' ';
+ print '
';
+
print '';
}
diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php
index 7d862ff59c4..00cd0b163ee 100644
--- a/htdocs/compta/bank/index.php
+++ b/htdocs/compta/bank/index.php
@@ -234,7 +234,6 @@ if (! $found) print '| '.$langs->trans("None").'
print ' |
| '.$langs->trans("Total").' | '.price($total).' |
';
print "";
-print "
";
/*
@@ -242,7 +241,7 @@ print "
";
*/
print ''."\n";
-if ($user->rights->banque->configurer)
+if ($user->rights->banque->configurer)
{
print '
'.$langs->trans("NewFinancialAccount").'';
}
diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php
index 819c3b6986c..2d948509fc0 100644
--- a/htdocs/societe/rib.php
+++ b/htdocs/societe/rib.php
@@ -92,37 +92,55 @@ if ($action == 'update' && ! $_POST["cancel"])
if ($action == 'add' && ! $_POST["cancel"])
{
- // Ajout
- $account = new CompanyBankAccount($db);
+ $error=0;
- $account->socid = $soc->id;
+ if (! GETPOST('label'))
+ {
+ setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv('Label')),'errors');
+ $action='create';
+ $error++;
+ }
+ if (! GETPOST('bank'))
+ {
+ setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv('BankName')),'errors');
+ $action='create';
+ $error++;
+ }
- $account->bank = $_POST["bank"];
- $account->label = $_POST["label"];
- $account->courant = $_POST["courant"];
- $account->clos = $_POST["clos"];
- $account->code_banque = $_POST["code_banque"];
- $account->code_guichet = $_POST["code_guichet"];
- $account->number = $_POST["number"];
- $account->cle_rib = $_POST["cle_rib"];
- $account->bic = $_POST["bic"];
- $account->iban_prefix = $_POST["iban_prefix"];
- $account->domiciliation = $_POST["domiciliation"];
- $account->proprio = $_POST["proprio"];
- $account->owner_address = $_POST["owner_address"];
+ if (! $error)
+ {
+ // Ajout
+ $account = new CompanyBankAccount($db);
- $result = $account->update($user); // TODO Use create and include update into create method
- if (! $result)
- {
- $message=$account->error;
- $_GET["action"]='create'; // Force chargement page création
- }
- else
- {
- $url=DOL_URL_ROOT.'/societe/rib.php?socid='.$soc->id;
- header('Location: '.$url);
- exit;
- }
+ $account->socid = $soc->id;
+
+ $account->bank = $_POST["bank"];
+ $account->label = $_POST["label"];
+ $account->courant = $_POST["courant"];
+ $account->clos = $_POST["clos"];
+ $account->code_banque = $_POST["code_banque"];
+ $account->code_guichet = $_POST["code_guichet"];
+ $account->number = $_POST["number"];
+ $account->cle_rib = $_POST["cle_rib"];
+ $account->bic = $_POST["bic"];
+ $account->iban_prefix = $_POST["iban_prefix"];
+ $account->domiciliation = $_POST["domiciliation"];
+ $account->proprio = $_POST["proprio"];
+ $account->owner_address = $_POST["owner_address"];
+
+ $result = $account->update($user); // TODO Use create and include update into create method
+ if (! $result)
+ {
+ $message=$account->error;
+ $_GET["action"]='create'; // Force chargement page création
+ }
+ else
+ {
+ $url=DOL_URL_ROOT.'/societe/rib.php?socid='.$soc->id;
+ header('Location: '.$url);
+ exit;
+ }
+ }
}
if ($action == 'setasdefault')
@@ -203,35 +221,68 @@ if ($socid && $action != 'edit' && $action != "create")
print '
| '.$langs->trans("LabelRIB").' | ';
print ''.$account->label.' |
';
- print '
| '.$langs->trans("Bank").' | ';
+ print '
| '.$langs->trans("BankName").' | ';
print ''.$account->bank.' |
';
- if ($account->useDetailedBBAN() == 1)
+ // Show fields of bank account
+ $fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
+ if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
{
- print '
| '.$langs->trans("BankCode").' | ';
- print ''.$account->code_banque.' | ';
- print '
';
-
- print '
| '.$langs->trans("DeskCode").' | ';
- print ''.$account->code_guichet.' | ';
- print '
';
+ 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;
}
- if ($account->useDetailedBBAN() == 2)
- {
- print '
| '.$langs->trans("BankCode").' | ';
- print ''.$account->code_banque.' | ';
- print '
';
- }
+ $fieldlistsarray=explode(' ',$fieldlists);
- print '
| '.$langs->trans("BankAccountNumber").' | ';
- print ''.$account->number.' | ';
- print '
';
-
- if ($account->useDetailedBBAN() == 1)
+ foreach($fieldlistsarray as $val)
{
- print '
| '.$langs->trans("BankAccountNumberKey").' | ';
- print ''.$account->cle_rib.' | ';
- print '
';
+ if ($val == 'BankCode')
+ {
+ if ($account->useDetailedBBAN() == 1)
+ {
+ print '
| '.$langs->trans("BankCode").' | ';
+ print ''.$account->code_banque.' | ';
+ print '
';
+ }
+ }
+ if ($val == 'DeskCode')
+ {
+ if ($account->useDetailedBBAN() == 1)
+ {
+ print '
| '.$langs->trans("DeskCode").' | ';
+ print ''.$account->code_guichet.' | ';
+ print '
';
+ }
+ }
+
+ if ($val == 'BankCode')
+ {
+ if ($account->useDetailedBBAN() == 2)
+ {
+ print '
| '.$langs->trans("BankCode").' | ';
+ print ''.$account->code_banque.' | ';
+ print '
';
+ }
+ }
+
+ if ($val == 'AccountNumber')
+ {
+ print '
| '.$langs->trans("BankAccountNumber").' | ';
+ print ''.$account->number.' | ';
+ print '
';
+ }
+
+ if ($val == 'BankAccountNumberKey')
+ {
+ if ($account->useDetailedBBAN() == 1)
+ {
+ print '
| '.$langs->trans("BankAccountNumberKey").' | ';
+ print ''.$account->cle_rib.' | ';
+ print '
';
+ }
+ }
}
print '
| '.$langs->trans("IBAN").' | ';
@@ -255,7 +306,7 @@ if ($socid && $action != 'edit' && $action != "create")
print '';
// Check BBAN
- if (! checkBanForAccount($account))
+ if ($account->label && ! checkBanForAccount($account))
{
print ''.$langs->trans("RIBControlError").'
';
}
@@ -327,11 +378,8 @@ if ($socid && $action != 'edit' && $action != "create")
/* */
/* ************************************************************************** */
-if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer)
+if ($socid && $action == 'edit' && $user->rights->societe->creer)
{
-
- $form = new Form($db);
-
dol_htmloutput_mesg($message);
print '