Bugzilla – Attachment 59269 Details for
Bug 17015
New Koha Calendar
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17015 - Koha now uses the new DiscreteCalendar module
Bug-17015---Koha-now-uses-the-new-DiscreteCalendar.patch (text/plain), 12.15 KB, created by
Mehdi Hamidi
on 2017-01-19 15:33:35 UTC
(
hide
)
Description:
Bug 17015 - Koha now uses the new DiscreteCalendar module
Filename:
MIME Type:
Creator:
Mehdi Hamidi
Created:
2017-01-19 15:33:35 UTC
Size:
12.15 KB
patch
obsolete
>From 1309006fc8ed267bbe09e9cd9d249f24817fa06a Mon Sep 17 00:00:00 2001 >From: mehdi <mehdi@inlibro.com> >Date: Mon, 16 Jan 2017 10:09:23 -0500 >Subject: [PATCH] Bug 17015 - Koha now uses the new DiscreteCalendar module > >C4/Circulation.pm >--- > C4/Circulation.pm | 8 ++++---- > C4/HoldsQueue.pm | 8 ++++---- > C4/Overdues.pm | 5 +++-- > C4/Reserves.pm | 4 ++-- > circ/returns.pl | 4 ++-- > koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt | 5 +++++ > misc/cronjobs/fines.pl | 4 ++-- > misc/cronjobs/overdue_notices.pl | 8 ++++---- > misc/cronjobs/staticfines.pl | 4 ++-- > misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl | 4 ++-- > 10 files changed, 30 insertions(+), 24 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index cfccbfc..74953de 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -42,7 +42,7 @@ use Data::Dumper; > use Koha::Account; > use Koha::AuthorisedValues; > use Koha::DateUtils; >-use Koha::Calendar; >+use Koha::DiscreteCalendar; > use Koha::Checkouts; > use Koha::IssuingRules; > use Koha::Items; >@@ -1203,7 +1203,7 @@ sub checkHighHolds { > > my $issuedate = DateTime->now( time_zone => C4::Context->tz() ); > >- my $calendar = Koha::Calendar->new( branchcode => $branch ); >+ my $calendar = Koha::DiscreteCalendar->new( branchcode => $branch ); > > my $itype = > ( C4::Context->preference('item-level_itypes') ) >@@ -2144,7 +2144,7 @@ sub MarkIssueReturned { > my $query = 'UPDATE issues SET returndate='; > my @bind; > if ($dropbox_branch) { >- my $calendar = Koha::Calendar->new( branchcode => $dropbox_branch ); >+ my $calendar = Koha::DiscreteCalendar->new( branchcode => $dropbox_branch ); > my $dropboxdate = $calendar->addDate( DateTime->now( time_zone => C4::Context->tz), -1 ); > $query .= ' ? '; > push @bind, $dropboxdate->strftime('%Y-%m-%d %H:%M'); >@@ -3502,7 +3502,7 @@ sub CalcDateDue { > else { # days > $dur = DateTime::Duration->new( days => $loanlength->{$length_key}); > } >- my $calendar = Koha::Calendar->new( branchcode => $branch ); >+ my $calendar = Koha::DiscreteCalendar->new( branchcode => $branch ); > $datedue = $calendar->addDate( $datedue, $dur, $loanlength->{lengthunit} ); > if ($loanlength->{lengthunit} eq 'days') { > $datedue->set_hour(23); >diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm >index e5f29c7..8041fd5 100755 >--- a/C4/HoldsQueue.pm >+++ b/C4/HoldsQueue.pm >@@ -29,7 +29,7 @@ use C4::Circulation; > use C4::Members; > use C4::Biblio; > use Koha::DateUtils; >- >+use Koha::DiscreteCalendar; > use List::Util qw(shuffle); > use List::MoreUtils qw(any); > use Data::Dumper; >@@ -76,7 +76,7 @@ sub TransportCostMatrix { > }; > > if ( C4::Context->preference("HoldsQueueSkipClosed") ) { >- $calendars->{$from} ||= Koha::Calendar->new( branchcode => $from ); >+ $calendars->{$from} ||= Koha::DiscreteCalendar->new( branchcode => $from ); > $transport_cost_matrix{$to}{$from}{disable_transfer} ||= > $calendars->{$from}->is_holiday( $today ); > } >@@ -205,7 +205,7 @@ sub CreateQueue { > $total_requests += scalar(@$hold_requests); > $total_available_items += scalar(@$available_items); > >- my $item_map = MapItemsToHoldRequests($hold_requests, $available_items, $branches_to_use, $transport_cost_matrix); >+ my $item_map = MapItemsToHoldRequests($hold_requests, $available_items, $branches_to_use, $transport_cost_matrix); > $item_map or next; > my $item_map_size = scalar(keys %$item_map) > or next; >@@ -736,7 +736,7 @@ sub load_branches_to_pull_from { > my $today = dt_from_string(); > if ( C4::Context->preference('HoldsQueueSkipClosed') ) { > @branches_to_use = grep { >- !Koha::Calendar->new( branchcode => $_ ) >+ !Koha::DiscreteCalendar->new( branchcode => $_ ) > ->is_holiday( $today ) > } @branches_to_use; > } >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index 8300a1e..9a4a942 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -34,6 +34,7 @@ use C4::Accounts; > use C4::Log; # logaction > use C4::Debug; > use Koha::DateUtils; >+use Koha::DiscreteCalendar; > use Koha::Account::Line; > use Koha::Account::Lines; > use Koha::IssuingRules; >@@ -298,7 +299,7 @@ sub get_chargeable_units { > my $charge_duration; > if ($unit eq 'hours') { > if(C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed') { >- my $calendar = Koha::Calendar->new( branchcode => $branchcode ); >+ my $calendar = Koha::DiscreteCalendar->new( branchcode => $branchcode ); > $charge_duration = $calendar->hours_between( $date_due, $date_returned ); > } else { > $charge_duration = $date_returned->delta_ms( $date_due ); >@@ -310,7 +311,7 @@ sub get_chargeable_units { > } > else { # days > if(C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed') { >- my $calendar = Koha::Calendar->new( branchcode => $branchcode ); >+ my $calendar = Koha::DiscreteCalendar->new( branchcode => $branchcode ); > $charge_duration = $calendar->days_between( $date_due, $date_returned ); > } else { > $charge_duration = $date_returned->delta_days( $date_due ); >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 3f124a6..118b593 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -37,7 +37,7 @@ use C4::Letters; > use C4::Log; > > use Koha::DateUtils; >-use Koha::Calendar; >+use Koha::DiscreteCalendar; > use Koha::Database; > use Koha::Hold; > use Koha::Old::Hold; >@@ -1031,7 +1031,7 @@ sub CancelExpiredReserves { > while ( my $res = $sth->fetchrow_hashref ) { > my $do_cancel = 1; > unless ( $cancel_on_holidays ) { >- my $calendar = Koha::Calendar->new( branchcode => $res->{'branchcode'} ); >+ my $calendar = Koha::DiscreteCalendar->new( branchcode => $res->{'branchcode'} ); > my $is_holiday = $calendar->is_holiday( $today ); > > if ( $is_holiday ) { >diff --git a/circ/returns.pl b/circ/returns.pl >index de701ff..ffe4496 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -49,7 +49,7 @@ use C4::Koha; # FIXME : is it still useful ? > use C4::RotatingCollections; > use Koha::AuthorisedValues; > use Koha::DateUtils; >-use Koha::Calendar; >+use Koha::DiscreteCalendar; > use Koha::Checkouts; > > my $query = new CGI; >@@ -202,7 +202,7 @@ my $dropboxmode = $query->param('dropboxmode'); > my $dotransfer = $query->param('dotransfer'); > my $canceltransfer = $query->param('canceltransfer'); > my $dest = $query->param('dest'); >-my $calendar = Koha::Calendar->new( branchcode => $userenv_branch ); >+my $calendar = Koha::DiscreteCalendar->new( branchcode => $userenv_branch ); > #dropbox: get last open day (today - 1) > my $today = DateTime->now( time_zone => C4::Context->tz()); > my $dropboxdate = $calendar->addDate($today, -1); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >index 3220aad..3f24e77 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >@@ -74,6 +74,11 @@ > <dd>Define days when the library is closed</dd> > [% END %] > >+ [% IF ( CAN_user_tools_edit_calendar ) %] >+ <dt><a href="/cgi-bin/koha/tools/discrete_calendar.pl">Discrete Calendar</a></dt> >+ <dd>Define days when the library is closed</dd> >+ [% END %] >+ > [% IF ( CAN_user_tools_manage_csv_profiles ) %] > <dt><a href="/cgi-bin/koha/tools/csv-profiles.pl">CSV profiles</a></dt> > <dd>Manage CSV export profiles</dd> >diff --git a/misc/cronjobs/fines.pl b/misc/cronjobs/fines.pl >index 6c3f830..d544537 100755 >--- a/misc/cronjobs/fines.pl >+++ b/misc/cronjobs/fines.pl >@@ -36,7 +36,7 @@ use Getopt::Long; > use Carp; > use File::Spec; > >-use Koha::Calendar; >+use Koha::DiscreteCalendar; > use Koha::DateUtils; > use C4::Log; > >@@ -176,7 +176,7 @@ EOM > sub set_holiday { > my ( $branch, $dt ) = @_; > >- my $calendar = Koha::Calendar->new( branchcode => $branch ); >+ my $calendar = Koha::DiscreteCalendar->new( branchcode => $branch ); > return $calendar->is_holiday($dt); > } > >diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl >index 0aaf22a..480e508 100755 >--- a/misc/cronjobs/overdue_notices.pl >+++ b/misc/cronjobs/overdue_notices.pl >@@ -40,7 +40,7 @@ use C4::Overdues qw(GetFine GetOverdueMessageTransportTypes parse_overdues_lette > use C4::Log; > use Koha::Patron::Debarments qw(AddUniqueDebarment); > use Koha::DateUtils; >-use Koha::Calendar; >+use Koha::DiscreteCalendar; > use Koha::Libraries; > use Koha::Acquisition::Currencies; > >@@ -444,7 +444,7 @@ elsif ( defined $text_filename ) { > > foreach my $branchcode (@branches) { > if ( C4::Context->preference('OverdueNoticeCalendar') ) { >- my $calendar = Koha::Calendar->new( branchcode => $branchcode ); >+ my $calendar = Koha::DiscreteCalendar->new( branchcode => $branchcode ); > if ( $calendar->is_holiday($date_to_run) ) { > next; > } >@@ -543,7 +543,7 @@ END_SQL > if ( C4::Context->preference('OverdueNoticeCalendar') ) > { > my $calendar = >- Koha::Calendar->new( branchcode => $branchcode ); >+ Koha::DiscreteCalendar->new( branchcode => $branchcode ); > $days_between = > $calendar->days_between( dt_from_string($data->{date_due}), > $date_to_run ); >@@ -627,7 +627,7 @@ END_SQL > while ( my $item_info = $sth2->fetchrow_hashref() ) { > if ( C4::Context->preference('OverdueNoticeCalendar') ) { > my $calendar = >- Koha::Calendar->new( branchcode => $branchcode ); >+ Koha::DiscreteCalendar->new( branchcode => $branchcode ); > $days_between = > $calendar->days_between( > dt_from_string( $item_info->{date_due} ), $date_to_run ); >diff --git a/misc/cronjobs/staticfines.pl b/misc/cronjobs/staticfines.pl >index c57e99e..1535790 100755 >--- a/misc/cronjobs/staticfines.pl >+++ b/misc/cronjobs/staticfines.pl >@@ -40,7 +40,7 @@ use Date::Calc qw/Date_to_Days/; > use C4::Context; > use C4::Circulation; > use C4::Overdues; >-use C4::Calendar qw(); # don't need any exports from Calendar >+use Koha::DiscreteCalendar qw(); # don't need any exports from Calendar > use C4::Biblio; > use C4::Debug; # supplying $debug and $cgi_debug > use C4::Log; >@@ -176,7 +176,7 @@ for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) { > > my $calendar; > unless ( defined( $calendars{$branchcode} ) ) { >- $calendars{$branchcode} = C4::Calendar->new( branchcode => $branchcode ); >+ $calendars{$branchcode} = Koha::DiscreteCalendar->new( branchcode => $branchcode ); > } > $calendar = $calendars{$branchcode}; > my $isHoliday = $calendar->isHoliday( $tday, $tmonth, $tyear ); >diff --git a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >index 1299b7d..7138c15 100755 >--- a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >+++ b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >@@ -35,7 +35,7 @@ use C4::Context; > use C4::Items; > use C4::Letters; > use C4::Overdues; >-use Koha::Calendar; >+use Koha::DiscreteCalendar; > use Koha::DateUtils; > > sub usage { >@@ -291,7 +291,7 @@ sub GetWaitingHolds { > $sth->execute(); > my @results; > while ( my $issue = $sth->fetchrow_hashref() ) { >- my $calendar = Koha::Calendar->new( branchcode => $issue->{'site'} ); >+ my $calendar = Koha::DiscreteCalendar->new( branchcode => $issue->{'site'} ); > > my $waiting_date = dt_from_string( $issue->{waitingdate}, 'sql' ); > my $pickup_date = $waiting_date->clone->add( days => $pickupdelay ); >-- >1.9.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 17015
:
53859
|
54318
|
54419
|
59166
|
59167
|
59168
|
59169
|
59170
|
59171
|
59267
|
59268
|
59269
|
59270
|
59271
|
59463
|
59516
|
59517
|
59518
|
59519
|
59520
|
59561
|
59562
|
59586
|
59587
|
59888
|
59889
|
60902
|
60903
|
60904
|
60905
|
60906
|
60986
|
61737
|
62375
|
62376
|
62380
|
63257
|
63282
|
63362
|
63363
|
63364
|
63365
|
63366
|
63367
|
64235
|
65073
|
65074
|
65075
|
65076
|
65077
|
67721
|
67722
|
67723
|
67724
|
67725
|
67879
|
67929
|
67930
|
67931
|
67932
|
67933
|
67934
|
68392
|
68393
|
68394
|
68395
|
68396
|
68397
|
71634
|
71635
|
71636
|
71637
|
71638
|
72890
|
73145
|
74859
|
74860
|
74861
|
74862
|
74863
|
74864
|
74865
|
74866
|
75444
|
75479
|
76594
|
77249
|
77250
|
77607
|
77608
|
77609
|
77610
|
77611
|
77612
|
77613
|
77770
|
77771
|
77772
|
77773
|
77774
|
79035
|
80523
|
80524
|
80525
|
80526
|
80527
|
80528
|
80529
|
80530
|
80531
|
80532
|
80533
|
80534
|
80535
|
83547
|
85394
|
85677
|
85678
|
85679
|
85680
|
85681
|
85682
|
85683
|
85684
|
85685
|
85686
|
85687
|
85688
|
85689
|
85690
|
85691
|
92595
|
92596
|
92597
|
92598
|
100079
|
110383
|
110384
|
110386
|
110387
|
110388
|
110389
|
113541
|
113905
|
115501
|
115502
|
115503
|
115504
|
115505
|
115506
|
115507
|
115508
|
115509
|
115510
|
115511
|
118554
|
118555
|
118556
|
118557
|
118558
|
118559
|
119095
|
119097
|
119099
|
119100
|
119101
|
119102
|
131619
|
131620
|
131621
|
131622
|
131623
|
131624
|
131625
|
131626
|
131634
|
131635
|
131636
|
131637
|
131638
|
131639
|
131640
|
131641
|
131667
|
132199
|
133596
|
133597
|
133598
|
133599
|
133600
|
133601
|
133602
|
133603
|
133604
|
133605
|
133678
|
137219
|
137220
|
137221
|
137222
|
137223
|
137224
|
137225
|
137226
|
137227
|
137228
|
137229
|
139378
|
139379
|
139380
|
139381
|
139382
|
139599
|
139600
|
139601
|
139602
|
139603
|
139851
|
140150
|
141176
|
144257
|
144258
|
144259
|
144260
|
144261
|
144262
|
144264
|
144268
|
144269
|
144270
|
144271
|
144272
|
144273
|
151438
|
151439
|
151440
|
151441
|
151442
|
151443
|
151444
|
151445
|
151446
|
151447
|
151448
|
151449
|
151450
|
156340
|
156341
|
156342
|
156343
|
156344
|
156345
|
156346
|
156347
|
156348
|
156349
|
156350
|
156351
|
156352
|
156353
|
156354
|
156355
|
157656
|
157657
|
157658
|
157659
|
157660
|
157661
|
157662
|
157663
|
157664
|
157665
|
157666
|
157667
|
157668
|
157669
|
157670
|
157671
|
157672
|
167805
|
167806
|
167807
|
167808
|
167809