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 <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Nick Clemens 2021-08-26 19:07:53 +00:00 committed by Jonathan Druart
parent f008b3ebe7
commit 9f78462025

View file

@ -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) )