diff --git a/C4/Circulation.pm b/C4/Circulation.pm index a1782afa44..9a65c34eb0 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1833,7 +1833,7 @@ END_SQL =head2 CanBookBeRenewed -($ok,$error) = &CanBookBeRenewed($borrowernumber, $itemnumber); +($ok,$error) = &CanBookBeRenewed($borrowernumber, $itemnumber[, $override_limit]); Find out whether a borrowed item may be renewed. @@ -1844,6 +1844,10 @@ has the item on loan. C<$itemnumber> is the number of the item to renew. +C<$override_limit>, if supplied with a true value, causes +the limit on the number of times that the loan can be renewed +(as controlled by the item type) to be ignored. + C<$CanBookBeRenewed> returns a true value iff the item may be renewed. The item must currently be on loan to the specified borrower; renewals must be allowed for the item's type; and the borrower must not have @@ -1854,7 +1858,7 @@ already renewed the loan. $error will contain the reason the renewal can not pro sub CanBookBeRenewed { # check renewal status - my ( $borrowernumber, $itemnumber ) = @_; + my ( $borrowernumber, $itemnumber, $override_limit ) = @_; my $dbh = C4::Context->dbh; my $renews = 1; my $renewokay = 0; @@ -1889,7 +1893,7 @@ sub CanBookBeRenewed { if ( my $data2 = $sth2->fetchrow_hashref ) { $renews = $data2->{'renewalsallowed'}; } - if ( $renews && $renews > $data1->{'renewals'} ) { + if ( ( $renews && $renews > $data1->{'renewals'} ) || $override_limit ) { $renewokay = 1; } else { diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index c81146e4f9..ef53715412 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -135,6 +135,7 @@ my %tabsysprefs; $tabsysprefs{useDaysMode}="Circulation"; $tabsysprefs{ReservesNeedReturns}="Circulation"; $tabsysprefs{CircAutocompl}="Circulation"; + $tabsysprefs{AllowRenewalLimitOverride}="Circulation"; $tabsysprefs{canreservefromotherbranches}="Circulation"; $tabsysprefs{finesMode}="Circulation"; $tabsysprefs{emailLibrarianWhenHoldIsPlaced}="Circulation"; diff --git a/circ/circulation.pl b/circ/circulation.pl index d07b0a6a0a..aec1b29087 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -435,13 +435,14 @@ if ($borrower) { $it->{'itemnumber'}, $borrower->{'borrowernumber'} ); $it->{'charge'} = sprintf("%.2f", $it->{'charge'}); - my $can_renew_error; - ($it->{'can_renew'}, $can_renew_error) = CanBookBeRenewed( + my ($can_renew, $can_renew_error) = CanBookBeRenewed( $borrower->{'borrowernumber'},$it->{'itemnumber'} ); $it->{"renew_error_${can_renew_error}"} = 1 if defined $can_renew_error; my ( $restype, $reserves ) = CheckReserves( $it->{'itemnumber'} ); - ( $restype ) and $it->{'can_renew'} = 0; + $it->{'can_renew'} = $can_renew; + $it->{'can_confirm'} = !$can_renew && !$restype; + $it->{'renew_error'} = $restype; $it->{'dd'} = format_date($it->{'date_due'}); $it->{'od'} = ( $it->{'date_due'} lt $todaysdate ) ? 1 : 0 ; @@ -700,10 +701,11 @@ $template->param( picture => 1 ) if $picture; $template->param( - debt_confirmed => $debt_confirmed, - SpecifyDueDate => C4::Context->preference("SpecifyDueDate"), - CircAutocompl => C4::Context->preference("CircAutocompl"), - dateformat => C4::Context->preference("dateformat"), - DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), + debt_confirmed => $debt_confirmed, + SpecifyDueDate => C4::Context->preference("SpecifyDueDate"), + CircAutocompl => C4::Context->preference("CircAutocompl"), + AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"), + dateformat => C4::Context->preference("dateformat"), + DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl index e8eccc353d..f2227d85a0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl @@ -456,21 +456,34 @@ No patron matched