From 38d47aa4ef295f53868ae8e891cdaa2ce014687e 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 --- C4/Reserves.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index fb0c22263a..a821577af5 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -1003,6 +1003,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 @@ -1026,6 +1029,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"; @@ -1044,15 +1048,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