Bugzilla – Attachment 148297 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: Holds API fixes for datetime
Bug-24718-Holds-API-fixes-for-datetime.patch (text/plain), 4.85 KB, created by
Aleisha Amohia
on 2023-03-16 23:23:30 UTC
(
hide
)
Description:
Bug 24718: Holds API fixes for datetime
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2023-03-16 23:23:30 UTC
Size:
4.85 KB
patch
obsolete
>From 15ebc671da65e09e6df6a388e922cc0b70807e7a Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Wed, 20 Oct 2021 17:02:28 +1300 >Subject: [PATCH] Bug 24718: Holds API fixes for datetime > >--- > api/v1/swagger/definitions/hold.yaml | 4 ++-- > api/v1/swagger/paths/holds.yaml | 6 +++--- > t/db_dependent/api/v1/holds.t | 14 ++++++++------ > 3 files changed, 13 insertions(+), 11 deletions(-) > >diff --git a/api/v1/swagger/definitions/hold.yaml b/api/v1/swagger/definitions/hold.yaml >index a7d0d393301..d66e8468654 100644 >--- a/api/v1/swagger/definitions/hold.yaml >+++ b/api/v1/swagger/definitions/hold.yaml >@@ -11,7 +11,7 @@ properties: > type: > - string > - "null" >- format: date >+ format: date-time > description: The date the hold was placed > biblio_id: > type: integer >@@ -77,7 +77,7 @@ properties: > type: > - string > - "null" >- format: date >+ format: date-time > description: The date the hold expires > lowest_priority: > type: boolean >diff --git a/api/v1/swagger/paths/holds.yaml b/api/v1/swagger/paths/holds.yaml >index f63ce0c017b..d8451fdec8c 100644 >--- a/api/v1/swagger/paths/holds.yaml >+++ b/api/v1/swagger/paths/holds.yaml >@@ -19,7 +19,7 @@ > in: query > description: Hold > type: string >- format: date >+ format: date-time > - name: biblio_id > in: query > description: Internal biblio identifier >@@ -154,7 +154,7 @@ > type: > - string > - "null" >- format: date >+ format: date-time > item_id: > description: Internal item identifier > type: >@@ -168,7 +168,7 @@ > type: > - string > - "null" >- format: date >+ format: date-time > notes: > description: Notes related to this hold > type: >diff --git a/t/db_dependent/api/v1/holds.t b/t/db_dependent/api/v1/holds.t >index adc54296605..4aaf366f38b 100755 >--- a/t/db_dependent/api/v1/holds.t >+++ b/t/db_dependent/api/v1/holds.t >@@ -159,7 +159,7 @@ my $post_data = { > biblio_id => $biblio_1->biblionumber, > item_id => $item_1->itemnumber, > pickup_library_id => $branchcode, >- expiration_date => output_pref( { dt => $expiration_date, dateformat => 'iso', dateonly => 1 } ), >+ expiration_date => output_pref( { dt => $expiration_date, dateformat => 'iso' } ), > }; > my $patch_data = { > priority => 2, >@@ -254,7 +254,7 @@ subtest "Test endpoints with permission" => sub { > $t->get_ok( "//$userid_1:$password@/api/v1/holds?patron_id=" . $patron_1->borrowernumber ) > ->status_is(200) > ->json_is('/0/hold_id', $reserve_id) >- ->json_is('/0/expiration_date', output_pref({ dt => $expiration_date, dateformat => 'iso', dateonly => 1 })) >+ ->json_is('/0/expiration_date', output_pref({ dt => $expiration_date, dateformat => 'iso' })) > ->json_is('/0/pickup_library_id', $branchcode); > > $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) >@@ -322,15 +322,15 @@ subtest 'test AllowHoldDateInFuture' => sub { > > $dbh->do('DELETE FROM reserves'); > >- my $future_hold_date = DateTime->now->add(days => 10)->truncate( to => 'day' ); >+ my $future_hold_date = DateTime->now->add(days => 10); > > my $post_data = { > patron_id => $patron_1->borrowernumber, > biblio_id => $biblio_1->biblionumber, > item_id => $item_1->itemnumber, > pickup_library_id => $branchcode, >- expiration_date => output_pref( { dt => $expiration_date, dateformat => 'iso', dateonly => 1 } ), >- hold_date => output_pref( { dt => $future_hold_date, dateformat => 'iso', dateonly => 1 } ), >+ expiration_date => output_pref( { dt => $expiration_date, dateformat => 'iso' } ), >+ hold_date => output_pref( { dt => $future_hold_date, dateformat => 'iso' } ), > }; > > t::lib::Mocks::mock_preference( 'AllowHoldDateInFuture', 0 ); >@@ -340,6 +340,8 @@ subtest 'test AllowHoldDateInFuture' => sub { > ->json_has('/error'); > > t::lib::Mocks::mock_preference( 'AllowHoldDateInFuture', 1 ); >+ t::lib::Mocks::mock_preference( 'HourBasedHolds', 1 ); >+ t::lib::Mocks::mock_preference( 'dateformat', 'rfc3339' ); > > # Make sure pickup location checks doesn't get in the middle > my $mock_biblio = Test::MockModule->new('Koha::Biblio'); >@@ -349,7 +351,7 @@ subtest 'test AllowHoldDateInFuture' => sub { > > $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) > ->status_is(201) >- ->json_is('/hold_date', output_pref({ dt => $future_hold_date, dateformat => 'iso', dateonly => 1 })); >+ ->json_is('/hold_date', output_pref({ dt => $future_hold_date, dateformat => 'iso' })); > }; > > $schema->storage->txn_rollback; >-- >2.20.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 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