Bug 21835: Fix display of request ID
authorAndrew Isherwood <andrew.isherwood@ptfs-europe.com>
Wed, 14 Nov 2018 16:08:32 +0000 (16:08 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 16 Nov 2018 12:42:11 +0000 (12:42 +0000)
We now populate the id_prefix property in the API response. It turns out
that explicitly casting to a string wasn't necessary as JS does "the
right thing" when concatenating a string and an integer

Test plan:

- Before applying the patch view the ILL requests table
- TEST: Observe that the Request number column displays as NaN
- Apply the patch
- Refresh the page
- TEST: Observe that the request number now displays correctly
- Add the following block to your koha-conf.xml:

<branch>
    <code>**The code of a branch that has an ILL request attached to
    it**</code>
    <prefix>YAY</prefix>
</branch>

- Refresh the page
- TEST: Observe the request made on the branch that you specified in the
config are now prefixed with "YAY-"

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Koha/Illrequest.pm
Koha/REST/V1/Illrequests.pm

index 0b4d71c..0fa4e49 100644 (file)
@@ -1018,7 +1018,6 @@ sub TO_JSON {
     my ( $self, $embed ) = @_;
 
     my $object = $self->SUPER::TO_JSON();
-    $object->{id_prefix} = $self->id_prefix;
 
     return $object;
 }
index 0b4c8f0..a3a0d61 100644 (file)
@@ -107,6 +107,7 @@ sub list {
     my @output = ();
     foreach my $req(@requests) {
         my $to_push = $req->unblessed;
+        $to_push->{id_prefix} = $req->id_prefix;
         foreach my $p(@{$patron_arr}) {
             if ($p->{borrowernumber} == $req->borrowernumber) {
                 $to_push->{patron} = {