Bugzilla – Attachment 110088 Details for
Bug 24718
Introduce hour-based holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24718: Ensuring tests pass
Bug-24718-Ensuring-tests-pass.patch (text/plain), 4.79 KB, created by
Aleisha Amohia
on 2020-09-15 01:59:43 UTC
(
hide
)
Description:
Bug 24718: Ensuring tests pass
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2020-09-15 01:59:43 UTC
Size:
4.79 KB
patch
obsolete
>From f2953c44cd40d78f9a6390614c2698802fe27f70 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Tue, 25 Feb 2020 00:28:36 +0000 >Subject: [PATCH] Bug 24718: Ensuring tests pass > >Confirm these tests pass before and after applying patches > >t/db_dependent/Holds.t >t/db_dependent/Circulation.t >t/db_dependent/Circulation/issue.t >t/db_dependent/Holds/HoldFulfillmentPolicy.t >t/db_dependent/Holds/LocalHoldsPriority.t >t/db_dependent/Holds/HoldItemtypeLimit.t >t/db_dependent/Holds/RevertWaitingStatus.t >t/db_dependent/HoldsQueue.t >t/db_dependent/Reserves/CancelExpiredReserves.t > >Signed-off-by: David Nind <david@davidnind.com> >--- > C4/HoldsQueue.pm | 4 ++-- > C4/Reserves.pm | 8 ++++++-- > Koha/Item.pm | 2 +- > t/db_dependent/Holds.t | 4 ++-- > 4 files changed, 11 insertions(+), 7 deletions(-) > >diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm >index 4950522726..cb061b6856 100644 >--- a/C4/HoldsQueue.pm >+++ b/C4/HoldsQueue.pm >@@ -239,7 +239,7 @@ sub GetBibsWithPendingHoldRequests { > FROM reserves > WHERE found IS NULL > AND priority > 0 >- AND reservedate <= CURRENT_DATE() >+ AND reservedate <= CURRENT_TIMESTAMP() > AND suspend = 0 > "; > my $sth = $dbh->prepare($bib_query); >@@ -283,7 +283,7 @@ sub GetPendingHoldRequestsForBib { > WHERE biblionumber = ? > AND found IS NULL > AND priority > 0 >- AND reservedate <= CURRENT_DATE() >+ AND reservedate <= CURRENT_TIMESTAMP() > AND suspend = 0 > ORDER BY priority"; > my $sth = $dbh->prepare($request_query); >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 4156b4c856..7232dccbe6 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -448,9 +448,13 @@ sub CanItemBeReserved { > return { status => "tooManyHoldsForThisRecord", limit => $holds_per_record }; > } > >+ my $dtf = Koha::Database->new->schema->storage->datetime_parser; >+ my $fromdate = dt_from_string->set({ hour => 00, minute => 00, second => 00 }); >+ my $todate = dt_from_string->set({ hour => 23, minute => 59, second => 59 }); >+ > my $today_holds = Koha::Holds->search({ > borrowernumber => $borrowernumber, >- reservedate => dt_from_string->date >+ reservedate => [ -and => { '>=' => $dtf->format_datetime($fromdate) }, { '<=' => $dtf->format_datetime($todate) } ] > }); > > if ( defined $holds_per_day && $holds_per_day ne '' >@@ -922,7 +926,7 @@ sub CancelExpiredReserves { > my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay'); > > my $dtf = Koha::Database->new->schema->storage->datetime_parser; >- my $params = { expirationdate => { '<', $today } }; >+ my $params = { expirationdate => { '<', $dtf->format_datetime($today) } }; > $params->{found} = [ { '!=', 'W' }, undef ] unless $expireWaiting; > > # FIXME To move to Koha::Holds->search_expired (?) >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 8dffac4db5..349cf651a4 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -648,7 +648,7 @@ sub current_holds { > itemnumber => $self->itemnumber, > suspend => 0, > -or => [ >- reservedate => { '<=' => $dtf->format_date(dt_from_string) }, >+ reservedate => { '<=' => $dtf->format_datetime(dt_from_string) }, > waitingdate => { '!=' => undef }, > ], > }; >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index 0cffe1501a..57191df336 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -102,7 +102,7 @@ my $reservedate = $first_hold->reservedate; > my $borrowernumber = $first_hold->borrowernumber; > my $branch_1code = $first_hold->branchcode; > my $reserve_id = $first_hold->reserve_id; >-is( $reservedate, output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), "holds_placed_today should return a valid reserve date"); >+is( dt_from_string( $reservedate ), dt_from_string, "holds_placed_today should return a valid reserve date"); > is( $borrowernumber, $borrowernumbers[0], "holds_placed_today should return a valid borrowernumber"); > is( $branch_1code, $branch_1, "holds_placed_today should return a valid branchcode"); > ok($reserve_id, "Test holds_placed_today()"); >@@ -715,7 +715,7 @@ subtest 'CanItemBeReserved / holds_per_day tests' => sub { > is_deeply( > CanItemBeReserved( $patron->borrowernumber, $itemnumber_2 ), > { status => 'tooManyReservesToday', limit => 2 }, >- 'Patron cannot a third item with 2 reserves daily cap' >+ 'Patron cannot reserve a third item with 2 reserves daily cap' > ); > > # Update last hold so reservedate is in the past, so 2 holds, but different day >-- >2.11.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 24718
:
99540
|
99541
|
99542
|
99543
|
99544
|
99545
|
99548
|
103521
|
103522
|
103549
|
103550
|
103551
|
103552
|
103553
|
103554
|
103555
|
106270
|
106271
|
106272
|
106273
|
106274
|
106275
|
110084
|
110085
|
110086
|
110087
|
110088
|
110089
|
110090
|
110091
|
110098
|
110137
|
110161
|
110303
|
126559
|
126560
|
126561
|
126562
|
126563
|
126564
|
148293
|
148294
|
148295
|
148296
|
148297
|
148298
|
162474
|
162475
|
162476
|
162477
|
162478
|
162479