From 94ca7dc5c89065164e5643f7f199bb3c1ab5866f Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Thu, 26 Mar 2020 06:30:09 +0000 Subject: [PATCH] Bug 24101: Enable renewals for on-site checkouts To test: 1. Enable system preference OnSiteCheckouts 2. Set renewalsallowed circulation rule for on-site checkouts via circulation rules interface 3. Perform an on-site checkout 4. Try to renew the loan 5. Observe a similar error dialog: "Cannot renew on-site checkout: test / ( test ) has been renewed the maximum number of times by ( admin )" Run unit tests: 1. prove t/db_dependent/Circulation.t --- C4/Circulation.pm | 1 - .../prog/en/modules/circ/renew.tt | 5 +-- t/db_dependent/Circulation.t | 32 +------------------ 3 files changed, 2 insertions(+), 36 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 632cba44a1..9385dbc9a5 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2671,7 +2671,6 @@ sub CanBookBeRenewed { my $item = Koha::Items->find($itemnumber) or return ( 0, 'no_item' ); my $issue = $item->checkout or return ( 0, 'no_checkout' ); - return ( 0, 'onsite_checkout' ) if $issue->is_onsite_checkout; return ( 0, 'item_denied_renewal') if _item_denied_renewal({ item => $item }); my $patron = $issue->patron or return; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt index 608ed5c84d..4a502c929d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt @@ -30,7 +30,7 @@ [% IF error %]
-

Cannot renew:

+

Cannot renew[% IF issue.onsite_checkout %] on-site checkout[% END %]:

[% IF error == "no_item" %] @@ -134,9 +134,6 @@

Item is not allowed renewal.

- [% ELSIF error == "onsite_checkout" %] -

Item cannot be renewed because it's an onsite checkout

- [% ELSE %] [% error | html %] diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index ef8959a4ab..bdce9d7961 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -18,7 +18,7 @@ use Modern::Perl; use utf8; -use Test::More tests => 47; +use Test::More tests => 45; use Test::MockModule; use Test::Deep qw( cmp_deeply ); @@ -1536,36 +1536,6 @@ subtest "AllowRenewalIfOtherItemsAvailable tests" => sub { 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 $branch = $library->{branchcode}; - - #Create another record - my $biblio = $builder->build_sample_biblio(); - - my $item = $builder->build_sample_item( - { - biblionumber => $biblio->biblionumber, - library => $branch, - itype => $itemtype, - } - ); - - my $borrowernumber = Koha::Patron->new({ - firstname => 'fn', - surname => 'dn', - categorycode => $patron_category->{categorycode}, - branchcode => $branch, - })->store->borrowernumber; - - my $borrower = Koha::Patrons->find( $borrowernumber )->unblessed; - - my $issue = AddIssue( $borrower, $item->barcode, undef, undef, undef, undef, { onsite_checkout => 1 } ); - my ( $renewed, $error ) = CanBookBeRenewed( $borrowernumber, $item->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' ); -} - { my $library = $builder->build({ source => 'Branch' }); -- 2.17.1