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

(-)a/Koha/Acquisition/Basket.pm (+47 lines)
Lines 71-76 sub effective_create_items { Link Here
71
    return $self->create_items || C4::Context->preference('AcqCreateItem');
71
    return $self->create_items || C4::Context->preference('AcqCreateItem');
72
}
72
}
73
73
74
=head3 to_api
75
76
    my $json = $basket->to_api;
77
78
Overloaded method that returns a JSON representation of the Koha::Acquisition::Basket object,
79
suitable for API output.
80
81
=cut
82
83
sub to_api {
84
    my ( $self ) = @_;
85
86
    my $json = $self->SUPER::to_api;
87
88
    $json->{closed} = ( $self->closedate )
89
                                    ? Mojo::JSON->true
90
                                    : Mojo::JSON->false;
91
92
    return $json;
93
}
94
95
=head3 to_api_mapping
96
97
This method returns the mapping for representing a Koha::Acquisition::Basket object
98
on the API.
99
100
=cut
101
102
sub to_api_mapping {
103
    return {
104
        basketno                => 'basket_id',
105
        basketname              => 'name',
106
        booksellernote          => 'vendor_note',
107
        contractnumber          => 'contract_id',
108
        creationdate            => 'creation_date',
109
        closedate               => 'close_date',
110
        booksellerid            => 'vendor_id',
111
        authorisedby            => 'authorised_by',
112
        booksellerinvoicenumber => undef,
113
        basketgroupid           => 'basket_group_id',
114
        deliveryplace           => 'delivery_place',
115
        billingplace            => 'billing_place',
116
        branch                  => 'library_id',
117
        is_standing             => 'standing'
118
    };
119
}
120
74
=head2 Internal methods
121
=head2 Internal methods
75
122
76
=head3 _type
123
=head3 _type
(-)a/Koha/Acquisition/Invoice.pm (+43 lines)
Lines 27-32 Koha::Acquisition::Invoice object class Link Here
27
27
28
=head1 API
28
=head1 API
29
29
30
31
=head3 to_api
32
33
    my $json = $invoice->to_api;
34
35
Overloaded method that returns a JSON representation of the Koha::Acquisition::Invoice object,
36
suitable for API output.
37
38
=cut
39
40
sub to_api {
41
    my ( $self ) = @_;
42
43
    my $json = $self->SUPER::to_api;
44
45
    $json->{closed} = ( $self->closedate )
46
                                    ? Mojo::JSON->true
47
                                    : Mojo::JSON->false;
48
49
    return $json;
50
}
51
52
=head3 to_api_mapping
53
54
This method returns the mapping for representing a Koha::Acquisition::Invoice object
55
on the API.
56
57
=cut
58
59
sub to_api_mapping {
60
    return {
61
        invoiceid             => 'invoice_id',
62
        invoicenumber         => 'invoice_number',
63
        booksellerid          => 'vendor_id',
64
        shipmentdate          => 'shipping_date',
65
        billingdate           => 'invoice_date',
66
        closedate             => 'close_date',
67
        shipmentcost          => 'shipping_cost',
68
        shipmentcost_budgetid => 'shipping_cost_budget_id',
69
        message_id            => undef
70
    };
71
}
72
30
=head2 Internal methods
73
=head2 Internal methods
31
74
32
=head3 _type
75
=head3 _type
(-)a/Koha/Schema/Result/Aqbasket.pm (-1 / +4 lines)
Lines 335-338 sub koha_objects_class { Link Here
335
    'Koha::Acquisition::Baskets';
335
    'Koha::Acquisition::Baskets';
336
}
336
}
337
337
338
__PACKAGE__->add_columns(
339
    '+is_standing' => { is_boolean => 1 }
340
);
341
338
1;
342
1;
339
- 

Return to bug 18731