View | Details | Raw Unified | Return to bug 17015
Collapse All | Expand All

(-)a/C4/Circulation.pm (-5 / +5 lines)
Lines 1410-1416 sub checkHighHolds { Link Here
1410
                branchcode   => $branchcode,
1410
                branchcode   => $branchcode,
1411
            }
1411
            }
1412
        );
1412
        );
1413
        my $calendar = Koha::DiscreteCalendar->new( branchcode => $branchcode, days_mode => $daysmode );
1413
        my $calendar = Koha::DiscreteCalendar->new({ branchcode => $branchcode, days_mode => $daysmode });
1414
1414
1415
        my $orig_due = C4::Circulation::CalcDateDue( $issuedate, $itype, $branchcode, $patron->unblessed );
1415
        my $orig_due = C4::Circulation::CalcDateDue( $issuedate, $itype, $branchcode, $patron->unblessed );
1416
1416
Lines 2629-2638 sub _calculate_new_debar_dt { Link Here
2629
        my $new_debar_dt;
2629
        my $new_debar_dt;
2630
        # Use the calendar or not to calculate the debarment date
2630
        # Use the calendar or not to calculate the debarment date
2631
        if ( C4::Context->preference('SuspensionsCalendar') eq 'noSuspensionsWhenClosed' ) {
2631
        if ( C4::Context->preference('SuspensionsCalendar') eq 'noSuspensionsWhenClosed' ) {
2632
            my $calendar = Koha::DiscreteCalendar->new(
2632
            my $calendar = Koha::DiscreteCalendar->new({
2633
                branchcode => $branchcode,
2633
                branchcode => $branchcode,
2634
                days_mode  => 'Calendar'
2634
                days_mode  => 'Calendar'
2635
            );
2635
            });
2636
            $new_debar_dt = $calendar->addDuration( $return_date, $suspension_days );
2636
            $new_debar_dt = $calendar->addDuration( $return_date, $suspension_days );
2637
        }
2637
        }
2638
        else {
2638
        else {
Lines 3795-3801 sub CalcDateDue { Link Here
3795
        else { # days
3795
        else { # days
3796
            $dur = DateTime::Duration->new( days => $loanlength->{$length_key});
3796
            $dur = DateTime::Duration->new( days => $loanlength->{$length_key});
3797
        }
3797
        }
3798
        my $calendar = Koha::DiscreteCalendar->new( branchcode => $branch, days_mode => $daysmode );
3798
        my $calendar = Koha::DiscreteCalendar->new({ branchcode => $branch, days_mode => $daysmode });
3799
        $datedue = $calendar->addDuration( $datedue, $dur, $loanlength->{lengthunit} );
3799
        $datedue = $calendar->addDuration( $datedue, $dur, $loanlength->{lengthunit} );
3800
        if ($loanlength->{lengthunit} eq 'days') {
3800
        if ($loanlength->{lengthunit} eq 'days') {
3801
            $datedue->set_hour(23);
3801
            $datedue->set_hour(23);
Lines 3834-3840 sub CalcDateDue { Link Here
3834
            }
3834
            }
3835
        }
3835
        }
3836
        if ( $daysmode ne 'Days' ) {
3836
        if ( $daysmode ne 'Days' ) {
3837
          my $calendar = Koha::DiscreteCalendar->new( branchcode => $branch, days_mode => $daysmode );
3837
          my $calendar = Koha::DiscreteCalendar->new({ branchcode => $branch, days_mode => $daysmode });
3838
          if ( $calendar->is_holiday($datedue) ) {
3838
          if ( $calendar->is_holiday($datedue) ) {
3839
              # Don't return on a closed day
3839
              # Don't return on a closed day
3840
              $datedue = $calendar->prev_open_days( $datedue )->set(hour => 23, minute => 59);
3840
              $datedue = $calendar->prev_open_days( $datedue )->set(hour => 23, minute => 59);
(-)a/C4/HoldsQueue.pm (-2 / +2 lines)
Lines 79-86 sub TransportCostMatrix { Link Here
79
            disable_transfer => $disabled
79
            disable_transfer => $disabled
80
        };
80
        };
81
81
82
        if ( !$ignore_holds_queue_skip_closed && C4::Context->preference("HoldsQueueSkipClosed") ) {
82
        if ( !my $ignore_holds_queue_skip_closed && C4::Context->preference("HoldsQueueSkipClosed") ) {
83
            $calendars->{$from} ||= Koha::DiscreteCalendar->new( branchcode => $from );
83
            my $calendars->{$from} ||= Koha::DiscreteCalendar->new({ branchcode => $from });
84
            $transport_cost_matrix{$to}{$from}{disable_transfer} ||=
84
            $transport_cost_matrix{$to}{$from}{disable_transfer} ||=
85
              $calendars->{$from}->is_holiday( $today );
85
              $calendars->{$from}->is_holiday( $today );
86
        }
86
        }
(-)a/Koha/Charges/Fees.pm (-1 / +1 lines)
Lines 109-115 sub accumulate_rentalcharge { Link Here
109
    return 0 unless $rentalcharge_increment && $rentalcharge_increment > 0;
109
    return 0 unless $rentalcharge_increment && $rentalcharge_increment > 0;
110
110
111
    my $duration;
111
    my $duration;
112
    my $calendar = Koha::DiscreteCalendar->new( branchcode => $self->library->id );
112
    my $calendar = Koha::DiscreteCalendar->new({ branchcode => $self->library->id });
113
113
114
    if ( $units eq 'hours' ) {
114
    if ( $units eq 'hours' ) {
115
        if ( $itemtype->rentalcharge_hourly_calendar ) {
115
        if ( $itemtype->rentalcharge_hourly_calendar ) {
(-)a/Koha/Checkouts.pm (-1 / +1 lines)
Lines 55-61 sub calculate_dropbox_date { Link Here
55
            branchcode   => $branchcode,
55
            branchcode   => $branchcode,
56
        }
56
        }
57
    );
57
    );
58
    my $calendar     = Koha::DiscreteCalendar->new( branchcode => $branchcode, days_mode => $daysmode );
58
    my $calendar     = Koha::DiscreteCalendar->new({ branchcode => $branchcode, days_mode => $daysmode });
59
    my $today        = dt_from_string;
59
    my $today        = dt_from_string;
60
    my $dropbox_date = $calendar->addDuration( $today, -1 );
60
    my $dropbox_date = $calendar->addDuration( $today, -1 );
61
    my $dateInfo = $calendar->get_date_info($dropbox_date);
61
    my $dateInfo = $calendar->get_date_info($dropbox_date);
(-)a/Koha/DiscreteCalendar.pm (-2 / +2 lines)
Lines 277-283 sub get_date_info { Link Here
277
277
278
    my $maxDate = $calendar->get_max_date();
278
    my $maxDate = $calendar->get_max_date();
279
279
280
Returns the furthest date available in the databse of current branch.
280
Returns the furthest date available in the database of current branch.
281
281
282
=cut
282
=cut
283
283
Lines 303-309 sub get_max_date { Link Here
303
303
304
    my $minDate = $calendar->get_min_date();
304
    my $minDate = $calendar->get_min_date();
305
305
306
Returns the oldest date available in the databse of current branch.
306
Returns the oldest date available in the database of current branch.
307
307
308
=cut
308
=cut
309
309
(-)a/Koha/Hold.pm (-1 / +1 lines)
Lines 231-237 sub set_waiting { Link Here
231
                branchcode   => $self->branchcode,
231
                branchcode   => $self->branchcode,
232
            }
232
            }
233
        );
233
        );
234
        my $calendar = Koha::DiscreteCalendar->new( branchcode => $self->branchcode, days_mode => $daysmode );
234
        my $calendar = Koha::DiscreteCalendar->new({ branchcode => $self->branchcode, days_mode => $daysmode });
235
235
236
        $new_expiration_date = $calendar->days_forward( dt_from_string(), $max_pickup_delay );
236
        $new_expiration_date = $calendar->days_forward( dt_from_string(), $max_pickup_delay );
237
    }
237
    }
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +1 lines)
Lines 14371-14377 if( CheckVersion( $DBversion ) ) { Link Here
14371
14371
14372
        my $expirationdate = dt_from_string($hold->{waitingdate});
14372
        my $expirationdate = dt_from_string($hold->{waitingdate});
14373
        if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) {
14373
        if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) {
14374
            my $calendar = Koha::DiscreteCalendar->new( branchcode => $hold->{branchcode}, days_mode => C4::Context->preference('useDaysMode') );
14374
            my $calendar = Koha::DiscreteCalendar->new({ branchcode => $hold->{branchcode}, days_mode => C4::Context->preference('useDaysMode') });
14375
            $expirationdate = $calendar->days_forward( $expirationdate, $max_pickup_delay );
14375
            $expirationdate = $calendar->days_forward( $expirationdate, $max_pickup_delay );
14376
        } else {
14376
        } else {
14377
            $expirationdate->add( days => $max_pickup_delay );
14377
            $expirationdate->add( days => $max_pickup_delay );
(-)a/misc/cronjobs/fines.pl (-1 / +1 lines)
Lines 203-209 EOM Link Here
203
sub set_holiday {
203
sub set_holiday {
204
    my ( $branch, $dt ) = @_;
204
    my ( $branch, $dt ) = @_;
205
205
206
    my $calendar = Koha::DiscreteCalendar->new( branchcode => $branch );
206
    my $calendar = Koha::DiscreteCalendar->new({ branchcode => $branch });
207
    return $calendar->is_holiday($dt);
207
    return $calendar->is_holiday($dt);
208
}
208
}
209
209
(-)a/misc/cronjobs/holds/holds_reminder.pl (-1 / +1 lines)
Lines 246-252 foreach my $branchcode (@branchcodes) { #BEGIN BRANCH LOOP Link Here
246
    # If respecting calendar get the correct waiting since date
246
    # If respecting calendar get the correct waiting since date
247
    my $waiting_date;
247
    my $waiting_date;
248
    if( $use_calendar ){
248
    if( $use_calendar ){
249
        my $calendar = Koha::DiscreteCalendar->new( branchcode => $branchcode, days_mode => 'Calendar' );
249
        my $calendar = Koha::DiscreteCalendar->new({ branchcode => $branchcode, days_mode => 'Calendar' });
250
        my $duration = DateTime::Duration->new( days => -$days );
250
        my $duration = DateTime::Duration->new( days => -$days );
251
        $waiting_date = $calendar->addDays($date_to_run,$duration); #Add negative of days
251
        $waiting_date = $calendar->addDays($date_to_run,$duration); #Add negative of days
252
    } else {
252
    } else {
(-)a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl (-2 / +1 lines)
Lines 335-341 sub GetWaitingHolds { Link Here
335
            }
335
            }
336
        );
336
        );
337
337
338
        my $calendar = Koha::DiscreteCalendar->new( branchcode => $issue->{'site'}, days_mode => $daysmode );
338
        my $calendar = Koha::DiscreteCalendar->new({ branchcode => $issue->{'site'}, days_mode => $daysmode });
339
339
340
        my $waiting_date = dt_from_string( $issue->{waitingdate}, 'sql' );
340
        my $waiting_date = dt_from_string( $issue->{waitingdate}, 'sql' );
341
        my $pickup_date = $waiting_date->clone->add( days => $pickupdelay );
341
        my $pickup_date = $waiting_date->clone->add( days => $pickupdelay );
342
- 

Return to bug 17015