From 6152d092fbbd038aaecb9257edf68a8e54a7ad3c Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 10 Dec 2017 14:00:37 +0100 Subject: [PATCH] Task #001381 : favori de filtre , ajout des favoris de filtre dans les recherches. --- html/ajax_misc.php | 18 +- html/js/acc_ledger.js | 156 +++ html/recherche.php | 7 +- html/test.php | 2 +- include/ajax/ajax_search_filter.php | 182 +++ .../ajax_search_operation.php} | 14 +- include/class/acc_ledger.class.php | 924 +-------------- include/class/acc_ledger_search.class.php | 1040 +++++++++++++++++ include/database/user_filter_sql.class.php | 92 ++ include/history_operation.inc.php | 10 +- include/template/ledger_search.php | 13 +- ...iselect-button.php => select-box-test.php} | 15 +- 12 files changed, 1522 insertions(+), 951 deletions(-) create mode 100644 include/ajax/ajax_search_filter.php rename include/{search.inc.php => ajax/ajax_search_operation.php} (92%) create mode 100644 include/class/acc_ledger_search.class.php create mode 100644 include/database/user_filter_sql.class.php rename scenario/{test-iselect-button.php => select-box-test.php} (77%) diff --git a/html/ajax_misc.php b/html/ajax_misc.php index 0bc48cb0f..1eb27c9b1 100644 --- a/html/ajax_misc.php +++ b/html/ajax_misc.php @@ -196,7 +196,17 @@ $path = array( // Update, insert or delete accounting frmo CFGPCMN "accounting"=>"ajax_accounting", // Show detail of an ANC operation - "anc_detail_op"=>"ajax_anc_detail_operation" + "anc_detail_op"=>"ajax_anc_detail_operation", + // Display the list of filter saved + "display_search_filter"=>"ajax_search_filter", + // Save search filter + "save_filter"=>"ajax_search_filter", + // Load a search filter + "load_filter"=>"ajax_search_filter", + // search operation to reconcile + 'search_op'=>'ajax_search_operation', + // delete operation + 'delete_search_operation'=>'ajax_search_filter' ) ; if (array_key_exists($op, $path)) { @@ -406,9 +416,7 @@ EOF; EOF; break; - case 'search_op': - require_once NOALYSS_INCLUDE.'/search.inc.php'; - break; + case 'add_plugin': $me_code = new IText('me_code'); $me_file = new IText('me_file'); @@ -451,5 +459,5 @@ EOF; break; default: - var_dump($_GET); + var_dump($_REQUEST); } diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js index 817dfd78e..a2de0dbc8 100644 --- a/html/js/acc_ledger.js +++ b/html/js/acc_ledger.js @@ -1215,3 +1215,159 @@ function document_remove(p_dossier,p_div,p_jrid) } }); } +/*** + * @brief receive an object and display a list of filter + form to save one + * fill up the span (id : {div}search_filter_span) with the name of the selected filter + * Object = '{'div':'','type':'ALL','all_type':1,'dossier':'10104'}' + * @see Acc_Ledger_Search + */ +function manage_search_filter(p_obj) { + waiting_box(); + new Ajax.Request("ajax_misc.php", { + method:'get', + parameters:{"op":"display_search_filter","gDossier":p_obj.dossier,"div":p_obj.div,"ledger_type":p_obj.ledger_type,"all_type":p_obj.all_type}, + onSuccess:function(req) { + remove_waiting_box(); + var x=posX; + var y=posY-20; + create_div({'id':'boxfilter'+p_obj.div,'cssclass':'inner_box','html':req.responseText,'style':'top:'+y+'px;left:'+x+'px;position:absolute;width:400px'}); + $('boxfilter'+p_obj.div).show(); + } + }); +} + +/** + * Send data from the form and record a new filter , the ajax answer is a json object + * with the attribute filter_name,filter_id,status,message + * + * @param p_div prefix id of all concerned DOM Element + * @param p_dossier + * @see Acc_Ledger_Search + */ +function save_filter(p_div,p_dossier) { + var elt=['ledger_type','nb_jrn','date_start','date_end','date_paid_start','date_paid_end','desc','amount_min','amount_max','qcode','accounting']; + var eltValue={}; + eltValue['gDossier']=p_dossier; + eltValue['op']="save_filter"; + eltValue['div']=p_div; + eltValue['filter_name']=$(p_div+"filter_new").value; + // Get all elt from the form + for ( var i = 0 ; i < elt.length;i++) { + var idx=elt[i]; + eltValue[idx]=$(p_div+elt[i]).value; + + } + //ledger's list r_jrn + if (eltValue['nb_jrn'] > 0) { + eltValue['r_jrn']=[]; + for (i=0;i