From 6d5578a8769ab5cdebf7bb6d5443bd5b324ca757 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO <alexandre.spangaro@gmail.com> Date: Sun, 19 Mar 2017 20:47:30 +0100 Subject: [PATCH] Reactivated constant BANK_DISABLE_DIRECT_INPUT --- htdocs/accountancy/admin/index.php | 26 +++++++++++++++++++ htdocs/compta/bank/bankentries.php | 24 ++++++++++------- .../install/mysql/migration/5.0.0-6.0.0.sql | 2 -- 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index b92da48353f..e6bae2f73d8 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -141,6 +141,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 */ @@ -230,6 +242,20 @@ if (! empty($user->admin)) } print '</tr>'; + $var = ! $var; + print "<tr " . $bc[$var] . ">"; + print '<td>' . $langs->trans("BANK_DISABLE_DIRECT_INPUT") . '</td>'; + if (! empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { + print '<td align="right"><a href="' . $_SERVER['PHP_SELF'] . '?action=setdisabledirectinput&value=0">'; + print img_picto($langs->trans("Activated"), 'switch_on'); + print '</a></td>'; + } else { + print '<td align="right"><a href="' . $_SERVER['PHP_SELF'] . '?action=setdisabledirectinput&value=1">'; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print '</a></td>'; + } + print '</tr>'; + $var = ! $var; print "<tr " . $bc[$var] . ">"; print '<td>' . $langs->trans("ACCOUNTING_MANAGE_ZERO") . '</td>'; diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index 81bd829b8f5..7ea3a0807a5 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -394,16 +394,15 @@ if ($id > 0 || ! empty($ref)) foreach ($bankcateg->fetchAll() as $bankcategory) { $options[$bankcategory->id] = $bankcategory->label; } - + // Bank card - $head=bank_prepare_head($object); dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account'); - + $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; - + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); - + dol_fiche_end(); /* @@ -413,10 +412,17 @@ if ($id > 0 || ! empty($ref)) { print '<div class="tabsAction">'; - if ($user->rights->banque->modifier) { - print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$account.'">'.$langs->trans("AddBankRecord").'</a>'; - } else { - print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>'; + if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) + { + if ($user->rights->banque->modifier) { + print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$account.'">'.$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 ($object->canBeConciliated() > 0) { diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index a4357cacdeb..5921e3a8099 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -124,8 +124,6 @@ INSERT INTO llx_const (name, entity, value, type, visible, note) VALUES ('USER_A ALTER TABLE llx_chargesociales ADD COLUMN fk_projet integer DEFAULT NULL; -DELETE FROM llx_const WHERE name = __ENCRYPT('BANK_DISABLE_DIRECT_INPUT')__; - create table llx_payment_various ( rowid integer AUTO_INCREMENT PRIMARY KEY, -- GitLab