View | Details | Raw Unified | Return to bug 20996
Collapse All | Expand All

(-)a/Koha/Illrequest.pm (-30 lines)
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
(-)a/Koha/REST/V1/Illrequests.pm (-1 / +3 lines)
Lines 137-142 sub list { Link Here
137
        if ($embed{capabilities}) {
137
        if ($embed{capabilities}) {
138
            $to_push->{capabilities} = $to_fetch->{$req->backend};
138
            $to_push->{capabilities} = $to_fetch->{$req->backend};
139
        }
139
        }
140
        if ($embed{comments}) {
141
            $to_push->{comments} = $req->illcomments->count;
142
        }
140
        push @output, $to_push;
143
        push @output, $to_push;
141
    }
144
    }
142
145
143
- 

Return to bug 20996