From 5593b786f16d4afee4f3fc9895de0377e054fab5 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Mon, 14 Jun 2021 13:43:37 +0200 Subject: [PATCH] =?UTF-8?q?New=20#0001983:=20CA=20-=20permettre=20d=C3=A9s?= =?UTF-8?q?activation=20poste?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/class/anc_account_table.class.php | 5 +++++ include/class/anc_operation.class.php | 7 ++++--- include/constant.php | 2 +- include/database/poste_analytique_sql.class.php | 2 ++ include/sql/patch/upgrade161.sql | 14 ++++++++++++++ 5 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 include/sql/patch/upgrade161.sql diff --git a/include/class/anc_account_table.class.php b/include/class/anc_account_table.class.php index 08ad0c393..3e816e676 100644 --- a/include/class/anc_account_table.class.php +++ b/include/class/anc_account_table.class.php @@ -48,6 +48,7 @@ class Anc_Account_Table extends Manage_Table_SQL $this->set_col_label("po_name", _("Label")); $this->set_col_label("po_description", _("Description")); $this->set_col_label("ga_id", _("Groupe")); + $this->set_col_label("po_state", _("Etat")); $this->set_col_type("ga_id", "select"); $this->set_object_name("anc_accounting"); $this->set_col_sort(1); @@ -56,6 +57,10 @@ class Anc_Account_Table extends Manage_Table_SQL where pa_id=$1 order by 2",0,array($p_table->pa_id)); + $this->set_col_type("po_state","select",array( + [ "value"=>"0",'label'=>_("Inactif")], + [ "value"=>"1","label"=>_("Actif")] + )); } /** diff --git a/include/class/anc_operation.class.php b/include/class/anc_operation.class.php index ea365db9e..505b393b3 100644 --- a/include/class/anc_operation.class.php +++ b/include/class/anc_operation.class.php @@ -584,12 +584,13 @@ class Anc_Operation foreach ($a_plan as $r_plan) { - + $existing=(isset($hplan[$p_seq][$count]))?$hplan[$p_seq][$count]:-1; $array=$this->db->make_array( "select po_id as value,". " html_quote(po_name) as label from poste_analytique ". - " where pa_id = ".$r_plan['id']. - " order by po_name",$p_null); + " where pa_id = $1 ". + " and ( po_state = 1 or po_id = $2) ". + " order by po_name",$p_null,[$r_plan['id'],$existing]); $select =new ISelect("hplan[".$p_seq."][]",$array); $select->table=0; // view only or editables diff --git a/include/constant.php b/include/constant.php index 3d6ed3e3f..4a3d4ba34 100644 --- a/include/constant.php +++ b/include/constant.php @@ -116,7 +116,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) { if ( ! defined ("SYSINFO_DISPLAY")) { define ("SYSINFO_DISPLAY",TRUE); } -define ("DBVERSION",161); +define ("DBVERSION",162); define ("MONO_DATABASE",25); define ("DBVERSIONREPO",20); define ('NOTFOUND','--not found--'); diff --git a/include/database/poste_analytique_sql.class.php b/include/database/poste_analytique_sql.class.php index d3d883e79..e5f044c84 100644 --- a/include/database/poste_analytique_sql.class.php +++ b/include/database/poste_analytique_sql.class.php @@ -49,6 +49,7 @@ class Poste_analytique_SQL extends Table_Data_SQL , "po_amount"=>"po_amount" , "po_description"=>"po_description" , "ga_id"=>"ga_id" + , 'po_state'=>'po_state' ); /* * Type of columns @@ -60,6 +61,7 @@ class Poste_analytique_SQL extends Table_Data_SQL , "po_amount"=>"numeric" , "po_description"=>"text" , "ga_id"=>"text" + , 'po_state'=>'numeric' ); diff --git a/include/sql/patch/upgrade161.sql b/include/sql/patch/upgrade161.sql new file mode 100644 index 000000000..18af03e79 --- /dev/null +++ b/include/sql/patch/upgrade161.sql @@ -0,0 +1,14 @@ +begin; + +alter table poste_analytique add po_state integer; + +alter table poste_analytique alter po_state set default 1; + +update poste_analytique set po_state=1; + +alter table poste_analytique alter po_state set not null; + +comment on column poste_analytique.po_state is 'Analytic Account state : 0 disabled 0 enabled '; + +insert into version (val,v_description) values (162,'Analytic accountancy : enable or disable #1983'); +commit ; \ No newline at end of file