Bugzilla – Attachment 38315 Details for
Bug 13919
Renewal possible with item level hold on item
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[Signed-off] Bug 13919 - Renewal possible with item level hold on item
Signed-off-Bug-13919---Renewal-possible-with-item-.patch (text/plain), 5.12 KB, created by
Marc Véron
on 2015-04-22 09:28:55 UTC
(
hide
)
Description:
[Signed-off] Bug 13919 - Renewal possible with item level hold on item
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2015-04-22 09:28:55 UTC
Size:
5.12 KB
patch
obsolete
>From 4358be49e736ab086ea84ab2c038bfd2a7248552 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 30 Mar 2015 10:16:31 -0400 >Subject: [PATCH] [Signed-off] Bug 13919 - Renewal possible with item level > hold on item >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Test Plan: >1) Apply this patch >2) Enable AllowRenewalIfOtherItemsAvailable >3) Check out an item from a record with multiple holdable items >4) Place an item level hold on the checked out item >5) Verify the item can not be renewed from the opac > >Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr> > >Followed test plan, works as expected. >Signed-off-by: Marc Véron <veron@veron.ch> >--- > C4/Circulation.pm | 87 +++++++++++++++++++++++++++++------------------------ > 1 file changed, 47 insertions(+), 40 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index bd192cf..6f36451 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2667,53 +2667,60 @@ sub CanBookBeRenewed { > { > my $schema = Koha::Database->new()->schema(); > >- # Get all other items that could possibly fill reserves >- my @itemnumbers = $schema->resultset('Item')->search( >- { >- biblionumber => $resrec->{biblionumber}, >- onloan => undef, >- -not => { itemnumber => $itemnumber } >- }, >- { columns => 'itemnumber' } >- )->get_column('itemnumber')->all(); >- >- # Get all other reserves that could have been filled by this item >- my @borrowernumbers; >- while (1) { >- my ( $reserve_found, $reserve, undef ) = >- C4::Reserves::CheckReserves( $itemnumber, undef, undef, >- \@borrowernumbers ); >- >- if ($reserve_found) { >- push( @borrowernumbers, $reserve->{borrowernumber} ); >- } >- else { >- last; >- } >+ my $item_holds = $schema->resultset('Reserve')->search( { itemnumber => $itemnumber, found => undef } )->count(); >+ if ($item_holds) { >+ # There is an item level hold on this item, no other item can fill the hold >+ $resfound = 1; > } >+ else { > >- # If the count of the union of the lists of reservable items for each borrower >- # is equal or greater than the number of borrowers, we know that all reserves >- # can be filled with available items. We can get the union of the sets simply >- # by pushing all the elements onto an array and removing the duplicates. >- my @reservable; >- foreach my $b (@borrowernumbers) { >- my ( $borr ) = C4::Members::GetMemberDetails( $b ); >- foreach my $i (@itemnumbers) { >- my $item = GetItem($i); >- if ( IsAvailableForItemLevelRequest($item, $borr) >- && CanItemBeReserved( $b, $i ) >- && !IsItemOnHoldAndFound($i) ) >+ # Get all other items that could possibly fill reserves >+ my @itemnumbers = $schema->resultset('Item')->search( > { >- push( @reservable, $i ); >+ biblionumber => $resrec->{biblionumber}, >+ onloan => undef, >+ -not => { itemnumber => $itemnumber } >+ }, >+ { columns => 'itemnumber' } >+ )->get_column('itemnumber')->all(); >+ >+ # Get all other reserves that could have been filled by this item >+ my @borrowernumbers; >+ while (1) { >+ my ( $reserve_found, $reserve, undef ) = >+ C4::Reserves::CheckReserves( $itemnumber, undef, undef, \@borrowernumbers ); >+ >+ if ($reserve_found) { >+ push( @borrowernumbers, $reserve->{borrowernumber} ); >+ } >+ else { >+ last; >+ } >+ } >+ >+ # If the count of the union of the lists of reservable items for each borrower >+ # is equal or greater than the number of borrowers, we know that all reserves >+ # can be filled with available items. We can get the union of the sets simply >+ # by pushing all the elements onto an array and removing the duplicates. >+ my @reservable; >+ foreach my $b (@borrowernumbers) { >+ my ($borr) = C4::Members::GetMemberDetails($b); >+ foreach my $i (@itemnumbers) { >+ my $item = GetItem($i); >+ if ( IsAvailableForItemLevelRequest( $item, $borr ) >+ && CanItemBeReserved( $b, $i ) >+ && !IsItemOnHoldAndFound($i) ) >+ { >+ push( @reservable, $i ); >+ } > } > } >- } > >- @reservable = uniq(@reservable); >+ @reservable = uniq(@reservable); > >- if ( @reservable >= @borrowernumbers ) { >- $resfound = 0; >+ if ( @reservable >= @borrowernumbers ) { >+ $resfound = 0; >+ } > } > } > >-- >1.7.10.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 13919
:
37376
|
37377
|
37721
|
37722
|
37729
|
38307
|
38308
|
38315
|
38377
|
38378
|
38379