3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along with
15 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16 # Suite 330, Boston, MA 02111-1307 USA
29 C4::Category - objects from the categories table
34 my @categories = C4::Category->all;
35 print join("\n", map { $_->description } @categories), "\n";
39 Objects of this class represent a row in the C<categories> table.
41 Currently, the bare minimum for using this as a read-only data source has
42 been implemented. The API was designed to make it easy to transition to
51 =head3 C4::Category->new(\%opts)
53 Given a hashref, a new (in-memory) C4::Category object will be instantiated.
54 The database is not touched.
59 my ($class, $opts) = @_;
60 bless $opts => $class;
66 =head3 C4::Category->all
68 This returns all the categories as objects. By default they're ordered by
75 my $dbh = C4
::Context
->dbh;
76 return map { $class->new($_) } @
{$dbh->selectall_arrayref(
77 # The categories table is small enough for
78 # `SELECT *` to be harmless.
79 "SELECT * FROM categories ORDER BY description",
89 These are read-only accessors for attributes of a C4::Category object.
91 =head3 $category->categorycode
93 =head3 $category->description
95 =head3 $category->enrolmentperiod
97 =head3 $category->upperagelimit
99 =head3 $category->dateofbirthrequired
101 =head3 $category->finetype
103 =head3 $category->bulk
105 =head3 $category->enrolmentfee
107 =head3 $category->overduenoticerequired
109 =head3 $category->issuelimit
111 =head3 $category->reservefee
113 =head3 $category->category_type
119 my $attr = $AUTOLOAD;
121 if (exists $self->{$attr}) {
122 return $self->{$attr};
135 The following modules make reference to the C<categories> table.
137 L<C4::Members>, L<C4::Overdues>, L<C4::Reserves>
142 John Beppu <john.beppu@liblime.com>