View | Details | Raw Unified | Return to bug 28726
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc (-2 / +58 lines)
Lines 56-61 Link Here
56
                                [% END %]
56
                                [% END %]
57
                            </select>
57
                            </select>
58
                        </li>
58
                        </li>
59
                    [% CASE 'sort1' %]
60
                        <li>
61
                            <label for="sort1_filter">Sort1:</label>
62
                            [% PROCESS 'av-build-dropbox.inc' name="sort1_filter", category="Bsort1", empty=1, size = 20 %]
63
                        </li>
64
                    [% CASE 'sort2' %]
65
                        <li>
66
                            <label for="sort2_filter">Sort2:</label>
67
                            [% PROCESS 'av-build-dropbox.inc' name="sort2_filter", category="Bsort2", empty=1, size = 20 %]
68
                        </li>
59
                    [% CASE 'search_field' %]
69
                    [% CASE 'search_field' %]
60
                        <li>
70
                        <li>
61
                            [% INCLUDE patron_fields_dropdown %]
71
                            [% INCLUDE patron_fields_dropdown %]
Lines 197-202 Link Here
197
    [% IF redirect_if_one_result && !redirect_url %]
207
    [% IF redirect_if_one_result && !redirect_url %]
198
        <script>console.log("Wrong call of patron_searh_js - missing redirect_url");</script>
208
        <script>console.log("Wrong call of patron_searh_js - missing redirect_url");</script>
199
    [% END %]
209
    [% END %]
210
211
    [% INCLUDE 'select2.inc' %]
200
    <script>
212
    <script>
