|
Lines 50-56
sub list_rules {
Link Here
|
| 50 |
my $c = shift->openapi->valid_input or return; |
50 |
my $c = shift->openapi->valid_input or return; |
| 51 |
|
51 |
|
| 52 |
return try { |
52 |
return try { |
| 53 |
my $effective = $c->param('effective') // 1; |
53 |
my $effective = $c->param('effective') // 1; |
| 54 |
my $kinds = |
54 |
my $kinds = |
| 55 |
defined( $c->param('rules') ) |
55 |
defined( $c->param('rules') ) |
| 56 |
? [ split /\s*,\s*/, $c->param('rules') ] |
56 |
? [ split /\s*,\s*/, $c->param('rules') ] |
|
Lines 157-162
sub list_rules {
Link Here
|
| 157 |
|
157 |
|
| 158 |
} |
158 |
} |
| 159 |
|
159 |
|
|
|
160 |
# Map context into rules |
| 161 |
@{$rules} = map { |
| 162 |
my %new_rule = %$_; |
| 163 |
my %context = ( |
| 164 |
"library_id" => delete $new_rule{"branchcode"} // "*", |
| 165 |
"patron_category_id" => delete $new_rule{"categorycode"} // "*", |
| 166 |
"item_type_id" => delete $new_rule{"itemtype"} // "*", |
| 167 |
); |
| 168 |
$new_rule{"context"} = \%context; |
| 169 |
\%new_rule; |
| 170 |
} @{$rules}; |
| 171 |
|
| 160 |
return $c->render( |
172 |
return $c->render( |
| 161 |
status => 200, |
173 |
status => 200, |
| 162 |
openapi => $rules |
174 |
openapi => $rules |