[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 70/119: Card can be disable if not used anymo
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 70/119: Card can be disable if not used anymore |
Date: |
Mon, 26 Oct 2020 18:27:25 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 8033b9f7ca7dd68a3aa6f4c0cb001d49f0e8a6a3
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: Sat Oct 10 19:35:33 2020 +0200
Card can be disable if not used anymore
---
html/fid_card.php | 4 +++-
html/js/card.js | 15 +++++++++++++--
include/ajax/ajax_card.php | 15 ++++++++++++++-
include/template/card_result.php | 4 ++--
sql/upgrade.sql | 5 +++++
5 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/html/fid_card.php b/html/fid_card.php
index 0c66dec..d01a89b 100644
--- a/html/fid_card.php
+++ b/html/fid_card.php
@@ -118,13 +118,15 @@ else
}
}
}
+// filter only enable card
+$filter_enable_card=" and f_id in (select f_id from fiche_detail where
ad_value = '1' and ad_id=54) ";
$sql_str="select distinct f_id
from fiche
join fiche_detail using (f_id)
where
ad_id in (9,1,23)
- and ad_value ilike '%'||$1||'%' ".$filter_card.' limit '.$limit;
+ and ad_value ilike '%'||$1||'%' ".$filter_enable_card.$filter_card.'
limit '.$limit;
$fid=$http->request("FID");
diff --git a/html/js/card.js b/html/js/card.js
index 253d213..3228d51 100644
--- a/html/js/card.js
+++ b/html/js/card.js
@@ -79,6 +79,8 @@ function search_card(obj)
var price=obj.price;
var tvaid=obj.tvaid;
var jrn=obj.jrn;
+ var inactive_card=0;
+ if ( obj.inactive_card) {inactive_card=obj.inactive_card.value;}
var amount_from_type=0;
if ( obj.amount_from_type) {
amount_from_type=obj.amount_from_type;
@@ -104,7 +106,8 @@ function search_card(obj)
'ctl':'search_card','op2':'fs','jrn':jrn,
'typecard':typecard,'query':string_to_search,'op':'card',
'accvis':accvis,
- 'amount_from_type':amount_from_type
+ 'amount_from_type':amount_from_type,
+ 'inactive_card':inactive_card
});
if ( $('search_card') ) {
removeDiv('search_card');
@@ -184,6 +187,7 @@ function action_concerned_search_card(obj)
var inp="";
var ag_id=0;
var search_in=-1;
+ var inactive_card=0;
if (obj.dossier) {
dossier = obj.dossier; /* From the button */
@@ -208,6 +212,9 @@ function action_concerned_search_card(obj)
if (obj.elements['search_in']) {
search_in = obj.elements['search_in'].value;
}
+ if ( obj.inactive_card) {
+ inactive_card=obj.elements['inactive_card'].value;
+ }
}
if (dossier == 0) {
throw "obj.dossier not found";
@@ -223,7 +230,8 @@ function action_concerned_search_card(obj)
'ag_id' : ag_id,
'op':'card',
'accvis':0,
- 'search_in':search_in
+ 'search_in':search_in,
+ 'inactive_card':inactive_card
});
waiting_box();
@@ -336,6 +344,9 @@ function search_get_card(obj)
if (obj.elements['page_card']) {
queryString+="&page_card="+obj.elements["page_card"].value;
}
+ if ( obj.elements["inactive_card"]) {
+ queryString+="&inactive_card="+obj.elements["inactive_card"].value;
+ }
queryString=encodeURI(queryString);
$('asearch').innerHTML=loading();
diff --git a/include/ajax/ajax_card.php b/include/ajax/ajax_card.php
index b3103e4..cfc824a 100644
--- a/include/ajax/ajax_card.php
+++ b/include/ajax/ajax_card.php
@@ -423,6 +423,11 @@ case 'fs':
// to navigate
$page_card=$http->get("page_card","number",0);
+ $inactive=$http->get("inactive_card","string",0);
+ if ($inactive=="undefined" || $inactive == "") $inactive=0;
+ $is=new InputSwitch("inactive_card",$inactive);
+ $is->value=$inactive;
+ $r.=_("Toutes les fiches").$is->input();
// save previous info
$hidden="";
@@ -439,6 +444,7 @@ case 'fs':
$r.="</form>";
$sql_array["query"]=$query;
+ $sql_array["inactive_card"]=$inactive;
/* what is the type of the ledger */
$type="GL";
if (isset($jrn) && $jrn > 1)
@@ -465,8 +471,15 @@ case 'fs':
$html.=HtmlInput::button_close("search_card");
break;
}
+ /**
+ * if inactive == 0 , then only active card
+ */
+ if ( $inactive == 0 ) {
+ $sql.=" and f_id in (select f_id from fiche_detail where ad_id=54 and
ad_value='1') ";
+ }
+
/* We limit the search to MAX_SEARCH_CARD records */
- $sql=$sql.' order by vw_name ';
+ $sql=$sql.' order by vw_name ';
$total_card=$cn->get_value("select count(*) from ($sql) as c");
$record_start=$page_card*MAX_SEARCH_CARD;
diff --git a/include/template/card_result.php b/include/template/card_result.php
index 466e7d7..7c86f39 100644
--- a/include/template/card_result.php
+++ b/include/template/card_result.php
@@ -14,7 +14,7 @@
echo '<form method="GET"
onsubmit="this.ctl=\'ipop_card\';search_get_card(this);return false;">';
$url=$sql_array;
$url["page_card"]=$page_card-1;
- echo
HtmlInput::array_to_hidden(array('accvis','inp','jrn','label','typecard','price','tvaid','amount_from_type','page_card','query'),
$url);
+ echo
HtmlInput::array_to_hidden(array('accvis','inp','jrn','label','typecard','price','tvaid','amount_from_type','page_card','query','inactive_card'),
$url);
echo HtmlInput::submit("previous","<");
echo '</form>';
echo '</li>';
@@ -24,7 +24,7 @@
echo '<form method="GET"
onsubmit="this.ctl=\'ipop_card\';search_get_card(this);return false;">';
$url=$sql_array;
$url["page_card"]=$page_card+1;
- echo
HtmlInput::array_to_hidden(array('accvis','inp','jrn','label','typecard','price','tvaid','amount_from_type','page_card','query'),
$url);
+ echo
HtmlInput::array_to_hidden(array('accvis','inp','jrn','label','typecard','price','tvaid','amount_from_type','page_card','query','inactive_card'),
$url);
echo HtmlInput::submit("next",">");
echo '</form>';
diff --git a/sql/upgrade.sql b/sql/upgrade.sql
index 50e61a7..e3b85d5 100644
--- a/sql/upgrade.sql
+++ b/sql/upgrade.sql
@@ -16,3 +16,8 @@ contact_option_ref_id bigint references
contact_option_ref(cor_id) on delete cas
);
ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT
jnt_document_option_contact_un UNIQUE (document_type_id,contact_option_ref_id);
ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT
jnt_document_option_contact_check CHECK (jdoc_enable in (0,1));
+
+insert into attr_def(ad_id,ad_text,ad_type,ad_size) values
(54,'Actif','check','1');
+insert into attr_min(frd_id,ad_id) select frd_id , 54 from fiche_def_ref ;
+insert into jnt_fic_attr (fd_id,ad_id,jnt_order) select fd_id,54,30 from
fiche_def;
+insert into fiche_detail (f_id,ad_id,ad_value) select f_id, 54,1 from
fiche_detail where ad_id=1;
\ No newline at end of file
- [Noalyss-commit] [noalyss] 20/119: documentation, (continued)
- [Noalyss-commit] [noalyss] 20/119: documentation, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 26/119: FollowUp : new right : delete action, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 40/119: ManageTable : you can set the style of the dialog box, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 36/119: javascript : add function to concat 2 json objects, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 32/119: Bug : syntax error, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 31/119: Bug : use ilike instead of tilde, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 46/119: Follow-up : tag enable when create doc, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 48/119: Action and Document Add missing files, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 57/119: Upgrade DB to 145, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 54/119: Contact option , allow to use option for contact, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 70/119: Card can be disable if not used anymore,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 73/119: Contact option : export CSV, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 67/119: Link between contact option and document, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 75/119: Fix : by default new contact options were not added to document_type, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 63/119: Bug #1839 : : accentuated character broken, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 76/119: Add : upgrade scrip added, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 24/119: Merge branch 'master' of gitlab.noalyss.eu:noalyss/noalyss, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 25/119: erge branch 'dev-7400-7500', Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 33/119: doc, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 41/119: Rewriting of Predefined Operation. You can add new Predefined Operation, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 51/119: Add group of tag to an action, Dany De Bontridder, 2020/10/26