[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
Mon Sep 14 19:54:41 CEST 2020


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

--- Comment #11 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
Created attachment 110073
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=110073&action=edit
Bug 25039: Move new due date calculation to Koha::Checkout

This is a follow-up patch of bug 25020.

This patch adds a new method Koha::Checkout->shift_due_date that accepts
the same parameters we provide in the form. It catches bad scenarios
(type errors, passing both parameters when only one is accepted, and so
 on). Date manipulation is tested so time is kept and resulting dates
are correct.

The controller script is cleaned a bit to use the introduced method.

I do this because:
- We really need tests for this and doing it with selenium is no-end
- I see a use for this new method for encapsulating behaviours, for
  example we might want to add Calendar support for the 'days' use case,
  and having the method here assures we will have tests, etc.

To test:
1. Apply this patches
2. Repeat the original test plan
=> SUCCESS: Everything works as expected
3. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Checkout.t
=> SUCCESS: Tests pass!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen at theke.io>

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


More information about the Koha-bugs mailing list