Bugzilla – Attachment 90802 Details for
Bug 23116
Cannot place overridden holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23116: AllowHoldPolicyOverride allows a librarian to almost place a hold on an item already on hold
Bug-23116-AllowHoldPolicyOverride-allows-a-librari.patch (text/plain), 4.65 KB, created by
Nick Clemens (kidclamp)
on 2019-06-19 15:53:26 UTC
(
hide
)
Description:
Bug 23116: AllowHoldPolicyOverride allows a librarian to almost place a hold on an item already on hold
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2019-06-19 15:53:26 UTC
Size:
4.65 KB
patch
obsolete
>From 0d7727433b343298bcc5c642a13af2d99314c106 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 13 Jun 2019 06:34:38 -0400 >Subject: [PATCH] Bug 23116: AllowHoldPolicyOverride allows a librarian to > almost place a hold on an item already on hold > >A library appears to be able to place a second item level hold on an item a patron already has on hold if >A) AllowHoldPolicyOverride is enabled >and >B) the circ rule allow for multple item level holds. > >Once the patron submits the hold requests though, the hold does not get stored in the database. > >Because allowing two item level holds for the same item makes no sense, we should not allow >this attempt to take place, even if AllowHoldPolicyOverride is enabled. > >Test Plan: > 1) Enable AllowHoldPolicyOverride > 2) Set up circ rules to allow for multiple item level holds on one record > 3) Place an item level hold on a record > 4) Note you can force placing a second item hold on that reocrd > 5) Attempt to do so, it will not actually work > 6) Apply this patch > 7) Note you can no longer place another item level hold for the same item > you just placed an item-level hold on > 8) Note you can still force holds that contravene the circ rules for > any and all other reasons > 9) Test with record level holds >10) Test by placing multiple holds from search results > >Signed-off-by: Martha Fuerst <mfurest@hmcpl.org> >--- > reserve/placerequest.pl | 13 ++++++++++--- > reserve/request.pl | 7 +++++-- > 2 files changed, 15 insertions(+), 5 deletions(-) > >diff --git a/reserve/placerequest.pl b/reserve/placerequest.pl >index 35add4829a..89c591d55b 100755 >--- a/reserve/placerequest.pl >+++ b/reserve/placerequest.pl >@@ -88,26 +88,33 @@ if ( $type eq 'str8' && $borrower ) { > } > } > >+ my $can_override = C4::Context->preference('AllowHoldPolicyOverride'); > if ( defined $checkitem && $checkitem ne '' ) { >+ > my $item = Koha::Items->find($checkitem); >+ > if ( $item->biblionumber ne $biblionumber ) { > $biblionumber = $item->biblionumber; > } >- if ( CanItemBeReserved($borrower->{'borrowernumber'}, $item->itemnumber, $branch)->{status} eq 'OK' ) { >+ >+ my $can_item_be_reserved = CanItemBeReserved($borrower->{'borrowernumber'}, $item->itemnumber, $branch)->{status}; >+ >+ if ( $can_item_be_reserved eq 'OK' || ( $can_item_be_reserved ne 'itemAlreadyOnHold' && $can_override ) ) { > AddReserve( $branch, $borrower->{'borrowernumber'}, > $biblionumber, \@realbi, $rank[0], $startdate, $expirationdate, $notes, $title, > $checkitem, $found, $itemtype ); > } >+ > } elsif ($multi_hold) { > my $bibinfo = $bibinfos{$biblionumber}; >- if ( CanBookBeReserved($borrower->{'borrowernumber'}, $biblionumber)->{status} eq 'OK' ) { >+ if ( $can_override || CanBookBeReserved($borrower->{'borrowernumber'}, $biblionumber)->{status} eq 'OK' ) { > AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,[$biblionumber], > $bibinfo->{rank},$startdate,$expirationdate,$notes,$bibinfo->{title},$checkitem,$found); > } > } else { > # place a request on 1st available > for ( my $i = 0 ; $i < $holds_to_place_count ; $i++ ) { >- if ( CanBookBeReserved($borrower->{'borrowernumber'}, $biblionumber)->{status} eq 'OK' ) { >+ if ( $can_override || CanBookBeReserved($borrower->{'borrowernumber'}, $biblionumber)->{status} eq 'OK' ) { > AddReserve( $branch, $borrower->{'borrowernumber'}, > $biblionumber, \@realbi, $rank[0], $startdate, $expirationdate, $notes, $title, > $checkitem, $found, $itemtype ); >diff --git a/reserve/request.pl b/reserve/request.pl >index f559ed0929..c709cec7e5 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -508,8 +508,11 @@ foreach my $biblionumber (@biblionumbers) { > } > elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) { > # If AllowHoldPolicyOverride is set, it should override EVERY restriction, not just branch item rules >- $item->{override} = 1; >- $num_override++; >+ # with the exception of itemAlreadyOnHold because, you know, the item is already on hold >+ if ( $can_item_be_reserved ne 'itemAlreadyOnHold' ) { >+ $item->{override} = 1; >+ $num_override++; >+ } > > push( @available_itemtypes, $item->{itype} ); > } >-- >2.11.0
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 23116
:
90565
|
90566
|
90754
|
90800
|
90802
|
90974