Bugzilla – Attachment 42366 Details for
Bug 14470
Renewals should be disabled in OPAC if are referred to an on-site checkout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 14470: Do not allow renew for on-site checkouts
PASSED-QA-Bug-14470-Do-not-allow-renew-for-on-site.patch (text/plain), 7.78 KB, created by
Katrin Fischer
on 2015-09-03 22:26:03 UTC
(
hide
)
Description:
[PASSED QA] Bug 14470: Do not allow renew for on-site checkouts
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2015-09-03 22:26:03 UTC
Size:
7.78 KB
patch
obsolete
>From c0dfa3e49660113ab3d50d365ea703e35b22d705 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 4 Aug 2015 10:38:29 +0100 >Subject: [PATCH] [PASSED QA] Bug 14470: Do not allow renew for on-site > checkouts > >At the opac, the renew checkbox should not be displayed if it's an >on-site checkout (same on the intranet). > >On the way, this patch adds a specific message to the intranet if the >librarian try to renew an on-site checkout. >Indeed before this patch a renew was allowed if the barcode was scanned. > >Test plan: >1/ Create an on-site checkout for a patron >2/ Confirm that the checkbox 'renew' is not displayed on the checkout >list tables >3/ At the OPAC, the renew should not be allowed (no checkbox) >4/ Try to check the item out to the same patron, confirm that you get a >specifig message to inform you the renew is not allowed for on-site >checkouts. > >Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net> >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >Changed 'issue' to 'item' in the error message. >--- > C4/Circulation.pm | 8 ++++- > koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js | 26 +++++++-------- > .../prog/en/modules/circ/circulation.tt | 4 +++ > t/db_dependent/Circulation.t | 38 +++++++++++++++++++++- > 4 files changed, 61 insertions(+), 15 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 5177203..4ddd75f 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -938,7 +938,12 @@ sub CanBookBeIssued { > $item->{'itemnumber'} > ); > if ( $CanBookBeRenewed == 0 ) { # no more renewals allowed >- $issuingimpossible{NO_MORE_RENEWALS} = 1; >+ if ( $renewerror eq 'onsite_checkout' ) { >+ $issuingimpossible{NO_RENEWAL_FOR_ONSITE_CHECKOUTS} = 1; >+ } >+ else { >+ $issuingimpossible{NO_MORE_RENEWALS} = 1; >+ } > } > else { > $needsconfirmation{RENEW_ISSUE} = 1; >@@ -2667,6 +2672,7 @@ sub CanBookBeRenewed { > > my $item = GetItem($itemnumber) or return ( 0, 'no_item' ); > my $itemissue = GetItemIssue($itemnumber) or return ( 0, 'no_checkout' ); >+ return ( 0, 'onsite_checkout' ) if $itemissue->{onsite_checkout}; > > $borrowernumber ||= $itemissue->{borrowernumber}; > my $borrower = C4::Members::GetMember( borrowernumber => $borrowernumber ) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js >index 23a8426..485c292 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js >@@ -328,6 +328,8 @@ $(document).ready(function() { > > span_style = "display: none"; > span_class = "renewals-allowed"; >+ } else if ( oObj.can_renew_error == "onsite_checkout" ) { >+ // Don't display something if it's an onsite checkout > } else { > content += "<span class='renewals-disabled'>" > + oObj.can_renew_error >@@ -339,20 +341,18 @@ $(document).ready(function() { > > var can_force_renew = ( oObj.onsite_checkout == 0 ) && ( oObj.can_renew_error != "on_reserve" ); > var can_renew = ( oObj.renewals_remaining > 0 && !oObj.can_renew_error ); >- if ( oObj.onsite_checkout == 0 ) { >- if ( can_renew || can_force_renew ) { >- content += "<span class='" + span_class + "' style='" + span_style + "'>" >- + "<input type='checkbox' "; >- if ( oObj.date_due_overdue && can_renew ) { >- content += "checked='checked' "; >- } >- content += "class='renew' id='renew_" + oObj.itemnumber + "' name='renew' value='" + oObj.itemnumber +"'/>" >- + "</span>"; >- >- content += "<span class='renewals'>(" >- + RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed ) >- + ")</span>"; >+ if ( can_renew || can_force_renew ) { >+ content += "<span class='" + span_class + "' style='" + span_style + "'>" >+ + "<input type='checkbox' "; >+ if ( oObj.date_due_overdue && can_renew ) { >+ content += "checked='checked' "; > } >+ content += "class='renew' id='renew_" + oObj.itemnumber + "' name='renew' value='" + oObj.itemnumber +"'/>" >+ + "</span>"; >+ >+ content += "<span class='renewals'>(" >+ + RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed ) >+ + ")</span>"; > } > > content += "</span>"; >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 fd4c53c..bc33091 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -481,6 +481,10 @@ $(document).ready(function() { > <li>No more renewals possible</li> > [% END %] > >+ [% IF NO_RENEWAL_FOR_ONSITE_CHECKOUTS %] >+ <li>This item can not be renewed, it's an on-site checkout</li> >+ [% END %] >+ > [%IF ( AGE_RESTRICTION ) %] > <li>Age restriction [% AGE_RESTRICTION %].</li> > [% END %] >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 591c7e4..f4910ef 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -27,7 +27,7 @@ use C4::Overdues qw(UpdateFine); > use Koha::DateUtils; > use Koha::Database; > >-use Test::More tests => 67; >+use Test::More tests => 69; > > BEGIN { > use_ok('C4::Circulation'); >@@ -685,5 +685,41 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > is( $renewokay, 0, 'Bug 14337 - Verify the borrower can not renew with a hold on the record if AllowRenewalIfOtherItemsAvailable is enabled but the only available item is notforloan' ); > } > >+{ >+ # Don't allow renewing onsite checkout >+ my $barcode = 'R00000XXX'; >+ my $branch = 'CPL'; >+ >+ #Create another record >+ my $biblio = MARC::Record->new(); >+ $biblio->append_fields( >+ MARC::Field->new('100', ' ', ' ', a => 'Anonymous'), >+ MARC::Field->new('245', ' ', ' ', a => 'A title'), >+ ); >+ my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, ''); >+ >+ my (undef, undef, $itemnumber) = AddItem( >+ { >+ homebranch => $branch, >+ holdingbranch => $branch, >+ barcode => $barcode, >+ }, >+ $biblionumber >+ ); >+ >+ my $borrowernumber = AddMember( >+ firstname => 'fn', >+ surname => 'dn', >+ categorycode => 'S', >+ branchcode => $branch, >+ ); >+ >+ my $borrower = GetMember( borrowernumber => $borrowernumber ); >+ my $issue = AddIssue( $borrower, $barcode, undef, undef, undef, undef, { onsite_checkout => 1 } ); >+ my ( $renewed, $error ) = CanBookBeRenewed( $borrowernumber, $itemnumber ); >+ is( $renewed, 0, 'CanBookBeRenewed should not allow to renew on-site checkout' ); >+ is( $error, 'onsite_checkout', 'A correct error code should be returned by CanBookBeRenewed for on-site checkout' ); >+} >+ > $schema->storage->txn_rollback(); > 1; >-- >1.9.1
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 14470
:
40706
|
41336
|
41430
|
41440
|
41444
|
42195
|
42365
| 42366