[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 46/73: Improve Sort Table ,
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 46/73: Improve Sort Table , |
Date: |
Fri, 28 May 2021 05:26:38 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 18b5fbcc5c42d0ef04cfc270b72e1b3ef255c0df
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Tue May 4 19:24:34 2021 +0200
Improve Sort Table ,
---
html/js/sorttable.js | 15 ++-
include/class/card_attribut_mtable.class.php | 4 +-
include/class/fiche.class.php | 2 +-
include/sql/patch/upgrade158.sql | 145 +++++++++++++++++++++++++++
4 files changed, 158 insertions(+), 8 deletions(-)
diff --git a/html/js/sorttable.js b/html/js/sorttable.js
index b36f383..8982f49 100644
--- a/html/js/sorttable.js
+++ b/html/js/sorttable.js
@@ -45,6 +45,11 @@ var sorttable = {
return;
// flag this function so we don't do the same thing twice
arguments.callee.done = true;
+ sorttable.icon_down='<span style="font-style: normal;vertical-align:
super;\n' +
+ 'padding: 2px;">▴</span>';
+ sorttable.icon_up='<span style="font-style: normal;vertical-align:
super;\n' +
+ 'padding: 2px;">▾</span>';
+
// kill the timer
if (_timer)
clearInterval(_timer);
@@ -117,7 +122,7 @@ var sorttable = {
sortrevind = document.createElement('span');
sortrevind.id = "sorttable_sortrevind";
- sortrevind.innerHTML = '<img src="image/down.gif">';
+ sortrevind.innerHTML = sorttable.icon_down;
headrow[i].appendChild(sortrevind);
}
@@ -125,7 +130,7 @@ var sorttable = {
sortfwdind = document.createElement('span');
sortfwdind.id = "sorttable_sortfwdind";
- sortfwdind.innerHTML = '<img src="image/up.gif">';
+ sortfwdind.innerHTML = sorttable.icon_up;
headrow[i].appendChild(sortfwdind);
}
@@ -144,7 +149,7 @@ var sorttable = {
sortrevind = document.createElement('span');
sortrevind.id = "sorttable_sortrevind";
// sortrevind.innerHTML = stIsIE ? ' <font
face="webdings">5</font>' : ' ▴';
- sortrevind.innerHTML = '<img src="image/down.gif">';
+ sortrevind.innerHTML = sorttable.icon_down;
this.appendChild(sortrevind);
return;
}
@@ -158,7 +163,7 @@ var sorttable = {
sortfwdind = document.createElement('span');
sortfwdind.id = "sorttable_sortfwdind";
// sortfwdind.innerHTML = stIsIE ? ' <font
face="webdings">6</font>' : ' ▾';
- sortfwdind.innerHTML = '<img src="image/up.gif">';
+ sortfwdind.innerHTML = sorttable.icon_up;
this.appendChild(sortfwdind);
return;
}
@@ -184,7 +189,7 @@ var sorttable = {
sortfwdind = document.createElement('span');
sortfwdind.id = "sorttable_sortfwdind";
// sortfwdind.innerHTML = stIsIE ? ' <font
face="webdings">6</font>' : ' ▾';
- sortfwdind.innerHTML = '<img src="image/up.gif">';
+ sortfwdind.innerHTML = sorttable.icon_up;
this.appendChild(sortfwdind);
// build an array to sort. This is a Schwartzian transform
thing,
diff --git a/include/class/card_attribut_mtable.class.php
b/include/class/card_attribut_mtable.class.php
index 7b468f4..5f0b709 100644
--- a/include/class/card_attribut_mtable.class.php
+++ b/include/class/card_attribut_mtable.class.php
@@ -107,10 +107,10 @@ class Card_Attribut_MTable extends Manage_Table_SQL
$ic->add_json_param("ctl", $p_id);
$ret=$ic->input();
- return $ret;
+ return td($ret);
}
if ($p_key == "ad_text"){
- return $p_value;
+ return td($p_value);
}
return;
}
diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php
index ee1d95e..aa90550 100644
--- a/include/class/fiche.class.php
+++ b/include/class/fiche.class.php
@@ -1945,7 +1945,7 @@ class Fiche
<TR >
<TH>'._('Quick Code').Icon_Action::infobulle(17).'</TH>'.
'<th>'._('Poste comptable').'</th>'.
- '<th class="sorttable_sorted">'._('Nom').'<span
id="sorttable_sortfwdind"><img src="image/up.gif"></span>'.'</th>
+ '<th class="sorttable_sorted">'._('Nom').'</span>'.'</th>
<th>'._('Adresse').'</th>
<th style="text-align:right">'._('Total débit').'</th>
<th style="text-align:right">'._('Total crédit').'</th>
diff --git a/include/sql/patch/upgrade158.sql b/include/sql/patch/upgrade158.sql
new file mode 100644
index 0000000..9560335
--- /dev/null
+++ b/include/sql/patch/upgrade158.sql
@@ -0,0 +1,145 @@
+begin;
+CREATE OR REPLACE FUNCTION comptaproc.account_update(p_f_id integer, p_account
account_type)
+ RETURNS integer
+LANGUAGE plpgsql
+AS $function$
+declare
+ nMax fiche.f_id%type;
+ nCount integer;
+ nParent tmp_pcmn.pcm_val_parent%type;
+ sName varchar;
+ first text;
+ second text;
+begin
+
+ if length(trim(p_account)) != 0 then
+ -- 2 accounts in card separated by comma
+ if position (',' in p_account) = 0 then
+ p_account := format_account(p_account);
+ select count(*) into nCount from tmp_pcmn where
pcm_val=p_account;
+ if nCount = 0 then
+ select ad_value into sName from
+ fiche_detail
+ where
+ ad_id=1 and f_id=p_f_id;
+ nParent:=account_parent(p_account);
+ raise notice 'insert into tmp_pcmn %
%',p_account,sName;
+ insert into
tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent) values (p_account,sName,nParent);
+ end if;
+ else
+ raise info 'presence of a comma';
+ -- there is 2 accounts separated by a comma
+ first := split_part(p_account,',',1);
+ second := split_part(p_account,',',2);
+ -- check there is no other coma
+ raise info 'first value % second value %', first,
second;
+
+ if position (',' in first) != 0 or position (',' in
second) != 0 then
+ raise exception 'Too many comas, invalid
account';
+ end if;
+ -- check that both account are in PCMN
+
+ end if;
+ else
+ -- account is null
+ update fiche_detail set ad_value=null where f_id=p_f_id and
ad_id=5 ;
+ return 0;
+ end if;
+
+ update fiche_detail set ad_value=p_account where f_id=p_f_id and
ad_id=5 ;
+
+return 0;
+end;
+$function$;
+
+
+CREATE OR REPLACE FUNCTION comptaproc.account_insert(p_f_id integer, p_account
text)
+ RETURNS text
+ LANGUAGE plpgsql
+AS $function$
+declare
+ nParent tmp_pcmn.pcm_val_parent%type;
+ sName varchar;
+ sNew tmp_pcmn.pcm_val%type;
+ bAuto bool;
+ nFd_id integer;
+ sClass_Base fiche_def.fd_class_base%TYPE;
+ nCount integer;
+ first text;
+ second text;
+ s_account text;
+begin
+
+ if p_account is not null and length(trim(p_account)) != 0 then
+ -- if there is coma in p_account, treat normally
+ if position (',' in p_account) = 0 then
+ raise info 'p_account is not empty';
+ s_account := format_account(substr( p_account,1
, 40)::account_type);
+ select count(*) into nCount from tmp_pcmn
where pcm_val=s_account::account_type;
+ raise notice 'found in tmp_pcm %',nCount;
+ if nCount !=0 then
+ raise info 'this account exists in
tmp_pcmn ';
+ perform
attribut_insert(p_f_id,5,s_account);
+ else
+ -- account doesn't exist, create it
+ select ad_value into sName from
+ fiche_detail
+ where
+ ad_id=1 and f_id=p_f_id;
+
+
nParent:=account_parent(s_account::account_type);
+ insert into
tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent) values
(s_account::account_type,sName,nParent);
+ perform
attribut_insert(p_f_id,5,s_account);
+
+ end if;
+ else
+ raise info 'presence of a comma';
+ -- there is 2 accounts separated by a comma
+ first := split_part(p_account,',',1);
+ second := split_part(p_account,',',2);
+ -- check there is no other coma
+ raise info 'first value % second value %', first, second;
+
+ if position (',' in first) != 0 or position (',' in second) !=
0 then
+ raise exception 'Too many comas, invalid account';
+ end if;
+ perform attribut_insert(p_f_id,5,p_account);
+ end if;
+ else
+ raise info 'A000 : p_account is empty';
+ select fd_id into nFd_id from fiche where f_id=p_f_id;
+ bAuto:= account_auto(nFd_id);
+
+ select fd_class_base into sClass_base from fiche_def where
fd_id=nFd_id;
+raise info 'sClass_Base : %',sClass_base;
+ if bAuto = true and sClass_base similar to '[[:digit:]]*' then
+ raise info 'account generated automatically';
+ sNew:=account_compute(p_f_id);
+ raise info 'sNew %', sNew;
+ select ad_value into sName from
+ fiche_detail
+ where
+ ad_id=1 and f_id=p_f_id;
+ nParent:=account_parent(sNew);
+ sNew := account_add (sNew,sName);
+ perform attribut_insert(p_f_id,5,sNew);
+
+ else
+ -- if there is an account_base then it is the default
+ select fd_class_base::account_type into sNew from
fiche_def join fiche using (fd_id) where f_id=p_f_id;
+ if sNew is null or length(trim(sNew)) = 0 then
+ raise notice 'count is null';
+ perform attribut_insert(p_f_id,5,null);
+ else
+ perform attribut_insert(p_f_id,5,sNew);
+ end if;
+ end if;
+ end if;
+
+return 0;
+end;
+$function$;
+
+
+insert into version (val,v_description) values (159,'correct bug when
inserting accounting');
+commit ;
\ No newline at end of file
- [Noalyss-commit] [noalyss] 32/73: Fix bug Forecast, (continued)
- [Noalyss-commit] [noalyss] 32/73: Fix bug Forecast, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 15/73: Cosmetic and small bugs, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 17/73: Cosmetic :, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 14/73: Cosmetic bg color tabs, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 42/73: Cosmetic : position of "invoice, template , ..." after saving an operation, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 43/73: Improve Manage_Table : align column numeric to the right by default, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 18/73: Direct Access with a Single AC (without the full path), Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 30/73: Historic : search on currency, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 26/73: Cosmetic : select_box for javascript , display the selected option, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 25/73: Cosmetic : icon in dialog box, lightblue when hover, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 46/73: Improve Sort Table ,,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 27/73: Javascript : waiting box display when exporting in PDF or CSV, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 37/73: Cosmetic improve smoke dg box, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 39/73: Bug #0001971: erreur calcul dans champ prix/unité htva, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 06/73: Cosmetic, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 08/73: Warning if PHPVERSION < 7.2, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 10/73: Cosmetic : update fontello, button inplace_edit, doc, logo and dashboad, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 16/73: Currency : add a check , upgrade version of DB, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 24/73: Bug Select_Box = problem with DIV id, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 29/73: Cosmetic : display properly currency in detail operation, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 34/73: javascript : test and improve cosmetic, Dany De Bontridder, 2021/05/28