|
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; |