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

(-)a/Koha/Acquisition/Fund.pm (+29 lines)
Lines 27-32 Koha::Acquisition::Fund object class Link Here
27
27
28
=head1 API
28
=head1 API
29
29
30
=head2 Class methods
31
32
=head3 to_api_mapping
33
34
This method returns the mapping for representing a Koha::Acquisition::Fund object
35
on the API.
36
37
=cut
38
39
sub to_api_mapping {
40
    return {
41
        budget_id         => 'fund_id',
42
        budget_code       => 'code',
43
        budget_name       => 'name',
44
        budget_branchcode => 'library_id',
45
        budget_amount     => 'total_amount',
46
        budget_encumb     => 'warn_at_percentage',
47
        budget_expend     => 'warn_at_amount',
48
        budget_notes      => 'notes',
49
        budget_period_id  => 'budget_id',
50
        timestamp         => 'timestamp',
51
        budget_owner_id   => 'fund_owner_id',
52
        budget_permission => 'fund_access',
53
        sort1_authcat     => 'statistic1_auth_value_category',
54
        sort2_authcat     => 'statistic2_auth_value_category',
55
        budget_parent_id  => 'parent_fund_id',
56
    };
57
}
58
30
=head2 Internal methods
59
=head2 Internal methods
31
60
32
=head3 _type
61
=head3 _type
(-)a/Koha/REST/V1/Acquisitions/Funds.pm (-4 / +5 lines)
Lines 56-65 sub list_funds { Link Here
56
    }
56
    }
57
57
58
    return try {
58
    return try {
59
        my @funds = Koha::Acquisition::Funds->search($filter);
59
        my $funds = Koha::Acquisition::Funds->search($filter);
60
        @funds = map { _to_api($_->TO_JSON) } @funds;
60
        return $c->render(
61
        return $c->render( status  => 200,
61
            status  => 200,
62
                           openapi =>  \@funds);
62
            openapi => $funds->to_api
63
        );
63
    }
64
    }
64
    catch {
65
    catch {
65
        if ( $_->isa('DBIx::Class::Exception') ) {
66
        if ( $_->isa('DBIx::Class::Exception') ) {
(-)a/api/v1/swagger/definitions/fund.json (-1 / +4 lines)
Lines 81-86 Link Here
81
      ],
81
      ],
82
      "description": "Level of permission for this fund (1: owner, 2: owner, users and library, 3: owner and users)"
82
      "description": "Level of permission for this fund (1: owner, 2: owner, users and library, 3: owner and users)"
83
    },
83
    },
84
    "parent_fund_id": {
85
        "type": [ "integer", "null" ],
86
        "description": "Internal identifier for parent fund"
87
    },
84
    "statistic1_auth_value_category": {
88
    "statistic1_auth_value_category": {
85
      "type": [
89
      "type": [
86
        "string",
90
        "string",
87
- 

Return to bug 23843