diff --git a/html/ajax_misc.php b/html/ajax_misc.php index 5e1261b5b..e79e3b0f8 100644 --- a/html/ajax_misc.php +++ b/html/ajax_misc.php @@ -266,6 +266,8 @@ $path = array( "save_filter"=>"ajax_search_filter", // Load a search filter "load_filter"=>"ajax_search_filter", + // display a list of filter (alias saved search) + "display_list_filter"=>"ajax_search_filter", // display tag for filter 'display_filter_tag'=>'ajax_search_filter', // search operation to reconcile diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js index 6298d53ad..7ca3b0422 100644 --- a/html/js/acc_ledger.js +++ b/html/js/acc_ledger.js @@ -1672,6 +1672,28 @@ function reset_filter(p_div) { // By default , unpaid is uncked $(p_div + "operation_filter").value = "all"; } +function display_list_filter(p_dossier,access_code,ledger_type) +{ + new Ajax.Request("ajax_misc.php",{ + parameters:{"gDossier":p_dossier + ,"op":"display_list_filter" + ,"ac":access_code + ,'ledger_type':ledger_type + }, + method:'GET', + onSuccess: function (responseHtml) { + try { + var posy=calcy(250) + var div = create_div({"id":"display_list_filter_div", + 'cssclass': "inner_box", 'style': 'width:90%,right:5%;top:'+posy+"px"}); + div.update(responseHtml.responseText); + div.show(); + }catch (e) { + console.error(e.message); + } + } + }) +} /** * propose to duplicate an operation diff --git a/include/ajax/ajax_search_filter.php b/include/ajax/ajax_search_filter.php index 7301c4ba3..e895707ad 100644 --- a/include/ajax/ajax_search_filter.php +++ b/include/ajax/ajax_search_filter.php @@ -111,13 +111,7 @@ if ($op=="load_filter") $answer['filter_id']=0; $answer['message']=""; $filter=new User_filter_SQL($cn, $filter_id); - $record=$filter->to_array(); - - $record['desc']=$record['description']; - $record['r_jrn']=explode(",", $record['r_jrn']??""); - $record['tag']=explode(",",$record['uf_tag']??""); - $record['tag_option']=$record["uf_tag_option"]; - $record['p_currency_code']=$record['uf_currency_code']; + $record=Acc_Ledger_Search::build_array($filter); $result=array_merge($answer, $record); @@ -227,4 +221,25 @@ if ($op=='display_filter_tag') $tag_operation->update_search_cell($div); } } + return; +} +//--------------------------------------------------------------------------------------------------------------- +// display_list_filter : display a list of saved search alias filter +//---------------------------------------------------------------------------------------------------------------- +if ($op=='display_list_filter') +{ + echo \HtmlInput::title_box("Recherches sauvées",'display_list_filter_div'); + + $ledger_search=new Acc_Ledger_Search($http->request("ledger_type")); + $ledger_search->display_list_filter(); +?> + + +