From d4d648f3bf49d3b42e7e5463159a2fdf6dc92486 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 26 Aug 2021 19:07:53 +0000 Subject: [PATCH] Bug 25619: Adjust POD and move date check before logging Potentially we could have logged a change when no date was passed. This patch moves the test before logging and updates POD Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall (cherry picked from commit 38d47aa4ef295f53868ae8e891cdaa2ce014687e) Signed-off-by: Fridolin Somers --- C4/Reserves.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index e1c1871c7f..3158e61e55 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -995,6 +995,9 @@ that the item is not waiting on the hold shelf, setting the priority to a non-zero value also sets the request's found status and waiting date to NULL. +If the hold is 'found' (waiting, in-transit, processing) the +only field that can be updated is the expiration date. + The optional C<$itemnumber> parameter is used only when C<$rank> is a non-zero integer; if supplied, the itemnumber of the hold request is set accordingly; if omitted, the itemnumber @@ -1018,6 +1021,7 @@ sub ModReserve { my $borrowernumber = $params->{'borrowernumber'}; my $biblionumber = $params->{'biblionumber'}; my $cancellation_reason = $params->{'cancellation_reason'}; + my $date = $params->{expirationdate}; return if $rank eq "n"; @@ -1036,15 +1040,12 @@ sub ModReserve { if ( $rank eq "del" ) { $hold->cancel({ cancellation_reason => $cancellation_reason }); } - elsif ($hold->found && $hold->priority eq '0') { + elsif ($hold->found && $hold->priority eq '0' && $date) { logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, Dumper($hold->unblessed) ) if C4::Context->preference('HoldsLog'); # The only column that can be updated for a found hold is the expiration date - my $date = $params->{expirationdate}; - if ($date) { - $hold->expirationdate(dt_from_string($date))->store(); - } + $hold->expirationdate(dt_from_string($date))->store(); } elsif ($rank =~ /^\d+/ and $rank > 0) { logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, Dumper($hold->unblessed) ) -- 2.39.5