Bug 7413: (follow-up) teach renew interface about too_soon
This patch ensures that the new staff interface for renewals recognizes when premature renewals are requested. If the AllowRenewalLimitOverride system preference is enabled, staff members are able to override the block: To test: [1] Set up a loan policy with a "no renewal before" value and check out an item. [2] In the renewal page, verify that attempting to renew the loan results in an error forbidding the renew. [3] If AllowRenewalLimitOverride is enabled, the operator should also be given the option to override the block. Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
9d9ae48a0c
commit
26c7924186
2 changed files with 21 additions and 1 deletions
|
@ -47,6 +47,7 @@ my $override_holds = $cgi->param('override_holds');
|
|||
|
||||
my ( $item, $issue, $borrower );
|
||||
my $error = q{};
|
||||
my $soonest_renew_date;
|
||||
|
||||
if ($barcode) {
|
||||
$item = $schema->resultset("Item")->single( { barcode => $barcode } );
|
||||
|
@ -75,6 +76,12 @@ if ($barcode) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( $error && ($error eq 'too_soon') ) {
|
||||
$soonest_renew_date = C4::Circulation::GetSoonestRenewDate(
|
||||
$borrower->borrowernumber(),
|
||||
$item->itemnumber(),
|
||||
);
|
||||
}
|
||||
if ($can_renew) {
|
||||
my $date_due = AddRenewal( undef, $item->itemnumber() );
|
||||
$template->param( date_due => $date_due );
|
||||
|
@ -96,7 +103,8 @@ if ($barcode) {
|
|||
item => $item,
|
||||
issue => $issue,
|
||||
borrower => $borrower,
|
||||
error => $error
|
||||
error => $error,
|
||||
soonestrenewdate => $soonest_renew_date,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,18 @@
|
|||
</form>
|
||||
[% END %]
|
||||
|
||||
[% ELSIF error == "too_soon" %]
|
||||
|
||||
<p>[% item.biblio.title | $EncodeUTF8 %] [% item.biblioitem.subtitle | $EncodeUTF8 %] ( [% item.barcode %] ) cannot be renewed before [% soonestrenewdate | $KohaDates %]. </p>
|
||||
|
||||
[% IF Koha.Preference('AllowRenewalLimitOverride') %]
|
||||
<form method="post" action="/cgi-bin/koha/circ/renew.pl">
|
||||
<input type="hidden" name="barcode" value="[% item.barcode %]"/>
|
||||
<input type="hidden" name="override_limit" value="1" />
|
||||
<input type="submit" class="approve" value="Override and renew" />
|
||||
</form>
|
||||
[% END %]
|
||||
|
||||
[% ELSIF error == "on_reserve" %]
|
||||
|
||||
<p>This item is on hold for another patron.</p>
|
||||
|
|
Loading…
Reference in a new issue