From eb017ee239eee3fac407d9d7c205cbf2f04d1d68 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 3 Nov 2021 12:05:42 +0100 Subject: [PATCH] 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 Signed-off-by: Jonathan Druart --- Koha/REST/V1/Holds.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Koha/REST/V1/Holds.pm b/Koha/REST/V1/Holds.pm index 256cb40259..0ca60b1459 100644 --- a/Koha/REST/V1/Holds.pm +++ b/Koha/REST/V1/Holds.pm @@ -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 }; -- 2.39.5