From 2f9d2f729b588f027a11ee7a6f3efb0a5fabd5a9 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 14 Apr 2022 14:06:43 +0100 Subject: [PATCH] Bug 30536: Use objects->find in Cashups controller This patch removes the direct reference to the koha.embed stashed variable in the Cashups controller and switches us to the modern objects->find approach. --- Koha/REST/V1/CashRegisters/Cashups.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Koha/REST/V1/CashRegisters/Cashups.pm b/Koha/REST/V1/CashRegisters/Cashups.pm index 12b6f30214..c6e4b2fcbb 100644 --- a/Koha/REST/V1/CashRegisters/Cashups.pm +++ b/Koha/REST/V1/CashRegisters/Cashups.pm @@ -75,8 +75,9 @@ sub get { my $c = shift->openapi->valid_input or return; return try { - my $cashup = Koha::Cash::Register::Cashups->find( - $c->validation->param('cashup_id') ); + my $cashup_id = $c->validation->param('cashup_id'); + my $cashup = + $c->objects->find( Koha::Cash::Register::Cashups->new, $cashup_id ); unless ($cashup) { return $c->render( status => 404, @@ -84,10 +85,9 @@ sub get { ); } - my $embed = $c->stash('koha.embed'); return $c->render( status => 200, - openapi => $cashup->to_api( { embed => $embed } ) + openapi => $cashup ); } catch { -- 2.20.1