Bug 24850: Correctly handle suspended_until for PUT

if we are passing suspended_until to the body, it should be a rfc3339 (what the spec is expecting)
but $hold->suspend_until will be iso

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2021-11-03 12:05:42 +01:00
parent 9d1ad49ec9
commit eb017ee239
1 changed files with 5 additions and 2 deletions

View File

@ -280,14 +280,17 @@ sub edit {
$pickup_library_id //= $hold->branchcode;
my $priority = $body->{priority} // $hold->priority;
# suspended_until can also be set to undef
my $suspended_until = exists $body->{suspended_until} ? $body->{suspended_until} : $hold->suspend_until;
my $suspended_until =
exists $body->{suspended_until}
? dt_from_string( $body->{suspended_until}, 'rfc3339' )
: dt_from_string( $hold->suspend_until, 'iso' );
my $params = {
reserve_id => $hold_id,
branchcode => $pickup_library_id,
rank => $priority,
suspend_until => $suspended_until
? output_pref({ dt => dt_from_string($suspended_until, 'iso'), dateformat => 'iso', dateonly => 1 })
? output_pref({ dt => $suspended_until, dateformat => 'iso', dateonly => 1 })
: '',
itemnumber => $hold->itemnumber
};