Bugzilla – Attachment 41992 Details for
Bug 8236
Prevent renewing if overdue or restriction
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8236 Renewing policy in overdue or restriction case
Bug-8236-Renewing-policy-in-overdue-or-restriction.patch (text/plain), 12.56 KB, created by
Alex Arnaud
on 2015-08-26 14:30:51 UTC
(
hide
)
Description:
Bug 8236 Renewing policy in overdue or restriction case
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2015-08-26 14:30:51 UTC
Size:
12.56 KB
patch
obsolete
>From 9d23d7ea5ae016b1f56a1392da1731483e54b80e Mon Sep 17 00:00:00 2001 >From: Lyon3 Team <koha@univ-lyon3.fr> >Date: Mon, 9 Mar 2015 16:24:20 +0100 >Subject: [PATCH] Bug 8236 Renewing policy in overdue or restriction case > >This patch introduces 2 sysprefs : > RestrictionBlockRenewing to allow/block renewal of items when patron is restricted. > OverduesBlockRenewing to allow, block only the late ones or block all checked out items > Default is "allow" in both case. > >Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Circulation.pm | 12 +++++++++++- > .../bug_8236-add-overduesblockrenewing.sql | 1 + > .../bug_8236-add-restrictionblockrenewing.sql | 1 + > installer/data/mysql/sysprefs.sql | 2 ++ > koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc | 2 ++ > koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js | 18 ++++++++++++++++++ > .../en/modules/admin/preferences/circulation.pref | 15 +++++++++++++++ > .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 4 ++++ > opac/opac-user.pl | 3 +++ > 9 files changed, 57 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_8236-add-overduesblockrenewing.sql > create mode 100644 installer/data/mysql/atomicupdate/bug_8236-add-restrictionblockrenewing.sql > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 7813e33..d690d00 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2737,7 +2737,6 @@ sub CanBookBeRenewed { > } > } > } >- > return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found > > return ( 1, undef ) if $override_limit; >@@ -2749,6 +2748,17 @@ sub CanBookBeRenewed { > return ( 0, "too_many" ) > if $issuingrule->{renewalsallowed} <= $itemissue->{renewals}; > >+ my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing'); >+ my $restrictionblockrenewing = C4::Context->preference('RestrictionBlockRenewing'); >+ my $restricted = Koha::Borrower::Debarments::IsDebarred($borrowernumber); >+ my $hasoverdues = C4::Members::HasOverdues($borrowernumber); >+ >+ if ( $restricted and $restrictionblockrenewing ) { >+ return ( 0, 'restriction'); >+ } elsif ( ($hasoverdues and $overduesblockrenewing eq 'block') || ($itemissue->{overdue} and $overduesblockrenewing eq 'blockitem') ) { >+ return ( 0, 'overdue'); >+ } >+ > if ( $issuingrule->{norenewalbefore} ) { > > # Get current time and add norenewalbefore. >diff --git a/installer/data/mysql/atomicupdate/bug_8236-add-overduesblockrenewing.sql b/installer/data/mysql/atomicupdate/bug_8236-add-overduesblockrenewing.sql >new file mode 100644 >index 0000000..72f5406 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_8236-add-overduesblockrenewing.sql >@@ -0,0 +1 @@ >+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OverduesBlockRenewing','allow','If any of a patron checked out documents is late, should renewal be allowed, blocked only on overdue items or blocked on whatever checked out document','allow|blockitem|block','Choice'); >\ No newline at end of file >diff --git a/installer/data/mysql/atomicupdate/bug_8236-add-restrictionblockrenewing.sql b/installer/data/mysql/atomicupdate/bug_8236-add-restrictionblockrenewing.sql >new file mode 100644 >index 0000000..4d3e014 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_8236-add-restrictionblockrenewing.sql >@@ -0,0 +1 @@ >+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('RestrictionBlockRenewing','0','If patron is restricted, should renewal be allowed or blocked',NULL,'YesNo'); >\ No newline at end of file >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index ac79f44..379346d 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -333,6 +333,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'), > ('OverdueNoticeCalendar',0,NULL,'Take the calendar into consideration when generating overdue notices','YesNo'), > ('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'), >+('OverduesBlockRenewing','allow','allow|blockitem|block','If any of patron checked out documents is late, should renewal be allowed, blocked only on overdue items or blocked on whatever checked out document','Choice'), > ('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'), > ('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'), > ('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'), >@@ -368,6 +369,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('RestrictedPageLocalIPs','',NULL,'Beginning of IP addresses considered as local (comma separated ex: "127.0.0,127.0.2")','Free'), > ('RestrictedPageContent','',NULL,'HTML content of the restricted page','TextArea'), > ('RestrictedPageTitle','',NULL,'Title of the restricted page (breadcrumb and header)','Free'), >+('RestrictionBlockRenewing','0',NULL,'If patron is restricted, should renewal be allowed or blocked','YesNo'), > ('ReturnBeforeExpiry','0',NULL,'If ON, checkout will be prevented if returndate is after patron card expiry','YesNo'), > ('ReturnLog','1',NULL,'If ON, enables the circulation (returns) log','YesNo'), > ('ReturnToShelvingCart','0','','If set, when any item is \'checked in\', it\'s location code will be changed to CART.','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc >index 2421ac6..3226ad3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc >@@ -2,6 +2,8 @@ > //<![CDATA[ > var CIRCULATION_RETURNED = _("Checked in"); > var CIRCULATION_NOT_RETURNED = _("Unable to check in"); >+ var NOT_RENEWABLE_OVERDUE = _("Not allowed: overdue"); >+ var NOT_RENEWABLE_RESTRICTION = _("Not allowed: patron restricted"); > var CIRCULATION_RENEWED_DUE = _("Renewed, due:"); > var CIRCULATION_RENEW_FAILED = _("Renew failed:"); > var NOT_CHECKED_OUT = _("not checked out"); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js >index 23a8426..10c95fa 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js >@@ -106,6 +106,10 @@ $(document).ready(function() { > content += TOO_MANY_RENEWALS; > } else if ( data.error == "on_reserve" ) { > content += ON_RESERVE; >+ } else if ( data.error == "restriction" ) { >+ content += NOT_RENEWABLE_RESTRICTION; >+ } else if ( data.error == "overdue" ) { >+ content += NOT_RENEWABLE_OVERDUE; > } else if ( data.error ) { > content += data.error; > } else { >@@ -307,6 +311,20 @@ $(document).ready(function() { > > span_style = "display: none"; > span_class = "renewals-allowed"; >+ } else if ( oObj.can_renew_error == "restriction" ) { >+ content += "<span class='renewals-disabled'>" >+ + NOT_RENEWABLE_RESTRICTION >+ + "</span>"; >+ >+ span_style = "display: none"; >+ span_class = "renewals-allowed"; >+ } else if ( oObj.can_renew_error == "overdue" ) { >+ content += "<span class='renewals-disabled'>" >+ + NOT_RENEWABLE_OVERDUE >+ + "</span>"; >+ >+ span_style = "display: none"; >+ span_class = "renewals-allowed"; > } else if ( oObj.can_renew_error == "too_soon" ) { > content += "<span class='renewals-disabled'>" > + NOT_RENEWABLE_TOO_SOON.format( oObj.can_renew_date ) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index f9cd822..22483f0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -391,6 +391,21 @@ Circulation: > yes: Enable > no: Disable > - the on-site for all cases (Even if a user is debarred, etc.). >+ - >+ - When a patron's checked out item is late, >+ - pref: OverduesBlockRenewing >+ type: choice >+ choices: >+ allow: allow renewing. >+ blockitem: block renewing only for this item. >+ block: block renewing for all his items. >+ - >+ - If patron is restricted, >+ - pref: RestrictionBlockRenewing >+ choices: >+ yes: Block >+ no: Allow >+ - renewing of items. > Checkin Policy: > - > - pref: BlockReturnOfWithdrawnItems >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >index b5bc8d2..87204e0 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -230,6 +230,8 @@ > <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span> > [% ELSIF ( ISSUE.too_many ) %] > Not renewable >+ [% ELSIF ( ISSUE.norenew_overdue ) %] >+ Not allowed <span class="renewals">(overdue on a document)</span> > [% ELSIF ( ISSUE.auto_renew || ISSUE.auto_too_soon ) %] > Automatic renewal > <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span> >@@ -463,6 +465,8 @@ > <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&item=[% OVERDUE.itemnumber %]&bornum=[% OVERDUE.borrowernumber %]">Renew</a> > [% END %] > <span class="renewals">([% OVERDUE.renewsleft %] of [% OVERDUE.renewsallowed %] renewals remaining)</span> >+ [% ELSIF ( OVERDUE.norenew_overdue ) %] >+ Not allowed<span class="renewals">(overdue on a document)</span> > [% ELSIF ( OVERDUE.onreserve ) %] > On hold > [% ELSE %] >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index d4fbbe3..248008b 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -198,6 +198,7 @@ if ($issues){ > if ($renewerror) { > $issue->{'too_many'} = 1 if $renewerror eq 'too_many'; > $issue->{'on_reserve'} = 1 if $renewerror eq 'on_reserve'; >+ $issue->{'norenew_overdue'} = 1 if $renewerror eq 'overdue'; > $issue->{'auto_renew'} = 1 if $renewerror eq 'auto_renew'; > $issue->{'auto_too_soon'} = 1 if $renewerror eq 'auto_too_soon'; > >@@ -244,6 +245,8 @@ if ($issues){ > } > } > } >+my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing'); >+$canrenew = 0 if ($overduesblockrenewing ne 'allow' and $overdues_count == $count); > $template->param( ISSUES => \@issuedat ); > $template->param( issues_count => $count ); > $template->param( canrenew => $canrenew ); >-- >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 8236
:
10230
|
11958
|
12362
|
12619
|
12727
|
12790
|
12791
|
13510
|
14433
|
17926
|
18071
|
18073
|
18507
|
18729
|
20716
|
20719
|
21163
|
21223
|
22264
|
22275
|
22280
|
34234
|
34322
|
35372
|
36674
|
36743
|
37407
|
37418
|
37457
|
37458
|
37459
| 41992 |
41993
|
41994
|
42007
|
43628