Bugzilla – Attachment 69129 Details for
Bug 18357
On-site checkouts issues with 'Unlimited'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18357: Handle unlimited on-site checkouts
Bug-18357-Handle-unlimited-on-site-checkouts.patch (text/plain), 4.45 KB, created by
Nick Clemens (kidclamp)
on 2017-11-13 16:11:23 UTC
(
hide
)
Description:
Bug 18357: Handle unlimited on-site checkouts
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-11-13 16:11:23 UTC
Size:
4.45 KB
patch
obsolete
>From 559d4c98d20bd8f9ef952ecf4d632781a682d2c3 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 2 Nov 2017 13:22:31 -0300 >Subject: [PATCH] Bug 18357: Handle unlimited on-site checkouts > >If on-site checkouts are set to unlimited (i.e. NULL/undef), they are >currently blocked. > >Test plan: >1/ Set All/All rule with Unlimited/unlimited for normal/onsite checkouts >2/ Will be able to perform onsite checkout >3/ Edit rule to be 15/Unlimited normal/onsite >4/ Will be able to perform onsite checkout >=> Without this patch it was blocked >5/ Set rule to 15/15 >6/ Onsite checkouts work again > >Signed-off-by: David Bourgault <david.bourgault@inlibro.com> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > C4/Circulation.pm | 4 +-- > t/db_dependent/Circulation/TooMany.t | 55 +++++++++++++++++++++++++++++++++++- > 2 files changed, 56 insertions(+), 3 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 5c55e8c..9397cbc 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -474,7 +474,7 @@ sub TooMany { > my $max_checkouts_allowed = $issuing_rule->maxissueqty; > my $max_onsite_checkouts_allowed = $issuing_rule->maxonsiteissueqty; > >- if ( $onsite_checkout ) { >+ if ( $onsite_checkout and defined $max_onsite_checkouts_allowed ) { > if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed ) { > return { > reason => 'TOO_MANY_ONSITE_CHECKOUTS', >@@ -528,7 +528,7 @@ sub TooMany { > my $max_checkouts_allowed = $branch_borrower_circ_rule->{maxissueqty}; > my $max_onsite_checkouts_allowed = $branch_borrower_circ_rule->{maxonsiteissueqty}; > >- if ( $onsite_checkout ) { >+ if ( $onsite_checkout and defined $max_onsite_checkouts_allowed ) { > if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed ) { > return { > reason => 'TOO_MANY_ONSITE_CHECKOUTS', >diff --git a/t/db_dependent/Circulation/TooMany.t b/t/db_dependent/Circulation/TooMany.t >index 7ce7e8e..193752f 100644 >--- a/t/db_dependent/Circulation/TooMany.t >+++ b/t/db_dependent/Circulation/TooMany.t >@@ -15,7 +15,7 @@ > # with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 6; >+use Test::More tests => 7; > use C4::Context; > > use C4::Biblio; >@@ -159,6 +159,59 @@ subtest '1 Issuingrule exist 0 0: no issue allowed' => sub { > teardown(); > }; > >+subtest '1 Issuingrule exist with onsiteissueqty=unlimited' => sub { >+ plan tests => 4; >+ my $issuingrule = $builder->build({ >+ source => 'Issuingrule', >+ value => { >+ branchcode => $branch->{branchcode}, >+ categorycode => $category->{categorycode}, >+ itemtype => '*', >+ maxissueqty => 1, >+ maxonsiteissueqty => undef, >+ }, >+ }); >+ my $issue = C4::Circulation::AddIssue( $patron, $item->{barcode}, dt_from_string() ); >+ t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); >+ is_deeply( >+ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), >+ { >+ reason => 'TOO_MANY_CHECKOUTS', >+ count => 1, >+ max_allowed => 1, >+ }, >+ 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' >+ ); >+ is( >+ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), >+ undef, >+ 'OSCO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' >+ ); >+ >+ t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); >+ is_deeply( >+ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), >+ { >+ reason => 'TOO_MANY_CHECKOUTS', >+ count => 1, >+ max_allowed => 1, >+ }, >+ 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' >+ ); >+ is_deeply( >+ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), >+ { >+ reason => 'TOO_MANY_CHECKOUTS', >+ count => 1, >+ max_allowed => 1, >+ }, >+ 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' >+ ); >+ >+ teardown(); >+}; >+ >+ > subtest '1 Issuingrule exist 1 1: issue is allowed' => sub { > plan tests => 4; > my $issuingrule = $builder->build({ >-- >2.1.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 18357
:
68896
|
68930
| 69129