Bugzilla – Attachment 88610 Details for
Bug 15260
Option for extended loan with useDaysMode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15260: Implement weekly rollforward
Bug-15260-Implement-weekly-rollforward.patch (text/plain), 2.94 KB, created by
Andrew Isherwood
on 2019-04-24 09:53:49 UTC
(
hide
)
Description:
Bug 15260: Implement weekly rollforward
Filename:
MIME Type:
Creator:
Andrew Isherwood
Created:
2019-04-24 09:53:49 UTC
Size:
2.94 KB
patch
obsolete
>From 517ed2b96f841e69ca52f8184391767daf66aa85 Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Fri, 1 Feb 2019 14:07:01 +0000 >Subject: [PATCH] Bug 15260: Implement weekly rollforward > >This patch will, when appropriate, roll due dates forward by full weeks, >rather than single days. > >Sponsored-by: Cheshire West and Chester and Cheshire East Councils >Sponsored-by: Newcastle City Council >Sponsored-by: Sefton Council >--- > Koha/Calendar.pm | 29 ++++++++++++++++++----------- > 1 file changed, 18 insertions(+), 11 deletions(-) > >diff --git a/Koha/Calendar.pm b/Koha/Calendar.pm >index b6ffbbc161..3aa7eb31f5 100644 >--- a/Koha/Calendar.pm >+++ b/Koha/Calendar.pm >@@ -144,7 +144,6 @@ sub addDate { > > $unit ||= 'days'; # default days ? > my $dt; >- > if ( $unit eq 'hours' ) { > # Fixed for legacy support. Should be set as a branch parameter > my $return_by_hour = 10; >@@ -154,7 +153,6 @@ sub addDate { > # days > $dt = $self->addDays($startdate, $add_duration); > } >- > return $dt; > } > >@@ -206,20 +204,31 @@ sub addDays { > } > } > >- } else { # Days or Datedue >+ } else { # Days, Datedue or Dayweek > # use straight days, then use calendar to push >- # the date to the next open day if Datedue >+ # the date to the next open day as appropriate >+ # if Datedue or Dayweek > $base_date->add_duration($days_duration); > >- if ( $self->{days_mode} eq 'Datedue' ) { >- # Datedue, then use the calendar to push >+ if ( $self->{days_mode} eq 'Datedue' || >+ $self->{days_mode} eq 'Dayweek') { >+ # Datedue or Dayweek, then use the calendar to push > # the date to the next open day if holiday > if ( $self->is_holiday($base_date) ) { >- >+ my $dow = $base_date->day_of_week; >+ my $days = $days_duration->in_units('days'); >+ my $push_amt = ( >+ # We're using Dayweek useDaysMode option >+ $self->{days_mode} eq 'Dayweek' && >+ # It's period based on weeks >+ $days % 7 == 0 && >+ # It's not a permanently closed day >+ !$self->{weekly_closed_days}->[$dow] == 1 >+ ) ? 7 : 1; > if ( $days_duration->is_negative() ) { >- $base_date = $self->prev_open_day($base_date); >+ $base_date = $self->prev_open_days($base_date, $push_amt); > } else { >- $base_date = $self->next_open_day($base_date); >+ $base_date = $self->next_open_days($base_date, $push_amt); > } > } > } >@@ -275,11 +284,9 @@ sub next_open_days { > my $base_date = $dt->clone(); > > $base_date->add(days => $to_add); >- > while ($self->is_holiday($base_date)) { > $base_date->add(days => $to_add); > } >- > return $base_date; > } > >-- >2.11.0
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 15260
:
87906
|
88052
|
88053
|
88054
|
88055
|
88056
|
88057
|
88059
|
88607
|
88608
|
88609
|
88610
|
88611
|
88612
|
88613
|
89178
|
89380
|
89381
|
89382
|
89383
|
89384
|
89385
|
89386
|
89387
|
89388
|
89885
|
94880
|
94881
|
94882
|
94883
|
94884
|
94885
|
94886
|
94887
|
94888
|
94889