From 3ca21c87479b066f5094a343cab09664c06e91b1 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 Signed-off-by: Nick Clemens --- 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.39.5