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

(-)a/circ/request-article.pl (-24 / +7 lines)
Lines 21-27 use Modern::Perl; Link Here
21
21
22
use C4::Output qw( output_and_exit output_html_with_http_headers );
22
use C4::Output qw( output_and_exit output_html_with_http_headers );
23
use C4::Auth qw( get_template_and_user );
23
use C4::Auth qw( get_template_and_user );
24
use C4::Utils::DataTables::Members;
25
use C4::Search qw( enabled_staff_search_views );
24
use C4::Search qw( enabled_staff_search_views );
26
use C4::Serials qw( CountSubscriptionFromBiblionumber );
25
use C4::Serials qw( CountSubscriptionFromBiblionumber );
27
use Koha::Biblios;
26
use Koha::Biblios;
Lines 46-52 my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user( Link Here
46
my $action            = $cgi->param('action') || q{};
45
my $action            = $cgi->param('action') || q{};
47
my $biblionumber      = $cgi->param('biblionumber');
46
my $biblionumber      = $cgi->param('biblionumber');
48
my $patron_cardnumber = $cgi->param('patron_cardnumber');
47
my $patron_cardnumber = $cgi->param('patron_cardnumber');
49
my $patron_id         = $cgi->param('patron_id');
48
my $patron_id         = $cgi->param('borrowernumber');
50
49
51
my $biblio = Koha::Biblios->find($biblionumber);
50
my $biblio = Koha::Biblios->find($biblionumber);
52
output_and_exit( $cgi, $cookie, $template, 'unknown_biblio')
51
output_and_exit( $cgi, $cookie, $template, 'unknown_biblio')
Lines 105-132 if ( $action eq 'create' ) { Link Here
105
            );
104
            );
106
        }
105
        }
107
    };
106
    };
108
107
    undef $patron;
109
}
110
111
if ( !$patron && $patron_cardnumber ) {
112
    my $results = C4::Utils::DataTables::Members::search(
113
        {
114
            searchmember => $patron_cardnumber,
115
            dt_params    => { iDisplayLength => -1 },
116
        }
117
    );
118
119
    my $patrons = $results->{patrons};
120
121
    if ( scalar @$patrons == 1 ) {
122
        $patron = Koha::Patrons->find( $patrons->[0]->{borrowernumber} );
123
    }
124
    elsif (@$patrons) {
125
        $template->param( patrons => $patrons );
126
    }
127
    else {
128
        $template->param( no_patrons_found => $patron_cardnumber );
129
    }
130
}
108
}
131
109
132
if ( $patron && !$patron->can_request_article ) {
110
if ( $patron && !$patron->can_request_article ) {
Lines 145-150 $template->param( Link Here
145
    patron => $patron,
123
    patron => $patron,
146
    subscriptionsnumber => CountSubscriptionFromBiblionumber($biblionumber),
124
    subscriptionsnumber => CountSubscriptionFromBiblionumber($biblionumber),
147
    C4::Search::enabled_staff_search_views,
125
    C4::Search::enabled_staff_search_views,
126
    attribute_type_codes => ( C4::Context->preference('ExtendedPatronAttributes')
127
        ? [ Koha::Patron::Attribute::Types->search( { staff_searchable => 1 } )->get_column('code') ]
128
        : []
129
    ),
148
);
130
);
149
131
132
150
output_html_with_http_headers $cgi, $cookie, $template->output;
133
output_html_with_http_headers $cgi, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt (-80 / +24 lines)
Lines 3-8 Link Here
3
[% USE Context %]
3
[% USE Context %]
4
[% USE KohaDates %]
4
[% USE KohaDates %]
5
[% USE Branches %]
5
[% USE Branches %]
6
[% USE Categories %]
6
[% USE ItemTypes %]
7
[% USE ItemTypes %]
7
[% USE AuthorisedValues %]
8
[% USE AuthorisedValues %]
8
[% USE Price %]
9
[% USE Price %]
Lines 10-15 Link Here
10
[% SET article_requests_view = 1 %]
11
[% SET article_requests_view = 1 %]
11
[% SET biblionumber = biblio.biblionumber %]
12
[% SET biblionumber = biblio.biblionumber %]
12
[% INCLUDE 'doc-head-open.inc' %]
13
[% INCLUDE 'doc-head-open.inc' %]
14
[% SET libraries = Branches.all %]
15
[% SET categories = Categories.all.unblessed %]
16
[% SET columns = ['name', 'address', 'cardnumber', 'dateofbirth', 'category', 'branch', 'phone'] %]
17
[% PROCESS "patron-search.inc" %]
13
<title>Request article &rsaquo; Circulation &rsaquo; Koha</title>
18
<title>Request article &rsaquo; Circulation &rsaquo; Koha</title>
14
[% INCLUDE 'doc-head-close.inc' %]
19
[% INCLUDE 'doc-head-close.inc' %]
15
</head>
20
</head>
Lines 96-147 Link Here
96
                        [% END %]
101
                        [% END %]
97
                        </div>
102
                        </div>
98
                    [% END %]
103
                    [% END %]
99
                    [% IF no_patrons_found %]
104
                    [% UNLESS patron %]
100
                        <div class="dialog alert">
105
                        <fieldset class="brief">
101
                            <h3>Patron not found</h3>
106
                            <label>Search patrons</label>
102
                            <p>No patron with this name, please, try another</p>
107
                            [% PROCESS patron_search_filters_simple %]
103
                        </div>
108
                            [% PROCESS patron_search_table table_id => 'table_borrowers', open_on_row_click => 1 %]
104
                    [% ELSIF patrons %]
109
                        </fieldset>
105
                        <form id="article_request_patron_results" method="post">
106
                            <fieldset>
107
                                <table id="table_borrowers">
108
                                    <thead>
109
                                        <tr>
110
                                            <th></th>
111
                                            <th>Name</th>
112
                                            <th>Cardnumber</th>
113
                                            <th>Category</th>
114
                                            <th>Library</th>
115
                                            <th>Address</th>
116
                                        </tr>
117
                                    </thead>
118
                                    <tbody>
119
                                        [% FOREACH patron IN patrons %]
120
                                            <tr>
121
                                                <td><input type="radio" name="patron_id" value="[% patron.borrowernumber | html %]"/></td>
122
                                                <td>[% patron.surname | html %], [% patron.firstname | html %]</td>
123
                                                <td>[% patron.cardnumber | html %]</td>
124
                                                <td>[% patron.categorycode | html %]</td>
125
                                                <td>[% patron.branchcode | html %]</td>
126
                                                <td>[% patron.address | html %]</td>
127
                                            </tr>
128
                                        [% END %]
129
                                    </tbody>
130
                                </table>
131
                                <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
132
                                <fieldset class="action"><input type="submit" value="Select" /></fieldset>
133
                            </fieldset>
134
                        </form>
135
                    [% ELSIF !patron %]
136
                        <form id="article_requests_patronsearch" action="request-article.pl" method="post">
137
                            <fieldset class="brief">
138
                                <label for="patron">Patron: </label>
139
                                <div class="hint">Enter patron card number or partial name:</div>
140
                                <input type="text" size="40" id="patron" class="focus" name="patron_cardnumber" />
141
                                <input type="submit" value="Search" />
142
                                <input type="hidden" name="biblionumber" value="[% biblio.id | html %]" />
143
                            </fieldset>
144
                        </form>
145
                    [% ELSE %]
110
                    [% ELSE %]
146
                        [% IF biblio.can_article_request( patron ) %]
111
                        [% IF biblio.can_article_request( patron ) %]
147
                            [% IF article_request_fee > 0 %]
112
                            [% IF article_request_fee > 0 %]
Lines 396-434 Link Here
396
        });
