Bug 25850: Adapt day of week in Koha::Calendar::get_push_amt to 0..6 with 0 being...
authorAndreas Jonsson <andreas.jonsson@kreablo.se>
Tue, 23 Jun 2020 13:57:29 +0000 (15:57 +0200)
committerAleisha Amohia <aleishaamohia@hotmail.com>
Thu, 30 Jul 2020 11:57:38 +0000 (23:57 +1200)
commit048f154e772bed09b50cb6343e89adb4ff4d78f6
treecc6e2d5ffaca20139cdd72710003e7c31290d1cb
parent0656ff9a99d733b483e6b800d8b58554435109b5
Bug 25850: Adapt day of week in Koha::Calendar::get_push_amt to 0..6 with 0 being Sunday.

1. Go to tools -> calendar and make sure Sundays are holidays by adding
   a holiday on a Sunday and selecting "Holiday repeated every same day
   of the week" and "Copy to all libraries" and save.
2. Go to administration -> system preferences and select "Use the
   calendar to push the due date to the next open matching weekday
   for weekly loan periods, or the next open day otherwise" for the
   system preference "useDaysMode" and save the system preferences.
3. Put the below code in a file name test.pl and execute it using
   the command "sudo koha-shell -c 'perl test.pl' kohadev"

   use Koha::Calendar;

   my $calendar = Koha::Calendar->new( branchcode => 'CPL' );
   $dt = DateTime->new(
       year       => 2020,
       month      => 06,
       day        => 21
   );

   print "This is a sunday: " .
   $dt->day_of_week . "\n";

   my $ndt = $calendar->next_open_days($dt, 0);

   print "This is a monday: " .
   $ndt->day_of_week . "\n";

4. Without the patch applied, this script
   will freeze after printing "This is a
   sunday ...".  Abort using ctrl-c.
5. Apply patch and run the script again.
   The test script will now complete.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 25127f422821756b030b8f377b3e112b907be5eb)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 238b2af84fe8efe8a740758a774f3587717ffb2b)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Koha/Calendar.pm