Bugzilla – Attachment 24928 Details for
Bug 7413
Allow OPAC renewal x days before due date
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7413: Add new error "too_soon" in CanBookBeRenewed
Bug-7413-Add-new-error-toosoon-in-CanBookBeRenewed.patch (text/plain), 5.04 KB, created by
Holger Meißner
on 2014-01-31 10:52:08 UTC
(
hide
)
Description:
Bug 7413: Add new error "too_soon" in CanBookBeRenewed
Filename:
MIME Type:
Creator:
Holger Meißner
Created:
2014-01-31 10:52:08 UTC
Size:
5.04 KB
patch
obsolete
>From e8ef898427a6b95c4b5520bda43d344db00debf8 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Holger=20Mei=C3=9Fner?= <h.meissner.82@web.de> >Date: Fri, 24 Jan 2014 10:21:09 +0100 >Subject: [PATCH] Bug 7413: Add new error "too_soon" in CanBookBeRenewed >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch modifies CanBookBeRenewed in Ciculation.pm, so that based >on issuingrules.norenewalbefore a new error "too_soon" can be >returned. >For this error intranet HTML templates will display "Not renewable >yet" instead of "Not renewable". > >To test: >1) Create an issuing rule with "No renewal before" set to value X > and "Unit" set to days. >2) Confirm that items can't be renewed if current date is more than > X days before due date. >3) Confirm that items can be renewed if "No renewal before" is > undefined or current date is X or less days before due date. >4) Confirm that "Renewals allowed (count)" has priority, i.e. if > the number of allowed renewals is exceeded "Not renewable" is > displayed, no matter what "No renewal before" is set to. >5) Test the same things with "Unit" set to hours. >6) Test for both circulation.tt and moremember.tt. > >Sponsored-by: Hochschule für Gesundheit (hsg), Germany >--- > C4/Circulation.pm | 26 +++++++++++++++++--- > .../prog/en/modules/circ/circulation.tt | 11 ++++++--- > .../prog/en/modules/members/moremember.tt | 7 +++++- > 3 files changed, 36 insertions(+), 8 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index f8b204a..e17193f 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2472,7 +2472,7 @@ sub CanBookBeRenewed { > > my $dbh = C4::Context->dbh; > my $renews = 1; >- my $renewokay = 0; >+ my $renewokay = 1; > my $error; > > my $item = GetItem($itemnumber) or return ( 0, 'no_item' ); >@@ -2486,12 +2486,30 @@ sub CanBookBeRenewed { > > my $issuingrule = GetIssuingRule($borrower->{categorycode}, $item->{itype}, $branchcode); > >- if ( ( $issuingrule->{renewalsallowed} > $itemissue->{renewals} ) || $override_limit ) { >- $renewokay = 1; >- } else { >+ if ( $issuingrule->{norenewalbefore} ) { >+ >+ # Get current time and add norenewalbefore. If this is smaller than date_due, it's too soon for renewal. >+ if ( >+ DateTime->now( time_zone => C4::Context->tz() )->add( >+ $issuingrule->{lengthunit} => $issuingrule->{norenewalbefore} >+ ) < $itemissue->{date_due} >+ ) >+ { >+ $renewokay = 0; >+ $error = "too_soon"; >+ } >+ } >+ >+ if ( $issuingrule->{renewalsallowed} <= $itemissue->{renewals} ) { >+ $renewokay = 0; > $error = "too_many"; > } > >+ if ( $override_limit ) { >+ $renewokay = 1; >+ $error = undef; >+ } >+ > my ( $resfound, $resrec, undef ) = C4::Reserves::CheckReserves( $itemnumber ); > > if ( $resfound ) { # '' when no hold was found >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index 5a6a82d..27a007c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -785,10 +785,15 @@ No patron matched <span class="ex">[% message %]</span> > [% END %] > [% IF ( todayissue.renew_error_on_reserve ) %] > <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% todayissue.biblionumber %]">On hold</a> >- [% END %] >- [% IF ( todayissue.renew_error_too_many ) %] >- Not renewable >+ [% ELSE %] >+ [% IF ( todayissue.renew_error_too_many ) %] >+ Not renewable >+ [% ELSE %] >+ [% IF ( todayissue.renew_error_too_soon ) %] >+ Not renewable yet > [% END %] >+ [% END %] >+ [% END %] > [% IF ( todayissue.can_confirm ) %] > </span> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index 79d319e..b392494 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -507,10 +507,15 @@ function validate1(date) { > [% END %] > [% IF ( issueloo.norenew_reason_on_reserve ) %] > <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% issueloo.biblionumber %]">On Hold</a> >- [% END %] >+ [% ELSE %] > [% IF ( issueloo.norenew_reason_too_many ) %] > Not renewable >+ [% ELSE %] >+ [% IF ( issueloo.norenew_reason_too_soon ) %] >+ Not renewable yet >+ [% END %] > [% END %] >+ [% END %] > [% IF ( issueloo.can_confirm ) %] > </span> > [% END %] >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7413
:
24685
|
24686
|
24687
|
24688
|
24689
|
24926
|
24927
|
24928
|
24929
|
24930
|
25166
|
25247
|
25248
|
25249
|
25250
|
25251
|
25252
|
25855
|
25856
|
25857
|
25858
|
25859
|
25860
|
26726
|
26727
|
26728
|
26729
|
26730
|
26731
|
26732
|
26733