From 3a70616b50b412632907cfd811f68dcc7800b63f 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 Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- Koha/REST/V1/Biblios.pm | 3 ++- t/db_dependent/api/v1/biblios.t | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Koha/REST/V1/Biblios.pm b/Koha/REST/V1/Biblios.pm index 4f198ef7b6c..0f628d6ff5c 100644 --- a/Koha/REST/V1/Biblios.pm +++ b/Koha/REST/V1/Biblios.pm @@ -803,7 +803,8 @@ sub list { push @prefetch, 'metadata' # don't prefetch metadata if not needed unless $c->req->headers->accept =~ m/application\/json/; - my $deleted = delete $c->param->{deleted}; + my $deleted = $c->param('deleted'); + $c->req->params->remove('deleted'); my $rs = $deleted ? Koha::Old::Biblios->search() : Koha::Biblios->search( undef, { prefetch => \@prefetch } ); my $biblios = $c->objects->search_rs( $rs, [(sub{ $rs->api_query_fixer( $_[0], '', $_[1] ) })] ); diff --git a/t/db_dependent/api/v1/biblios.t b/t/db_dependent/api/v1/biblios.t index 467feb23ab9..0d2160ada7e 100755 --- a/t/db_dependent/api/v1/biblios.t +++ b/t/db_dependent/api/v1/biblios.t @@ -31,6 +31,7 @@ use t::lib::TestBuilder; use Mojo::JSON qw(encode_json); use C4::Auth; +use C4::Biblio qw( DelBiblio ); use C4::Circulation qw( AddIssue AddReturn ); use Koha::Biblios; @@ -1696,8 +1697,8 @@ subtest 'list() tests' => sub { { Accept => 'text/plain' } ) ->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.41.0