Bugzilla – Attachment 189915 Details for
Bug 15261
Verify if checkout or hold request periods overlap with existing holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15261: Add overlap reserve check in ILS-DI HoldTitle and HoldItem
Bug-15261-Add-overlap-reserve-check-in-ILS-DI-Hold.patch (text/plain), 4.08 KB, created by
Arthur Suzuki
on 2025-11-24 14:00:28 UTC
(
hide
)
Description:
Bug 15261: Add overlap reserve check in ILS-DI HoldTitle and HoldItem
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2025-11-24 14:00:28 UTC
Size:
4.08 KB
patch
obsolete
>From 91c57a9e64f7d8a20051518b96483700c64b2dc6 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Fri, 8 Nov 2019 10:22:09 +0100 >Subject: [PATCH] Bug 15261: Add overlap reserve check in ILS-DI HoldTitle and > HoldItem > >Test plan : >- apply the tests patch. >- prove t/db_dependent/ILSDI_Services.t => it should fail >- apply fix patch and run the tests again. >- tests should pass. >--- > C4/ILSDI/Services.pm | 33 +++++++++++++-------------------- > C4/Reserves.pm | 8 ++++++++ > 2 files changed, 21 insertions(+), 20 deletions(-) > >diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm >index b528e78a46..f0c5fb9d4c 100644 >--- a/C4/ILSDI/Services.pm >+++ b/C4/ILSDI/Services.pm >@@ -796,9 +796,8 @@ sub HoldTitle { > > my $title = $biblio ? $biblio->title : ''; > >- # Check if the biblio can be reserved >- my $code = CanBookBeReserved( $borrowernumber, $biblionumber )->{status}; >- return { code => $code } unless ( $code eq 'OK' ); >+ my $resdate = $cgi->param('start_date'); >+ my $expdate = $cgi->param('expiry_date'); > > my $branch; > >@@ -814,14 +813,12 @@ sub HoldTitle { > return { code => 'libraryNotPickupLocation' } unless $destination->pickup_location; > return { code => 'cannotBeTransferred' } unless $biblio->can_be_transferred( { to => $destination } ); > >- my $resdate = $cgi->param('start_date'); >- my $expdate = $cgi->param('expiry_date'); >- >- if ( C4::Context->preference('PreventReservesOnSamePeriod') >- && ReservesOnSamePeriod( $biblionumber, undef, $resdate, $expdate ) ) >- { >- return { code => 'overlap' }; >- } >+ # Check if the biblio can be reserved >+ my $code = CanBookBeReserved( >+ $borrowernumber, $biblionumber, $branch, >+ { start_date => $resdate, expiry_date => $expdate } >+ )->{status}; >+ return { code => $code } unless ( $code eq 'OK' ); > > # Add the reserve > # $branch, $borrowernumber, $biblionumber, >@@ -912,18 +909,14 @@ sub HoldItem { > $branch = $patron->branchcode; > } > >- # Check for item disponibility >- my $canitembereserved = C4::Reserves::CanItemBeReserved( $patron, $item, $branch )->{status}; >- return { code => $canitembereserved } unless $canitembereserved eq 'OK'; >- > my $resdate = $cgi->param('start_date'); > my $expdate = $cgi->param('expiry_date'); > >- if ( C4::Context->preference('PreventReservesOnSamePeriod') >- && ReservesOnSamePeriod( $biblionumber, $itemnumber, $resdate, $expdate ) ) >- { >- return { code => 'overlap' }; >- } >+ # Check for item disponibility >+ my $canitembereserved = >+ C4::Reserves::CanItemBeReserved( $patron, $item, $branch, { start_date => $resdate, expiry_date => $expdate } ) >+ ->{status}; >+ return { code => $canitembereserved } unless $canitembereserved eq 'OK'; > > # Add the reserve > my $priority = C4::Reserves::CalculatePriority($biblionumber); >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 05e26ebee2..80f2db8339 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -473,6 +473,7 @@ sub CanBookBeReserved { > { status => cannotBeTransferred }, if branch transfer limit applies on given item and branchcode > { status => pickupNotInHoldGroup }, pickup location is not in hold group, and pickup locations are only allowed from hold groups. > { status => recall }, if the borrower has already placed a recall on this item >+ { status => overlap }, if PreventReservesOnSamePeriod is true and reservation dates overlaps with a previous reservation > > =cut > >@@ -537,6 +538,13 @@ sub CanItemBeReserved { > return _cache { status => 'alreadypossession' }; > } > >+ if ( C4::Context->preference('PreventReservesOnSamePeriod') >+ && ReservesOnSamePeriod( $item->biblionumber, $item->itemnumber, $params->{start_date}, $params->{expiry_date} ) >+ ) >+ { >+ return _cache { status => 'overlap' }; >+ } >+ > # check if a recall exists on this item from this borrower > return _cache { status => 'recall' } > if $patron->recalls->filter_by_current->search( { item_id => $item->itemnumber } )->count; >-- >2.39.5
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 15261
:
45216
|
45833
|
45841
|
46432
|
46433
|
46441
|
46442
|
49001
|
49002
|
49003
|
52704
|
59643
|
61534
|
61539
|
61544
|
67088
|
67094
|
67143
|
68660
|
68661
|
68662
|
68663
|
68664
|
68852
|
68853
|
72956
|
72957
|
76221
|
76222
|
88292
|
88293
|
88297
|
88298
|
92376
|
92377
|
92584
|
92585
|
92664
|
93136
|
94871
|
98383
|
98424
|
98672
|
106944
|
106949
|
120822
|
123405
|
125793
|
125794
|
125795
|
125796
|
131569
|
131570
|
131571
|
131572
|
131573
|
187999
|
188000
|
189912
|
189913
|
189914
| 189915