X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=circ%2Frenew.pl;h=246c26629f7c9365a0ef5c1d1c8825e476b1e511;hb=796379697849d6ca0364a736aa72dfecf28134e6;hp=8cde6339d476fac3471378ab491def4927bfbf63;hpb=716eaecc6c35b0491ba248ddba27273181f48856;p=koha-ffzg.git diff --git a/circ/renew.pl b/circ/renew.pl index 8cde6339d4..246c26629f 100755 --- a/circ/renew.pl +++ b/circ/renew.pl @@ -19,19 +19,21 @@ use Modern::Perl; -use CGI; +use CGI qw ( -utf8 ); use C4::Context; use C4::Auth qw/:DEFAULT get_session/; use C4::Output; use C4::Circulation; +use C4::Koha; use Koha::DateUtils; use Koha::Database; +use Koha::BiblioFrameworks; my $cgi = new CGI; -my ( $template, $librarian, $cookie ) = get_template_and_user( +my ( $template, $librarian, $cookie, $flags ) = get_template_and_user( { - template_name => "circ/renew.tmpl", + template_name => "circ/renew.tt", query => $cgi, type => "intranet", authnotrequired => 0, @@ -47,13 +49,14 @@ my $override_holds = $cgi->param('override_holds'); my ( $item, $issue, $borrower ); my $error = q{}; +my ( $soonest_renew_date, $latest_auto_renew_date ); if ($barcode) { $item = $schema->resultset("Item")->single( { barcode => $barcode } ); if ($item) { - $issue = $item->issues()->single(); + $issue = $item->issue(); if ($issue) { @@ -75,8 +78,21 @@ if ($barcode) { } } + if ( $error && ($error eq 'too_soon' or $error eq 'auto_too_soon') ) { + $soonest_renew_date = C4::Circulation::GetSoonestRenewDate( + $borrower->borrowernumber(), + $item->itemnumber(), + ); + } + if ( $error && ( $error eq 'auto_too_late' ) ) { + $latest_auto_renew_date = C4::Circulation::GetLatestAutoRenewDate( + $borrower->borrowernumber(), + $item->itemnumber(), + ); + } if ($can_renew) { - my $date_due = AddRenewal( undef, $item->itemnumber() ); + my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; + my $date_due = AddRenewal( undef, $item->itemnumber(), $branchcode ); $template->param( date_due => $date_due ); } } @@ -96,8 +112,13 @@ if ($barcode) { item => $item, issue => $issue, borrower => $borrower, - error => $error + error => $error, + soonestrenewdate => $soonest_renew_date, + latestautorenewdate => $latest_auto_renew_date, ); } +# Checking if there is a Fast Cataloging Framework +$template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find( 'FA' ); + output_html_with_http_headers( $cgi, $cookie, $template->output );