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

(-)a/Koha/REST/V1/Illrequests.pm (-5 / +12 lines)
Lines 58-64 sub list { Link Here
58
    # Get the pipe-separated string of hidden ILL statuses
58
    # Get the pipe-separated string of hidden ILL statuses
59
    my $hidden_statuses_string = C4::Context->preference('ILLHiddenRequestStatuses') // q{};
59
    my $hidden_statuses_string = C4::Context->preference('ILLHiddenRequestStatuses') // q{};
60
    # Turn into arrayref
60
    # Turn into arrayref
61
    my $hidden_statuses = [ split /\|/, $hidden_statuses_string ];
61
    my $hidden_statuses = [ split "|", $hidden_statuses_string ];
62
62
63
    # Get all requests
63
    # Get all requests
64
    # If necessary, only get those from a specified patron
64
    # If necessary, only get those from a specified patron
Lines 71-76 sub list { Link Here
71
        : ()
71
        : ()
72
    })->as_list;
72
    })->as_list;
73
73
74
    my $fetch_backends = {};
75
    foreach my $request (@requests) {
76
        $fetch_backends->{ $request->backend } ||=
77
          Koha::Illrequest->new->load_backend( $request->backend );
78
    }
79
80
    # Pre-load the backend object to avoid useless backend lookup/loads
81
    @requests = map { $_->_backend( $fetch_backends->{ $_->backend } ); $_ } @requests;
82
74
    # Identify patrons & branches that
83
    # Identify patrons & branches that
75
    # we're going to need and get them
84
    # we're going to need and get them
76
    my $to_fetch = {
85
    my $to_fetch = {
Lines 78-84 sub list { Link Here
78
        branches     => {},
87
        branches     => {},
79
        capabilities => {}
88
        capabilities => {}
80
    };
89
    };
81
    foreach my $req(@requests) {
90
    foreach my $req (@requests) {
82
        $to_fetch->{patrons}->{$req->borrowernumber} = 1 if $embed{patron};
91
        $to_fetch->{patrons}->{$req->borrowernumber} = 1 if $embed{patron};
83
        $to_fetch->{branches}->{$req->branchcode} = 1 if $embed{library};
92
        $to_fetch->{branches}->{$req->branchcode} = 1 if $embed{library};
84
        $to_fetch->{capabilities}->{$req->backend} = 1 if $embed{capabilities};
93
        $to_fetch->{capabilities}->{$req->backend} = 1 if $embed{capabilities};
Lines 113-120 sub list { Link Here
113
        my @backends = keys %{$to_fetch->{capabilities}};
122
        my @backends = keys %{$to_fetch->{capabilities}};
114
        if (scalar @backends > 0) {
123
        if (scalar @backends > 0) {
115
            foreach my $bc(@backends) {
124
            foreach my $bc(@backends) {
116
                my $backend = Koha::Illrequest->new->load_backend($bc);
125
                $to_fetch->{$bc} = $fetch_backends->{$bc}->capabilities;
117
                $to_fetch->{$bc} = $backend->capabilities;
118
            }
126
            }
119
        }
127
        }
120
    }
128
    }
121
- 

Return to bug 29032