3 # Copyright 2013 ByWater Solutions
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 use C4::Auth qw/:DEFAULT get_session/;
32 my ( $template, $librarian, $cookie ) = get_template_and_user(
34 template_name => "circ/renew.tmpl",
38 flagsrequired => { circulate => "circulate_remaining_permissions" },
42 my $schema = Koha::Database->new()->schema();
44 my $barcode = $cgi->param('barcode');
45 my $override_limit = $cgi->param('override_limit');
46 my $override_holds = $cgi->param('override_holds');
48 my ( $item, $issue, $borrower, $error );
51 $item = $schema->resultset("Item")->single( { barcode => $barcode } );
55 $issue = $item->issues()->single();
59 $borrower = $issue->borrower();
61 if ( $borrower->debarred() lt dt_from_string()->ymd() ) {
63 ( $can_renew, $error ) =
64 CanBookBeRenewed( $borrower->borrowernumber(),
65 $item->itemnumber(), $override_limit );
67 if ( $error eq 'on_reserve' ) {
68 if ($override_holds) {
78 my $date_due = AddRenewal( undef, $item->itemnumber() );
79 $template->param( date_due => $date_due );
83 $error = "patron_restricted";
87 $error = "no_checkout";
97 borrower => $borrower,
102 output_html_with_http_headers( $cgi, $cookie, $template->output );