Skip to content

Commit 697a18d

Browse files
kidclampLMSCloudPaulD
authored andcommitted
Bug 38650: Only fill title level holds, or holds on the exact item
We change the conditions for filling holds to require that either: - the hold is title level - the hold is on the exact item To test: 1 - Place a hold for patron A on item #1 of a record 2 - Place a hold for patron B on item #2 of a record 3 - Issue item #2 to patron A - their hold on item #1 is filled incorrectly, check the item in 4 - Apply patch, restart all 5 - Place hold for patron A on item #1 6 - Issue item #2 to patron A - their hold on item #1 is not filled, check the item in 7 - Cancel that hold 8 - Place a title level hold for the record for patron A 9 - Check item #1 in at a different branch and confirm transfer 9 - Issue item #2 to patron A 10 - The hold is filled as title level, even though item #1 was selected for the hold, check the item in 11 - Place an item level hold for item #2 for patron A 12 - Issue item #2 to patron A, hold is filled Signed-off-by: Stephanie Petruso <spetruso@aacpl.net> Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> (cherry picked from commit 1df2297) Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
1 parent a21bf53 commit 697a18d

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

C4/Reserves.pm

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,22 +1960,26 @@ sub MoveReserve {
19601960
my $lookahead = C4::Context->preference('ConfirmFutureHolds'); #number of days to look for future holds
19611961
my $item = Koha::Items->find($itemnumber);
19621962
my ( $restype, $res, undef ) = CheckReserves( $item, $lookahead );
1963-
return unless $res;
19641963

1965-
my $biblionumber = $res->{biblionumber};
1966-
1967-
if ($res->{borrowernumber} == $borrowernumber) {
1964+
if ( $res &&$res->{borrowernumber} == $borrowernumber) {
19681965
my $hold = Koha::Holds->find( $res->{reserve_id} );
19691966
$hold->fill({ item_id => $itemnumber });
19701967
}
19711968
else {
1972-
# warn "Reserved";
19731969
# The item is reserved by someone else.
19741970
# Find this item in the reserves
19751971

1972+
my $lookahead_date = output_pref(
1973+
{
1974+
dt => dt_from_string->add_duration( DateTime::Duration->new( days => $lookahead ) ),
1975+
dateformat => 'iso', dateonly => 1
1976+
}
1977+
);
19761978
my $borr_res = Koha::Holds->search({
19771979
borrowernumber => $borrowernumber,
1978-
biblionumber => $biblionumber,
1980+
biblionumber => $item->biblionumber,
1981+
reservedate => { '<=' => $lookahead_date },
1982+
-or => [ item_level_hold => 0, itemnumber => $itemnumber ],
19791983
},{
19801984
order_by => 'priority'
19811985
})->next();

0 commit comments

Comments
 (0)