3 # Copyright 2009 Liblime
4 # Parts Copyright 2011 Tamil
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along
18 # with Koha; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
32 C4::Category - objects from the categories table
37 my @categories = C4::Category->all;
38 print join("\n", map { $_->description } @categories), "\n";
42 Objects of this class represent a row in the C<categories> table.
44 Currently, the bare minimum for using this as a read-only data source has
45 been implemented. The API was designed to make it easy to transition to
54 =head3 C4::Category->new(\%opts)
56 Given a hashref, a new (in-memory) C4::Category object will be instantiated.
57 The database is not touched.
62 my ($class, $opts) = @_;
63 bless $opts => $class;
69 =head3 C4::Category->all
71 This returns all the categories as objects. By default they're ordered by
79 utf8::encode($_->{description});
81 } @{C4::Context->dbh->selectall_arrayref(
82 "SELECT * FROM categories ORDER BY description", { Slice => {} }
91 These are read-only accessors for attributes of a C4::Category object.
93 =head3 $category->categorycode
97 =head3 $category->description
101 =head3 $category->enrolmentperiod
105 =head3 $category->upperagelimit
109 =head3 $category->dateofbirthrequired
113 =head3 $category->finetype
117 =head3 $category->bulk
121 =head3 $category->enrolmentfee
125 =head3 $category->overduenoticerequired
129 =head3 $category->issuelimit
133 =head3 $category->reservefee
137 =head3 $category->category_type
143 my $attr = $AUTOLOAD;
145 if (exists $self->{$attr}) {
146 return $self->{$attr};
159 The following modules make reference to the C<categories> table.
161 L<C4::Members>, L<C4::Overdues>, L<C4::Reserves>
166 John Beppu <john.beppu@liblime.com>