|
Lines 1020-1055
sub TO_JSON {
Link Here
|
| 1020 |
my $object = $self->SUPER::TO_JSON(); |
1020 |
my $object = $self->SUPER::TO_JSON(); |
| 1021 |
$object->{id_prefix} = $self->id_prefix; |
1021 |
$object->{id_prefix} = $self->id_prefix; |
| 1022 |
|
1022 |
|
| 1023 |
if ( scalar (keys %$embed) ) { |
|
|
| 1024 |
# Augment the request response with patron details if appropriate |
| 1025 |
if ( $embed->{patron} ) { |
| 1026 |
my $patron = $self->patron; |
| 1027 |
$object->{patron} = { |
| 1028 |
firstname => $patron->firstname, |
| 1029 |
surname => $patron->surname, |
| 1030 |
cardnumber => $patron->cardnumber |
| 1031 |
}; |
| 1032 |
} |
| 1033 |
# Augment the request response with metadata details if appropriate |
| 1034 |
if ( $embed->{metadata} ) { |
| 1035 |
$object->{metadata} = $self->metadata; |
| 1036 |
} |
| 1037 |
# Augment the request response with status details if appropriate |
| 1038 |
if ( $embed->{capabilities} ) { |
| 1039 |
$object->{capabilities} = $self->capabilities; |
| 1040 |
} |
| 1041 |
# Augment the request response with library details if appropriate |
| 1042 |
if ( $embed->{library} ) { |
| 1043 |
$object->{library} = Koha::Libraries->find( |
| 1044 |
$self->branchcode |
| 1045 |
)->TO_JSON; |
| 1046 |
} |
| 1047 |
# Augment the request response with the number of comments if appropriate |
| 1048 |
if ( $embed->{comments} ) { |
| 1049 |
$object->{comments} = $self->illcomments->count; |
| 1050 |
} |
| 1051 |
} |
| 1052 |
|
| 1053 |
return $object; |
1023 |
return $object; |
| 1054 |
} |
1024 |
} |
| 1055 |
|
1025 |
|