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

(-)a/Koha/ILL/Request.pm (+26 lines)
Lines 2104-2109 sub strings_map { Link Here
2104
    return $strings;
2104
    return $strings;
2105
}
2105
}
2106
2106
2107
=head3 can_patron_place_ill_in_opac
2108
2109
    my $can_patron_place_ill_in_opac = Koha::Illrequest->can_patron_place_ill_in_opac($patron);
2110
2111
Returns whether the given patron can place an ILL request in OPAC
2112
2113
=over
2114
2115
=item patron
2116
2117
Patron object
2118
2119
=back
2120
2121
=cut
2122
2123
sub can_patron_place_ill_in_opac {
2124
    my ( $self, $patron ) = @_;
2125
2126
    return 0
2127
        unless $patron->_result->categorycode->can_place_ill_in_opac
2128
        && !( $patron->is_expired
2129
        && $patron->category->effective_BlockExpiredPatronOpacActions_contains('ill_request') );
2130
    return 1;
2131
}
2132
2107
=head3 get_op_param_deprecation
2133
=head3 get_op_param_deprecation
2108
2134
2109
    my $op = $req->check_url_param_deprecation($params);
2135
    my $op = $req->check_url_param_deprecation($params);
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt (-2 / +2 lines)
Lines 117-123 Link Here
117
                            <h1>Interlibrary loan requests</h1>
117
                            <h1>Interlibrary loan requests</h1>
118
                            [% INCLUDE messages %]
118
                            [% INCLUDE messages %]
119
119
120
                            [% IF can_place_ill_in_opac %]
120
                            [% IF can_patron_place_ill_in_opac %]
121
                                <div id="illrequests-create-button" class="dropdown btn-group">
121
                                <div id="illrequests-create-button" class="dropdown btn-group">
122
                                    [% IF backends.size > 1 %]
122
                                    [% IF backends.size > 1 %]
123
                                        <button class="btn btn-primary dropdown-toggle" type="button" id="ill-backend-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
123
                                        <button class="btn btn-primary dropdown-toggle" type="button" id="ill-backend-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
Lines 240-246 Link Here
240
                                        </div>
240
                                        </div>
241
                                    [% END %]
241
                                    [% END %]
242
                                </div>
242
                                </div>
243
                            [% IF can_place_ill_in_opac %]
243
                            [% IF can_patron_place_ill_in_opac %]
244
                                <fieldset class="action illrequest-actions">
244
                                <fieldset class="action illrequest-actions">
245
                                    <input type="hidden" name="illrequest_id" value="[% request.illrequest_id | html %]" />
245
                                    <input type="hidden" name="illrequest_id" value="[% request.illrequest_id | html %]" />
246
                                    <input type="hidden" name="op" value="cud-update" />
246
                                    <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 181-190 if ( $op eq 'list' ) { Link Here
181
}
182
}
182
183
183
$template->param(
184
$template->param(
184
    can_place_ill_in_opac => $patron->_result->categorycode->can_place_ill_in_opac,
185
    can_patron_place_ill_in_opac => $can_patron_place_ill_in_opac,
185
    message               => $params->{message},
186
    message                      => $params->{message},
186
    illrequestsview       => 1,
187
    illrequestsview              => 1,
187
    op                    => $op
188
    op                           => $op
188
);
189
);
189
190
190
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
191
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
191
- 

Return to bug 34597