Bugzilla – Attachment 164542 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.41 KB, created by
Martin Renvoize (ashimema)
on 2024-04-09 09:57:27 UTC
(
hide
)
Description:
Bug 6796: Fix saving of libraries and tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-04-09 09:57:27 UTC
Size:
5.41 KB
patch
obsolete
>From 795e2965e2c578998ebcec015545b1821412f546 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 > >Sponsored-by: Catalyst IT >Sponsored-by: Auckland University of Technology >Signed-off-by: Sam Lau <samalau@gmail.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > 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 21de53802fe..b94325eef20 100755 >--- a/admin/branches.pl >+++ b/admin/branches.pl >@@ -125,10 +125,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; > } > >@@ -178,10 +178,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 96e1f3a2106..54bde9fe957 100755 >--- a/t/db_dependent/Circulation/CalcDateDue.t >+++ b/t/db_dependent/Circulation/CalcDateDue.t >@@ -368,13 +368,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. >@@ -387,17 +388,17 @@ t::lib::Mocks::mock_preference('ConsiderLibraryHoursInCirculation', '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 ConsiderLibraryHoursInCirculation 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 ConsiderLibraryHoursInCirculation 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} ); >@@ -414,7 +415,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', > } > } >@@ -425,14 +426,14 @@ t::lib::Mocks::mock_preference('ConsiderLibraryHoursInCirculation', '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 ConsiderLibraryHoursInCirculation is set to close time" ); > > t::lib::Mocks::mock_preference( 'ConsiderLibraryHoursInCirculation', '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 ConsiderLibraryHoursInCirculation is set to open time" ); > > $cache->clear_from_cache($key); >-- >2.44.0
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