361
        });
397
362
398
        $(document).ready(function() {
363
        $(document).ready(function() {
399
            if ( $( "#patron" ).size() ){
400
                $( "#patron" ).autocomplete({
401
                    source: "/cgi-bin/koha/circ/ysearch.pl",
402
                    minLength: 3,
403
                    select: function( event, ui ) {
404
                        $( "#patron" ).val( ui.item.cardnumber );
405
                        $( "#holds_patronsearch" ).submit();
406
                        return false;
407
                    }
408
                })
409
                .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
410
                    return $( "<li></li>" )
411
                    .data( "ui-autocomplete-item", item )
412
                    .append(
413
                        "<a>"
414
                            + ( item.surname ? item.surname.escapeHtml() : "" )
415
                            + ", "
416
                            + ( item.firstname ? item.firstname.escapeHtml() : "" )
417
                            + " (" + ( item.cardnumber ? item.cardnumber.escapeHtml() : "" ) + ")"
418
                            + " "
419
                            + "<small>"
420
                                + ( item.address ? item.address.escapeHtml() : "" )
421
                                + " "
422
                                + ( item.city ? item.city.escapeHtml() : "" )
423
                                + " "
424
                                + ( item.zipcode ? item.zipcode.escapeHtml() : "" )
425
                                + " "
426
                                + ( item.country ? item.country.escapeHtml() : "" )
427
                            + "</small>"
428
                        + "</a>" )
429
                    .appendTo( ul );
430
                };
431
            }
432
364
433
            $( ".ar-update-branchcode" ).on('focus', function(){
365
            $( ".ar-update-branchcode" ).on('focus', function(){
434
                previous_branchcode = this.value;
366
                previous_branchcode = this.value;
Lines 503-508 Link Here
503
            }
435
            }
504
        });
436
        });
505
    </script>
437
    </script>
438
439
    [% PROCESS patron_search_js
440
        table_id    => 'table_borrowers',
441
        categories  => categories,
442
        libraries   => libraries,
443
        extended_attribute_types => attribute_type_codes,
444
        columns     => columns,
445
        open_on_row_click => 1,
446
        on_click_url      => '/cgi-bin/koha/circ/request-article.pl?biblionumber=' _ biblio.biblionumber,
447
        redirect_if_one_result => 1,
448
        redirect_url           => '/cgi-bin/koha/circ/request-article.pl?biblionumber=' _ biblio.biblionumber,
449
    %]
450
506
[% END %]
451
[% END %]
507
452
508
[% INCLUDE 'intranet-bottom.inc' %]
453
[% INCLUDE 'intranet-bottom.inc' %]
509
- 

Return to bug 30094