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

(-)a/Koha/REST/V1/CirculationRules.pm (-3 / +3 lines)
Lines 49-57 List all effective rules for the requested patron/item/branch combination Link Here
49
sub list_effective_rules {
49
sub list_effective_rules {
50
    my $c = shift->openapi->valid_input or return;
50
    my $c = shift->openapi->valid_input or return;
51
51
52
    my $item_type       = $c->param('itemtype');
52
    my $item_type       = $c->param('item_type_id');
53
    my $branchcode      = $c->param('library');
53
    my $branchcode      = $c->param('library_id');
54
    my $patron_category = $c->param('category');
54
    my $patron_category = $c->param('patron_category_id');
55
    my $rules           = $c->param('rules') // [ keys %{ Koha::CirculationRules->rule_kinds } ];
55
    my $rules           = $c->param('rules') // [ keys %{ Koha::CirculationRules->rule_kinds } ];
56
56
57
    if ($item_type) {
57
    if ($item_type) {
(-)a/api/v1/swagger/paths/circulation_rules.yaml (-8 / +8 lines)
Lines 5-27 Link Here
5
    operationId: listCirculationRules
5
    operationId: listCirculationRules
6
    tags:
6
    tags:
7
      - circulation_rules
7
      - circulation_rules
8
    summary: Get circulation rules for this item/library/patron combination
8
    summary: Get circulation rules for a given item type/library/patron combination.
9
    produces:
9
    produces:
10
      - application/json
10
      - application/json
11
    parameters:
11
    parameters:
12
      - name: item_type
12
      - name: item_type_id
13
        in: query
13
        in: query
14
        description: The itemtype
14
        description: The item type identifier
15
        required: false
15
        required: false
16
        type: string
16
        type: string
17
      - name: library
17
      - name: library_id
18
        in: query
18
        in: query
19
        description: The library code
19
        description: The library identifier
20
        required: false
20
        required: false
21
        type: string
21
        type: string
22
      - name: patron_category
22
      - name: patron_category_id
23
        in: query
23
        in: query
24
        description: The patron category
24
        description: The patron category identifier
25
        required: false
25
        required: false
26
        type: string
26
        type: string
27
      - name: rules
27
      - name: rules
Lines 34-40 Link Here
34
        collectionFormat: multi
34
        collectionFormat: multi
35
    responses:
35
    responses:
36
      "200":
36
      "200":
37
        description: A list of rules for this itemtype, library and patron category combination
37
        description: A list of rules for this item type, library and patron category combination
38
        schema:
38
        schema:
39
          type: object
39
          type: object
40
          additionalProperties:
40
          additionalProperties:
(-)a/t/db_dependent/api/v1/circulation_rules.t (-3 / +2 lines)
Lines 120-126 subtest 'list_effective_rules() tests' => sub { Link Here
120
        "Given I added an issuing rule branchcode => $branchcode," . ' categorycode => undef, itemtype => undef,'
120
        "Given I added an issuing rule branchcode => $branchcode," . ' categorycode => undef, itemtype => undef,'
121
    );
121
    );
122
122
123
    $t->get_ok("//$userid:$password@/api/v1/circulation_rules?library=$branchcode")->status_is(200)->json_is(
123
    $t->get_ok("//$userid:$password@/api/v1/circulation_rules?library_id=$branchcode")->status_is(200)->json_is(
124
        '' => {
124
        '' => {
125
            fine     => 4,
125
            fine     => 4,
126
            finedays => 5,
126
            finedays => 5,
Lines 141-147 subtest 'list_effective_rules() tests' => sub { Link Here
141
        ->json_is( [ { path => '/query/rules_blah', message => 'Malformed query string' } ] );
141
        ->json_is( [ { path => '/query/rules_blah', message => 'Malformed query string' } ] );
142
142
143
    # Warn on incorrect query parameter value
143
    # Warn on incorrect query parameter value
144
    $t->get_ok("//$userid:$password@/api/v1/circulation_rules?library=SMITH")->status_is(400)->json_is(
144
    $t->get_ok("//$userid:$password@/api/v1/circulation_rules?library_id=SMITH")->status_is(400)->json_is(
145
        '' => {
145
        '' => {
146
            error      => 'Invalid parameter value',
146
            error      => 'Invalid parameter value',
147
            error_code => 'invalid_parameter_value',
147
            error_code => 'invalid_parameter_value',
148
- 

Return to bug 36641