|
Lines 103-110
Controller function that handles adding a new Koha::Patron object
Link Here
|
| 103 |
=cut |
103 |
=cut |
| 104 |
|
104 |
|
| 105 |
sub add { |
105 |
sub add { |
| 106 |
my $c = shift->openapi->valid_input or return; |
106 |
my $c = shift->openapi->valid_input or return; |
| 107 |
my $current_user = $c->stash('koha.user'); |
|
|
| 108 |
|
107 |
|
| 109 |
return try { |
108 |
return try { |
| 110 |
|
109 |
|
|
Lines 169-175
sub add {
Link Here
|
| 169 |
$c->res->headers->location($c->req->url->to_string . '/' . $patron->borrowernumber); |
168 |
$c->res->headers->location($c->req->url->to_string . '/' . $patron->borrowernumber); |
| 170 |
return $c->render( |
169 |
return $c->render( |
| 171 |
status => 201, |
170 |
status => 201, |
| 172 |
openapi => $patron->to_api( { user => $current_user } ) |
171 |
openapi => $c->objects->to_api($patron), |
| 173 |
); |
172 |
); |
| 174 |
} |
173 |
} |
| 175 |
); |
174 |
); |
|
Lines 261-268
Controller function that handles updating a Koha::Patron object
Link Here
|
| 261 |
=cut |
260 |
=cut |
| 262 |
|
261 |
|
| 263 |
sub update { |
262 |
sub update { |
| 264 |
my $c = shift->openapi->valid_input or return; |
263 |
my $c = shift->openapi->valid_input or return; |
| 265 |
my $current_user = $c->stash('koha.user'); |
|
|
| 266 |
|
264 |
|
| 267 |
my $patron = Koha::Patrons->find( $c->param('patron_id') ); |
265 |
my $patron = Koha::Patrons->find( $c->param('patron_id') ); |
| 268 |
|
266 |
|
|
Lines 311-317
sub update {
Link Here
|
| 311 |
$patron->discard_changes; |
309 |
$patron->discard_changes; |
| 312 |
return $c->render( |
310 |
return $c->render( |
| 313 |
status => 200, |
311 |
status => 200, |
| 314 |
openapi => $patron->to_api( { user => $current_user } ) |
312 |
openapi => $c->objects->to_api($patron), |
| 315 |
); |
313 |
); |
| 316 |
} |
314 |
} |
| 317 |
catch { |
315 |
catch { |
| 318 |
- |
|
|