From 1bb428f2f2a469a9fbf541537afec19a59f5ac9c Mon Sep 17 00:00:00 2001 From: sparkyx Date: Mon, 27 Jan 2025 15:36:36 +0100 Subject: [PATCH] Hide inactive ledgers --- include/class/acc_ledger_search.class.php | 15 +++++++-------- include/class/noalyss_user.class.php | 4 ++-- include/class/package_repository.class.php | 1 + include/impress_jrn.inc.php | 13 +++++++++---- include/lib/itext.class.php | 4 +++- include/template/tax_detail-display_form.php | 4 ++-- 6 files changed, 24 insertions(+), 17 deletions(-) diff --git a/include/class/acc_ledger_search.class.php b/include/class/acc_ledger_search.class.php index 2a25e2fbc..90e0a72ef 100644 --- a/include/class/acc_ledger_search.class.php +++ b/include/class/acc_ledger_search.class.php @@ -1240,22 +1240,21 @@ class Acc_Ledger_Search return array($count, $r); } /** - * return the html code to create an hidden div and a button + * @brief return the html code to create an hidden div and a button * to show this DIV. This contains all the available ledgers * for the user in READ or RW *@param $p_selected is an array of checkbox - *@param $p_div div suffix for the list of ledgers + *@param $p_div div suffix for the list of ledgers, base for building the DOMID of elements from the DIV *@note the choosen ledger are stored in the array r_jrn (_GET) */ function select_ledger($p_selected,$p_div) { global $g_user; - $r = ''; - /* security : filter ledger on user */ - $p_array = $g_user->get_ledger($this->type, 3,FALSE); - + $r = ''; + /* security : filter ledger on user */ + $p_array = $g_user->get_ledger($this->type, 3,false); ob_start(); - + /* create a hidden div for the ledger */ echo '
'; @@ -1290,7 +1289,7 @@ class Acc_Ledger_Search for ($e=0;$e<$nb_array;$e++) { $row=$p_array[$e]; -// if ( $row['jrn_enable']==0) continue; + $r=new ICheckBox($p_div.'r_jrn'.$e,$row['jrn_def_id']); $r->set_attribute("ledger_type", $row['jrn_def_type']); $idx=$row['jrn_def_id']; diff --git a/include/class/noalyss_user.class.php b/include/class/noalyss_user.class.php index 09a46557d..00c91aa99 100644 --- a/include/class/noalyss_user.class.php +++ b/include/class/noalyss_user.class.php @@ -583,7 +583,7 @@ class Noalyss_User [uj_priv] @endverbatim */ - function get_ledger($p_type='ALL', $p_access=3, $disable=TRUE) + function get_ledger($p_type='ALL', $p_access=3, $all=TRUE) { $p_type=strtoupper($p_type); if (!in_array($p_type, ["FIN", "ALL", "ODS", "VEN", 'ACH'])) @@ -591,7 +591,7 @@ class Noalyss_User record_log(sprintf("UGL1, p_type %s", $p_type)); throw new Exception("UGL1"._("Type incorrecte")); } - if ($disable==TRUE) + if ($all==TRUE) { $sql_enable=""; } diff --git a/include/class/package_repository.class.php b/include/class/package_repository.class.php index 89324275b..3f508eb4d 100644 --- a/include/class/package_repository.class.php +++ b/include/class/package_repository.class.php @@ -39,6 +39,7 @@ class Package_Repository */ function __construct() { + if ( DEBUGNOALYSS > 1) self::$time_cache_second=1; // Check we can resolve the name $host=parse_url(NOALYSS_PACKAGE_REPOSITORY,PHP_URL_HOST); $file=$_ENV['TMP']."/web.xml"; diff --git a/include/impress_jrn.inc.php b/include/impress_jrn.inc.php index 1bb2a1371..65d32247d 100644 --- a/include/impress_jrn.inc.php +++ b/include/impress_jrn.inc.php @@ -38,14 +38,14 @@ $exercice =$http->get("exercice","string",$user_exercice); if ($g_user->Admin() == 0 && $g_user->is_local_admin() == 0 && $g_user->get_status_security_ledger()==1) { $sql = "select jrn_def_id,jrn_def_name - from jrn_def join jrn_type on jrn_def_type=jrn_type_id + from jrn_def a join jrn_type on jrn_def_type=jrn_type_id join user_sec_jrn on uj_jrn_id=jrn_def_id where uj_login=$1 and uj_priv in ('R','W') and ( jrn_enable=1 or - exists (select 1 from jrn where jr_tech_per in (select p_id from parm_periode where p_exercice=$2))) + exists (select 1 from jrn where jr_tech_per in (select p_id from parm_periode where p_exercice=$2 ) and jr_def_id=a.jrn_def_id)) order by jrn_def_name "; $ret = $cn->make_array($sql,0,array($g_user->login,$exercice)); @@ -53,9 +53,14 @@ if ($g_user->Admin() == 0 && $g_user->is_local_admin() == 0 && $g_user->get_sta else { $ret = $cn->make_array("select jrn_def_id,jrn_def_name - from jrn_def join jrn_type on jrn_def_type=jrn_type_id + from jrn_def a + join jrn_type on jrn_def_type=jrn_type_id where - jrn_enable=1 or exists(select 1 from jrn where jr_tech_per in (select p_id from parm_periode where p_exercice=$1)) + jrn_enable=1 or exists(select 1 + from jrn + where + jr_tech_per in (select p_id from parm_periode where p_exercice=$1) + and jr_def_id=a.jrn_def_id) order by jrn_def_name ",0,[$exercice]); } diff --git a/include/lib/itext.class.php b/include/lib/itext.class.php index 1168cb16c..647c7392b 100644 --- a/include/lib/itext.class.php +++ b/include/lib/itext.class.php @@ -44,7 +44,9 @@ class IText extends HtmlInput $this->require=false; $this->css_size=""; } - /*!\brief show the html input of the widget*/ + /*! + \brief show the html input of the widget + */ public function input($p_name=null,$p_value=null) { $this->name=($p_name==null)?$this->name:$p_name; diff --git a/include/template/tax_detail-display_form.php b/include/template/tax_detail-display_form.php index 14ba481b4..30d098ec3 100644 --- a/include/template/tax_detail-display_form.php +++ b/include/template/tax_detail-display_form.php @@ -52,8 +52,8 @@ $idateend->value = $http->get('to', 'date', $a_limit[1]); input(); ?> get_ledger('ACH',3); - $a_ledger_sale=$g_user->get_ledger('VEN',3); + $a_ledger_purchase=$g_user->get_ledger('ACH',3,all:false); + $a_ledger_sale=$g_user->get_ledger('VEN',3,all:false); $a_ledger=array_merge($a_ledger_sale??[],$a_ledger_purchase??[]); if ( DEBUGNOALYSS > 1 ) echo \Noalyss\Dbg::hidden_info("a_ledger",$a_ledger); $select_value=array();