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

(-)a/acqui/add_user_search.pl (+8 lines)
Lines 21-26 use Modern::Perl; Link Here
21
21
22
use CGI qw ( -utf8 );
22
use CGI qw ( -utf8 );
23
use C4::Auth;
23
use C4::Auth;
24
use C4::Branch qw( GetBranches );
25
use C4::Category;
24
use C4::Output;
26
use C4::Output;
25
use C4::Members;
27
use C4::Members;
26
28
Lines 49-59 my $search_patrons_with_acq_perm_only = Link Here
49
    ( $referer =~ m|acqui/basket.pl| )
51
    ( $referer =~ m|acqui/basket.pl| )
50
        ? 1 : 0;
52
        ? 1 : 0;
51
53
54
my $onlymine = C4::Branch::onlymine;
55
my $branches = C4::Branch::GetBranches( $onlymine );
56
52
$template->param(
57
$template->param(
53
    patrons_with_acq_perm_only => $search_patrons_with_acq_perm_only,
58
    patrons_with_acq_perm_only => $search_patrons_with_acq_perm_only,
54
    view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
59
    view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
55
    columns => ['cardnumber', 'name', 'branch', 'category', 'action'],
60
    columns => ['cardnumber', 'name', 'branch', 'category', 'action'],
56
    json_template => 'acqui/tables/members_results.tt',
61
    json_template => 'acqui/tables/members_results.tt',
57
    selection_type => 'add',
62
    selection_type => 'add',
63
    alphabet        => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ),
64
    categories      => [ C4::Category->all ],
65
    branches        => [ map { { branchcode => $_->{branchcode}, branchname => $_->{branchname} } } values %$branches ],
58
);
66
);
59
output_html_with_http_headers( $input, $cookie, $template->output );
67
output_html_with_http_headers( $input, $cookie, $template->output );
(-)a/admin/add_user_search.pl (+8 lines)
Lines 21-26 use Modern::Perl; Link Here
21
21
22
use CGI qw ( -utf8 );
22
use CGI qw ( -utf8 );
23
use C4::Auth;
23
use C4::Auth;
24
use C4::Branch qw( GetBranches );
25
use C4::Category;
24
use C4::Output;
26
use C4::Output;
25
use C4::Members;
27
use C4::Members;
26
28
Lines 50-60 my $search_patrons_with_acq_perm_only = Link Here
50
    ( $referer =~ m|admin/aqbudgets.pl| )
52
    ( $referer =~ m|admin/aqbudgets.pl| )
51
        ? 1 : 0;
53
        ? 1 : 0;
