From 3a700d31b09e7abe054e9ebb3f422c3ad735d9cd Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 12 Nov 2019 09:59:53 -0300 Subject: [PATCH] Bug 23893: Use in /cities This patch makes the cities controller use the new methods from Koha::Object. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/cities.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec Signed-off-by: Tomas Cohen Arazi --- Koha/REST/V1/Cities.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Koha/REST/V1/Cities.pm b/Koha/REST/V1/Cities.pm index 793880c813..bbc54defcb 100644 --- a/Koha/REST/V1/Cities.pm +++ b/Koha/REST/V1/Cities.pm @@ -76,7 +76,7 @@ sub add { my $c = shift->openapi->valid_input or return; return try { - my $city = Koha::City->new( _to_model( $c->validation->param('body') ) ); + my $city = Koha::City->new_from_api( $c->validation->param('body') ); $city->store; $c->res->headers->location( $c->req->url->to_string . '/' . $city->cityid ); return $c->render( @@ -115,8 +115,7 @@ sub update { } return try { - my $params = $c->req->json; - $city->set( _to_model($params) ); + $city->set_from_api( $c->validation->param('body') ); $city->store(); return $c->render( status => 200, openapi => $city->to_api ); } -- 2.24.1