|
Lines 19-25
use Modern::Perl;
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Mojo::Base 'Mojolicious::Controller'; |
20 |
use Mojo::Base 'Mojolicious::Controller'; |
| 21 |
|
21 |
|
| 22 |
use C4::Members qw( AddMember ModMember ); |
22 |
use C4::Members qw( ModMember ); |
| 23 |
use Koha::Patrons; |
23 |
use Koha::Patrons; |
| 24 |
|
24 |
|
| 25 |
use Scalar::Util qw(blessed); |
25 |
use Scalar::Util qw(blessed); |
|
Lines 126-134
sub add {
Link Here
|
| 126 |
|
126 |
|
| 127 |
my $body = _to_model( $c->validation->param('body') ); |
127 |
my $body = _to_model( $c->validation->param('body') ); |
| 128 |
|
128 |
|
| 129 |
# TODO: Use AddMember until it has been moved to Koha-namespace |
129 |
my $patron = Koha::Patron->new( _to_model($body) )->store; |
| 130 |
my $patron_id = AddMember( %{ _to_model($body) } ); |
130 |
$patron = _to_api( $patron->TO_JSON ); |
| 131 |
my $patron = _to_api( Koha::Patrons->find($patron_id)->TO_JSON ); |
|
|
| 132 |
|
131 |
|
| 133 |
return $c->render( status => 201, openapi => $patron ); |
132 |
return $c->render( status => 201, openapi => $patron ); |
| 134 |
} |
133 |
} |
| 135 |
- |
|
|