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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt (-84 lines)
Lines 1-84 Link Here
1
[% USE raw %]
2
[% USE Asset %]
3
[% USE Koha %]
4
[% USE Branches %]
5
[% USE Categories %]
6
[% PROCESS 'i18n.inc' %]
7
[% SET footerjs = 1 %]
8
[% INCLUDE 'doc-head-open.inc' %]
9
[% SET libraries = Branches.all %]
10
[% SET categories = Categories.all.unblessed %]
11
[% PROCESS 'patron-search.inc' %]
12
<title>[% FILTER collapse %]
13
    [% t("Patron search") | html %] &rsaquo;
14
    [% t("Patrons") | html %] &rsaquo;
15
    [% t("Koha") | html %]
16
[% END %]</title>
17
[% INCLUDE 'doc-head-close.inc' %]
18
<style> .modal-body .close { display: none; } </style>[%# FIXME This is not great, we should make members/memberentrygen.tt use a modal as well and we won't need that here %]
19
</head>
20
21
<body id="common_patron_search" class="common">
22
<div id="patron_search">
23
    <div class="container-fluid">
24
25
        [% PROCESS patron_search_filters categories => categories, libraries => libraries, filters => ['branch','category','sort1','sort2'], search_filter => searchmember %]
26
        </form>
27
28
        <div id="searchresults">
29
        [% IF columns.grep('checkbox').size %]
30
            <div class="searchheader fh-fixedHeader" id="searchheader" style="display:none;">
31
                <div>
32
                    <a href="#" class="btn btn-link" id="select_all"><i class="fa fa-check"></i> Select all</a>
33
                    |
34
                    <a href="#" class="btn btn-link" id="clear_all"><i class="fa fa-remove"></i> Clear all</a>
35
                    [% IF selection_type == 'add' %]
36
                    <button id="add-selected" class="btn btn-sm btn-default" type="submit">Add selected patrons</button>
37
                    [% END %]
38
                </div>
39
            </div>
40
        [% END %]
41
        [% PROCESS patron_search_table table_id => 'memberresultst' columns => columns %]
42
        </div>
43
44
        <div id="closewindow"><a href="#" class="btn btn-default btn-default close">Close</a></div>
45
46
    </div>
47
</div>
48
49
[% MACRO jsinclude BLOCK %]
50
[% INCLUDE 'select2.inc' %]
51
<script>
52
    $(document).ready(function() {
53
        $("#select_all").on("click",function(e){
54
            e.preventDefault();
55
            $(".selection").prop("checked", true).change();
56
        });
57
        $("#clear_all").on("click",function(e){
58
            e.preventDefault();
59
            $(".selection").prop("checked", false).change();
60
        });
61
        $("#searchheader").hide();
62
        $("#patron_search_form").on('submit', function(){$("#searchheader").show();});
63
        $("#clear_search").on("click",function(e){$("#searchheader").hide();});
64
65
        $('#add-selected').on('click', function(e) {
66
            e.preventDefault();
67
            var counter = 0;
68
            $('tr:has(.selection:checked) .add_user').each(function(){
69
                var borrowernumber = $(this).data('borrowernumber');
70
                var firstname = $(this).data('firstname');
71
                var surname = $(this).data('surname');
72
                add_user( borrowernumber, firstname + ' ' + surname );
73
                counter++;
74
            });
75
            $('#info').html(_("%s Patrons added.").format(counter));
76
        });
77
    });
78
</script>
79
80
    [% PROCESS patron_search_js table_id => 'memberresultst', categories => categories, libraries => libraries, columns => columns, filter => filter, actions => [selection_type], preview_on_name_click => 1, callback => callback %]
81
[% END %]
82
83
[% SET popup_window = 1 %]
84
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/members/search.pl (-51 lines)
Lines 1-50 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use CGI qw ( -utf8 );
21
use C4::Context;
22
use C4::Auth qw( get_template_and_user );
23
use C4::Output qw( output_html_with_http_headers );
24
use Koha::Patron::Attribute::Types;
25
26
my $input = CGI->new;
27
28
my ( $template, $loggedinuser, $cookie, $staff_flags ) = get_template_and_user(
29
    {   template_name   => "members/search.tt",
30
        query           => $input,
31
        type            => "intranet",
32
        flagsrequired   => { catalogue => '*' },
33
    }
34
);
35
36
my $referer = $input->referer();
37
38
my @columns = split ',', $input->param('columns');
39
my $callback = $input->param('callback');
40
my $selection_type = $input->param('selection_type') || 'select';
41
my $filter = $input->param('filter');
42
43
$template->param(
44
    view           => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
45
    callback       => $callback,
46
    columns        => \@columns,
47
    filter         => $filter,
48
    selection_type => $selection_type,
49
);
50
output_html_with_http_headers( $input, $cookie, $template->output );
51
- 

Return to bug 35329