From a50ab34d656176eb944567ebee2f35bae1ce8fd1 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 25 Oct 2024 10:31:53 -0300 Subject: [PATCH] Bug 38204: Tidy Signed-off-by: Tomas Cohen Arazi Signed-off-by: Katrin Fischer --- Koha/REST/V1/Acquisitions/Baskets.pm | 13 ++++--------- t/db_dependent/api/v1/acquisitions_baskets.t | 9 +++------ 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/Koha/REST/V1/Acquisitions/Baskets.pm b/Koha/REST/V1/Acquisitions/Baskets.pm index bcd013bb0f..b7f39b8144 100644 --- a/Koha/REST/V1/Acquisitions/Baskets.pm +++ b/Koha/REST/V1/Acquisitions/Baskets.pm @@ -47,14 +47,13 @@ sub list_managers { return try { my $patrons_rs = Koha::Patrons->search->filter_by_have_permission('acquisition.order_manage'); - my $patrons = $c->objects->search( $patrons_rs ); + my $patrons = $c->objects->search($patrons_rs); return $c->render( status => 200, openapi => $patrons ); - } - catch { + } catch { $c->unhandled_exception($_); }; } @@ -70,15 +69,11 @@ sub list { return try { - my $baskets_rs = Koha::Acquisition::Baskets->new; - my $baskets = $c->objects->search( $baskets_rs ); - return $c->render( status => 200, - openapi => $baskets + openapi => $c->objects->search( Koha::Acquisition::Baskets->new ), ); - } - catch { + } catch { $c->unhandled_exception($_); }; } diff --git a/t/db_dependent/api/v1/acquisitions_baskets.t b/t/db_dependent/api/v1/acquisitions_baskets.t index 69222a80b0..b41939a5e3 100755 --- a/t/db_dependent/api/v1/acquisitions_baskets.t +++ b/t/db_dependent/api/v1/acquisitions_baskets.t @@ -86,9 +86,7 @@ subtest 'list() tests' => sub { my $userid = $superlibrarian->userid; $superlibrarian->discard_changes; - $t->get_ok("//$userid:$password@/api/v1/acquisitions/baskets")->status_is(200)->json_is( - [] - ); + $t->get_ok("//$userid:$password@/api/v1/acquisitions/baskets")->status_is(200)->json_is( [] ); my $vendor = $builder->build_object( { @@ -102,8 +100,7 @@ subtest 'list() tests' => sub { } ); - $t->get_ok("//$userid:$password@/api/v1/acquisitions/baskets")->status_is(200)->json_is( [$basket->to_api ]); + $t->get_ok("//$userid:$password@/api/v1/acquisitions/baskets")->status_is(200)->json_is( [ $basket->to_api ] ); $schema->storage->txn_rollback; - -} \ No newline at end of file +}; -- 2.39.5