From 6138fb73cb080104c7c1a8d6eed4542c5e4641c7 Mon Sep 17 00:00:00 2001
From: Petro Vashchuk <stalkernoid@gmail.com>
Date: Wed, 19 Jan 2022 18:01:15 +0200
Subject: [PATCH] Bug 29906: fix the forcibly gets to "suspended" state problem

which passes "perl false" to $suspended_until as it is,
but in case of "perl truth" it calls dt_from_string.
---
 Koha/REST/V1/Holds.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Koha/REST/V1/Holds.pm b/Koha/REST/V1/Holds.pm
index 0ca60b1459..8bde3d1531 100644
--- a/Koha/REST/V1/Holds.pm
+++ b/Koha/REST/V1/Holds.pm
@@ -282,8 +282,8 @@ sub edit {
         # suspended_until can also be set to undef
         my $suspended_until =
           exists $body->{suspended_until}
-          ? dt_from_string( $body->{suspended_until}, 'rfc3339' )
-          : dt_from_string( $hold->suspend_until,     'iso' );
+          ? $body->{suspended_until} && dt_from_string( $body->{suspended_until}, 'rfc3339' )
+          : $hold->suspend_unti    l && dt_from_string( $hold->suspend_until,     'iso' );
 
         my $params = {
             reserve_id    => $hold_id,
-- 
2.28.0