Bugzilla – Attachment 127235 Details for
Bug 24850
Koha::DateUtils ignores offsets in RFC3339 datetimes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24850: Fix api/v1/holds.t
Bug-24850-Fix-apiv1holdst.patch (text/plain), 6.12 KB, created by
Jonathan Druart
on 2021-11-03 09:46:15 UTC
(
hide
)
Description:
Bug 24850: Fix api/v1/holds.t
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-11-03 09:46:15 UTC
Size:
6.12 KB
patch
obsolete
>From 08f2ee843845c5749f6abba93f85f4dfe628e39d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 3 Nov 2021 10:44:14 +0100 >Subject: [PATCH] Bug 24850: Fix api/v1/holds.t > >--- > Koha/REST/V1/Holds.pm | 12 +++++++----- > t/db_dependent/api/v1/holds.t | 20 ++++++++++---------- > 2 files changed, 17 insertions(+), 15 deletions(-) > >diff --git a/Koha/REST/V1/Holds.pm b/Koha/REST/V1/Holds.pm >index 7541a5c653d..256cb402599 100644 >--- a/Koha/REST/V1/Holds.pm >+++ b/Koha/REST/V1/Holds.pm >@@ -185,7 +185,7 @@ sub add { > > # AddReserve expects date to be in syspref format > if ($expiration_date) { >- $expiration_date = output_pref( dt_from_string( $expiration_date, 'rfc3339' ) ); >+ $expiration_date = output_pref( { dt => dt_from_string($expiration_date, 'iso'), dateformat => 'iso', dateonly => 1 } ); > } > > my $hold_id = C4::Reserves::AddReserve( >@@ -286,7 +286,9 @@ sub edit { > reserve_id => $hold_id, > branchcode => $pickup_library_id, > rank => $priority, >- suspend_until => $suspended_until ? output_pref(dt_from_string($suspended_until, 'rfc3339')) : '', >+ suspend_until => $suspended_until >+ ? output_pref({ dt => dt_from_string($suspended_until, 'iso'), dateformat => 'iso', dateonly => 1 }) >+ : '', > itemnumber => $hold->itemnumber > }; > >@@ -351,15 +353,15 @@ sub suspend { > } > > return try { >- my $date = ($end_date) ? dt_from_string( $end_date, 'rfc3339' ) : undef; >+ my $date = ($end_date) ? dt_from_string( $end_date, 'iso' ) : undef; > $hold->suspend_hold($date); > $hold->discard_changes; > $c->res->headers->location( $c->req->url->to_string ); > my $suspend_end_date; > if ($hold->suspend_until) { > $suspend_end_date = output_pref({ >- dt => dt_from_string( $hold->suspend_until ), >- dateformat => 'rfc3339', >+ dt => dt_from_string( $hold->suspend_until, 'iso' ), >+ dateformat => 'iso', > dateonly => 1 > } > ); >diff --git a/t/db_dependent/api/v1/holds.t b/t/db_dependent/api/v1/holds.t >index ac188772729..22e9f3e5c64 100755 >--- a/t/db_dependent/api/v1/holds.t >+++ b/t/db_dependent/api/v1/holds.t >@@ -159,11 +159,11 @@ 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 => 'rfc3339', dateonly => 1 } ), >+ expiration_date => output_pref( { dt => $expiration_date, dateformat => 'iso', dateonly => 1 } ), > }; > my $patch_data = { > priority => 2, >- suspended_until => output_pref( { dt => $suspended_until, dateformat => 'rfc3339' } ), >+ suspended_until => output_pref( { dt => $suspended_until, dateformat => 'iso', dateonly => 1 } ), > }; > > subtest "Test endpoints without authentication" => sub { >@@ -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 => 'rfc3339', dateonly => 1 })) >+ ->json_is('/0/expiration_date', output_pref({ dt => $expiration_date, dateformat => 'iso', dateonly => 1 })) > ->json_is('/0/pickup_library_id', $branchcode); > > $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) >@@ -329,8 +329,8 @@ subtest 'test AllowHoldDateInFuture' => sub { > biblio_id => $biblio_1->biblionumber, > item_id => $item_1->itemnumber, > pickup_library_id => $branchcode, >- expiration_date => output_pref( { dt => $expiration_date, dateformat => 'rfc3339', dateonly => 1 } ), >- hold_date => output_pref( { dt => $future_hold_date, dateformat => 'rfc3339', dateonly => 1 } ), >+ expiration_date => output_pref( { dt => $expiration_date, dateformat => 'iso', dateonly => 1 } ), >+ hold_date => output_pref( { dt => $future_hold_date, dateformat => 'iso', dateonly => 1 } ), > }; > > t::lib::Mocks::mock_preference( 'AllowHoldDateInFuture', 0 ); >@@ -349,7 +349,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 => 'rfc3339', dateonly => 1 })); >+ ->json_is('/hold_date', output_pref({ dt => $future_hold_date, dateformat => 'iso', dateonly => 1 })); > }; > > $schema->storage->txn_rollback; >@@ -486,7 +486,7 @@ subtest 'suspend and resume tests' => sub { > > my $end_date = output_pref({ > dt => dt_from_string( undef ), >- dateformat => 'rfc3339', >+ dateformat => 'iso', > dateonly => 1 > }); > >@@ -499,7 +499,7 @@ subtest 'suspend and resume tests' => sub { > '/end_date', > output_pref({ > dt => dt_from_string( $hold->suspend_until ), >- dateformat => 'rfc3339', >+ dateformat => 'iso', > dateonly => 1 > }), > 'Hold suspension has correct end date' >@@ -516,11 +516,11 @@ subtest 'suspend and resume tests' => sub { > . $hold->id > . "/suspension" => json => { > end_date => >- output_pref( { dt => $date, dateformat => 'rfc3339', dateonly => 1 } ) >+ output_pref( { dt => $date, dateformat => 'iso', dateonly => 1 } ) > } > )->status_is( 201, 'Hold suspension created' ) > ->json_is( '/end_date', >- output_pref( { dt => $date, dateformat => 'rfc3339', dateonly => 1 } ) ) >+ output_pref( { dt => $date, dateformat => 'iso', dateonly => 1 } ) ) > ->header_is( Location => "/api/v1/holds/" . $hold->id . "/suspension", 'The Location header is set' ); > > $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" ) >-- >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 24850
:
100585
|
100586
|
100587
|
100592
|
100593
|
100594
|
100595
|
100678
|
100679
|
100680
|
100681
|
100881
|
100901
|
100902
|
100903
|
100904
|
100905
|
101803
|
101804
|
101805
|
101806
|
101807
|
101808
|
101837
|
101838
|
101839
|
101840
|
101841
|
101842
|
101843
|
101844
|
115851
|
115852
|
115853
|
115854
|
115855
|
115856
|
115857
|
116299
|
116300
|
116301
|
116302
|
116303
|
116304
|
116305
|
116355
|
116356
|
116357
|
116358
|
116359
|
116360
|
116361
|
116511
|
126182
|
126183
|
126184
|
126185
|
126186
|
126187
|
126188
|
126189
|
127231
|
127232
|
127235
|
127236
|
127239
|
127240
|
127241
|
127242
|
127243
|
127244