From 008c36c07363dcb704ad2d47e8e8c6824616b6e8 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 --- C4/Reserves.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 50cfbe0df6..f2ee463979 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -1007,6 +1007,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 @@ -1030,6 +1033,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"; @@ -1048,15 +1052,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.20.1