Bug 20996: (follow-up) Fix merge problems
authorAndrew Isherwood <andrew.isherwood@ptfs-europe.com>
Wed, 31 Oct 2018 15:25:17 +0000 (15:25 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 2 Nov 2018 10:33:06 +0000 (10:33 +0000)
Merge conflicts resolved

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Koha/Illrequest.pm
Koha/REST/V1/Illrequests.pm

index 4754b43..0b4d71c 100644 (file)
@@ -1020,36 +1020,6 @@ sub TO_JSON {
     my $object = $self->SUPER::TO_JSON();
     $object->{id_prefix} = $self->id_prefix;
 
-    if ( scalar (keys %$embed) ) {
-        # Augment the request response with patron details if appropriate
-        if ( $embed->{patron} ) {
-            my $patron = $self->patron;
-            $object->{patron} = {
-                firstname  => $patron->firstname,
-                surname    => $patron->surname,
-                cardnumber => $patron->cardnumber
-            };
-        }
-        # Augment the request response with metadata details if appropriate
-        if ( $embed->{metadata} ) {
-            $object->{metadata} = $self->metadata;
-        }
-        # Augment the request response with status details if appropriate
-        if ( $embed->{capabilities} ) {
-            $object->{capabilities} = $self->capabilities;
-        }
-        # Augment the request response with library details if appropriate
-        if ( $embed->{library} ) {
-            $object->{library} = Koha::Libraries->find(
-                $self->branchcode
-            )->TO_JSON;
-        }
-        # Augment the request response with the number of comments if appropriate
-        if ( $embed->{comments} ) {
-            $object->{comments} = $self->illcomments->count;
-        }
-    }
-
     return $object;
 }
 
index 0a6dee0..0b4c8f0 100644 (file)
@@ -137,6 +137,9 @@ sub list {
         if ($embed{capabilities}) {
             $to_push->{capabilities} = $to_fetch->{$req->backend};
         }
+        if ($embed{comments}) {
+            $to_push->{comments} = $req->illcomments->count;
+        }
         push @output, $to_push;
     }