[Koha-bugs] [Bug 25039] Move new due calculation to Koha::Checkout

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Apr 7 23:29:59 CEST 2020


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

Tomás Cohen Arazi <tomascohen at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |Needs Signoff

--- Comment #7 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
(In reply to Jonathan Druart from comment #2)
>
> +    else {
> +        Koha::Exceptions::WrongParameter->throw(
> +            "'days' must be an integer"
> +        ) unless looks_like_number($days);
> +        $due_date->add( days => $days );
>
> Developers will get an error anyway if $days is not an integer (DateTime
> will raise its own meaningful exception), or $hard_due_date is not a
> DateTime.

I tried removing the checks, and the results are not cool:

- Removing the check for DateTime object => found: Can't locate object method
"clone" via package "cat" (perhaps you forgot to load "cat"?) at
/kohadevbox/koha/Koha/Checkout.pm line 190.

- Removing the check for number => found: normal exit, and a simple warning:
Argument "dog" isn't numeric in addition (+) at
/usr/lib/x86_64-linux-gnu/perl5/5.24/DateTime/Duration.pm line 74.

So, from the developer POV, in this particular cases, I still think my patch is
better with the checks than not having them. I agree on something: It is boring
to code this much for a small feature. But I would do it like this anyway.

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


More information about the Koha-bugs mailing list