Bug 22521: DBRev 18.12.00.055
[koha.git] / Koha / Acquisition / Basket.pm
1 package Koha::Acquisition::Basket;
2
3 # Copyright 2017 Aleisha Amohia <aleisha@catalyst.net.nz>
4 #
5 # This file is part of Koha.
6 #
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 3 of the License, or (at your option) any later
10 # version.
11 #
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20 use Modern::Perl;
21
22 use Koha::Database;
23 use Koha::Acquisition::BasketGroups;
24
25 use base qw( Koha::Object Koha::Object::Mixin::AdditionalFields );
26
27 =head1 NAME
28
29 Koha::Acquisition::Basket - Koha Basket Object class
30
31 =head1 API
32
33 =head2 Class Methods
34
35 =cut
36
37 =head3 bookseller
38
39 Returns the vendor
40
41 =cut
42
43 sub bookseller {
44     my ($self) = @_;
45     my $bookseller_rs = $self->_result->booksellerid;
46     return Koha::Acquisition::Bookseller->_new_from_dbic( $bookseller_rs );
47 }
48
49 =head3 basket_group
50
51 Returns the basket group associated to this basket
52
53 =cut
54
55 sub basket_group {
56     my ($self) = @_;
57     my $basket_group_rs = $self->_result->basketgroupid;
58     return unless $basket_group_rs;
59     return Koha::Acquisition::BasketGroup->_new_from_dbic( $basket_group_rs );
60 }
61
62 =head3 effective_create_items
63
64 Returns C<create_items> for this basket, falling back to C<AcqCreateItem> if unset.
65
66 =cut
67
68 sub effective_create_items {
69     my ( $self ) = @_;
70
71     return $self->create_items || C4::Context->preference('AcqCreateItem');
72 }
73
74 =head2 Internal methods
75
76 =head3 _type
77
78 =cut
79
80 sub _type {
81     return 'Aqbasket';
82 }
83
84 =head1 AUTHOR
85
86 Aleisha Amohia <aleisha@catalyst.net.nz>
87 Catalyst IT
88
89 =cut
90
91 1;