Bugzilla – Attachment 96129 Details for
Bug 23893
Add ->new_from_api and ->set_from_api methods to Koha::Object
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23893: Use in /cities
Bug-23893-Use-in-cities.patch (text/plain), 1.39 KB, created by
Josef Moravec
on 2019-12-10 06:33:24 UTC
(
hide
)
Description:
Bug 23893: Use in /cities
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2019-12-10 06:33:24 UTC
Size:
1.39 KB
patch
obsolete
>From 5568652da8597c4896f92a7738ce865eb7286d07 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >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 <josef.moravec@gmail.com> >--- > 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.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23893
:
95276
|
95277
|
95278
|
95311
|
95312
|
95313
|
95314
|
95315
|
96126
|
96127
|
96128
|
96129
|
96130
|
96652
|
96655
|
96656
|
96657
|
96658
|
96659
|
96660
|
96661
|
96662
|
96665
|
96666
|
96920
|
96921
|
96922
|
96923
|
96924
|
96925
|
96926
|
96927
|
96928
|
96929
|
96930
|
96931
|
96932
|
96933
|
96934
|
96935
|
96936
|
96937
|
97391