From 9448b24d4e4c477f5fc4f46581da54cddb9c33d5 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Mon, 26 Feb 2018 19:19:11 +0100 Subject: [PATCH] Do not propose disable ledger for new operation --- include/class/acc_ledger.class.php | 12 +++++++----- include/class/acc_ledger_fin.class.php | 2 +- include/class/acc_ledger_purchase.class.php | 2 +- include/class/acc_ledger_sold.class.php | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/class/acc_ledger.class.php b/include/class/acc_ledger.class.php index 43a16b0eb..6cb8dba8d 100644 --- a/include/class/acc_ledger.class.php +++ b/include/class/acc_ledger.class.php @@ -483,14 +483,16 @@ class Acc_Ledger extends jrn_def_sql /** * @brief Show a select list of the ledgers you can access in * writing, reading or simply accessing. - * @param$p_type = ALL or the type of the ledger (ACH,VEN,FIN,ODS) - * @param$p_access =3 for READ and WRITE, 2 for write and 1 for readonly + * @param $p_type = ALL or the type of the ledger (ACH,VEN,FIN,ODS) + * @param $p_access =3 for READ and WRITE, 2 for write and 1 for readonly + * @param Boolean TRUE all ledger are selected, or FALSE only enable * \return object HtmlInput select + * */ - function select_ledger($p_type="ALL", $p_access=3) + function select_ledger($p_type="ALL", $p_access=3,$enable=TRUE) { global $g_user; - $array=$g_user->get_ledger($p_type, $p_access); + $array=$g_user->get_ledger($p_type, $p_access,$enable); if ($array==null) return null; @@ -765,7 +767,7 @@ class Acc_Ledger extends jrn_def_sql // Button for adding customer $add_card=TRUE; } - $wLedger=$this->select_ledger('ODS', 2); + $wLedger=$this->select_ledger('ODS', 2,FALSE); if ($wLedger==null) throw new Exception(_('Pas de journal disponible')); $wLedger->javascript="onChange='update_name();update_predef(\"ods\",\"t\",\"".$_REQUEST['ac']."\");$add_js'"; diff --git a/include/class/acc_ledger_fin.class.php b/include/class/acc_ledger_fin.class.php index ca5da1a73..c9ef7d967 100644 --- a/include/class/acc_ledger_fin.class.php +++ b/include/class/acc_ledger_fin.class.php @@ -309,7 +309,7 @@ class Acc_Ledger_Fin extends Acc_Ledger $onchange .= 'update_pj();'; $add_js = 'onchange="'.$onchange.'"'; - $wLedger = $this->select_ledger('FIN', 2); + $wLedger = $this->select_ledger('FIN', 2,FALSE); if ($wLedger == null) throw new Exception(_('Pas de journal disponible')); diff --git a/include/class/acc_ledger_purchase.class.php b/include/class/acc_ledger_purchase.class.php index 7dfc93803..5990d1de8 100644 --- a/include/class/acc_ledger_purchase.class.php +++ b/include/class/acc_ledger_purchase.class.php @@ -1053,7 +1053,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger $add_js.='update_pay_method();'; $add_js.='update_row("sold_item");'; - $wLedger=$this->select_ledger('ACH',2); + $wLedger=$this->select_ledger('ACH',2,FALSE); if ($wLedger == null) throw new Exception(_('Pas de journal disponible')); $wLedger->javascript="onChange='update_predef(\"ach\",\"f\",\"".$_REQUEST['ac']."\");$add_js'"; diff --git a/include/class/acc_ledger_sold.class.php b/include/class/acc_ledger_sold.class.php index b7e8d53df..bfee0b688 100644 --- a/include/class/acc_ledger_sold.class.php +++ b/include/class/acc_ledger_sold.class.php @@ -1105,7 +1105,7 @@ EOF; $add_js.='update_pay_method();'; $add_js.='update_row("sold_item");'; - $wLedger = $this->select_ledger('VEN', 2); + $wLedger = $this->select_ledger('VEN', 2,FALSE); if ($wLedger == null) throw new Exception(_('Pas de journal disponible')); $wLedger->table = 1;