From f49036f83ec9672ecd1fd5dff588bc518e5bcff3 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Wed, 16 Sep 2020 13:32:15 +1200 Subject: [PATCH] Bug 24718: (follow-up) Attempting to fix Koha REST holds --- C4/Reserves.pm | 2 +- api/v1/swagger/definitions/hold.json | 4 ++-- api/v1/swagger/paths/holds.json | 2 +- t/db_dependent/api/v1/holds.t | 14 +++++++------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 7232dccbe6..29892966bf 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -194,7 +194,7 @@ sub AddReserve { $resdate = dt_from_string(); } if ( $expdate ){ - $expdate = dt_from_string( $expdate )->set_second( 59 ); + $expdate = dt_from_string( $expdate )->set_second( 00 ); } } else { # add hour and minute components diff --git a/api/v1/swagger/definitions/hold.json b/api/v1/swagger/definitions/hold.json index 6a018e916f..f8235aa97a 100644 --- a/api/v1/swagger/definitions/hold.json +++ b/api/v1/swagger/definitions/hold.json @@ -11,7 +11,7 @@ }, "hold_date": { "type": ["string", "null"], - "format": "date", + "format": "date-time", "description": "The date the hold was placed" }, "biblio_id": { @@ -55,7 +55,7 @@ }, "expiration_date": { "type": ["string", "null"], - "format": "date", + "format": "date-time", "description": "The date the hold expires" }, "lowest_priority": { diff --git a/api/v1/swagger/paths/holds.json b/api/v1/swagger/paths/holds.json index 8137f16a7f..9c3accfd5c 100644 --- a/api/v1/swagger/paths/holds.json +++ b/api/v1/swagger/paths/holds.json @@ -198,7 +198,7 @@ "expiration_date": { "description": "Hold end date", "type": ["string", "null"], - "format": "date" + "format": "date-time" }, "notes": { "description": "Notes related to this hold", diff --git a/t/db_dependent/api/v1/holds.t b/t/db_dependent/api/v1/holds.t index 750bcd95b4..ea459f6021 100755 --- a/t/db_dependent/api/v1/holds.t +++ b/t/db_dependent/api/v1/holds.t @@ -157,7 +157,7 @@ my $post_data = { biblio_id => int($biblio_1->biblionumber), item_id => int($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 => 'rfc3339' }), priority => 2, }; my $put_data = { @@ -273,7 +273,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 => 'rfc3339' })) ->json_is('/0/pickup_library_id', $branchcode); $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) @@ -342,8 +342,8 @@ subtest 'test AllowHoldDateInFuture' => sub { biblio_id => int($biblio_1->biblionumber), item_id => int($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 => 'rfc3339' }), + hold_date => output_pref({ dt => $future_hold_date, dateformat => 'rfc3339' }), priority => 2, }; @@ -357,7 +357,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 => 'rfc3339' })); }; subtest 'test AllowHoldPolicyOverride' => sub { @@ -425,7 +425,7 @@ subtest 'suspend and resume tests' => sub { my $end_date = output_pref({ dt => dt_from_string( undef ), dateformat => 'rfc3339', - dateonly => 1 + dateonly => 1 }); $t->post_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" => json => { end_date => $end_date } ); @@ -438,7 +438,7 @@ subtest 'suspend and resume tests' => sub { output_pref({ dt => dt_from_string( $hold->suspend_until ), dateformat => 'rfc3339', - dateonly => 1 + dateonly => 1 }), 'Hold suspension has correct end date' ); -- 2.11.0