diff --git a/html/fid_card.php b/html/fid_card.php index 0c66dec21..d01a89b86 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 253d213b5..3228d517d 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 b3103e471..cfc824a65 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.=""; $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 466e7d735..7c86f3938 100644 --- a/include/template/card_result.php +++ b/include/template/card_result.php @@ -14,7 +14,7 @@ echo '
'; echo ''; @@ -24,7 +24,7 @@ echo ''; diff --git a/sql/upgrade.sql b/sql/upgrade.sql index 50e61a794..e3b85d573 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