201
        let categories = [% To.json(categories) | $raw %].map(e => {
213
        let categories = [% To.json(categories) | $raw %].map(e => {
202
            e['_id'] = e.categorycode.toLowerCase();
214
            e['_id'] = e.categorycode.toLowerCase();
Lines 221-226 Link Here
221
            let extended_attribute_types = [% To.json(extended_attribute_types || []) | $raw %];
233
            let extended_attribute_types = [% To.json(extended_attribute_types || []) | $raw %];
222
        [% END %]
234
        [% END %]
223
235
236
        $(document).ready(function() {
237
            $('select#sort1_filter').select2({allowClear:true});
238
            $('select#sort2_filter').select2({allowClear:true});
239
        });
224
    </script>
240
    </script>
225
241
226
    [% INCLUDE 'datatables.inc' %]
242
    [% INCLUDE 'datatables.inc' %]
Lines 298-308 Link Here
298
                    return { "like": start_with + "%" }
314
                    return { "like": start_with + "%" }
299
                },
315
                },
300
                "-and": function(){
316
                "-and": function(){
317
                    let filters = [];
318
                    let f_sort1 = $("#sort1_filter").val();
319
                    if ( f_sort1 ) {
320
                        filters.push({
321
                            "me.sort1": f_sort1
322
                        });
323
                    }
324
                    let f_sort2 = $("#sort2_filter").val();
325
                    if ( f_sort2 ) {
326
                        filters.push({
327
                            "me.sort2": f_sort2
328
                        });
329
                    }
330
301
                    let pattern = $("#search_patron_filter").val();
331
                    let pattern = $("#search_patron_filter").val();
302
                    if (!pattern) return "";
332
                    if (!pattern) {
333
                        if ( filters.length == 0 ) {
334
                            return "";
335
                        }
336
                        else {
337
                            return filters;
338
                        }
339
                    }
303
                    let patterns = pattern.split(/[\s,]+/).filter(function(s){ return s.length });
340
                    let patterns = pattern.split(/[\s,]+/).filter(function(s){ return s.length });
304
341
305
                    let filters = [];
306
                    let search_type = $("#searchtype_filter").val() || "contain";
342
                    let search_type = $("#searchtype_filter").val() || "contain";
307
                    let search_fields = $("#searchfieldstype_filter").val();
343
                    let search_fields = $("#searchfieldstype_filter").val();
308
                    if ( !search_fields ) {
344
                    if ( !search_fields ) {
Lines 733-738 Link Here
733
            if ( $("#branchcode_filter").val() ) {
769
            if ( $("#branchcode_filter").val() ) {
734
                searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text();
770
                searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text();
735
            }
771
            }
772
            if ( $("#sort1_filter").val() ) {
773
                searched += _(" with sort1 ")
774
                if ( $("select#sort1_filter") ) {
775
                    searched += $("select#sort1_filter").find("option:selected").text();
776
                }
777
                else {
778
                    searched += $("#sort1_filter").val();
779
                }
780
            }
781
            if ( $("#sort2_filter").val() ) {
782
                searched += _(" with sort2 ");
783
                if ( $("select#sort2_filter") ) {
784
                    searched += $("select#sort2_filter").find("option:selected").text();
785
                }
786
                else {
787
                    searched += $("#sort2_filter").val();
788
                }
789
            }
736
            $("#searchpattern").text(searched);
790
            $("#searchpattern").text(searched);
737
            $("#searchpattern").parent().show();
791
            $("#searchpattern").parent().show();
738
        }
792
        }
Lines 790-795 Link Here
790
            $("#searchtype_filter option[value='contain']").prop("selected", true);
844
            $("#searchtype_filter option[value='contain']").prop("selected", true);
791
            $("#categorycode_filter option:first").prop("selected", true);
845
            $("#categorycode_filter option:first").prop("selected", true);
792
            $("#branchcode_filter option:first").prop("selected", true);
846
            $("#branchcode_filter option:first").prop("selected", true);
847
            $("#sort1_filter").val('').trigger("change");
848
            $("#sort2_filter").val('').trigger("change");
793
            $("#firstletter_filter").val('');
849
            $("#firstletter_filter").val('');
794
            $("#search_patron_filter").val('');
850
            $("#search_patron_filter").val('');
795
            /* remove any search string added by firstletter search */
851
            /* remove any search string added by firstletter search */
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt (-1 / +44 lines)
Lines 17-26 Link Here
17
<div id="patron_search">
17
<div id="patron_search">
18
    <div class="container-fluid">
18
    <div class="container-fluid">
19
19
20
        [% PROCESS patron_search_filters categories => categories, libraries => libraries, filters => ['branch', 'category'], search_filter => searchmember %]
20
        [% PROCESS patron_search_filters categories => categories, libraries => libraries, filters => ['branch','category','sort1','sort2'], search_filter => searchmember %]
21
        </form>
21
        </form>
22
22
23
        <div id="searchresults">
24
            <div class="searchheader fh-fixedHeader" id="searchheader" style="display:none;">
25
                <div>
26
                [% IF columns.grep('checkbox').size %]
27
                    <a href="#" class="btn btn-link" id="select_all"><i class="fa fa-check"></i> Select all</a>
28
                    |
29
                    <a href="#" class="btn btn-link" id="clear_all"><i class="fa fa-remove"></i> Clear all</a>
30
                    [% IF selection_type == 'add' %]
31
                    <button id="add-selected" class="btn btn-sm btn-default" type="submit">Add selected patrons</button>
32
                    [% END %]
33
                [% END %]
34
                </div>
35
            </div>
23
        [% PROCESS patron_search_table table_id => 'memberresultst' columns => columns %]
36
        [% PROCESS patron_search_table table_id => 'memberresultst' columns => columns %]
37
        </div>
24
38
25
        <div id="closewindow"><a href="#" class="btn btn-default btn-default close">Close</a></div>
39
        <div id="closewindow"><a href="#" class="btn btn-default btn-default close">Close</a></div>
26
40
Lines 28-33 Link Here
28
</div>
42
</div>
29
43
30
[% MACRO jsinclude BLOCK %]
44
[% MACRO jsinclude BLOCK %]
45
<script>
46
    $(document).ready(function() {
47
        $("#select_all").on("click",function(e){
48
            e.preventDefault();
49
            $(".selection").prop("checked", true).change();
50
        });
51
        $("#clear_all").on("click",function(e){
52
            e.preventDefault();
53
            $(".selection").prop("checked", false).change();
54
        });
55
        $("#searchheader").hide();
56
        $("#patron_search_form").on('submit', function(){$("#searchheader").show();});
57
        $("#clear_search").on("click",function(e){$("#searchheader").hide();});
58
59
        $('#add-selected').on('click', function(e) {
60
            e.preventDefault();
61
            var counter = 0;
62
            $('tr:has(.selection:checked) .add_user').each(function(){
63
                var borrowernumber = $(this).data('borrowernumber');
64
                var firstname = $(this).data('firstname');
65
                var surname = $(this).data('surname');
66
                add_user( borrowernumber, firstname + ' ' + surname );
67
                counter++;
68
            });
69
            $('#info').html(_("%s Patrons added.").format(counter));
70
        });
71
    });
72
</script>
73
31
    [% PROCESS patron_search_js table_id => 'memberresultst', categories => categories, libraries => libraries, extended_attribute_types => attribute_type_codes, columns => columns, filter => filter, actions => [selection_type], preview_on_name_click => 1, callback => callback %]
74
    [% PROCESS patron_search_js table_id => 'memberresultst', categories => categories, libraries => libraries, extended_attribute_types => attribute_type_codes, columns => columns, filter => filter, actions => [selection_type], preview_on_name_click => 1, callback => callback %]
32
[% END %]
75
[% END %]
33
76
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt (-2 / +1 lines)
Lines 195-201 Link Here
195
        function Add() {
195
        function Add() {
196
            var bor_nums = document.getElementById("bor_num_list");
196
            var bor_nums = document.getElementById("bor_num_list");
197
            if (bor_nums.value == '') {
197
            if (bor_nums.value == '') {
198
                window.open("/cgi-bin/koha/members/search.pl?columns=cardnumber,name,category,branch,dateexpiry,borrowernotes,action&selection_type=add",
198
                window.open("/cgi-bin/koha/members/search.pl?columns=checkbox,cardnumber,name,category,branch,dateexpiry,borrowernotes,action&selection_type=add",
199
               'PatronPopup',
199
               'PatronPopup',
200
               'width=1024,height=768,location=yes,toolbar=no,'
200
               'width=1024,height=768,location=yes,toolbar=no,'
201
               + 'scrollbars=yes,resize=yes');
201
               + 'scrollbars=yes,resize=yes');
202
- 

Return to bug 28726