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

(-)a/C4/Circulation.pm (-5 / +5 lines)
Lines 1423-1429 sub checkHighHolds { Link Here
1423
                branchcode   => $branchcode,
1423
                branchcode   => $branchcode,
1424
            }
1424
            }
1425
        );
1425
        );
1426
        my $calendar = Koha::DiscreteCalendar->new( branchcode => $branchcode, days_mode => $daysmode );
1426
        my $calendar = Koha::DiscreteCalendar->new({ branchcode => $branchcode, days_mode => $daysmode });
1427
1427
1428
        my $orig_due = C4::Circulation::CalcDateDue( $issuedate, $itype, $branchcode, $patron->unblessed );
1428
        my $orig_due = C4::Circulation::CalcDateDue( $issuedate, $itype, $branchcode, $patron->unblessed );
1429
1429
Lines 2606-2615 sub _calculate_new_debar_dt { Link Here
2606
        my $new_debar_dt;
2606
        my $new_debar_dt;
2607
        # Use the calendar or not to calculate the debarment date
2607
        # Use the calendar or not to calculate the debarment date
2608
        if ( C4::Context->preference('SuspensionsCalendar') eq 'noSuspensionsWhenClosed' ) {
2608
        if ( C4::Context->preference('SuspensionsCalendar') eq 'noSuspensionsWhenClosed' ) {
2609
            my $calendar = Koha::DiscreteCalendar->new(
2609
            my $calendar = Koha::DiscreteCalendar->new({
2610
                branchcode => $branchcode,
2610
                branchcode => $branchcode,
2611
                days_mode  => 'Calendar'
2611
                days_mode  => 'Calendar'
2612
            );
2612
            });
2613
            $new_debar_dt = $calendar->addDuration( $return_date, $suspension_days );
2613
            $new_debar_dt = $calendar->addDuration( $return_date, $suspension_days );
2614
        }
2614
        }
2615
        else {
2615
        else {
Lines 3757-3763 sub CalcDateDue { Link Here
3757
        else { # days
3757
        else { # days
3758
            $dur = DateTime::Duration->new( days => $loanlength->{$length_key});
3758
            $dur = DateTime::Duration->new( days => $loanlength->{$length_key});
3759
        }
3759
        }
3760
        my $calendar = Koha::DiscreteCalendar->new( branchcode => $branch, days_mode => $daysmode );
3760
        my $calendar = Koha::DiscreteCalendar->new({ branchcode => $branch, days_mode => $daysmode });
3761
        $datedue = $calendar->addDuration( $datedue, $dur, $loanlength->{lengthunit} );
3761
        $datedue = $calendar->addDuration( $datedue, $dur, $loanlength->{lengthunit} );
3762
        if ($loanlength->{lengthunit} eq 'days') {
3762
        if ($loanlength->{lengthunit} eq 'days') {
3763
            $datedue->set_hour(23);
3763
            $datedue->set_hour(23);
Lines 3796-3802 sub CalcDateDue { Link Here
3796
            }
3796
            }
3797
        }
3797
        }
3798
        if ( $daysmode ne 'Days' ) {
3798
        if ( $daysmode ne 'Days' ) {
3799
          my $calendar = Koha::DiscreteCalendar->new( branchcode => $branch, days_mode => $daysmode );
3799
          my $calendar = Koha::DiscreteCalendar->new({ branchcode => $branch, days_mode => $daysmode });
3800
          if ( $calendar->is_holiday($datedue) ) {
3800
          if ( $calendar->is_holiday($datedue) ) {
3801
              # Don't return on a closed day
3801
              # Don't return on a closed day
3802
              $datedue = $calendar->prev_open_days( $datedue )->set(hour => 23, minute => 59);
3802
              $datedue = $calendar->prev_open_days( $datedue )->set(hour => 23, minute => 59);
(-)a/C4/HoldsQueue.pm (-2 / +2 lines)
Lines 78-85 sub TransportCostMatrix { Link Here
78
            disable_transfer => $disabled
78
            disable_transfer => $disabled
79
        };
79
        };
80
80
81
        if ( !$ignore_holds_queue_skip_closed && C4::Context->preference("HoldsQueueSkipClosed") ) {
81
        if ( !my $ignore_holds_queue_skip_closed && C4::Context->preference("HoldsQueueSkipClosed") ) {
82
            $calendars->{$from} ||= Koha::DiscreteCalendar->new( branchcode => $from );
82
            my $calendars->{$from} ||= Koha::DiscreteCalendar->new({ branchcode => $from });
83
            $transport_cost_matrix{$to}{$from}{disable_transfer} ||=
83
            $transport_cost_matrix{$to}{$from}{disable_transfer} ||=
84
              $calendars->{$from}->is_holiday( $today );
84
              $calendars->{$from}->is_holiday( $today );
85
        }
85
        }
(-)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 217-223 sub set_waiting { Link Here
217
                branchcode   => $self->branchcode,
217
                branchcode   => $self->branchcode,
218
            }
218
            }
219
        );
219
        );
220
        my $calendar = Koha::DiscreteCalendar->new( branchcode => $self->branchcode, days_mode => $daysmode );
220
        my $calendar = Koha::DiscreteCalendar->new({ branchcode => $self->branchcode, days_mode => $daysmode });
221
221
222
        $new_expiration_date = $calendar->days_forward( dt_from_string(), $max_pickup_delay );
222
        $new_expiration_date = $calendar->days_forward( dt_from_string(), $max_pickup_delay );
223
    }
223
    }
(-)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 244-250 foreach my $branchcode (@branchcodes) { #BEGIN BRANCH LOOP Link Here
244
    # If respecting calendar get the correct waiting since date
244
    # If respecting calendar get the correct waiting since date
245
    my $waiting_date;
245
    my $waiting_date;
246
    if( $use_calendar ){
246
    if( $use_calendar ){
247
        my $calendar = Koha::DiscreteCalendar->new( branchcode => $branchcode, days_mode => 'Calendar' );
247
        my $calendar = Koha::DiscreteCalendar->new({ branchcode => $branchcode, days_mode => 'Calendar' });
248
        my $duration = DateTime::Duration->new( days => -$days );
248
        my $duration = DateTime::Duration->new( days => -$days );
249
        $waiting_date = $calendar->addDays($date_to_run,$duration); #Add negative of days
249
        $waiting_date = $calendar->addDays($date_to_run,$duration); #Add negative of days
250
    } else {
250
    } 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