From 9c9073496dd14a69318498b7221bfe05348bd0e5 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 29 Mar 2018 12:59:18 -0300 Subject: [PATCH] Bug 20287: Replace occurrences of ModMember in REST API Signed-off-by: Josef Moravec Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize --- Koha/REST/V1/Patrons.pm | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/Koha/REST/V1/Patrons.pm b/Koha/REST/V1/Patrons.pm index a24a7d50e4..a43d57114b 100644 --- a/Koha/REST/V1/Patrons.pm +++ b/Koha/REST/V1/Patrons.pm @@ -19,7 +19,6 @@ use Modern::Perl; use Mojo::Base 'Mojolicious::Controller'; -use C4::Members qw( ModMember ); use Koha::Patrons; use Scalar::Util qw(blessed); @@ -196,23 +195,9 @@ sub update { return try { my $body = _to_model($c->validation->param('body')); - ## TODO: Use ModMember until it has been moved to Koha-namespace - # Add borrowernumber to $body, as required by ModMember - $body->{borrowernumber} = $patron_id; - - if ( ModMember(%$body) ) { - # Fetch the updated Koha::Patron object - $patron->discard_changes; - return $c->render( status => 200, openapi => $patron ); - } - else { - return $c->render( - status => 500, - openapi => { - error => 'Something went wrong, check Koha logs for details.' - } - ); - } + $patron->set($body)->store; + $patron->discard_changes; + return $c->render( status => 200, openapi => $patron ); } catch { unless ( blessed $_ && $_->can('rethrow') ) { -- 2.11.0