Bugzilla – Attachment 150448 Details for
Bug 6796
Overnight checkouts taking into account opening and closing hours
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6796: Fix saving of libraries and tests
Bug-6796-Fix-saving-of-libraries-and-tests.patch (text/plain), 5.22 KB, created by
Aleisha Amohia
on 2023-05-01 03:01:13 UTC
(
hide
)
Description:
Bug 6796: Fix saving of libraries and tests
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2023-05-01 03:01:13 UTC
Size:
5.22 KB
patch
obsolete
>From 686188a6ebb87059940a9bacb44d9e587832a1a1 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Mon, 1 May 2023 02:56:42 +0000 >Subject: [PATCH] Bug 6796: Fix saving of libraries and tests > >--- > admin/branches.pl | 8 ++++---- > t/db_dependent/Circulation/CalcDateDue.t | 19 ++++++++++--------- > 2 files changed, 14 insertions(+), 13 deletions(-) > >diff --git a/admin/branches.pl b/admin/branches.pl >index d0e8af71847..6baaa6d6a6a 100755 >--- a/admin/branches.pl >+++ b/admin/branches.pl >@@ -123,10 +123,10 @@ if ( $op eq 'add_form' ) { > my @close_times = $input->multi_param("close_time"); > > foreach my $day ( @days ) { >- if ( $open_times[$day] and $open_times[$day] eq '' ) { >+ if ( $open_times[$day] !~ /([0-9]{2}:[0-9]{2})/ ) { > $open_times[$day] = undef; > } >- if ( $close_times[$day] and $close_times[$day] eq '' ) { >+ if ( $close_times[$day] !~ /([0-9]{2}:[0-9]{2})/ ) { > $close_times[$day] = undef; > } > >@@ -176,10 +176,10 @@ if ( $op eq 'add_form' ) { > my @close_times = $input->multi_param("close_time"); > > foreach my $day ( @days ) { >- if ( $open_times[$day] and $open_times[$day] eq '' ) { >+ if ( $open_times[$day] !~ /([0-9]{2}:[0-9]{2})/ ) { > $open_times[$day] = undef; > } >- if ( $close_times[$day] and $close_times[$day] eq '' ) { >+ if ( $close_times[$day] !~ /([0-9]{2}:[0-9]{2})/ ) { > $close_times[$day] = undef; > } > >diff --git a/t/db_dependent/Circulation/CalcDateDue.t b/t/db_dependent/Circulation/CalcDateDue.t >index faa1f4af35b..50c88d1cd39 100755 >--- a/t/db_dependent/Circulation/CalcDateDue.t >+++ b/t/db_dependent/Circulation/CalcDateDue.t >@@ -352,13 +352,14 @@ Koha::CirculationRules->set_rules( > rules => { > issuelength => 3, # loan period is 3 hours > lengthunit => 'hours', >+ daysmode => '', > } > } > ); > >-my $open = DateTime->now->subtract( hours => 4 )->hms; >-my $close = DateTime->now->add( hours => 2 )->hms; >-my $now = DateTime->now; >+my $open = DateTime->new( year => 2023, month => 5, day => 1, hour => 10 )->hms; >+my $close = DateTime->new( year => 2023, month => 5, day => 1, hour => 16 )->hms; >+my $now = DateTime->new( year => 2023, month => 5, day => 1, hour => 14 ); > > foreach (0..6) { > # library opened 4 hours ago and closes in 2 hours. >@@ -371,17 +372,17 @@ t::lib::Mocks::mock_preference('ConsiderLibraryHoursWhenIssuing', 'close'); > # shorten loan period > > $date = C4::Circulation::CalcDateDue( $now, $itemtype, $library1->{branchcode}, $borrower ); >-my $expected_duetime = DateTime->now->add( hours => 2 ); >+my $expected_duetime = $now->clone->add( hours => 2 ); > is( $date, $expected_duetime, "Loan period was shortened because ConsiderLibraryHoursWhenIssuing is set to close time" ); > > t::lib::Mocks::mock_preference('ConsiderLibraryHoursWhenIssuing', 'open'); > # extend loan period > > $date = C4::Circulation::CalcDateDue( $now, $itemtype, $library1->{branchcode}, $borrower ); >-$expected_duetime = DateTime->now->add( days => 1 )->subtract( hours => 4 ); >+$expected_duetime = $now->clone->add( days => 1 )->subtract( hours => 4 ); > is( $date, $expected_duetime, "Loan period was extended because ConsiderLibraryHoursWhenIssuing is set to open time" ); > >-my $holiday_tomorrow = DateTime->now->add( days => 1 ); >+my $holiday_tomorrow = $now->clone->add( days => 1 ); > > # consider calendar > my $library1_calendar = C4::Calendar->new( branchcode => $library1->{branchcode} ); >@@ -398,7 +399,7 @@ Koha::CirculationRules->set_rules( > itemtype => $itemtype, > branchcode => $library1->{branchcode}, > rules => { >- issuelength => 13, # loan period must cross over into tomorrow >+ issuelength => 18, # loan period must cross over into tomorrow > lengthunit => 'hours', > } > } >@@ -409,14 +410,14 @@ t::lib::Mocks::mock_preference('ConsiderLibraryHoursWhenIssuing', 'close'); > # shorten loan period > > $date = C4::Circulation::CalcDateDue( $now, $itemtype, $library1->{branchcode}, $borrower ); >-$expected_duetime = DateTime->now->add( days => 2, hours => 2 ); >+$expected_duetime = $now->clone->add( days => 2, hours => 2 ); > is( $date, $expected_duetime, "Loan period was shortened (but considers the holiday) because ConsiderLibraryHoursWhenIssuing is set to close time" ); > > t::lib::Mocks::mock_preference('ConsiderLibraryHoursWhenIssuing', 'open'); > # extend loan period > > $date = C4::Circulation::CalcDateDue( $now, $itemtype, $library1->{branchcode}, $borrower ); >-$expected_duetime = DateTime->now->add( days => 2 )->subtract( hours => 4 ); >+$expected_duetime = $now->clone->add( days => 2 )->subtract( hours => 4 ); > is( $date, $expected_duetime, "Loan period was extended (but considers the holiday) because ConsiderLibraryHoursWhenIssuing is set to open time" ); > > $cache->clear_from_cache($key); >-- >2.30.2
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 6796
:
124669
|
124670
|
124671
|
124672
|
134323
|
134324
|
134325
|
134326
|
134327
|
145669
|
145670
|
145671
|
145672
|
145673
|
146988
|
146989
|
146990
|
146991
|
146992
|
150442
|
150443
|
150444
|
150445
|
150446
|
150447
|
150448
|
150477
|
150478
|
153252
|
153253
|
153254
|
153255
|
153256
|
153257
|
153258
|
153259
|
153260
|
153261
|
153271
|
153272
|
153273
|
153274
|
153275
|
153276
|
153277
|
153278
|
153279
|
153280
|
156772
|
156773
|
156774
|
156775
|
156776
|
156777
|
156778
|
156779
|
156780
|
161970
|
161971
|
161972
|
161973
|
161974
|
161975
|
161976
|
161977
|
161978
|
161979
|
161980
|
161986
|
161987
|
161988
|
161989
|
162043
|
162044
|
162045
|
162046
|
162047
|
162048
|
162049
|
162050
|
162051
|
162052
|
162053
|
162054
|
162055
|
162056
|
162090
|
162091
|
162092
|
162093
|
162094
|
162095
|
162096
|
162097
|
162098
|
162099
|
162100
|
162101
|
162102
|
162103
|
162104
|
164511
|
164512
|
164513
|
164514
|
164515
|
164516
|
164517
|
164518
|
164538
|
164539
|
164540
|
164541
|
164542
|
164543
|
164544
|
164545
|
164546
|
164547
|
164548
|
164549
|
164550
|
164551
|
164552