Bugzilla – Attachment 176191 Details for
Bug 24401
REST API: Check-in
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24401: (QA follow-up) Tidy and spelling
Bug-24401-QA-follow-up-Tidy-and-spelling.patch (text/plain), 6.47 KB, created by
Nick Clemens (kidclamp)
on 2025-01-07 14:25:55 UTC
(
hide
)
Description:
Bug 24401: (QA follow-up) Tidy and spelling
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2025-01-07 14:25:55 UTC
Size:
6.47 KB
patch
obsolete
>From e9ea05f5efef6ad754ee72b4a32c097d9a869ca6 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 7 Jan 2025 14:17:11 +0000 >Subject: [PATCH] Bug 24401: (QA follow-up) Tidy and spelling > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > Koha/REST/V1/Checkouts.pm | 29 ++++++++++--------- > t/db_dependent/api/v1/checkin.t | 49 ++++++++++++++------------------- > 2 files changed, 34 insertions(+), 44 deletions(-) > >diff --git a/Koha/REST/V1/Checkouts.pm b/Koha/REST/V1/Checkouts.pm >index 7e979251324..6761515e4be 100644 >--- a/Koha/REST/V1/Checkouts.pm >+++ b/Koha/REST/V1/Checkouts.pm >@@ -314,6 +314,7 @@ sub add { > }; > } > >+ > =head3 checkin > > Check in a checked out item via item_id or barcode >@@ -345,8 +346,7 @@ sub checkin { > my $item; > if ($item_id) { > $item = Koha::Items->find($item_id); >- } >- else { >+ } else { > $item = Koha::Items->find( { barcode => $barcode } ); > } > >@@ -368,25 +368,25 @@ sub checkin { > return $c->render( > status => 409, > openapi => { >- error => >- 'Item id and external id belong to different items', >+ error => 'Item id and external id belong to different items', > error_code => 'ITEM_ID_NOT_MATCHING_EXTERNAL_ID', > } > ); > } > >- my ( $returned, $return_messages ) = >- C4::Circulation::AddReturn( $item->barcode, $library_id, >- $exemptfine ); >+ my ( $returned, $return_messages ) = C4::Circulation::AddReturn( >+ $item->barcode, $library_id, >+ $exemptfine >+ ); > > my $response = { returned => $returned, messages => $return_messages }; > >- if ($return_messages->{BadBarcode}){ >- $response->{error} = 'Item not found.'; >- return $c->render( >- status => 409, >- openapi => $response >- ); >+ if ( $return_messages->{BadBarcode} ) { >+ $response->{error} = 'Item not found.'; >+ return $c->render( >+ status => 409, >+ openapi => $response >+ ); > } > > unless ($returned) { >@@ -402,8 +402,7 @@ sub checkin { > openapi => $response > ); > >- } >- catch { >+ } catch { > $c->unhandled_exception($_); > }; > } >diff --git a/t/db_dependent/api/v1/checkin.t b/t/db_dependent/api/v1/checkin.t >index 5c00ebbec8a..d0178f68ad2 100755 >--- a/t/db_dependent/api/v1/checkin.t >+++ b/t/db_dependent/api/v1/checkin.t >@@ -61,18 +61,16 @@ my $patron = $builder->build_object( > } > ); > my $unauth_password = 'thePassword000'; >-$patron->set_password( >- { password => $unauth_password, skip_validattion => 1 } ); >+$patron->set_password( { password => $unauth_password, skip_validattion => 1 } ); > my $unauth_userid = $patron->userid; > my $patron_id = $patron->borrowernumber; > > my $item1 = $builder->build_sample_item; > my $item1_id = $item1->id; > >-my $itemtype = $builder->build( { source => 'Itemtype' } )->{itemtype}; >-my $biblio_2 = $builder->build_sample_biblio; >-my $item_2 = $builder->build_sample_item( >- { biblionumber => $biblio_2->biblionumber, itype => $itemtype } ); >+my $itemtype = $builder->build( { source => 'Itemtype' } )->{itemtype}; >+my $biblio_2 = $builder->build_sample_biblio; >+my $item_2 = $builder->build_sample_item( { biblionumber => $biblio_2->biblionumber, itype => $itemtype } ); > my $item_2_barcode = $item_2->barcode; > my $item_2_id = $item_2->id; > >@@ -146,31 +144,25 @@ my $reserve_id = C4::Reserves::AddReserve( > ); > > # empty checkin >-$t->post_ok( "//$userid:$password@/api/v1/checkin" => json => {} ) >- ->status_is(400); >+$t->post_ok( "//$userid:$password@/api/v1/checkin" => json => {} )->status_is(400); > >-# checkin on unknow item id >-$t->post_ok( "//$userid:$password@/api/v1/checkin" => json => >- { item_id => $non_existent_item_id } )->status_is(404) >- ->json_is( { error => 'Item not found', error_code => 'ITEM_NOT_FOUND' } ); >+# checkin on unknown item id >+$t->post_ok( "//$userid:$password@/api/v1/checkin" => json => { item_id => $non_existent_item_id } )->status_is(404) >+ ->json_is( { error => 'Item not found', error_code => 'ITEM_NOT_FOUND' } ); > >-# checkin with unknow barcode >-$t->post_ok( "//$userid:$password@/api/v1/checkin" => json => >- { external_id => $non_existent_item_barcode } )->status_is(404) >- ->json_is( { error => 'Item not found', error_code => 'ITEM_NOT_FOUND' } ); >+# checkin with unknown barcode >+$t->post_ok( "//$userid:$password@/api/v1/checkin" => json => { external_id => $non_existent_item_barcode } ) >+ ->status_is(404)->json_is( { error => 'Item not found', error_code => 'ITEM_NOT_FOUND' } ); > > # not isued >-$t->post_ok( "//$userid:$password@/api/v1/checkin" => json => >- { item_id => $not_issued_item_id, library_id => $branchcode } ) >- ->status_is(403)->json_is( '/returned' => 0 ) >- ->json_has( '/messages' => { NotIssued => $not_issued_item_barcode } ); >+$t->post_ok( >+ "//$userid:$password@/api/v1/checkin" => json => { item_id => $not_issued_item_id, library_id => $branchcode } ) >+ ->status_is(403)->json_is( '/returned' => 0 )->json_has( '/messages' => { NotIssued => $not_issued_item_barcode } ); > > # checkin okay >-$t->post_ok( "//$userid:$password@/api/v1/checkin" => json => >- { item_id => $item1_id, library_id => $branchcode } )->status_is(201) >- ->json_is( '/returned' => 1 ) >- ->json_has( >- '/messages' => { TransferTrigger => 'ReturnToHome', WasReturned => '1' } ); >+$t->post_ok( "//$userid:$password@/api/v1/checkin" => json => { item_id => $item1_id, library_id => $branchcode } ) >+ ->status_is(201)->json_is( '/returned' => 1 ) >+ ->json_has( '/messages' => { TransferTrigger => 'ReturnToHome', WasReturned => '1' } ); > > #mismatch of item_id and barcode when both given > $t->post_ok( >@@ -182,11 +174,10 @@ $t->post_ok( > )->status_is(409); > > # reserved item >-$t->post_ok( "//$userid:$password@/api/v1/checkin" => json => >- { item_id => $item_2_id, library_id => $branchcode } )->status_is(201) >- ->json_is( '/returned' => 1 )->json_has( >+$t->post_ok( "//$userid:$password@/api/v1/checkin" => json => { item_id => $item_2_id, library_id => $branchcode } ) >+ ->status_is(201)->json_is( '/returned' => 1 )->json_has( > '/messages' => { WasReturned => '1' }, > '/ResFound' => { "ResFound" => "Reserved" } >- ); >+ ); > > $schema->storage->txn_rollback; >-- >2.39.5
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 24401
:
151109
|
151181
|
151182
|
151183
|
151184
|
152717
|
154428
|
154429
|
154430
|
154431
|
156884
|
156885
|
168337
|
172764
|
173189
|
173194
|
176190
| 176191