Bugzilla – Attachment 18071 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 Block renewing for overdue items
0001-Bug-8236-Block-renewing-for-overdue-items.patch (text/plain), 26.35 KB, created by
Koha Team University Lyon 3
on 2013-05-10 15:05:33 UTC
(
hide
)
Description:
Bug 8236 Block renewing for overdue items
Filename:
MIME Type:
Creator:
Koha Team University Lyon 3
Created:
2013-05-10 15:05:33 UTC
Size:
26.35 KB
patch
obsolete
>From a15e8e662927fa30a00ff4359782ec1b10afe444 Mon Sep 17 00:00:00 2001 >From: Lyon3 Team <koha@univ-lyon3.fr> >Date: Wed, 8 May 2013 12:22:17 -0400 >Subject: [PATCH] Bug 8236 Block renewing for overdue items > >If any of patron's document is late, renewal can be allowed, blocked on every checked >out items or only on overdue ones. >The renewal remains nevertheless possible for the librarian checking the Override renewal limit >--- > C4/Circulation.pm | 46 ++++++++++++++++- > C4/ILSDI/Services.pm | 5 +- > circ/circulation.pl | 8 ++- > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 7 +++ > .../en/modules/admin/preferences/circulation.pref | 8 +++ > .../prog/en/modules/circ/circulation.tt | 53 ++++++++++++++----- > .../prog/en/modules/members/moremember.tt | 30 ++++++++++- > koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 6 ++- > members/moremember.pl | 7 ++- > opac/opac-renew.pl | 6 ++- > opac/opac-user.pl | 11 ++++- > reserve/renewscript.pl | 5 +- > 13 files changed, 159 insertions(+), 34 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 1de40e8..4b36a9b 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -75,6 +75,7 @@ BEGIN { > push @EXPORT, qw( > &CanBookBeIssued > &CanBookBeRenewed >+ &HasWhateverRenewalToBeBlocked > &AddIssue > &AddRenewal > &GetRenewCount >@@ -2441,7 +2442,7 @@ already renewed the loan. $error will contain the reason the renewal can not pro > sub CanBookBeRenewed { > > # check renewal status >- my ( $borrowernumber, $itemnumber, $override_limit ) = @_; >+ my ( $borrowernumber, $itemnumber, $override_limit, $overduesblockrenew ) = @_; > my $dbh = C4::Context->dbh; > my $renews = 1; > my $renewokay = 0; >@@ -2450,13 +2451,15 @@ sub CanBookBeRenewed { > my $borrower = C4::Members::GetMemberDetails( $borrowernumber, 0 ) or return; > my $item = GetItem($itemnumber) or return; > my $itemissue = GetItemIssue($itemnumber) or return; >+ my $overdue = $itemissue->{'overdue'}; > > my $branchcode = _GetCircControlBranch($item, $borrower); > > my $issuingrule = GetIssuingRule($borrower->{categorycode}, $item->{itype}, $branchcode); > > if ( ( $issuingrule->{renewalsallowed} > $itemissue->{renewals} ) || $override_limit ) { >- $renewokay = 1; >+ $renewokay = ( $overduesblockrenew eq 'blockitem' and $overdue and !$override_limit ) ? 0 : 1; >+ $error = 'overdue' unless $renewokay; > } else { > $error = "too_many"; > } >@@ -2466,10 +2469,47 @@ sub CanBookBeRenewed { > $renewokay = 0; > $error = "on_reserve"; > } >- > return ( $renewokay, $error ); > } > >+=head2 HasWhateverRenewalToBeBlocked >+ >+ ($blockallitems, $reasonwhy, $overduesblockrenew) = &HasWhateverRenewalToBeBlocked($borrowernumber, $override_limit); >+ >+Check whether whatever renewal must be blocked in the case patron is restricted or any of his documents are late. >+ >+C<$blockallitems> if true, causes the renewal to be blocked for every items. >+ >+C<$reasonwhy> if $blockallitems is true, will be an information displayed in checkouts table on patron page. >+ >+C<$overduesblockrenew> is the value of the syspref OverduesBlockRenew. >+ >+=cut >+ >+sub HasWhateverRenewalToBeBlocked { >+ my $borrowernumber = shift; >+ my $override_limit = shift; >+ # get the option selected for the syspref OverduesBlockRenew >+ my $overduesblockrenew = C4::Context->preference('OverduesBlockRenew'); >+ my $blockallitems; >+ my $reasonwhy; >+ unless ( $override_limit ) { >+ # check if patron is restricted or if any of his documents are late >+ my ($memberblocked) = C4::Members::IsMemberBlocked($borrowernumber); >+ if ($memberblocked == 1) { >+ $reasonwhy = 'restriction'; >+ $blockallitems = 1; >+ } elsif ($memberblocked == -1) { >+ # check if renewal must be blocked for all the patron's documents on loan >+ if ( $overduesblockrenew eq 'blockall' ) { >+ $blockallitems = 1; >+ $reasonwhy = 'overdue'; >+ } >+ } >+ } >+ return($blockallitems,$reasonwhy,$overduesblockrenew); >+} >+ > =head2 AddRenewal > > &AddRenewal($borrowernumber, $itemnumber, $branch, [$datedue], [$lastreneweddate]); >diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm >index 68cbdb3..bd140ec 100644 >--- a/C4/ILSDI/Services.pm >+++ b/C4/ILSDI/Services.pm >@@ -561,11 +561,10 @@ sub RenewLoan { > return { code => 'RecordNotFound' } unless $$item{itemnumber}; > > # Add renewal if possible >- my @renewal = CanBookBeRenewed( $borrowernumber, $itemnumber ); >+ my ($blockallitems,$reasonwhy,$overduesblockrenew) = HasAnyRenewalToBeBlocked($borrowernumber,undef); >+ my @renewal = $blockallitems ? (0, $reasonwhy) : CanBookBeRenewed( $borrowernumber, $itemnumber, undef, $overduesblockrenew ); > if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber ); } > >- my $issue = GetItemIssue($itemnumber); >- > # Hashref building > my $out; > $out->{'renewals'} = $issue->{'renewals'}; >diff --git a/circ/circulation.pl b/circ/circulation.pl >index ef0edf7..1fb5b8a 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -435,6 +435,8 @@ my $displayrelissues; > > our $totalprice = 0; > >+my ($blockallitems, $reasonwhy, $overduesblockrenew) = HasWhateverRenewalToBeBlocked($borrowernumber, undef); >+ > sub build_issue_data { > my $issueslist = shift; > my $relatives = shift; >@@ -450,10 +452,10 @@ sub build_issue_data { > $it->{'itemnumber'}, $it->{'borrowernumber'} > ); > $it->{'charge'} = sprintf("%.2f", $it->{'charge'}); >- my ($can_renew, $can_renew_error) = CanBookBeRenewed( >- $it->{'borrowernumber'},$it->{'itemnumber'} >- ); >+ my ($can_renew, $can_renew_error) = $blockallitems ? (0, $reasonwhy) : CanBookBeRenewed( >+ $it->{'borrowernumber'},$it->{'itemnumber'}, undef, $overduesblockrenew); > $it->{"renew_error_${can_renew_error}"} = 1 if defined $can_renew_error; >+ $it->{'blockrenewal'} = ($can_renew_error=~/overdue|restriction/) ? 1 : 0; > my $restype = C4::Reserves::GetReserveStatus( $it->{'itemnumber'} ); > $it->{'can_renew'} = $can_renew; > $it->{'can_confirm'} = !$can_renew && !$restype; >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 34e2ca0..bf8e9f3 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -424,3 +424,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES(' > INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPAC','0','','If on, and a patron is logged into the OPAC, items from his or her home library will be emphasized and shown first in search results and item details.','YesNo'); > INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPACWhich','PatronBranch','PatronBranch|OpacURLBranch','Decides which branch''s items to emphasize. If PatronBranch, emphasize the logged in user''s library''s items. If OpacURLBranch, highlight the items of the Apache var BRANCHCODE defined in Koha''s Apache configuration file.','Choice'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UniqueItemFields', 'barcode', 'Space-separated list of fields that should be unique (used in acquisition module for item creation). Fields must be valid SQL column names of items table', '', 'Free'); >+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OverduesBlockRenew','allow','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','allow|blockitem|blockall','Choice'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index be4dfa2..a146b4b 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6784,6 +6784,13 @@ if ( CheckVersion($DBversion) ) { > SetVersion ($DBversion); > } > >+$DBversion = "3.11.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OverduesBlockRenew','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|blockall','Choice')"); >+ print "Upgrade to $DBversion done (Add system preference OverduesBlockRenew)\n"; >+ SetVersion($DBversion); >+} >+ > > =head1 FUNCTIONS > >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 f88d964..43eadc4 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 >@@ -298,6 +298,14 @@ Circulation: > confirmation: Ask for confirmation > - when checking out to a borrower that has overdues outstanding > - >+ - If any of a patron's checked out items are late, >+ - pref: OverduesBlockRenew >+ type: choice >+ choices: >+ allow: allow renewing of items. >+ blockall: block renewing for all items. >+ blockitem: block renewing only for overdue items. >+ - > - On checkin route the returned item to > - pref: HomeOrHoldingBranchReturn > type: choice >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 05dbefa..a0e0905 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -20,10 +20,12 @@ > <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery-ui-timepicker-addon.js"></script> > <script type="text/javascript"> > //<![CDATA[ >+ > [% IF ( UseTablesortForCirc && dateformat == 'metric' ) %]dt_add_type_uk_date();[% END %] > [% IF ( borrowernumber ) %]if($.cookie("holdfor") != [% borrowernumber %]){ $.cookie("holdfor",null, { path: "/", expires: 0 }); }[% ELSE %]$.cookie("holdfor",null, { path: "/", expires: 0 });[% END %] > [% UNLESS ( borrowernumber ) %][% UNLESS ( CGIselectborrower ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %][% END %] > $(document).ready(function() { >+ $(function(){ hiderenew() }); > $('#patronlists').tabs([% IF ( UseTablesortForCirc ) %]{ > // Correct table sizing for tables hidden in tabs > // http://www.datatables.net/examples/api/tabs_and_scrolling.html >@@ -67,8 +69,12 @@ > $( '#override_limit' ).click( function () { > if ( this.checked ) { > $( '.renewals-allowed' ).show(); $( '.renewals-disabled' ).hide(); >+ $("input[name='renew_checked']").val('Renew or Return checked items'); >+ $("input[name='renew_all']").css('display','inline'); >+ > } else { > $( '.renewals-allowed' ).hide(); $( '.renewals-disabled' ).show(); >+ hiderenew(); > } > } ).attr( 'checked', false ); > [% END %][% IF ( CircAutoPrintQuickSlip ) %] >@@ -78,7 +84,6 @@ > return printx_window('qslip'); } > });[% END %] > >- > var allcheckboxes = $(".checkboxed"); > $("#renew_all").click(function(){ > $(allcheckboxes).checkCheckboxes(":input[name*=items]"); >@@ -235,6 +240,22 @@ function validate1(date) { > return false; > } > }; >+ >+function hiderenew () { >+ var valid=false; >+ $("input[name^=items]").parent().each(function(){ >+ if($(this).css('display') !='none'){ >+ valid = true; >+ return; >+ } >+ }); >+ if(!valid){ >+ $("input[name='renew_checked']").val('Return checked items'); >+ $("input[name='renew_all']").css('display','none'); >+ } >+ return; >+}; >+ > //]]> > </script> > </head> >@@ -841,15 +862,13 @@ No patron matched <span class="ex">[% message %]</span> > <td><span style="padding: 0 1em;">[% IF ( todayissue.renewals ) %][% todayissue.renewals %][% ELSE %]0[% END %]</span> > [% IF ( todayissue.can_renew ) %] > <input type="checkbox" name="all_items[]" value="[% todayissue.itemnumber %]" checked="checked" style="display: none;" /> >- [% IF ( todayissue.od ) %] >+ [% IF ( todayissue.od) %] > <input type="checkbox" class="radio" name="items[]" value="[% todayissue.itemnumber %]" checked="checked" /> >- [% ELSE %] >- <input type="checkbox" class="radio" name="items[]" value="[% todayissue.itemnumber %]" /> > [% END %] > [% ELSE %] > [% IF ( todayissue.can_confirm ) %]<span class="renewals-allowed" style="display: none"> > <input type="checkbox" name="all_items[]" value="[% todayissue.itemnumber %]" checked="checked" style="display: none;" /> >- [% IF ( todayissue.od ) %] >+ [% IF ( todayissue.od and !todayissue.blockrenewal ) %] > <input type="checkbox" class="radio" name="items[]" value="[% todayissue.itemnumber %]" checked="checked" /> > [% ELSE %] > <input type="checkbox" class="radio" name="items[]" value="[% todayissue.itemnumber %]" /> >@@ -860,9 +879,13 @@ No patron matched <span class="ex">[% message %]</span> > [% 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 >- [% END %] >+ [% IF ( todayissue.renew_error_restriction ) %] >+ Renewal not allowed (restriction) >+ [% ELSIF ( todayissue.renew_error_overdue ) %] >+ Renewal not allowed (overdue) >+ [% ELSIF ( todayissue.renew_error_too_many ) %] >+ Not renewable >+ [% END %] > [% IF ( todayissue.can_confirm ) %] > </span> > [% END %] >@@ -932,13 +955,11 @@ No patron matched <span class="ex">[% message %]</span> > <input type="checkbox" name="all_items[]" value="[% previssue.itemnumber %]" checked="checked" style="display: none;" /> > [% IF ( previssue.od ) %] > <input type="checkbox" class="radio" name="items[]" value="[% previssue.itemnumber %]" checked="checked" /> >- [% ELSE %] >- <input type="checkbox" class="radio" name="items[]" value="[% previssue.itemnumber %]" /> > [% END %] > [% ELSE %] > [% IF ( previssue.can_confirm ) %]<span class="renewals-allowed" style="display: none"> > <input type="checkbox" name="all_items[]" value="[% previssue.itemnumber %]" checked="checked" style="display: none;" /> >- [% IF ( previssue.od ) %] >+ [% IF ( previssue.od and !previssue.blockrenewal ) %] > <input type="checkbox" class="radio" name="items[]" value="[% previssue.itemnumber %]" checked="checked" /> > [% ELSE %] > <input type="checkbox" class="radio" name="items[]" value="[% previssue.itemnumber %]" /> >@@ -949,9 +970,13 @@ No patron matched <span class="ex">[% message %]</span> > [% IF ( previssue.renew_error_on_reserve ) %] > <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% previssue.biblionumber %]">On hold</a> > [% END %] >- [% IF ( previssue.renew_error_too_many ) %] >- Not renewable >- [% END %] >+ [% IF ( previssue.renew_error_restriction ) %] >+ Renewal not allowed (restriction) >+ [% ELSIF ( previssue.renew_error_overdue ) %] >+ Renewal not allowed (overdue) >+ [% ELSIF ( previssue.renew_error_too_many ) %] >+ Not renewable >+ [% END %] > [% IF ( previssue.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 0b23a74..f0ae2da 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -18,6 +18,7 @@ > <script type="text/JavaScript"> > //<![CDATA[ > $(document).ready(function() { >+ $(function(){ hiderenew() }); > $('#finesholdsissues').tabs({ > // Correct table sizing for tables hidden in tabs > // http://www.datatables.net/examples/api/tabs_and_scrolling.html >@@ -85,8 +86,11 @@ $(document).ready(function() { > $( '#override_limit' ).click( function () { > if ( this.checked ) { > $( '.renewals-allowed' ).show(); $( '.renewals-disabled' ).hide(); >+ $("input[name='renew_checked']").val('Renew or Return checked items'); >+ $("input[name='renew_all']").css('display','inline'); > } else { > $( '.renewals-allowed' ).hide(); $( '.renewals-disabled' ).show(); >+ hiderenew(); > } > } ).attr( 'checked', false ); > [% END %] >@@ -141,6 +145,22 @@ function validate1(date) { > return false; > } > }; >+ >+function hiderenew () { >+ var valid=false; >+ $("input[name^=items]").parent().each(function(){ >+ if($(this).css('display') !='none'){ >+ valid = true; >+ return; >+ } >+ }); >+ if(!valid){ >+ $("input[name='renew_checked']").val('Return checked items'); >+ $("input[name='renew_all']").css('display','none'); >+ } >+ return; >+}; >+ > //]]> > </script> > >@@ -496,7 +516,7 @@ function validate1(date) { > [% IF ( issueloo.norenew ) %] > [% IF ( issueloo.can_confirm ) %]<span class="renewals-allowed" style="display: none"> > <input type="checkbox" name="all_items[]" value="[% issueloo.itemnumber %]" checked="checked" style="display: none;" /> >- [% IF ( issueloo.od ) %] >+ [% IF ( issueloo.od and !issueloo.blockrenewal ) %] > <input type="checkbox" name="items[]" value="[% issueloo.itemnumber %]" checked="checked" /> > [% ELSE %] > <input type="checkbox" name="items[]" value="[% issueloo.itemnumber %]" /> >@@ -507,9 +527,13 @@ function validate1(date) { > [% IF ( issueloo.norenew_reason_on_reserve ) %] > <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% issueloo.biblionumber %]">On Hold</a> > [% END %] >- [% IF ( issueloo.norenew_reason_too_many ) %] >+ [% IF ( issueloo.norenew_reason_restriction ) %] >+ Renewal not allowed (restriction) >+ [% ELSIF ( issueloo.norenew_reason_overdue ) %] >+ Renewal not allowed (overdue) >+ [% ELSIF ( issueloo.norenew_reason_too_many ) %] > Not renewable >- [% END %] >+ [% END %] > [% IF ( issueloo.can_confirm ) %] > </span> > [% END %] >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt >index 96f6e8d..0925f7a 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt >@@ -195,8 +195,11 @@ $.tablesorter.addParser({ > [% IF ( OpacRenewalAllowed ) %] > <td class="renew">[% IF ( ISSUE.status ) %][% IF ( canrenew ) %]<input type="checkbox" name="item" value="[% ISSUE.itemnumber %]"/> <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&item=[% ISSUE.itemnumber %]&borrowernumber=[% ISSUE.borrowernumber %]">Renew</a>[% END %] <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span> > [% ELSE %] >+ [% IF ( ISSUE.norenew_overdue ) %] >+ Renewal not allowed <span class="renewals">(overdue on a document)</span> >+ [% ELSE %] > Not renewable[% IF ( ISSUE.too_many ) %] <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span>[% ELSE %][% IF ( ISSUE.on_reserve ) %] <span class="renewals">(On hold)</span>[% END %][% END %] >- [% END %]</td> >+ [% END %][% END %]</td> > [% END %] > [% IF ( OPACFinesTab ) %] > <td class="fines">[% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %]</td> >@@ -339,6 +342,7 @@ $.tablesorter.addParser({ > [% ELSIF ( OVERDUE.status ) %] > [% IF ( canrenew ) %]<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.onreserve ) %]On hold >+[% ELSIF ( OVERDUE.norenew_overdue ) %]Renewal not allowed<span class="renewals">(overdue on a document)</span> > [% ELSE %]No renewals left > [% END %] > </td>[% END %] >diff --git a/members/moremember.pl b/members/moremember.pl >index 2e5c66a..a6f9857 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -251,6 +251,8 @@ my @borrowers_with_issues; > my $overdues_exist = 0; > my $totalprice = 0; > >+my ($blockallitems, $reasonwhy, $overduesblockrenew) = HasWhateverRenewalToBeBlocked($borrowernumber, $override_limit); >+ > my @issuedata = build_issue_data($issue); > my @relissuedata = build_issue_data($relissue); > >@@ -502,12 +504,11 @@ sub build_issue_data { > > $row{'charge'} = sprintf( "%.2f", $charge ); > >- my ( $renewokay, $renewerror ) = >- CanBookBeRenewed( $borrowernumber, $issue->{itemnumber}, >- $override_limit ); >+ my ( $renewokay, $renewerror ) = $blockallitems ? (0, $reasonwhy) : CanBookBeRenewed( $borrowernumber, $issue->{itemnumber}, $override_limit, $overduesblockrenew ); > $row{'norenew'} = !$renewokay; > $row{'can_confirm'} = ( !$renewokay && $renewerror ne 'on_reserve' ); > $row{"norenew_reason_$renewerror"} = 1 if $renewerror; >+ $row{'blockrenewal'} = ($renewerror=~ /overdue|restriction/) ? 1 : 0; > $row{renew_failed} = $renew_failed{ $issue->{itemnumber} }; > $row{return_failed} = $return_failed{ $issue->{barcode} }; > push( @{$localissue}, \%row ); >diff --git a/opac/opac-renew.pl b/opac/opac-renew.pl >index c699b35..08e44f9 100755 >--- a/opac/opac-renew.pl >+++ b/opac/opac-renew.pl >@@ -46,8 +46,12 @@ my @items = $query->param('item'); > my $opacrenew = C4::Context->preference("OpacRenewalAllowed"); > > my $errorstring=''; >+ >+my ($blockallitems, $reasonwhy, $overduesblockrenew) = HasWhateverRenewalToBeBlocked($borrowernumber, $override_limit); >+ > for my $itemnumber ( @items ) { >- my ($status,$error) = CanBookBeRenewed( $borrowernumber, $itemnumber ); >+ >+ my ($status,$error) = $blockallitems ? (0, $reasonwhy) : CanBookBeRenewed( $borrowernumber, $itemnumber, undef, $overduesblockrenew ); > if ( $status == 1 && $opacrenew == 1 ) { > my $renewalbranch = C4::Context->preference('OpacRenewalBranch'); > my $branchcode; >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index 750a9c3..afc3f0c 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -155,6 +155,10 @@ my @overdues; > my @issuedat; > my $itemtypes = GetItemTypes(); > my $issues = GetPendingIssues($borrowernumber); >+ >+ >+my ($blockallitems, $reasonwhy, $overduesblockrenew) = HasWhateverRenewalToBeBlocked($borrowernumber, undef); >+ > if ($issues){ > foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) { > # check for reserves >@@ -178,11 +182,12 @@ if ($issues){ > $issue->{'charges'} = $charges; > > # check if item is renewable >- my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} ); >+ my ($status,$renewerror) = $blockallitems ? (0, $reasonwhy) : CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'}, undef, $overduesblockrenew); > ($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'}); > if($status && C4::Context->preference("OpacRenewalAllowed")){ > $issue->{'status'} = $status; > } >+ $issue->{'norenew_overdue'} = 1 if $renewerror and $renewerror eq 'overdue'; > $issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many'; > $issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq 'on_reserve'; > >@@ -218,12 +223,16 @@ if ($issues){ > } > } > } >+ >+$canrenew = 0 if ($overduesblockrenew ne 'allow' and $overdues_count == $count); >+ > $template->param( ISSUES => \@issuedat ); > $template->param( issues_count => $count ); > $template->param( canrenew => $canrenew ); > $template->param( OVERDUES => \@overdues ); > $template->param( overdues_count => $overdues_count ); > >+ > my $show_barcode = C4::Members::AttributeTypes::AttributeTypeExists( ATTRIBUTE_SHOW_BARCODE ); > if ($show_barcode) { > my $patron_show_barcode = GetBorrowerAttributeValue($borrowernumber, ATTRIBUTE_SHOW_BARCODE); >diff --git a/reserve/renewscript.pl b/reserve/renewscript.pl >index dbdced9..0c1900d 100755 >--- a/reserve/renewscript.pl >+++ b/reserve/renewscript.pl >@@ -81,11 +81,12 @@ my $borrowernumber = $input->param("borrowernumber"); > my $exemptfine = $input->param("exemptfine") || 0; > my $override_limit = $input->param("override_limit") || 0; > my $failedrenews = q{}; >+my ($blockallitems, $reasonwhy, $overduesblockrenew) = HasWhateverRenewalToBeBlocked($borrowernumber, $override_limit); >+ > foreach my $itemno (@data) { > > # check status before renewing issue >- my ( $renewokay, $error ) = >- CanBookBeRenewed( $borrowernumber, $itemno, $override_limit ); >+ my ( $renewokay, $error ) = $blockallitems ? (0, $reasonwhy) : CanBookBeRenewed( $borrowernumber, $itemno, $override_limit, $overduesblockrenew ); > if ($renewokay) { > AddRenewal( $borrowernumber, $itemno, $branch, $datedue ); > } >-- >1.7.2.5 >
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