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

(-)a/Koha/REST/V1/Items.pm (-4 / +7 lines)
Lines 115-133 sub pickup_locations { Link Here
115
115
116
        my $ps_set = $item->pickup_locations( { patron => $patron } );
116
        my $ps_set = $item->pickup_locations( { patron => $patron } );
117
117
118
        my $pickup_locations = $c->objects->search( $ps_set );
119
        my @response = ();
118
        my @response = ();
120
121
        if ( C4::Context->preference('AllowHoldPolicyOverride') ) {
119
        if ( C4::Context->preference('AllowHoldPolicyOverride') ) {
122
120
123
            my $libraries_rs = Koha::Libraries->search( { pickup_location => 1 } );
121
            my $libraries_rs = Koha::Libraries->search( { pickup_location => 1 } );
124
            my $libraries    = $c->objects->search($libraries_rs);
122
            my $libraries    = $c->objects->search($libraries_rs);
125
123
124
            return $c->render(
125
                status  => 200,
126
                openapi => $libraries
127
            );
126
            @response = map {
128
            @response = map {
127
                my $library = $_;
129
                my $library = $_;
128
                $library->{needs_override} = (
130
                $library->{needs_override} = (
129
                    any { $_->{library_id} eq $library->{library_id} }
131
                    any { $_->{library_id} eq $library->{library_id} }
130
                    @{$pickup_locations}
132
                    @{$ps_set}
131
                  )
133
                  )
132
                  ? Mojo::JSON->false
134
                  ? Mojo::JSON->false
133
                  : Mojo::JSON->true;
135
                  : Mojo::JSON->true;
Lines 140-145 sub pickup_locations { Link Here
140
            );
142
            );
141
        }
143
        }
142
144
145
        my $pickup_locations = $c->objects->search( $ps_set );
146
143
        @response = map { $_->{needs_override} = Mojo::JSON->false; $_; } @{$pickup_locations};
147
        @response = map { $_->{needs_override} = Mojo::JSON->false; $_; } @{$pickup_locations};
144
148
145
        return $c->render(
149
        return $c->render(
146
- 

Return to bug 30133