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

(-)a/Koha/Illrequest.pm (+26 lines)
Lines 2033-2038 sub strings_map { Link Here
2033
    return $strings;
2033
    return $strings;
2034
}
2034
}
2035
2035
2036
=head3 can_patron_place_ill_in_opac
2037
2038
    my $can_patron_place_ill_in_opac = Koha::Illrequest->can_patron_place_ill_in_opac($patron);
2039
2040
Returns whether the given patron can place an ILL request in OPAC
2041
2042
=over
2043
2044
=item patron
2045
2046
Patron object
2047
2048
=back
2049
2050
=cut
2051
2052
sub can_patron_place_ill_in_opac {
2053
    my ( $self, $patron ) = @_;
2054
2055
    return 0
2056
        unless $patron->_result->categorycode->can_place_ill_in_opac
2057
        && !( $patron->is_expired
2058
        && $patron->category->effective_BlockExpiredPatronOpacActions_contains('ill_request') );
2059
    return 1;
2060
}
2061
2036
=head3 get_op_param_deprecation
2062
=head3 get_op_param_deprecation
2037
2063
2038
    my $op = Koha::Illrequest->check_url_param_deprecation($params);
2064
    my $op = Koha::Illrequest->check_url_param_deprecation($params);
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt (-2 / +2 lines)
Lines 112-118 Link Here
112
                            <h1>Interlibrary loan requests</h1>
112
                            <h1>Interlibrary loan requests</h1>
113
                            [% INCLUDE messages %]
113
                            [% INCLUDE messages %]
114
114
115
                            [% IF can_place_ill_in_opac %]
115
                            [% IF can_patron_place_ill_in_opac %]
116
                                <div id="illrequests-create-button" class="dropdown btn-group">
116
                                <div id="illrequests-create-button" class="dropdown btn-group">
117
                                    [% IF backends.size > 1 %]
117
                                    [% IF backends.size > 1 %]
118
                                        <button class="btn btn-primary dropdown-toggle" type="button" id="ill-backend-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
118
                                        <button class="btn btn-primary dropdown-toggle" type="button" id="ill-backend-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
Lines 235-241 Link Here
235
                                        </div>
235
                                        </div>
236
                                    [% END %]
236
                                    [% END %]
237
                                </div>
237
                                </div>
238
                            [% IF can_place_ill_in_opac %]
238
                            [% IF can_patron_place_ill_in_opac %]
239
                                <fieldset class="action illrequest-actions">
239
                                <fieldset class="action illrequest-actions">
240
                                    <input type="hidden" name="illrequest_id" value="[% request.illrequest_id | html %]" />
240
                                    <input type="hidden" name="illrequest_id" value="[% request.illrequest_id | html %]" />
241
                                    <input type="hidden" name="op" value="cud-update" />
241
                                    <input type="hidden" name="op" value="cud-update" />
(-)a/opac/opac-illrequests.pl (-6 / +6 lines)
Lines 73-79 if ( $illrequest_id = $params->{illrequest_id} ) { Link Here
73
    }
73
    }
74
}
74
}
75
75
76
if ( ( $op eq 'cud-create' || $op eq 'cancreq' || $op eq 'cud-update' ) && !$patron->_result->categorycode->can_place_ill_in_opac ) {
76
my $can_patron_place_ill_in_opac = Koha::Illrequest->can_patron_place_ill_in_opac($patron);
77
if ( ( $op eq 'cud-create' || $op eq 'cancreq' || $op eq 'cud-update' ) && !$can_patron_place_ill_in_opac ) {
77
    print $query->redirect('/cgi-bin/koha/errors/403.pl');
78
    print $query->redirect('/cgi-bin/koha/errors/403.pl');
78
    exit;
79
    exit;
79
}
80
}
Lines 180-189 if ( $op eq 'list' ) { Link Here
180
}
181
}
181
182
182
$template->param(
183
$template->param(
183
    can_place_ill_in_opac => $patron->_result->categorycode->can_place_ill_in_opac,
184
    can_patron_place_ill_in_opac => $can_patron_place_ill_in_opac,
184
    message               => $params->{message},
185
    message                      => $params->{message},
185
    illrequestsview       => 1,
186
    illrequestsview              => 1,
186
    op                    => $op
187
    op                           => $op
187
);
188
);
188
189
189
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
190
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
190
- 

Return to bug 34597