Bugzilla – Attachment 137227 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: DiscreteCalendar->new() method is now in a HASH
Bug-17015-DiscreteCalendar-new-method-is-now-in-a-.patch (text/plain), 10.19 KB, created by
Shi Yao Wang
on 2022-07-06 15:24:35 UTC
(
hide
)
Description:
Bug 17015: DiscreteCalendar->new() method is now in a HASH
Filename:
MIME Type:
Creator:
Shi Yao Wang
Created:
2022-07-06 15:24:35 UTC
Size:
10.19 KB
patch
obsolete
>From b65f6313c917d188b7e25c89744c1b1913367e39 Mon Sep 17 00:00:00 2001 >From: The Minh Luong <theminh@inlibro.com> >Date: Mon, 14 Mar 2022 11:57:08 -0400 >Subject: [PATCH] Bug 17015: DiscreteCalendar->new() method is now in a HASH > >This patch adds missing curly brackets in all new() calls. >All tests in t/ should pass too (The one that don't pass are not passing before the patch) > >TEST PLAN: >1- Apply the patch >2- Run installer/data/mysql/updatedatabase.pl >3- Run misc/cronjobs/add_days_discrete_calendar.pl >4- Check that the max date is today + 1 day >5- Attempt a checkout > ~ The error "Can't use string ("branchcode") as a HASH ref while > "strict refs" in use at /kohadevbox/koha/Koha/DiscreteCalendar.pm line 79" is no longer here >5- Run t/db_dependent/DiscreteCalendar.t (prove -l t/db_dependent/DiscreteCalendar.t) >6- Run all koha test in t/ (prove t). All tests should pass >7- Use Discrete Calendar in Tools->Calendar > >USING THE DISCRETE CALENDAR: >1- New UI > a) Calendar on the left > b) Holidays list on the right >2- New color system for holiday types: > a) Working day : white > b) Unique holiday: red > c) Holiday repeating weekly: yellow > d) Holiday repeating yearly: orange > e) Floating holiday: green > f) Need validation: blue >3- When clicking on a date in the calendar, opening, closing hours and holiday type are displayed. >4- All the fields are editable >5- New radio button to Edit selected dates or Copy to different dates >6- Option to copy the calendar to another branch >--- > C4/Circulation.pm | 10 +++++----- > C4/HoldsQueue.pm | 4 ++-- > Koha/Charges/Fees.pm | 2 +- > Koha/Checkouts.pm | 2 +- > Koha/DiscreteCalendar.pm | 4 ++-- > Koha/Hold.pm | 2 +- > installer/data/mysql/updatedatabase.pl | 2 +- > misc/cronjobs/fines.pl | 2 +- > misc/cronjobs/holds/holds_reminder.pl | 2 +- > misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl | 2 +- > 10 files changed, 16 insertions(+), 16 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 0f5396e32f..9d3fa2b062 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1410,7 +1410,7 @@ sub checkHighHolds { > branchcode => $branchcode, > } > ); >- my $calendar = Koha::DiscreteCalendar->new( branchcode => $branchcode, days_mode => $daysmode ); >+ my $calendar = Koha::DiscreteCalendar->new({ branchcode => $branchcode, days_mode => $daysmode }); > > my $orig_due = C4::Circulation::CalcDateDue( $issuedate, $itype, $branchcode, $patron->unblessed ); > >@@ -2629,10 +2629,10 @@ sub _calculate_new_debar_dt { > my $new_debar_dt; > # Use the calendar or not to calculate the debarment date > if ( C4::Context->preference('SuspensionsCalendar') eq 'noSuspensionsWhenClosed' ) { >- my $calendar = Koha::DiscreteCalendar->new( >+ my $calendar = Koha::DiscreteCalendar->new({ > branchcode => $branchcode, > days_mode => 'Calendar' >- ); >+ }); > $new_debar_dt = $calendar->addDuration( $return_date, $suspension_days ); > } > else { >@@ -3795,7 +3795,7 @@ sub CalcDateDue { > else { # days > $dur = DateTime::Duration->new( days => $loanlength->{$length_key}); > } >- my $calendar = Koha::DiscreteCalendar->new( branchcode => $branch, days_mode => $daysmode ); >+ my $calendar = Koha::DiscreteCalendar->new({ branchcode => $branch, days_mode => $daysmode }); > $datedue = $calendar->addDuration( $datedue, $dur, $loanlength->{lengthunit} ); > if ($loanlength->{lengthunit} eq 'days') { > $datedue->set_hour(23); >@@ -3834,7 +3834,7 @@ sub CalcDateDue { > } > } > if ( $daysmode ne 'Days' ) { >- my $calendar = Koha::DiscreteCalendar->new( branchcode => $branch, days_mode => $daysmode ); >+ my $calendar = Koha::DiscreteCalendar->new({ branchcode => $branch, days_mode => $daysmode }); > if ( $calendar->is_holiday($datedue) ) { > # Don't return on a closed day > $datedue = $calendar->prev_open_days( $datedue )->set(hour => 23, minute => 59); >diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm >index 6ecdc601a3..40fc186798 100644 >--- a/C4/HoldsQueue.pm >+++ b/C4/HoldsQueue.pm >@@ -79,8 +79,8 @@ sub TransportCostMatrix { > disable_transfer => $disabled > }; > >- if ( !$ignore_holds_queue_skip_closed && C4::Context->preference("HoldsQueueSkipClosed") ) { >- $calendars->{$from} ||= Koha::DiscreteCalendar->new( branchcode => $from ); >+ if ( !my $ignore_holds_queue_skip_closed && C4::Context->preference("HoldsQueueSkipClosed") ) { >+ my $calendars->{$from} ||= Koha::DiscreteCalendar->new({ branchcode => $from }); > $transport_cost_matrix{$to}{$from}{disable_transfer} ||= > $calendars->{$from}->is_holiday( $today ); > } >diff --git a/Koha/Charges/Fees.pm b/Koha/Charges/Fees.pm >index 034e320a02..ed17b200fd 100644 >--- a/Koha/Charges/Fees.pm >+++ b/Koha/Charges/Fees.pm >@@ -109,7 +109,7 @@ sub accumulate_rentalcharge { > return 0 unless $rentalcharge_increment && $rentalcharge_increment > 0; > > my $duration; >- my $calendar = Koha::DiscreteCalendar->new( branchcode => $self->library->id ); >+ my $calendar = Koha::DiscreteCalendar->new({ branchcode => $self->library->id }); > > if ( $units eq 'hours' ) { > if ( $itemtype->rentalcharge_hourly_calendar ) { >diff --git a/Koha/Checkouts.pm b/Koha/Checkouts.pm >index 1872479ad7..69263e7d95 100644 >--- a/Koha/Checkouts.pm >+++ b/Koha/Checkouts.pm >@@ -55,7 +55,7 @@ sub calculate_dropbox_date { > branchcode => $branchcode, > } > ); >- my $calendar = Koha::DiscreteCalendar->new( branchcode => $branchcode, days_mode => $daysmode ); >+ my $calendar = Koha::DiscreteCalendar->new({ branchcode => $branchcode, days_mode => $daysmode }); > my $today = dt_from_string; > my $dropbox_date = $calendar->addDuration( $today, -1 ); > my $dateInfo = $calendar->get_date_info($dropbox_date); >diff --git a/Koha/DiscreteCalendar.pm b/Koha/DiscreteCalendar.pm >index 17c633eab9..9ee432e6ad 100644 >--- a/Koha/DiscreteCalendar.pm >+++ b/Koha/DiscreteCalendar.pm >@@ -277,7 +277,7 @@ sub get_date_info { > > my $maxDate = $calendar->get_max_date(); > >-Returns the furthest date available in the databse of current branch. >+Returns the furthest date available in the database of current branch. > > =cut > >@@ -303,7 +303,7 @@ sub get_max_date { > > my $minDate = $calendar->get_min_date(); > >-Returns the oldest date available in the databse of current branch. >+Returns the oldest date available in the database of current branch. > > =cut > >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index af286bc7fc..dd88bd3894 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -231,7 +231,7 @@ sub set_waiting { > branchcode => $self->branchcode, > } > ); >- my $calendar = Koha::DiscreteCalendar->new( branchcode => $self->branchcode, days_mode => $daysmode ); >+ my $calendar = Koha::DiscreteCalendar->new({ branchcode => $self->branchcode, days_mode => $daysmode }); > > $new_expiration_date = $calendar->days_forward( dt_from_string(), $max_pickup_delay ); > } >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 737d5f8316..3a8af59f3c 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -14371,7 +14371,7 @@ if( CheckVersion( $DBversion ) ) { > > my $expirationdate = dt_from_string($hold->{waitingdate}); > if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) { >- my $calendar = Koha::DiscreteCalendar->new( branchcode => $hold->{branchcode}, days_mode => C4::Context->preference('useDaysMode') ); >+ my $calendar = Koha::DiscreteCalendar->new({ branchcode => $hold->{branchcode}, days_mode => C4::Context->preference('useDaysMode') }); > $expirationdate = $calendar->days_forward( $expirationdate, $max_pickup_delay ); > } else { > $expirationdate->add( days => $max_pickup_delay ); >diff --git a/misc/cronjobs/fines.pl b/misc/cronjobs/fines.pl >index 2ede371105..897c773005 100755 >--- a/misc/cronjobs/fines.pl >+++ b/misc/cronjobs/fines.pl >@@ -203,7 +203,7 @@ EOM > sub set_holiday { > my ( $branch, $dt ) = @_; > >- my $calendar = Koha::DiscreteCalendar->new( branchcode => $branch ); >+ my $calendar = Koha::DiscreteCalendar->new({ branchcode => $branch }); > return $calendar->is_holiday($dt); > } > >diff --git a/misc/cronjobs/holds/holds_reminder.pl b/misc/cronjobs/holds/holds_reminder.pl >index 8c8ad780ce..390ecd041d 100755 >--- a/misc/cronjobs/holds/holds_reminder.pl >+++ b/misc/cronjobs/holds/holds_reminder.pl >@@ -246,7 +246,7 @@ foreach my $branchcode (@branchcodes) { #BEGIN BRANCH LOOP > # If respecting calendar get the correct waiting since date > my $waiting_date; > if( $use_calendar ){ >- my $calendar = Koha::DiscreteCalendar->new( branchcode => $branchcode, days_mode => 'Calendar' ); >+ my $calendar = Koha::DiscreteCalendar->new({ branchcode => $branchcode, days_mode => 'Calendar' }); > my $duration = DateTime::Duration->new( days => -$days ); > $waiting_date = $calendar->addDays($date_to_run,$duration); #Add negative of days > } else { >diff --git a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >index 94b3b62f54..3fe64bb29c 100755 >--- a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >+++ b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >@@ -335,7 +335,7 @@ sub GetWaitingHolds { > } > ); > >- my $calendar = Koha::DiscreteCalendar->new( branchcode => $issue->{'site'}, days_mode => $daysmode ); >+ my $calendar = Koha::DiscreteCalendar->new({ branchcode => $issue->{'site'}, days_mode => $daysmode }); > > my $waiting_date = dt_from_string( $issue->{waitingdate}, 'sql' ); > my $pickup_date = $waiting_date->clone->add( days => $pickupdelay ); >-- >2.25.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