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

--- Comment #5 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 206187
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206187&action=edit
Bug 43546: (follow-up) Require --hours to be a positive integer in
cart_to_shelf.pl

--hours was only checked for being present (required => 1), not for
being a sensible value. The pre-conversion script used
"unless ($hours) { die ... }", which treated 0 the same as
not-supplied and rejected it; required => 1 only checks that the
option was specified, so --hours 0 silently started passing instead
of dying, and a negative --hours would make the
TIMESTAMPDIFF(HOUR, ...) > ? comparison true for essentially every
item ever placed on the cart, reverting far more than intended.

Add a callback requiring --hours to be a positive integer, restoring
the original rejection of 0 and closing the negative-number gap at
the same time. TIMESTAMPDIFF(HOUR, ...) truncates to whole hours in
MySQL, so there's no finer-grained value (e.g. 0.5) this query could
ever act on regardless of type.

Test plan:
1. cart_to_shelf.pl --hours 0
   Rejected: --hours must be a positive integer (matches the
   pre-conversion script's behaviour).
2. cart_to_shelf.pl --hours -5
   Rejected: --hours must be a positive integer.
3. cart_to_shelf.pl --hours 24
   Still works exactly as before.
4. koha-qa.pl passes.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to