Bugzilla – Attachment 106383 Details for
Bug 25850
CalcDateDue freezes with 'useDaysMode' set to 'Dayweek' and the due date lands on a Sunday
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25850: Adapt day of week in Koha::Calendar::get_push_amt to 0..6 with 0 being Sunday.
Bug-25850-Adapt-day-of-week-in-KohaCalendargetpush.patch (text/plain), 1.96 KB, created by
Martin Renvoize (ashimema)
on 2020-06-29 08:24:07 UTC
(
hide
)
Description:
Bug 25850: Adapt day of week in Koha::Calendar::get_push_amt to 0..6 with 0 being Sunday.
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-06-29 08:24:07 UTC
Size:
1.96 KB
patch
obsolete
>From b8b81a14e83581a1e380ed6628496cb15c510804 Mon Sep 17 00:00:00 2001 >From: Andreas Jonsson <andreas.jonsson@kreablo.se> >Date: Tue, 23 Jun 2020 15:57:29 +0200 >Subject: [PATCH] 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> >--- > Koha/Calendar.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/Koha/Calendar.pm b/Koha/Calendar.pm >index 0d600a6e79..f2bc834c34 100644 >--- a/Koha/Calendar.pm >+++ b/Koha/Calendar.pm >@@ -250,7 +250,7 @@ sub get_push_amt { > # We're using Dayweek useDaysMode option > $self->{days_mode} eq 'Dayweek' && > # It's not a permanently closed day >- !$self->{weekly_closed_days}->[$dow] == 1 >+ !$self->{weekly_closed_days}->[$dow % 7] > ) ? 7 : 1; > } > >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25850
:
106207
|
106346
|
106347
|
106348
|
106381
|
106382
|
106383
|
106384
|
106626
|
106627
|
106628
|
106629
|
106630