diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index b019872da6e33bd5e3b0a5a63b8263a8e2fa4bc9..0173ac931cc438a7197007114995f279f530db75 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -168,6 +168,18 @@ if ($action == 'setmanagezero') { } } +if ($action == 'setdisabledirectinput') { + $setdisabledirectinput = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity); + if (! $res > 0) + $error ++; + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + /* * View */ @@ -342,6 +354,20 @@ if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { } print '</tr>'; +$var = ! $var; +print "<tr " . $bc[$var] . ">"; +print '<td width="80%">' . $langs->trans("BANK_DISABLE_DIRECT_INPUT") . '</td>'; +if (! empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { + print '<td align="center" colspan="2"><a href="' . $_SERVER['PHP_SELF'] . '?action=setdisabledirectinput&value=0">'; + print img_picto($langs->trans("Activated"), 'switch_on'); + print '</a></td>'; +} else { + print '<td align="center" colspan="2"><a href="' . $_SERVER['PHP_SELF'] . '?action=setdisabledirectinput&value=1">'; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print '</a></td>'; +} +print '</tr>'; + print "</table>\n"; dol_fiche_end(); diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 3eb4764bb11ea597bda40eb0c6c999ddfebdb7b8..10c52e657ab7c245abdb7b4c0a73ee86cc620f27 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -366,16 +366,11 @@ if ($id > 0 || ! empty($ref)) { if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { - if (empty($conf->accounting->enabled)) - { - if ($user->rights->banque->modifier) { - print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=addline&id='.$object->id.'&page='.$page.($vline?'&vline='.$vline:'').'">'.$langs->trans("AddBankRecord").'</a>'; - } else { - print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>'; - } - } else { - print '<a class="butActionRefused" title="'.$langs->trans("FeatureDisabled").'" href="#">'.$langs->trans("AddBankRecord").'</a>'; - } + if ($user->rights->banque->modifier) { + print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=addline&id='.$object->id.'&page='.$page.($vline?'&vline='.$vline:'').'">'.$langs->trans("AddBankRecord").'</a>'; + } else { + print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>'; + } } else { print '<a class="butActionRefused" title="'.$langs->trans("FeatureDisabled").'" href="#">'.$langs->trans("AddBankRecord").'</a>'; } diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index af51e01c5767c62c73ef6cba3b2a10bedd1d3d01..60d99438f4f48fdc255bbefed07ed4b3599f0721 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -207,6 +207,11 @@ class modAccounting extends DolibarrModules "chaine", "csv" ); + $this->const[24] = array( + "BANK_DISABLE_DIRECT_INPUT", + "yesno", + "1" + ); // Tabs $this->tabs = array(); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 056466706a14e403f2ad57b930a78e3cade35b68..3c8a431fbb652be1c6a1c32bf4c88110aae3260d 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -56,7 +56,8 @@ ACCOUNTING_LENGTH_DESCRIPTION=Length for displaying product & services descripti ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT=Length for displaying product & services account description form in listings (Best = 50) ACCOUNTING_LENGTH_GACCOUNT=Length of the general accounts ACCOUNTING_LENGTH_AACCOUNT=Length of the third party accounts -ACCOUNTING_MANAGE_ZERO=Manage the zero at the end of an accounting account. Needed by some countries. Disable by default. Be careful with the function of length of the accounts. +ACCOUNTING_MANAGE_ZERO=Manage the zero at the end of an accounting account. Needed by some countries. Disable by default. Be careful with the function "length of the accounts". +BANK_DISABLE_DIRECT_INPUT=Disable free input of bank transactions. Enable by default with this module. ACCOUNTING_SELL_JOURNAL=Sell journal ACCOUNTING_PURCHASE_JOURNAL=Purchase journal