[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
Thu Apr 2 10:26:53 CEST 2020
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25039
--- Comment #2 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
>From bug 25020 comment 6:
"""
A quick note, I think this kind of tests is overkill and not needed:
+ Koha::Exceptions::WrongParameter->throw(
+ "'hard_due_date' must be a DateTime object"
+ ) unless $hard_due_date->isa('DateTime');
+
+ $due_date = $hard_due_date->clone->set(
+ hour => $due_date->hour,
+ minute => $due_date->minute,
+ second => $due_date->second
+ );
+ }
+ 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.
"""
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list