|
Lines 113-119
sub pickup_locations {
Link Here
|
| 113 |
|
113 |
|
| 114 |
return try { |
114 |
return try { |
| 115 |
|
115 |
|
| 116 |
my $ps_set = $item->pickup_locations( { patron => $patron } ); |
116 |
my $pl_set = $item->pickup_locations( { patron => $patron } ); |
| 117 |
|
117 |
|
| 118 |
my @response = (); |
118 |
my @response = (); |
| 119 |
if ( C4::Context->preference('AllowHoldPolicyOverride') ) { |
119 |
if ( C4::Context->preference('AllowHoldPolicyOverride') ) { |
|
Lines 124-146
sub pickup_locations {
Link Here
|
| 124 |
@response = map { |
124 |
@response = map { |
| 125 |
my $library = $_; |
125 |
my $library = $_; |
| 126 |
$library->{needs_override} = ( |
126 |
$library->{needs_override} = ( |
| 127 |
any { $_->{library_id} eq $library->{library_id} } |
127 |
any { $_->branchcode eq $library->{library_id} } |
| 128 |
@{$ps_set->as_list} |
128 |
@{ $pl_set->as_list } |
| 129 |
) |
129 |
) |
| 130 |
? Mojo::JSON->false |
130 |
? Mojo::JSON->false |
| 131 |
: Mojo::JSON->true; |
131 |
: Mojo::JSON->true; |
| 132 |
$library; |
132 |
$library; |
| 133 |
} @{$libraries}; |
133 |
} @{$libraries}; |
| 134 |
|
|
|
| 135 |
return $c->render( |
| 136 |
status => 200, |
| 137 |
openapi => \@response |
| 138 |
); |
| 139 |
} |
134 |
} |
|
|
135 |
else { |
| 140 |
|
136 |
|
| 141 |
my $pickup_locations = $c->objects->search( $ps_set ); |
137 |
my $pickup_locations = $c->objects->search($pl_set); |
| 142 |
|
138 |
@response = map { $_->{needs_override} = Mojo::JSON->false; $_; } @{$pickup_locations}; |
| 143 |
@response = map { $_->{needs_override} = Mojo::JSON->false; $_; } @{$pickup_locations}; |
139 |
} |
| 144 |
|
140 |
|
| 145 |
return $c->render( |
141 |
return $c->render( |
| 146 |
status => 200, |
142 |
status => 200, |
| 147 |
- |
|
|