[Koha-bugs] [Bug 29906] When changing hold parameters over API (PUT) it forcibly gets to "suspended" state

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Jan 20 14:04:36 CET 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29906

--- Comment #8 from Andrew Nugged <nugged at gmail.com> ---
it doesn't mean undef explicitly in parameters, but it was meant those two vars
to BE undef on the moment when calling:

    my $params = {
        ... 
        suspend_until => $suspended_until

as I understand this:

> Breaks passing "undef" in $hold->suspend_until
> as well as "undef" in $body->{suspended_until}

this means when on the beginning before this code:

    my $suspended_until = ...

$hold->suspend_until will return undef, or
$body->{suspended_until} will be absent at all, so be undef in place,

then this code:

+        my $suspended_until =
+          exists $body->{suspended_until}
+          ? dt_from_string( $body->{suspended_until}, 'rfc3339' )
+          : dt_from_string( $hold->suspend_until,     'iso' );

won't allow for $suspended_until TO BECOME UNDEF, it will always have the date,
and unwanted "TODAY" because when you pass undef to dt_from_string, as it is
in:

    ...
    return DateTime->now( time_zone => $tz ) unless $date_string;

thus that will make any call to this API endpoint to suspend hold.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list