|
Lines 1005-1040
sub TO_JSON {
Link Here
|
| 1005 |
my $object = $self->SUPER::TO_JSON(); |
1005 |
my $object = $self->SUPER::TO_JSON(); |
| 1006 |
$object->{id_prefix} = $self->id_prefix; |
1006 |
$object->{id_prefix} = $self->id_prefix; |
| 1007 |
|
1007 |
|
| 1008 |
if ( scalar (keys %$embed) ) { |
|
|
| 1009 |
# Augment the request response with patron details if appropriate |
| 1010 |
if ( $embed->{patron} ) { |
| 1011 |
my $patron = $self->patron; |
| 1012 |
$object->{patron} = { |
| 1013 |
firstname => $patron->firstname, |
| 1014 |
surname => $patron->surname, |
| 1015 |
cardnumber => $patron->cardnumber |
| 1016 |
}; |
| 1017 |
} |
| 1018 |
# Augment the request response with metadata details if appropriate |
| 1019 |
if ( $embed->{metadata} ) { |
| 1020 |
$object->{metadata} = $self->metadata; |
| 1021 |
} |
| 1022 |
# Augment the request response with status details if appropriate |
| 1023 |
if ( $embed->{capabilities} ) { |
| 1024 |
$object->{capabilities} = $self->capabilities; |
| 1025 |
} |
| 1026 |
# Augment the request response with library details if appropriate |
| 1027 |
if ( $embed->{library} ) { |
| 1028 |
$object->{library} = Koha::Libraries->find( |
| 1029 |
$self->branchcode |
| 1030 |
)->TO_JSON; |
| 1031 |
} |
| 1032 |
# Augment the request response with the number of comments if appropriate |
| 1033 |
if ( $embed->{comments} ) { |
| 1034 |
$object->{comments} = $self->illcomments->count; |
| 1035 |
} |
| 1036 |
} |
| 1037 |
|
| 1038 |
return $object; |
1008 |
return $object; |
| 1039 |
} |
1009 |
} |
| 1040 |
|
1010 |
|