Bug 36641: Return '*' for 'default rule'
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
d34a6046a6
commit
8754e100f4
1 changed files with 8 additions and 4 deletions
|
@ -51,11 +51,11 @@ sub list_rules {
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
my $effective = $c->param('effective') // 1;
|
my $effective = $c->param('effective') // 1;
|
||||||
my $kinds = $c->param('rules') // [ keys %{ Koha::CirculationRules->rule_kinds } ];
|
my $kinds = $c->param('rules') // [ keys %{ Koha::CirculationRules->rule_kinds } ];
|
||||||
my $item_type = $c->param('item_type_id');
|
my $item_type = $c->param('item_type_id');
|
||||||
my $branchcode = $c->param('library_id');
|
my $branchcode = $c->param('library_id');
|
||||||
my $patron_category = $c->param('patron_category_id');
|
my $patron_category = $c->param('patron_category_id');
|
||||||
my ($filter_branch, $filter_itemtype, $filter_patron);
|
my ( $filter_branch, $filter_itemtype, $filter_patron );
|
||||||
|
|
||||||
if ($item_type) {
|
if ($item_type) {
|
||||||
$filter_itemtype = 1;
|
$filter_itemtype = 1;
|
||||||
|
@ -124,8 +124,12 @@ sub list_rules {
|
||||||
) // {};
|
) // {};
|
||||||
push @{$rules}, $effective_rules;
|
push @{$rules}, $effective_rules;
|
||||||
} else {
|
} else {
|
||||||
my $select = [ 'branchcode', 'categorycode', 'itemtype' ];
|
my $select = [
|
||||||
my $as = [ 'branchcode', 'categorycode', 'itemtype' ];
|
{ 'COALESCE' => [ 'branchcode', \["'*'"] ], -as => 'branchcode' },
|
||||||
|
{ 'COALESCE' => [ 'categorycode', \["'*'"] ], -as => 'categorycode' },
|
||||||
|
{ 'COALESCE' => [ 'itemtype', \["'*'"] ], -as => 'itemtype' }
|
||||||
|
];
|
||||||
|
my $as = [ 'branchcode', 'categorycode', 'itemtype' ];
|
||||||
for my $kind ( @{$kinds} ) {
|
for my $kind ( @{$kinds} ) {
|
||||||
push @{$select}, { max => \[ "CASE WHEN rule_name = ? THEN rule_value END", $kind ], -as => $kind };
|
push @{$select}, { max => \[ "CASE WHEN rule_name = ? THEN rule_value END", $kind ], -as => $kind };
|
||||||
push @{$as}, $kind;
|
push @{$as}, $kind;
|
||||||
|
|
Loading…
Reference in a new issue