| Lines 69-74
          
      
      
        Link Here | 
        
          | 69 |                         [% total | html %] result(s) found [% IF ( query_desc ) %]for <span class="results_query_desc">'[% query_desc | html %]'</span>[% END %][% IF limit_desc  %] with limit(s): <span class="results_limit_desc">'[% limit_desc | html %]'</span>[% END %][% IF ( LibraryName ) %] in [% LibraryName | html %] Catalog[% END %]. | 69 |                         [% total | html %] result(s) found [% IF ( query_desc ) %]for <span class="results_query_desc">'[% query_desc | html %]'</span>[% END %][% IF limit_desc  %] with limit(s): <span class="results_limit_desc">'[% limit_desc | html %]'</span>[% END %][% IF ( LibraryName ) %] in [% LibraryName | html %] Catalog[% END %]. | 
        
          | 70 |                     </h3> | 70 |                     </h3> | 
        
          | 71 |                     <a href="/cgi-bin/koha/catalogue/search.pl?advsearch=1&edit_search=1&[% query_cgi | $raw %]&[% limit_cgi | $raw %]&sort_by=[% sort_by | $raw %]">Edit this search</a> | 71 |                     <a href="/cgi-bin/koha/catalogue/search.pl?advsearch=1&edit_search=1&[% query_cgi | $raw %]&[% limit_cgi | $raw %]&sort_by=[% sort_by | $raw %]">Edit this search</a> | 
            
              |  |  | 72 |                     [% IF ( Koha.Preference('SavedSearchFilters') && CAN_user_parameters_manage_search_filters ) %] | 
            
              | 73 |                         | <a href="#" id="save_search_filter">Save search as filter</a> | 
            
              | 74 |                     [% END %] | 
        
          | 72 |  | 75 |  | 
        
          | 73 |                     <div class="searchheader" id="searchheader"> | 76 |                     <div class="searchheader" id="searchheader"> | 
        
          | 74 |                         <div id="selection_ops"> | 77 |                         <div id="selection_ops"> | 
  
    | Lines 331-336
          
      
      
        Link Here | 
        
          | 331 |                                 <p><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% searchtoorder_basketno | uri %]">View basket<a></p> | 334 |                                 <p><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% searchtoorder_basketno | uri %]">View basket<a></p> | 
        
          | 332 |                             [% END %] | 335 |                             [% END %] | 
        
          | 333 |                             <a href="/cgi-bin/koha/catalogue/search.pl?advsearch=1&edit_search=1&[% query_cgi | $raw %]&[% limit_cgi | $raw %]&sort_by=[% sort_by | $raw %]">Edit this search</a> | 336 |                             <a href="/cgi-bin/koha/catalogue/search.pl?advsearch=1&edit_search=1&[% query_cgi | $raw %]&[% limit_cgi | $raw %]&sort_by=[% sort_by | $raw %]">Edit this search</a> | 
            
              |  |  | 337 |                             [% IF ( Koha.Preference('SavedSearchFilters') &&CAN_user_parameters_manage_search_filters ) %] | 
            
              | 338 |                                 | <a href="#" id="save_search_filter">Save search as filter</a> | 
            
              | 339 |                             [% END %] | 
        
          | 334 |                         [% ELSE %] | 340 |                         [% ELSE %] | 
        
          | 335 |                             <p>You did not specify any search criteria.</p> | 341 |                             <p>You did not specify any search criteria.</p> | 
        
          | 336 |                         [% END %] | 342 |                         [% END %] | 
  
    | Lines 687-692
          
      
      
        Link Here | 
        
          | 687 |                 </div> | 693 |                 </div> | 
        
          | 688 |                 [% END #/IF outer_sup_results_loop %] | 694 |                 [% END #/IF outer_sup_results_loop %] | 
        
          | 689 |  | 695 |  | 
            
              |  |  | 696 |                 [% IF ( Koha.Preference('SavedSearchFilters') && CAN_user_parameters_manage_search_filters ) %] | 
            
              | 697 |                     <div id="search_filters_modal" class="modal" role="dialog" aria-hidden="true"> | 
            
              | 698 |                         <div class="modal-dialog"> | 
            
              | 699 |                         <div class="modal-content"> | 
            
              | 700 |                             <div class="modal-header"> | 
            
              | 701 |                                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> | 
            
              | 702 |                                 <h3 id="search_filters_label">Save: '[% query_desc | html %]' with limits '[% limit_desc | html %]' as filter</h3> | 
            
              | 703 |                             </div> | 
            
              | 704 |                             <div class="modal-body"> | 
            
              | 705 |                                 <h6>Visibility:</h6> | 
            
              | 706 |                                 <label for="show_filter_opac">Show in OPAC?</label> | 
            
              | 707 |                                 <input type="checkbox" id="show_filter_opac" name="show_filter_opac"> | 
            
              | 708 |                                 <label for="show_filter_staff_client">Show in Staff client?</label> | 
            
              | 709 |                                 <input type="checkbox" id="show_filter_staff_client" name="show_filter_staff_client"> | 
            
              | 710 |                                 <hr> | 
            
              | 711 |                                 <h6>Save as new search filter:</h6> | 
            
              | 712 |                                 <label for="new_filter">Name:</label> | 
            
              | 713 |                                 <input id="new_filter" name="new_filter" type="text"> | 
            
              | 714 |                                 <a id="save_new_filter" class="btn btn-default btn-xs" href="#">Save</a> | 
            
              | 715 |                                 </br>OR</br> | 
            
              | 716 |                                 <h6>Replace existing search filter:</h6> | 
            
              | 717 |                                 <label for="existing_filters">Choose</label> | 
            
              | 718 |                                 <select id="existing_filters" name="existing_filters" class="search_filters_list"></select> | 
            
              | 719 |                                 <a id="replace_existing_filter" class="btn btn-default btn-xs" href="#">Replace</a> | 
            
              | 720 |                             </div> | 
            
              | 721 |                             <div class="modal-footer"> | 
            
              | 722 |                                 <a href="#" data-dismiss="modal" aria-hidden="true" class="cancel">Cancel</a> | 
            
              | 723 |                             </div> | 
            
              | 724 |                         </div> | 
            
              | 725 |                         </div> | 
            
              | 726 |                     </div> | 
            
              | 727 |                 [% END %] | 
            
              | 728 |  | 
        
          | 690 |                 <form id="hold_form" method="get" action="/cgi-bin/koha/reserve/request.pl"> | 729 |                 <form id="hold_form" method="get" action="/cgi-bin/koha/reserve/request.pl"> | 
        
          | 691 |                     <!-- Value will be set here by placeHold() --> | 730 |                     <!-- Value will be set here by placeHold() --> | 
        
          | 692 |                     <input type="hidden" name="findborrower" id="holdFor" value="" /> | 731 |                     <input type="hidden" name="findborrower" id="holdFor" value="" /> | 
  
    | Lines 712-717
          
      
      
        Link Here | 
        
          | 712 |     [% Asset.js("js/browser.js") | $raw %] | 751 |     [% Asset.js("js/browser.js") | $raw %] | 
        
          | 713 |     [% Asset.js("lib/hc-sticky.js") | $raw %] | 752 |     [% Asset.js("lib/hc-sticky.js") | $raw %] | 
        
          | 714 |     [% Asset.js("js/coce.js") | $raw %] | 753 |     [% Asset.js("js/coce.js") | $raw %] | 
            
              |  |  | 754 |     [% Asset.css("css/humanmsg.css") | $raw %] | 
            
              | 755 |     [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %] | 
            
              | 756 |     [% INCLUDE 'select2.inc' %] | 
        
          | 715 |     <script> | 757 |     <script> | 
        
          | 716 |         var PREF_AmazonCoverImages = parseInt( "[% Koha.Preference('AmazonCoverImages') | html %]", 10); | 758 |         var PREF_AmazonCoverImages = parseInt( "[% Koha.Preference('AmazonCoverImages') | html %]", 10); | 
        
          | 717 |         var q_array = new Array();  // will hold search terms, if present | 759 |         var q_array = new Array();  // will hold search terms, if present | 
  
    | Lines 745-750
          
      
      
        Link Here | 
        
          | 745 |             query_desc: "[% To.json( query_desc ) | html %]", | 787 |             query_desc: "[% To.json( query_desc ) | html %]", | 
        
          | 746 |             query_cgi: "[% query_cgi | html %]", | 788 |             query_cgi: "[% query_cgi | html %]", | 
        
          | 747 |             limit_cgi: "[% limit_cgi | html %]", | 789 |             limit_cgi: "[% limit_cgi | html %]", | 
            
              |  |  | 790 |             query_json: [% query_json | $raw %], | 
            
              | 791 |             limit_json: [% limit_json | $raw %], | 
        
          | 748 |             sort_by: "[% sort_by | html %]", | 792 |             sort_by: "[% sort_by | html %]", | 
        
          | 749 |             gotoPage: "[% gotoPage | html %]", | 793 |             gotoPage: "[% gotoPage | html %]", | 
        
          | 750 |             gotoNumber: "[% gotoNumber | html %]", | 794 |             gotoNumber: "[% gotoNumber | html %]", | 
  
    | Lines 754-759
          
      
      
        Link Here | 
        
          | 754 |             first_biblionumber: "[% SEARCH_RESULTS.first.biblionumber | html %]", | 798 |             first_biblionumber: "[% SEARCH_RESULTS.first.biblionumber | html %]", | 
        
          | 755 |             last_biblionumber: "[% SEARCH_RESULTS.last.biblionumber | html %]", | 799 |             last_biblionumber: "[% SEARCH_RESULTS.last.biblionumber | html %]", | 
        
          | 756 |         } | 800 |         } | 
            
              |  |  | 801 |         [% IF ( CAN_user_parameters_manage_search_filters ) %] | 
            
              | 802 |             function getFilters(id) { | 
            
              | 803 |                 const select = $("#existing_filters"); | 
            
              | 804 |                 $("option[value!='']", select).remove(); | 
            
              | 805 |                 return new Promise(function(resolve, reject) { | 
            
              | 806 |                     $.ajax("/api/v1/search_filters") | 
            
              | 807 |                     .then(resolve, reject); | 
            
              | 808 |                 }) | 
            
              | 809 |                 .then(function(filters) { | 
            
              | 810 |                     filters.forEach(function(filter) { | 
            
              | 811 |                         const opt = $("<option/>"); | 
            
              | 812 |                         select.append(opt); | 
            
              | 813 |                         if(id && filter.search_filter_id == id) { | 
            
              | 814 |                             opt.prop('selected', true); | 
            
              | 815 |                         } | 
            
              | 816 |                         opt.attr("value", filter.search_filter_id); | 
            
              | 817 |                         opt.attr("title", "Query:" + filter.filter_query + " Limit:"+filter.filter_limits); | 
            
              | 818 |                         opt.text(filter.name); | 
            
              | 819 |                         opt.data("filter", filter); | 
            
              | 820 |                     }); | 
            
              | 821 |                 }) | 
            
              | 822 |                 .then(function(){ | 
            
              | 823 |                     select.change(); | 
            
              | 824 |                 }); | 
            
              | 825 |             } | 
            
              | 826 |             $("#save_search_filter").click(function(){ | 
            
              | 827 |                 getFilters(); | 
            
              | 828 |                 $("#search_filters_modal").modal('show'); | 
            
              | 829 |             }); | 
            
              | 830 |             $("#save_new_filter").click(function(){ | 
            
              | 831 |                 let name = $("#new_filter").val().trim(); | 
            
              | 832 |                 if(!name){ | 
            
              | 833 |                     humanMsg.displayAlert( _("You must provide a name for the new filter"), { className: 'human Error' } ); | 
            
              | 834 |                     return; | 
            
              | 835 |                 } | 
            
              | 836 |                 let opac = $("#show_filter_opac").prop('checked'); | 
            
              | 837 |                 let staff = $("#show_filter_staff_client").prop('checked'); | 
            
              | 838 |                 save_search_filter(name,null,opac,staff); | 
            
              | 839 |             }); | 
            
              | 840 |             $("#replace_existing_filter").click(function(){ | 
            
              | 841 |                 let id = $("#existing_filters").val(); | 
            
              | 842 |                 let name = $("#existing_filters option[value="+id+"]").text(); | 
            
              | 843 |                 console.log(id,name); | 
            
              | 844 |                 save_search_filter(name,id); | 
            
              | 845 |             }); | 
            
              | 846 |             function save_search_filter(name,id,opac,staff){ | 
            
              | 847 |                 let options = { | 
            
              | 848 |                     url: '/api/v1/search_filters', | 
            
              | 849 |                     contentType: "application/json", | 
            
              | 850 |                     data: JSON.stringify({ | 
            
              | 851 |                         name: name, | 
            
              | 852 |                         filter_query: JSON.stringify(search_result.query_json), | 
            
              | 853 |                         filter_limits: JSON.stringify(search_result.limit_json), | 
            
              | 854 |                         opac: opac, | 
            
              | 855 |                         staff_client: staff, | 
            
              | 856 |                     }) | 
            
              | 857 |                 }; | 
            
              | 858 |                 if (id){ | 
            
              | 859 |                     options.method = "PUT"; | 
            
              | 860 |                     options.url = options.url+"/"+id | 
            
              | 861 |                 } else { | 
            
              | 862 |                     options.method = "POST"; | 
            
              | 863 |                 } | 
            
              | 864 |                 $.ajax(options) | 
            
              | 865 |                     .then(function(result) { | 
            
              | 866 |                         $("#search_filters_modal").modal('hide'); | 
            
              | 867 |                         humanMsg.displayAlert( _("Saved filter: ") + name  , { className: 'human Success' } ); | 
            
              | 868 |                         getFilters(); | 
            
              | 869 |                     }) | 
            
              | 870 |                     .fail(function(err) { | 
            
              | 871 |                         console.log(err); | 
            
              | 872 |                         humanMsg.displayAlert( _("There was an error during saving:") + err.responseText, { className: 'humanError' } ); | 
            
              | 873 |                     }); | 
            
              | 874 |             } | 
            
              | 875 |  | 
            
              | 876 |         [% END %] | 
        
          | 757 |     </script> | 877 |     </script> | 
        
          | 758 |     [% Asset.js("js/pages/results.js") | $raw %] | 878 |     [% Asset.js("js/pages/results.js") | $raw %] | 
        
          | 759 | [% END %] | 879 | [% END %] |