From 9406277b8b9c7b65e0bd718fcab71b1e0750b4ed Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 8 Jun 2023 15:27:35 -0300 Subject: [PATCH] Bug 33960: (QA follow-up) ->delete doesn't send to deletedbiblio Signed-off-by: Tomas Cohen Arazi --- Koha/REST/V1/Biblios.pm | 10 ++++++---- t/db_dependent/api/v1/biblios.t | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Koha/REST/V1/Biblios.pm b/Koha/REST/V1/Biblios.pm index 5aa09093b82..6ade31b7689 100644 --- a/Koha/REST/V1/Biblios.pm +++ b/Koha/REST/V1/Biblios.pm @@ -798,16 +798,18 @@ Controller function that handles retrieving a single biblio object sub list { my $c = shift->openapi->valid_input or return; - my $deleted = delete $c->validation->output->{deleted}; + my $deleted = $c->param('deleted'); + $c->req->params->remove('deleted'); my $attributes; $attributes = { prefetch => ['metadata'] } # don't prefetch metadata if not needed unless $c->req->headers->accept =~ m/application\/json/; - my $biblios = $deleted ? - $c->objects->search_rs( Koha::Old::Biblios->new ) : - $c->objects->search_rs( Koha::Biblios->new ); + my $biblios = + $deleted + ? $c->objects->search_rs( Koha::Old::Biblios->new ) + : $c->objects->search_rs( Koha::Biblios->new ); return try { diff --git a/t/db_dependent/api/v1/biblios.t b/t/db_dependent/api/v1/biblios.t index 10f65a857a5..af830ee44df 100755 --- a/t/db_dependent/api/v1/biblios.t +++ b/t/db_dependent/api/v1/biblios.t @@ -29,6 +29,7 @@ use t::lib::Mocks; use t::lib::TestBuilder; use C4::Auth; +use C4::Biblio qw( DelBiblio ); use C4::Circulation qw( AddIssue AddReturn ); use Koha::Biblios; @@ -1687,8 +1688,8 @@ subtest 'list() tests' => sub { { Accept => 'text/plain', 'x-koha-query' => $search } ) ->status_is(200); - $biblio->delete; - $biblio2->delete; + DelBiblio( $biblio->id ); + DelBiblio( $biblio2->id ); $t->get_ok( "//$userid:$password@/api/v1/biblios/?deleted=1" => { Accept => 'application/json', 'x-koha-query' => $search } ) -- 2.34.1