Lines 45-50
sub validate {
Link Here
|
45 |
my $identifier = $body->{identifier}; |
45 |
my $identifier = $body->{identifier}; |
46 |
my $userid = $body->{userid}; |
46 |
my $userid = $body->{userid}; |
47 |
|
47 |
|
|
|
48 |
my $embeds = $c->stash('koha.embed'); |
49 |
my $embed_patron; |
50 |
$embed_patron = 1 |
51 |
if $embeds && exists $embeds->{patron}; |
52 |
|
53 |
# fake embed as the basis is not a Koha::Object-derived class |
54 |
# remove it so $c->objects->to_api doesn't try to embed 'patron'. |
55 |
delete $embeds->{patron}; |
56 |
|
48 |
unless ( defined $identifier or defined $userid ) { |
57 |
unless ( defined $identifier or defined $userid ) { |
49 |
return $c->render( |
58 |
return $c->render( |
50 |
status => 400, |
59 |
status => 400, |
Lines 86-91
sub validate {
Link Here
|
86 |
cardnumber => $patron->cardnumber, |
95 |
cardnumber => $patron->cardnumber, |
87 |
patron_id => $patron->id, |
96 |
patron_id => $patron->id, |
88 |
userid => $patron->userid, |
97 |
userid => $patron->userid, |
|
|
98 |
( $embed_patron ? ( patron => $c->objects->to_api($patron) ) : () ), |
89 |
} |
99 |
} |
90 |
); |
100 |
); |
91 |
} catch { |
101 |
} catch { |