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

(-)a/Koha/REST/V1/CirculationRules.pm (-5 / +8 lines)
Lines 51-61 sub list_rules { Link Here
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           = $c->param('rules') // [ keys %{ Koha::CirculationRules->rule_kinds } ];
54
        my $kinds           = $c->param('rules')     // [ keys %{ Koha::CirculationRules->rule_kinds } ];
55
        my $item_type       = $c->param('item_type_id');
55
        my $item_type       = $c->param('item_type_id');
56
        my $branchcode      = $c->param('library_id');
56
        my $branchcode      = $c->param('library_id');
57
        my $patron_category = $c->param('patron_category_id');
57
        my $patron_category = $c->param('patron_category_id');
58
        my ($filter_branch, $filter_itemtype, $filter_patron);
58
        my ( $filter_branch, $filter_itemtype, $filter_patron );
59
59
60
        if ($item_type) {
60
        if ($item_type) {
61
            $filter_itemtype = 1;
61
            $filter_itemtype = 1;
Lines 124-131 sub list_rules { Link Here
124
            ) // {};
124
            ) // {};
125
            push @{$rules}, $effective_rules;
125
            push @{$rules}, $effective_rules;
126
        } else {
126
        } else {
127
            my $select = [ 'branchcode', 'categorycode', 'itemtype' ];
127
            my $select = [
128
            my $as     = [ 'branchcode', 'categorycode', 'itemtype' ];
128
                { 'COALESCE' => [ 'branchcode',   \["'*'"] ], -as => 'branchcode' },
129
                { 'COALESCE' => [ 'categorycode', \["'*'"] ], -as => 'categorycode' },
130
                { 'COALESCE' => [ 'itemtype',     \["'*'"] ], -as => 'itemtype' }
131
            ];
132
            my $as = [ 'branchcode', 'categorycode', 'itemtype' ];
129
            for my $kind ( @{$kinds} ) {
133
            for my $kind ( @{$kinds} ) {
130
                push @{$select}, { max => \[ "CASE WHEN rule_name = ? THEN rule_value END", $kind ], -as => $kind };
134
                push @{$select}, { max => \[ "CASE WHEN rule_name = ? THEN rule_value END", $kind ], -as => $kind };
131
                push @{$as}, $kind;
135
                push @{$as}, $kind;
132
- 

Return to bug 36641