52
54
55
my $onlymine = C4::Branch::onlymine;
56
my $branches = C4::Branch::GetBranches( $onlymine );
57
53
$template->param(
58
$template->param(
54
    patrons_with_acq_perm_only => $search_patrons_with_acq_perm_only,
59
    patrons_with_acq_perm_only => $search_patrons_with_acq_perm_only,
55
    view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
60
    view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
56
    columns => ['cardnumber', 'name', 'branch', 'category', 'action'],
61
    columns => ['cardnumber', 'name', 'branch', 'category', 'action'],
57
    json_template => 'acqui/tables/members_results.tt',
62
    json_template => 'acqui/tables/members_results.tt',
58
    selection_type => $selection_type,
63
    selection_type => $selection_type,
64
    alphabet        => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ),
65
    categories      => [ C4::Category->all ],
66
    branches        => [ map { { branchcode => $_->{branchcode}, branchname => $_->{branchname} } } values %$branches ],
59
);
67
);
60
output_html_with_http_headers( $input, $cookie, $template->output );
68
output_html_with_http_headers( $input, $cookie, $template->output );
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt (-24 / +64 lines)
Lines 18-26 $(document).ready(function(){ Link Here
18
        search = 0;
18
        search = 0;
19
    [% END %]
19
    [% END %]
20
20
21
    $("#searchmember_filter").on('keyup', function(){
22
        filter();
23
    });
24
    // Apply DataTables on the results table
21
    // Apply DataTables on the results table
25
    dtMemberResults = $("#memberresultst").dataTable($.extend(true, {}, dataTablesDefaults, {
22
    dtMemberResults = $("#memberresultst").dataTable($.extend(true, {}, dataTablesDefaults, {
26
        'bServerSide': true,
23
        'bServerSide': true,
Lines 33-38 $(document).ready(function(){ Link Here
33
                'name': 'searchmember',
30
                'name': 'searchmember',
34
                'value': $("#searchmember_filter").val()
31
                'value': $("#searchmember_filter").val()
35
            },{
32
            },{
33
                'name': 'firstletter',
34
                'value': $("#firstletter_filter").val()
35
            },{
36
                'name': 'categorycode',
37
                'value': $("#categorycode_filter").val()
38
            },{
39
                'name': 'branchcode',
40
                'value': $("#branchcode_filter").val()
41
            },{
36
                'name': 'name_sorton',
42
                'name': 'name_sorton',
37
                'value': 'borrowers.surname borrowers.firstname'
43
                'value': 'borrowers.surname borrowers.firstname'
38
            },{
44
            },{
Lines 87-117 $(document).ready(function(){ Link Here
87
        'bFilter': false,
93
        'bFilter': false,
88
        'bProcessing': true,
94
        'bProcessing': true,
89
    }));
95
    }));
90
    dtMemberResults.fnAddFilters("filter", 750);
91
});
92
96
93
var delay = (function(){
97
    $("#searchform").on('submit', filter);
94
  var timer = 0;
98
});
95
  return function(callback, ms){
96
    clearTimeout (timer);
97
    timer = setTimeout(callback, ms);
98
  };
99
})();
100
99
101
function filter() {
100
function filter() {
102
    search = 1;
101
    search = 1;
103
102
    $("#firstletter_filter").val('');
104
    $("#searchresults").show();
103
    $("#searchresults").show();
105
104
    dtMemberResults.fnDraw();
106
    if ( $("#searchmember_filter").val().length > 0 ) {
107
        delay(function(){
108
            dtMemberResults.fnDraw();
109
        }, 1000);
110
    }
111
112
    return false;
105
    return false;
113
}
106
}
114
107
108
// User has clicked on a letter
109
function filterByFirstLetterSurname(letter) {
110
    $("#firstletter_filter").val(letter);
111
    search = 1;
112
    $("#searchresults").show();
113
    dtMemberResults.fnDraw();
114
}
115
116
115
    // modify parent window owner element
117
    // modify parent window owner element
116
    [% IF selection_type == 'add' %]
118
    [% IF selection_type == 'add' %]
117
        function add_user(borrowernumber, borrowername) {
119
        function add_user(borrowernumber, borrowername) {
Lines 152-169 function filter() { Link Here
152
  <div id="bd">
154
  <div id="bd">
153
    <div class="yui-g">
155
    <div class="yui-g">
154
156
155
        <h3>Search for patron</h3>
157
        <form id="searchform">
156
158
            <fieldset class="brief">
157
          <label for="searchmember_filter">Search:</label>
159
                <h3>Search for patron</h3>
158
          <input type="text" id="searchmember_filter" value="[% searchmember %]"/>
160
                <ol>
161
                    <li>
162
                        <label for="searchmember_filter">Search:</label>
163
                        <input type="text" id="searchmember_filter" value="[% searchmember %]"/>
164
                    </li>
165
                    <li>
166
                        <label for="categorycode_filter">Category:</label>
167
                        <select id="categorycode_filter">
168
                            <option value="">Any</option>
169
                            [% FOREACH category IN categories %]
170
                                <option value="[% category.categorycode %]">[% category.description %]</option>
171
                            [% END %]
172
                        </select>
173
                    </li>
174
                    <li>
175
                        <label for="branchcode_filter">Library:</label>
176
                        <select id="branchcode_filter">
177
                            [% IF branches.size != 1 %]
178
                                <option value="">Any</option>
179
                            [% END %]
180
                            [% FOREACH branch IN branches %]
181
                                <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
182
                            [% END %]
183
                        </select>
184
                    </li>
185
                </ol>
186
                <fieldset class="action">
187
                    <input type="submit" value="Search" />
188
                </fieldset>
189
            </fieldset>
190
        <form>
159
191
160
        [% IF patrons_with_acq_perm_only %]
192
        [% IF patrons_with_acq_perm_only %]
161
            <div class="hint">Only staff with superlibrarian or acquisitions permissions (or order_manage permission if granular permissions are enabled) are returned in the search results</div>
193
            <div class="hint">Only staff with superlibrarian or acquisitions permissions (or order_manage permission if granular permissions are enabled) are returned in the search results</div>
162
        [% END %]
194
        [% END %]
163
195
196
        <div class="browse">
197
            Browse by last name:
198
            [% FOREACH letter IN alphabet.split(' ') %]
199
                <a style="cursor:pointer" onclick="filterByFirstLetterSurname('[% letter %]');">[% letter %]</a>
200
            [% END %]
201
        </div>
202
164
        <div id="info" class="dialog message"></div>
203
        <div id="info" class="dialog message"></div>
165
        <div id="error" class="dialog alert"></div>
204
        <div id="error" class="dialog alert"></div>
166
205
206
        <input type="hidden" id="firstletter_filter" value="" />
167
        <div id="searchresults">
207
        <div id="searchresults">
168
            <table id="memberresultst">
208
            <table id="memberresultst">
169
                <thead>
209
                <thead>
(-)a/members/guarantor_search.pl (+8 lines)
Lines 21-26 use Modern::Perl; Link Here
21
21
22
use CGI qw ( -utf8 );
22
use CGI qw ( -utf8 );
23
use C4::Auth;
23
use C4::Auth;
24
use C4::Branch qw( GetBranches );
25
use C4::Category;
24
use C4::Output;
26
use C4::Output;
25
use C4::Members;
27
use C4::Members;
26
28
Lines 42-51 my $op = $input->param('op') || ''; Link Here
42
44
43
my $referer = $input->referer();
45
my $referer = $input->referer();
44
46
47
my $onlymine = C4::Branch::onlymine;
48
my $branches = C4::Branch::GetBranches( $onlymine );
49
45
$template->param(
50
$template->param(
46
    view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
51
    view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
47
    columns => ['cardnumber', 'name', 'dateofbirth', 'address', 'action' ],
52
    columns => ['cardnumber', 'name', 'dateofbirth', 'address', 'action' ],
48
    json_template => 'members/tables/guarantor_search.tt',
53
    json_template => 'members/tables/guarantor_search.tt',
49
    selection_type => 'select',
54
    selection_type => 'select',
55
    alphabet        => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ),
56
    categories      => [ C4::Category->all ],
57
    branches        => [ map { { branchcode => $_->{branchcode}, branchname => $_->{branchname} } } values %$branches ],
50
);
58
);
51
output_html_with_http_headers( $input, $cookie, $template->output );
59
output_html_with_http_headers( $input, $cookie, $template->output );
(-)a/patroncards/add_user_search.pl (-4 / +12 lines)
Lines 21-26 use Modern::Perl; Link Here
21
21
22
use CGI qw ( -utf8 );
22
use CGI qw ( -utf8 );
23
use C4::Auth;
23
use C4::Auth;
24
use C4::Branch qw( GetBranches );
25
use C4::Category;
24
use C4::Output;
26
use C4::Output;
25
use C4::Members;
27
use C4::Members;
26
28
Lines 42-51 my $op = $input->param('op') || ''; Link Here
42
44
43
my $referer = $input->referer();
45
my $referer = $input->referer();
44
46
47
my $onlymine = C4::Branch::onlymine;
48
my $branches = C4::Branch::GetBranches( $onlymine );
49
45
$template->param(
50
$template->param(
46
    view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
51
    view            => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
47
    columns => ['cardnumber', 'name', 'category', 'branch', 'dateexpiry', 'borrowernotes', 'action'],
52
    columns         => ['cardnumber', 'name', 'category', 'branch', 'dateexpiry', 'borrowernotes', 'action'],
48
    json_template => 'patroncards/tables/members_results.tt',
53
    json_template   => 'patroncards/tables/members_results.tt',
49
    selection_type => 'add',
54
    selection_type  => 'add',
55
    alphabet        => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ),
56
    categories      => [ C4::Category->all ],
57
    branches        => [ map { { branchcode => $_->{branchcode}, branchname => $_->{branchname} } } values %$branches ],
50
);
58
);
51
output_html_with_http_headers( $input, $cookie, $template->output );
59
output_html_with_http_headers( $input, $cookie, $template->output );
(-)a/serials/add_user_search.pl (-1 / +8 lines)
Lines 21-26 use Modern::Perl; Link Here
21
21
22
use CGI qw ( -utf8 );
22
use CGI qw ( -utf8 );
23
use C4::Auth;
23
use C4::Auth;
24
use C4::Branch qw( GetBranches );
25
use C4::Category;
24
use C4::Output;
26
use C4::Output;
25
use C4::Members;
27
use C4::Members;
26
28
Lines 42-51 my $op = $input->param('op') || ''; Link Here
42
44
43
my $referer = $input->referer();
45
my $referer = $input->referer();
44
46
47
my $onlymine = C4::Branch::onlymine;
48
my $branches = C4::Branch::GetBranches( $onlymine );
49
45
$template->param(
50
$template->param(
46
    view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
51
    view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
47
    columns => ['cardnumber', 'name', 'branch', 'action'],
52
    columns => ['cardnumber', 'name', 'branch', 'action'],
48
    json_template => 'serials/tables/members_results.tt',
53
    json_template => 'serials/tables/members_results.tt',
49
    selection_type => 'add',
54
    selection_type => 'add',
55
    alphabet        => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ),
56
    categories      => [ C4::Category->all ],
57
    branches        => [ map { { branchcode => $_->{branchcode}, branchname => $_->{branchname} } } values %$branches ],
50
);
58
);
51
output_html_with_http_headers( $input, $cookie, $template->output );
59
output_html_with_http_headers( $input, $cookie, $template->output );
52
- 

Return to bug 13891