From 2810a32db6addd29d74b372caaf1daec38a57e9a Mon Sep 17 00:00:00 2001 From: sparkyx Date: Fri, 21 Jun 2024 11:54:08 +0200 Subject: [PATCH] cosmetic : improve appearance --- html/fid.php | 1 + include/class/acc_ledger_purchase.class.php | 2 +- include/class/acc_ledger_sale.class.php | 2 +- include/class/tva_rate_mtable.class.php | 4 + include/constant.php | 2 + include/database/tva_rate_sql.class.php | 3 +- include/lib/icon_action.class.php | 12 +- include/lib/idate.class.php | 1 + include/lib/itva_popup.class.php | 19 +-- include/template/form_ledger_detail.php | 13 +- sql/upgrade.sql | 131 +++++++++++--------- 11 files changed, 109 insertions(+), 81 deletions(-) diff --git a/html/fid.php b/html/fid.php index f7d17666a..514405af0 100644 --- a/html/fid.php +++ b/html/fid.php @@ -129,6 +129,7 @@ if ( isset($_SESSION[SESSION_KEY.'isValid']) && $_SESSION[SESSION_KEY.'isValid'] $name=$array[0]['vw_name']; + // use for followup $sell=(isNumber($array[0]['vw_sell']) == 1) ? $array[0]['vw_sell'] : 0 ; $buy=(isNumber($array[0]['vw_buy']) == 1) ?$array[0]['vw_buy']:0; diff --git a/include/class/acc_ledger_purchase.class.php b/include/class/acc_ledger_purchase.class.php index c5b36ca87..c28e7eb9b 100644 --- a/include/class/acc_ledger_purchase.class.php +++ b/include/class/acc_ledger_purchase.class.php @@ -1366,7 +1366,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger $W1->label=""; $W1->name="e_march".$i; $W1->value=$march; - $W1->table=1; + $W1->table=0; $W1->set_dblclick("fill_ipopcard(this);"); $W1->set_attribute('ipopup','ipopcard'); diff --git a/include/class/acc_ledger_sale.class.php b/include/class/acc_ledger_sale.class.php index bde50793d..75f27c89c 100644 --- a/include/class/acc_ledger_sale.class.php +++ b/include/class/acc_ledger_sale.class.php @@ -1487,7 +1487,7 @@ EOF; $W1->label = ""; $W1->name = "e_march" . $i; $W1->value = $march; - $W1->table = 1; + $W1->table = 0; $W1->set_attribute('typecard', 'cred'); $W1->set_dblclick("fill_ipopcard(this);"); $W1->set_attribute('ipopup', 'ipopcard'); diff --git a/include/class/tva_rate_mtable.class.php b/include/class/tva_rate_mtable.class.php index 38b035cbb..09c59821a 100644 --- a/include/class/tva_rate_mtable.class.php +++ b/include/class/tva_rate_mtable.class.php @@ -226,6 +226,7 @@ class Tva_Rate_MTable extends Manage_Table_SQL $tva_rate=new Tva_rate_SQL($cn); $tva_rate->setp("tva_id",$new_tva_id); $tva_rate->setp("tva_rate", $this->table->tva_rate); + $tva_rate->setp("tva_code", $this->table->tva_code); $tva_rate->setp("tva_label", $this->table->tva_label); $tva_rate->setp("tva_comment", $this->table->tva_comment); $tva_rate->setp("tva_both_side", $this->table->tva_both_side); @@ -336,6 +337,9 @@ class Tva_Rate_MTable extends Manage_Table_SQL if (strlen($this->table->tva_code)>5){ $this->set_error("tva_code", _("code tva : Maximum 5 caractères")); } + if (isNumber($this->table->tva_code) == 1){ + $this->set_error("tva_code", _("code tva : doit aussi contenir des lettres")); + } if ($this->count_error()!=0) return false; return true; diff --git a/include/constant.php b/include/constant.php index 8a7debbf5..020df53e8 100644 --- a/include/constant.php +++ b/include/constant.php @@ -100,6 +100,8 @@ $g_failed = ""; $g_succeed = ""; define('SMALLX', '#xe816;'); define('BUTTONADD', "✚"); +define('ICON_SEARCH', '🔎'); +define('ICON_CLEAN', '✕'); // If noalyss_version is not defined it is likely directly taken from // git and so this variable is not set, this cause some issue diff --git a/include/database/tva_rate_sql.class.php b/include/database/tva_rate_sql.class.php index 2ff4ff48e..5fc0593da 100644 --- a/include/database/tva_rate_sql.class.php +++ b/include/database/tva_rate_sql.class.php @@ -50,6 +50,7 @@ class Tva_Rate_SQL extends Table_Data_SQL , "tva_both_side"=>"tva_both_side" ,"tva_payment_purchase"=>"tva_payment_purchase" ,"tva_payment_sale"=>"tva_payment_sale" + ,"tva_code"=>"tva_code" ); /* * Type of columns @@ -63,7 +64,7 @@ class Tva_Rate_SQL extends Table_Data_SQL , "tva_both_side"=>"numeric" ,"tva_payment_purchase"=>"text" ,"tva_payment_sale"=>"text" - + ,"tva_code"=>"text" ); diff --git a/include/lib/icon_action.class.php b/include/lib/icon_action.class.php index d189cc3e1..42fe5d19d 100644 --- a/include/lib/icon_action.class.php +++ b/include/lib/icon_action.class.php @@ -40,8 +40,8 @@ class Icon_Action static function icon_magnifier($id, $p_javascript, $p_style="") { $r=""; - $r.=sprintf('', - $id, $p_style, $p_javascript); + $r.=sprintf('%s', + $id, $p_style, $p_javascript,ICON_SEARCH); return $r; } /** @@ -54,8 +54,8 @@ class Icon_Action static function button_magnifier($id, $p_javascript, $p_style="") { $r=""; - $r.=sprintf('', - $id, $p_style, $p_javascript); + $r.=sprintf('', + $id, $p_style, $p_javascript,ICON_SEARCH); return $r; } @@ -82,8 +82,8 @@ class Icon_Action */ static function clean_zone($id, $p_javascript, $p_style="") { - $r=sprintf('', - $p_javascript, $id, $p_style + $r=sprintf('', + $p_javascript, $id, ICON_CLEAN,$p_style ); return $r; } diff --git a/include/lib/idate.class.php b/include/lib/idate.class.php index 8d74f80e6..1a131b16f 100644 --- a/include/lib/idate.class.php +++ b/include/lib/idate.class.php @@ -143,6 +143,7 @@ class IDate extends HtmlInput %s />  diff --git a/include/lib/itva_popup.class.php b/include/lib/itva_popup.class.php index f23b05a4a..6e248ffba 100644 --- a/include/lib/itva_popup.class.php +++ b/include/lib/itva_popup.class.php @@ -77,21 +77,21 @@ class ITva_Popup extends HtmlInput $r=""; switch ($this->filter) { case 'none': - $sql="select tva_code + $sql="select tva_code,tva_label from v_tva_rate where tva_purchase <> '#' and tva_sale <> '#' order by tva_code "; break; case 'sale': - $sql="select tva_code + $sql="select tva_code,tva_label from v_tva_rate where tva_sale <> '#' order by tva_code "; break; case 'purchase': - $sql="select tva_code + $sql="select tva_code,tva_label from v_tva_rate where tva_purchase <> '#' @@ -100,9 +100,11 @@ class ITva_Popup extends HtmlInput } $a_tva_code=$cn->get_array($sql); if ( empty($a_tva_code)) return ""; - $r.=sprintf('',$this->id); + $r.=sprintf('',$this->id); foreach ($a_tva_code as $item) { - $r.=sprintf('',$item['tva_code']); + $r.=sprintf('' + ,$item['tva_code'],$item['tva_code'] + ,htmlentities($item['tva_label'])); } $r.=''; return $r; @@ -137,9 +139,11 @@ class ITva_Popup extends HtmlInput $strAttribut = $this->get_node_attribute(); - $str = ''; + $str = ''; $r = sprintf($str, $this->name, $this->value, $this->id, _("C.TVA"),$this->js, $strAttribut,$this->id); $r.=$code; + $r.=$this->make_datalist(); if ($this->in_table) $table = '' . '' . td($r); @@ -183,7 +187,8 @@ class ITva_Popup extends HtmlInput // button $bt = new ISmallButton('bt_' . $this->id); $bt->tabindex = "-1"; - $bt->label = _(' TVA '); + $bt->label = ICON_SEARCH; + $bt->set_attribute('gDossier', dossier::id()); $bt->set_attribute('ctl', $this->id); $bt->set_attribute('popup', 'popup_tva'); diff --git a/include/template/form_ledger_detail.php b/include/template/form_ledger_detail.php index c072650ce..ce06927ef 100644 --- a/include/template/form_ledger_detail.php +++ b/include/template/form_ledger_detail.php @@ -104,7 +104,7 @@ $hidden=($this->has_quantity()==0)?'d-none':'';

- + @@ -124,10 +124,10 @@ $hidden=($this->has_quantity()==0)?'d-none':''; '; -// echo ""; -echo ''; +echo $item['bt'].$item['card_add'].''; ?> '; - - + @@ -166,13 +165,13 @@ echo ''; + - - +
Code Code
"; + echo ""; echo $item['quick_code']; // echo "'.$item['bt'].$item['card_add'].' 0.0
diff --git a/sql/upgrade.sql b/sql/upgrade.sql index 92014f93a..efaad1ec9 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -1,65 +1,80 @@ -begin; -with correct_periode as (select jr_tech_per, jr_grpt_id from jrn) -update jrnx set j_tech_per = jr_tech_per from correct_periode where correct_periode.jr_grpt_id=j_grpt and correct_periode.jr_tech_per != j_tech_per; + +update menu_ref set me_menu='Navigateur 🧭' where me_code ~ 'NAVI'; + +update menu_ref set me_menu='Configuration 🔧' where me_code='CFG'; +ALTER TABLE public.tva_rate ADD CONSTRAINT tva_code_number_check CHECK (isnumeric(tva_code) = false); -ALTER TABLE public.tva_rate ADD tva_code text ; -ALTER TABLE public.tva_rate ADD CONSTRAINT tva_code_unique UNIQUE (tva_code); -update tva_rate set tva_code=null; +drop view if exists public.vw_fiche_attr; - -drop VIEW public.v_tva_rate; - -CREATE OR REPLACE VIEW public.v_tva_rate -AS SELECT tva_rate.tva_id, +CREATE OR REPLACE VIEW public.vw_fiche_attr +AS SELECT a.f_id, + a.fd_id, + a.ad_value AS vw_name, + k.ad_value AS vw_first_name, + b.ad_value AS vw_sell, + c.ad_value AS vw_buy, + d.ad_value AS tva_code, + tva_rate.tva_id, tva_rate.tva_rate, - tva_rate.tva_code, tva_rate.tva_label, - tva_rate.tva_comment, - split_part(tva_rate.tva_poste, ','::text, 1) AS tva_purchase, - split_part(tva_rate.tva_poste, ','::text, 2) AS tva_sale, - tva_rate.tva_both_side, - tva_rate.tva_payment_purchase, - tva_rate.tva_payment_sale - FROM tva_rate; + e.ad_value AS vw_addr, + f.ad_value AS vw_cp, + j.ad_value AS quick_code, + h.ad_value AS vw_description, + i.ad_value AS tva_num, + fiche_def.frd_id, + l.ad_value AS accounting, + a.f_enable + FROM ( SELECT fiche.f_id, + fiche.fd_id, + fiche.f_enable, + fiche_detail.ad_value + FROM fiche + LEFT JOIN fiche_detail USING (f_id) + WHERE fiche_detail.ad_id = 1) a + LEFT JOIN ( SELECT fiche_detail.f_id, + fiche_detail.ad_value + FROM fiche_detail + WHERE fiche_detail.ad_id = 6) b ON a.f_id = b.f_id + LEFT JOIN ( SELECT fiche_detail.f_id, + fiche_detail.ad_value + FROM fiche_detail + WHERE fiche_detail.ad_id = 7) c ON a.f_id = c.f_id + LEFT JOIN ( SELECT fiche_detail.f_id, + fiche_detail.ad_value + FROM fiche_detail + WHERE fiche_detail.ad_id = 2) d ON a.f_id = d.f_id + LEFT JOIN ( SELECT fiche_detail.f_id, + fiche_detail.ad_value + FROM fiche_detail + WHERE fiche_detail.ad_id = 14) e ON a.f_id = e.f_id + LEFT JOIN ( SELECT fiche_detail.f_id, + fiche_detail.ad_value + FROM fiche_detail + WHERE fiche_detail.ad_id = 15) f ON a.f_id = f.f_id + LEFT JOIN ( SELECT fiche_detail.f_id, + fiche_detail.ad_value + FROM fiche_detail + WHERE fiche_detail.ad_id = 23) j ON a.f_id = j.f_id + LEFT JOIN ( SELECT fiche_detail.f_id, + fiche_detail.ad_value + FROM fiche_detail + WHERE fiche_detail.ad_id = 9) h ON a.f_id = h.f_id + LEFT JOIN ( SELECT fiche_detail.f_id, + fiche_detail.ad_value + FROM fiche_detail + WHERE fiche_detail.ad_id = 13) i ON a.f_id = i.f_id + LEFT JOIN ( SELECT fiche_detail.f_id, + fiche_detail.ad_value + FROM fiche_detail + WHERE fiche_detail.ad_id = 32) k ON a.f_id = k.f_id + LEFT JOIN tva_rate ON d.ad_value = tva_rate.tva_id::text + JOIN fiche_def USING (fd_id) + LEFT JOIN ( SELECT fiche_detail.f_id, + fiche_detail.ad_value + FROM fiche_detail + WHERE fiche_detail.ad_id = 5) l ON a.f_id = l.f_id; -CREATE OR REPLACE FUNCTION update_tva_code () - returns int4 -AS -$BODY$ -declare -/* - * Section for variables - */ - counter int:=0; - letter int; - x record; - e record; - str_tva_code text; -begin - -- basic loop - for x in select distinct tva_rate from public.tva_rate order by tva_rate - loop - letter :=65; - for e in select * from public.tva_rate where tva_rate = x.tva_rate loop - str_tva_code := round(e.tva_rate*1000)::text||chr(letter); - update tva_rate set tva_code=str_tva_code where tva_id=e.tva_id; - letter := letter+1; - counter := counter+1; - end loop; - - end loop; - return counter; -end; -$BODY$ -LANGUAGE plpgsql; - -select update_tva_code(); - -drop function update_tva_code(); -alter table public.tva_rate alter tva_code set not null; - -ALTER TABLE public.op_predef_detail ALTER COLUMN opd_tva_id TYPE text USING opd_tva_id::text; -insert into version (val,v_description) values (197,'Adapt for VAT CODE'); -commit; +COMMENT ON VIEW public.vw_fiche_attr IS 'Some attribute for all cards'; \ No newline at end of file