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

(-)a/Koha/EDI/Account.pm (+111 lines)
Line 0 Link Here
1
package Koha::EDI::Account;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <https://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use Koha::Acquisition::Bookseller;
21
use Koha::Acquisition::Fund;
22
use Koha::Edifact::Files;
23
use Koha::File::Transport;
24
25
use base qw(Koha::Object);
26
27
=head1 NAME
28
29
Koha::EDI::Account - Koha EDI Account Object class
30
31
=head1 API
32
33
=head2 Class methods
34
35
=head3 vendor
36
37
    my $vendor = $edi_account->vendor;
38
39
Returns the Koha::Acquisition::Bookseller object for this EDI account
40
41
=cut
42
43
sub vendor {
44
    my ($self) = @_;
45
    my $vendor_rs = $self->_result->vendor;
46
    return unless $vendor_rs;
47
    return Koha::Acquisition::Bookseller->_new_from_dbic($vendor_rs);
48
}
49
50
=head3 file_transport
51
52
    my $transport = $edi_account->file_transport;
53
54
Returns the Koha::File::Transport object for this EDI account
55
56
=cut
57
58
sub file_transport {
59
    my ($self) = @_;
60
    my $transport_rs = $self->_result->file_transport;
61
    return unless $transport_rs;
62
    return Koha::File::Transport->_new_from_dbic($transport_rs);
63
}
64
65
=head3 shipment_fund
66
67
    my $fund = $edi_account->shipment_fund;
68
69
Returns the Koha::Acquisition::Fund object for the shipment fund
70
71
=cut
72
73
sub shipment_fund {
74
    my ($self) = @_;
75
    my $fund_rs = $self->_result->shipment_budget;
76
    return unless $fund_rs;
77
    return Koha::Acquisition::Fund->_new_from_dbic($fund_rs);
78
}
79
80
=head3 files
81
82
    my $files = $edi_account->files;
83
84
Returns a Koha::Edifact::Files object containing all EDIFACT interchange files
85
for this account
86
87
=cut
88
89
sub files {
90
    my ($self) = @_;
91
    my $files_rs = $self->_result->edifact_messages;
92
    return Koha::Edifact::Files->_new_from_dbic($files_rs);
93
}
94
95
=head2 Internal methods
96
97
=head3 _type
98
99
=cut
100
101
sub _type {
102
    return 'VendorEdiAccount';
103
}
104
105
=head1 AUTHOR
106
107
Koha Development Team <http://koha-community.org/>
108
109
=cut
110
111
1;
(-)a/Koha/EDI/Accounts.pm (+60 lines)
Line 0 Link Here
1
package Koha::EDI::Accounts;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <https://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use Koha::EDI::Account;
21
22
use base qw(Koha::Objects);
23
24
=head1 NAME
25
26
Koha::EDI::Accounts - Koha EDI Account Objects class
27
28
=head1 API
29
30
=head2 Internal methods
31
32
=head3 _type
33
34
Returns name of corresponding DBIC resultset
35
36
=cut
37
38
sub _type {
39
    return 'VendorEdiAccount';
40
}
41
42
=head3 object_class
43
44
Returns name of corresponding koha object class
45
46
=cut
47
48
sub object_class {
49
    return 'Koha::EDI::Account';
50
}
51
52
=head1 AUTHOR
53
54
Martin Renvoize <martin.renvoize@openfifth.co.uk>
55
56
Koha Development Team <http://koha-community.org/>
57
58
=cut
59
60
1;
(-)a/Koha/Schema/Result/VendorEdiAccount.pm (-1 / +20 lines)
Lines 251-254 __PACKAGE__->add_columns( Link Here
251
    '+responses_enabled' => { is_boolean => 1 },
251
    '+responses_enabled' => { is_boolean => 1 },
252
);
252
);
253
253
254
=head2 koha_object_class
255
256
Helper for Koha::Object-based class name resolution.
257
258
=cut
259
260
sub koha_object_class {
261
    return 'Koha::EDI::Account';
262
}
263
264
=head2 koha_objects_class
265
266
Helper for Koha::Objects-based class name resolution.
267
268
=cut
269
270
sub koha_objects_class {
271
    return 'Koha::EDI::Accounts';
272
}
273
254
1;
274
1;
255
- 

Return to bug 38195