Bugzilla – Attachment 61992 Details for
Bug 18407
REST API: Include renewability information on checkouts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18407: (follow-up) Add renewability error information
Bug-18407-follow-up-Add-renewability-error-informa.patch (text/plain), 3.39 KB, created by
Lari Taskula
on 2017-04-10 11:05:17 UTC
(
hide
)
Description:
Bug 18407: (follow-up) Add renewability error information
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2017-04-10 11:05:17 UTC
Size:
3.39 KB
patch
obsolete
>From 6f8793f157b36d04572e97fbf4e1f86aaa44f541 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@jns.fi> >Date: Mon, 10 Apr 2017 11:03:08 +0000 >Subject: [PATCH] Bug 18407: (follow-up) Add renewability error information > >--- > Koha/REST/V1/Checkout.pm | 1 + > api/v1/swagger/definitions/checkoutexpanded.json | 4 ++++ > t/db_dependent/api/v1/checkoutsexpanded.t | 11 ++++++++--- > 3 files changed, 13 insertions(+), 3 deletions(-) > >diff --git a/Koha/REST/V1/Checkout.pm b/Koha/REST/V1/Checkout.pm >index c6a2749..bfb07af 100644 >--- a/Koha/REST/V1/Checkout.pm >+++ b/Koha/REST/V1/Checkout.pm >@@ -187,6 +187,7 @@ sub expanded { > > $checkout->{'renewable'} = $can_renew > ? Mojo::JSON->true : Mojo::JSON->false; >+ $checkout->{'renewability_error'} = $error; > } > > return $c->render( status => 200, openapi => $checkouts_json ); >diff --git a/api/v1/swagger/definitions/checkoutexpanded.json b/api/v1/swagger/definitions/checkoutexpanded.json >index 17bce36..79e9cbf 100644 >--- a/api/v1/swagger/definitions/checkoutexpanded.json >+++ b/api/v1/swagger/definitions/checkoutexpanded.json >@@ -8,6 +8,10 @@ > "type": "boolean", > "description": "renewability status" > }, >+ "renewability_error": { >+ "type": ["string", "null"], >+ "description": "renewability error code" >+ }, > "max_renewals": { > "type": "integer", > "description": "maximum number of renewals allowed" >diff --git a/t/db_dependent/api/v1/checkoutsexpanded.t b/t/db_dependent/api/v1/checkoutsexpanded.t >index abb7b7c..9686d26 100644 >--- a/t/db_dependent/api/v1/checkoutsexpanded.t >+++ b/t/db_dependent/api/v1/checkoutsexpanded.t >@@ -47,7 +47,7 @@ my $module = new Test::MockModule('C4::Context'); > $module->mock('userenv', sub { { branch => $branchcode } }); > > subtest 'get() tests' => sub { >- plan tests => 13; >+ plan tests => 17; > > $schema->storage->txn_begin; > >@@ -76,6 +76,7 @@ subtest 'get() tests' => sub { > C4::Circulation::AddRenewal($borrowernumber, $itemnumber2, $branchcode, $due2); > > # 4. Issuing rules >+ t::lib::Mocks::mock_preference('OpacRenewalAllowed', 1); > t::lib::Mocks::mock_preference('CircControl', 'ItemHomeLibrary'); > t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'homebranch'); > Koha::IssuingRule->new({ >@@ -88,7 +89,7 @@ subtest 'get() tests' => sub { > categorycode => $patron->categorycode, > itemtype => $item2->effective_itemtype, > branchcode => $item2->homebranch, >- renewalsallowed => 10, >+ renewalsallowed => 1, > })->store; > > # BEGIN TEST >@@ -104,12 +105,16 @@ subtest 'get() tests' => sub { > ->json_is('/0/itemnumber' => $itemnumber1) > ->json_like('/0/date_due' => qr/$due\+\d\d:\d\d/) > ->json_is('/0/renewals' => 0) >+ ->json_is('/0/renewable' => Mojo::JSON->true) >+ ->json_is('/0/renewability_error' => undef) > ->json_is('/0/max_renewals' => 5) > ->json_is('/1/borrowernumber' => $borrowernumber) > ->json_is('/1/itemnumber' => $itemnumber2) > ->json_like('/1/date_due' => qr/$due2\+\d\d:\d\d/) > ->json_is('/1/renewals' => 1) >- ->json_is('/1/max_renewals' => 10) >+ ->json_is('/1/renewable' => Mojo::JSON->false) >+ ->json_is('/1/renewability_error' => 'too_many') >+ ->json_is('/1/max_renewals' => 1) > ->json_hasnt('/2'); > > $schema->storage->txn_rollback; >-- >2.7.4
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 18407
:
61991
| 61992 |
61993
|
65009