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

(-)a/C4/Circulation.pm (-4 / +4 lines)
Lines 42-48 use Data::Dumper; Link Here
42
use Koha::Account;
42
use Koha::Account;
43
use Koha::AuthorisedValues;
43
use Koha::AuthorisedValues;
44
use Koha::DateUtils;
44
use Koha::DateUtils;
45
use Koha::Calendar;
45
use Koha::DiscreteCalendar;
46
use Koha::Checkouts;
46
use Koha::Checkouts;
47
use Koha::IssuingRules;
47
use Koha::IssuingRules;
48
use Koha::Items;
48
use Koha::Items;
Lines 1207-1213 sub checkHighHolds { Link Here
1207
1207
1208
        my $issuedate = DateTime->now( time_zone => C4::Context->tz() );
1208
        my $issuedate = DateTime->now( time_zone => C4::Context->tz() );
1209
1209
1210
        my $calendar = Koha::Calendar->new( branchcode => $branch );
1210
        my $calendar = Koha::DiscreteCalendar->new( branchcode => $branch );
1211
1211
1212
        my $itype =
1212
        my $itype =
1213
          ( C4::Context->preference('item-level_itypes') )
1213
          ( C4::Context->preference('item-level_itypes') )
Lines 2148-2154 sub MarkIssueReturned { Link Here
2148
    my $query = 'UPDATE issues SET returndate=';
2148
    my $query = 'UPDATE issues SET returndate=';
2149
    my @bind;
2149
    my @bind;
2150
    if ($dropbox_branch) {
2150
    if ($dropbox_branch) {
2151
        my $calendar = Koha::Calendar->new( branchcode => $dropbox_branch );
2151
        my $calendar = Koha::DiscreteCalendar->new( branchcode => $dropbox_branch );
2152
        my $dropboxdate = $calendar->addDate( DateTime->now( time_zone => C4::Context->tz), -1 );
2152
        my $dropboxdate = $calendar->addDate( DateTime->now( time_zone => C4::Context->tz), -1 );
2153
        $query .= ' ? ';
2153
        $query .= ' ? ';
2154
        push @bind, $dropboxdate->strftime('%Y-%m-%d %H:%M');
2154
        push @bind, $dropboxdate->strftime('%Y-%m-%d %H:%M');
Lines 3506-3512 sub CalcDateDue { Link Here
3506
        else { # days
3506
        else { # days
3507
            $dur = DateTime::Duration->new( days => $loanlength->{$length_key});
3507
            $dur = DateTime::Duration->new( days => $loanlength->{$length_key});
3508
        }
3508
        }
3509
        my $calendar = Koha::Calendar->new( branchcode => $branch );
3509
        my $calendar = Koha::DiscreteCalendar->new( branchcode => $branch );
3510
        $datedue = $calendar->addDate( $datedue, $dur, $loanlength->{lengthunit} );
3510
        $datedue = $calendar->addDate( $datedue, $dur, $loanlength->{lengthunit} );
3511
        if ($loanlength->{lengthunit} eq 'days') {
3511
        if ($loanlength->{lengthunit} eq 'days') {
3512
            $datedue->set_hour(23);
3512
            $datedue->set_hour(23);
(-)a/C4/HoldsQueue.pm (-4 / +4 lines)
Lines 29-35 use C4::Circulation; Link Here
29
use C4::Members;
29
use C4::Members;
30
use C4::Biblio;
30
use C4::Biblio;
31
use Koha::DateUtils;
31
use Koha::DateUtils;
32
32
use Koha::DiscreteCalendar;
33
use List::Util qw(shuffle);
33
use List::Util qw(shuffle);
34
use List::MoreUtils qw(any);
34
use List::MoreUtils qw(any);
35
use Data::Dumper;
35
use Data::Dumper;
Lines 76-82 sub TransportCostMatrix { Link Here
76
        };
76
        };
77
77
78
        if ( C4::Context->preference("HoldsQueueSkipClosed") ) {
78
        if ( C4::Context->preference("HoldsQueueSkipClosed") ) {
79
            $calendars->{$from} ||= Koha::Calendar->new( branchcode => $from );
79
            $calendars->{$from} ||= Koha::DiscreteCalendar->new( branchcode => $from );
80
            $transport_cost_matrix{$to}{$from}{disable_transfer} ||=
80
            $transport_cost_matrix{$to}{$from}{disable_transfer} ||=
81
              $calendars->{$from}->is_holiday( $today );
81
              $calendars->{$from}->is_holiday( $today );
82
        }
82
        }
Lines 205-211 sub CreateQueue { Link Here
205
        $total_requests        += scalar(@$hold_requests);
205
        $total_requests        += scalar(@$hold_requests);
206
        $total_available_items += scalar(@$available_items);
206
        $total_available_items += scalar(@$available_items);
207
207
208
        my $item_map = MapItemsToHoldRequests($hold_requests, $available_items, $branches_to_use, $transport_cost_matrix);
208
       my $item_map = MapItemsToHoldRequests($hold_requests, $available_items, $branches_to_use, $transport_cost_matrix);
209
        $item_map  or next;
209
        $item_map  or next;
210
        my $item_map_size = scalar(keys %$item_map)
210
        my $item_map_size = scalar(keys %$item_map)
211
          or next;
211
          or next;
Lines 736-742 sub load_branches_to_pull_from { Link Here
736
    my $today = dt_from_string();
736
    my $today = dt_from_string();
737
    if ( C4::Context->preference('HoldsQueueSkipClosed') ) {
737
    if ( C4::Context->preference('HoldsQueueSkipClosed') ) {
738
        @branches_to_use = grep {
738
        @branches_to_use = grep {
739
            !Koha::Calendar->new( branchcode => $_ )
739
            !Koha::DiscreteCalendar->new( branchcode => $_ )
740
              ->is_holiday( $today )
740
              ->is_holiday( $today )
741
        } @branches_to_use;
741
        } @branches_to_use;
742
    }
742
    }
(-)a/C4/Overdues.pm (-2 / +3 lines)
Lines 34-39 use C4::Accounts; Link Here
34
use C4::Log; # logaction
34
use C4::Log; # logaction
35
use C4::Debug;
35
use C4::Debug;
36
use Koha::DateUtils;
36
use Koha::DateUtils;
37
use Koha::DiscreteCalendar;
37
use Koha::Account::Line;
38
use Koha::Account::Line;
38
use Koha::Account::Lines;
39
use Koha::Account::Lines;
39
use Koha::IssuingRules;
40
use Koha::IssuingRules;
Lines 298-304 sub get_chargeable_units { Link Here
298
    my $charge_duration;
299
    my $charge_duration;
299
    if ($unit eq 'hours') {
300
    if ($unit eq 'hours') {
300
        if(C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed') {
301
        if(C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed') {
301
            my $calendar = Koha::Calendar->new( branchcode => $branchcode );
302
            my $calendar = Koha::DiscreteCalendar->new( branchcode => $branchcode );
302
            $charge_duration = $calendar->hours_between( $date_due, $date_returned );
303
            $charge_duration = $calendar->hours_between( $date_due, $date_returned );
303
        } else {
304
        } else {
304
            $charge_duration = $date_returned->delta_ms( $date_due );
305
            $charge_duration = $date_returned->delta_ms( $date_due );
Lines 310-316 sub get_chargeable_units { Link Here
310
    }
311
    }
311
    else { # days
312
    else { # days
312
        if(C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed') {
313
        if(C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed') {
313
            my $calendar = Koha::Calendar->new( branchcode => $branchcode );
314
            my $calendar = Koha::DiscreteCalendar->new( branchcode => $branchcode );
314
            $charge_duration = $calendar->days_between( $date_due, $date_returned );
315
            $charge_duration = $calendar->days_between( $date_due, $date_returned );
315
        } else {
316
        } else {
316
            $charge_duration = $date_returned->delta_days( $date_due );
317
            $charge_duration = $date_returned->delta_days( $date_due );
(-)a/C4/Reserves.pm (-2 / +2 lines)
Lines 37-43 use C4::Letters; Link Here
37
use C4::Log;
37
use C4::Log;
38
38
39
use Koha::DateUtils;
39
use Koha::DateUtils;
40
use Koha::Calendar;
40
use Koha::DiscreteCalendar;
41
use Koha::Database;
41
use Koha::Database;
42
use Koha::Hold;
42
use Koha::Hold;
43
use Koha::Old::Hold;
43
use Koha::Old::Hold;
Lines 1031-1037 sub CancelExpiredReserves { Link Here
1031
        while ( my $res = $sth->fetchrow_hashref ) {
1031
        while ( my $res = $sth->fetchrow_hashref ) {
1032
            my $do_cancel = 1;
1032
            my $do_cancel = 1;
1033
            unless ( $cancel_on_holidays ) {
1033
            unless ( $cancel_on_holidays ) {
1034
                my $calendar = Koha::Calendar->new( branchcode => $res->{'branchcode'} );
1034
                my $calendar = Koha::DiscreteCalendar->new( branchcode => $res->{'branchcode'} );
1035
                my $is_holiday = $calendar->is_holiday( $today );
1035
                my $is_holiday = $calendar->is_holiday( $today );
1036
1036
1037
                if ( $is_holiday ) {
1037
                if ( $is_holiday ) {
(-)a/circ/returns.pl (-2 / +2 lines)
Lines 49-55 use C4::Koha; # FIXME : is it still useful ? Link Here
49
use C4::RotatingCollections;
49
use C4::RotatingCollections;
50
use Koha::AuthorisedValues;
50
use Koha::AuthorisedValues;
51
use Koha::DateUtils;
51
use Koha::DateUtils;
52
use Koha::Calendar;
52
use Koha::DiscreteCalendar;
53
use Koha::Checkouts;
53
use Koha::Checkouts;
54
54
55
my $query = new CGI;
55
my $query = new CGI;
Lines 202-208 my $dropboxmode = $query->param('dropboxmode'); Link Here
202
my $dotransfer  = $query->param('dotransfer');
202
my $dotransfer  = $query->param('dotransfer');
203
my $canceltransfer = $query->param('canceltransfer');
203
my $canceltransfer = $query->param('canceltransfer');
204
my $dest = $query->param('dest');
204
my $dest = $query->param('dest');
205
my $calendar    = Koha::Calendar->new( branchcode => $userenv_branch );
205
my $calendar    = Koha::DiscreteCalendar->new( branchcode => $userenv_branch );
206
#dropbox: get last open day (today - 1)
206
#dropbox: get last open day (today - 1)
207
my $today       = DateTime->now( time_zone => C4::Context->tz());
207
my $today       = DateTime->now( time_zone => C4::Context->tz());
208
my $dropboxdate = $calendar->addDate($today, -1);
208
my $dropboxdate = $calendar->addDate($today, -1);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt (+5 lines)
Lines 74-79 Link Here
74
    <dd>Define days when the library is closed</dd>
74
    <dd>Define days when the library is closed</dd>
75
    [% END %]
75
    [% END %]
76
76
77
    [% IF ( CAN_user_tools_edit_calendar ) %]
78
    <dt><a href="/cgi-bin/koha/tools/discrete_calendar.pl">Discrete Calendar</a></dt>
79
    <dd>Define days when the library is closed</dd>
80
    [% END %]
81
77
    [% IF ( CAN_user_tools_manage_csv_profiles ) %]
82
    [% IF ( CAN_user_tools_manage_csv_profiles ) %]
78
    <dt><a href="/cgi-bin/koha/tools/csv-profiles.pl">CSV profiles</a></dt>
83
    <dt><a href="/cgi-bin/koha/tools/csv-profiles.pl">CSV profiles</a></dt>
79
	<dd>Manage CSV export profiles</dd>
84
	<dd>Manage CSV export profiles</dd>
(-)a/misc/cronjobs/fines.pl (-2 / +2 lines)
Lines 36-42 use Getopt::Long; Link Here
36
use Carp;
36
use Carp;
37
use File::Spec;
37
use File::Spec;
38
38
39
use Koha::Calendar;
39
use Koha::DiscreteCalendar;
40
use Koha::DateUtils;
40
use Koha::DateUtils;
41
use C4::Log;
41
use C4::Log;
42
42
Lines 176-182 EOM Link Here
176
sub set_holiday {
176
sub set_holiday {
177
    my ( $branch, $dt ) = @_;
177
    my ( $branch, $dt ) = @_;
178
178
179
    my $calendar = Koha::Calendar->new( branchcode => $branch );
179
    my $calendar = Koha::DiscreteCalendar->new( branchcode => $branch );
180
    return $calendar->is_holiday($dt);
180
    return $calendar->is_holiday($dt);
181
}
181
}
182
182
(-)a/misc/cronjobs/overdue_notices.pl (-4 / +4 lines)
Lines 40-46 use C4::Overdues qw(GetFine GetOverdueMessageTransportTypes parse_overdues_lette Link Here
40
use C4::Log;
40
use C4::Log;
41
use Koha::Patron::Debarments qw(AddUniqueDebarment);
41
use Koha::Patron::Debarments qw(AddUniqueDebarment);
42
use Koha::DateUtils;
42
use Koha::DateUtils;
43
use Koha::Calendar;
43
use Koha::DiscreteCalendar;
44
use Koha::Libraries;
44
use Koha::Libraries;
45
use Koha::Acquisition::Currencies;
45
use Koha::Acquisition::Currencies;
46
46
Lines 444-450 elsif ( defined $text_filename ) { Link Here
444
444
445
foreach my $branchcode (@branches) {
445
foreach my $branchcode (@branches) {
446
    if ( C4::Context->preference('OverdueNoticeCalendar') ) {
446
    if ( C4::Context->preference('OverdueNoticeCalendar') ) {
447
        my $calendar = Koha::Calendar->new( branchcode => $branchcode );
447
        my $calendar = Koha::DiscreteCalendar->new( branchcode => $branchcode );
448
        if ( $calendar->is_holiday($date_to_run) ) {
448
        if ( $calendar->is_holiday($date_to_run) ) {
449
            next;
449
            next;
450
        }
450
        }
Lines 543-549 END_SQL Link Here
543
                if ( C4::Context->preference('OverdueNoticeCalendar') )
543
                if ( C4::Context->preference('OverdueNoticeCalendar') )
544
                {
544
                {
545
                    my $calendar =
545
                    my $calendar =
546
                      Koha::Calendar->new( branchcode => $branchcode );
546
                      Koha::DiscreteCalendar->new( branchcode => $branchcode );
547
                    $days_between =
547
                    $days_between =
548
                      $calendar->days_between( dt_from_string($data->{date_due}),
548
                      $calendar->days_between( dt_from_string($data->{date_due}),
549
                        $date_to_run );
549
                        $date_to_run );
Lines 627-633 END_SQL Link Here
627
                while ( my $item_info = $sth2->fetchrow_hashref() ) {
627
                while ( my $item_info = $sth2->fetchrow_hashref() ) {
628
                    if ( C4::Context->preference('OverdueNoticeCalendar') ) {
628
                    if ( C4::Context->preference('OverdueNoticeCalendar') ) {
629
                        my $calendar =
629
                        my $calendar =
630
                          Koha::Calendar->new( branchcode => $branchcode );
630
                          Koha::DiscreteCalendar->new( branchcode => $branchcode );
631
                        $days_between =
631
                        $days_between =
632
                          $calendar->days_between(
632
                          $calendar->days_between(
633
                            dt_from_string( $item_info->{date_due} ), $date_to_run );
633
                            dt_from_string( $item_info->{date_due} ), $date_to_run );
(-)a/misc/cronjobs/staticfines.pl (-2 / +2 lines)
Lines 40-46 use Date::Calc qw/Date_to_Days/; Link Here
40
use C4::Context;
40
use C4::Context;
41
use C4::Circulation;
41
use C4::Circulation;
42
use C4::Overdues;
42
use C4::Overdues;
43
use C4::Calendar qw();    # don't need any exports from Calendar
43
use Koha::DiscreteCalendar qw();    # don't need any exports from Calendar
44
use C4::Biblio;
44
use C4::Biblio;
45
use C4::Debug;            # supplying $debug and $cgi_debug
45
use C4::Debug;            # supplying $debug and $cgi_debug
46
use C4::Log;
46
use C4::Log;
Lines 176-182 for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) { Link Here
176
176
177
    my $calendar;
177
    my $calendar;
178
    unless ( defined( $calendars{$branchcode} ) ) {
178
    unless ( defined( $calendars{$branchcode} ) ) {
179
        $calendars{$branchcode} = C4::Calendar->new( branchcode => $branchcode );
179
        $calendars{$branchcode} = Koha::DiscreteCalendar->new( branchcode => $branchcode );
180
    }
180
    }
181
    $calendar = $calendars{$branchcode};
181
    $calendar = $calendars{$branchcode};
182
    my $isHoliday = $calendar->isHoliday( $tday, $tmonth, $tyear );
182
    my $isHoliday = $calendar->isHoliday( $tday, $tmonth, $tyear );
(-)a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl (-3 / +2 lines)
Lines 35-41 use C4::Context; Link Here
35
use C4::Items;
35
use C4::Items;
36
use C4::Letters;
36
use C4::Letters;
37
use C4::Overdues;
37
use C4::Overdues;
38
use Koha::Calendar;
38
use Koha::DiscreteCalendar;
39
use Koha::DateUtils;
39
use Koha::DateUtils;
40
40
41
sub usage {
41
sub usage {
Lines 291-297 sub GetWaitingHolds { Link Here
291
    $sth->execute();
291
    $sth->execute();
292
    my @results;
292
    my @results;
293
    while ( my $issue = $sth->fetchrow_hashref() ) {
293
    while ( my $issue = $sth->fetchrow_hashref() ) {
294
        my $calendar = Koha::Calendar->new( branchcode => $issue->{'site'} );
294
        my $calendar = Koha::DiscreteCalendar->new( branchcode => $issue->{'site'} );
295
295
296
        my $waiting_date = dt_from_string( $issue->{waitingdate}, 'sql' );
296
        my $waiting_date = dt_from_string( $issue->{waitingdate}, 'sql' );
297
        my $pickup_date = $waiting_date->clone->add( days => $pickupdelay );
297
        my $pickup_date = $waiting_date->clone->add( days => $pickupdelay );
298
- 

Return to bug 17015