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::ItemType - objects from the itemtypes table
34 my @itemtypes = C4::ItemType->all;
35 print join("\n", map { $_->description } @itemtypes), "\n";
39 Objects of this class represent a row in the C<itemtypes> 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::ItemType->new(\%opts)
53 Given a hashref, a new (in-memory) C4::ItemType object will be instantiated.
54 The database is not touched.
59 my ($class, $opts) = @_;
60 bless $opts => $class;
66 =head3 C4::ItemType->all
68 This returns all the itemtypes as objects. By default they're ordered by
75 my $dbh = C4
::Context
->dbh;
76 return map { $class->new($_) } @
{$dbh->selectall_arrayref(
77 # The itemtypes table is small enough for
78 # `SELECT *` to be harmless.
79 "SELECT * FROM itemtypes ORDER BY description",
89 These are read-only accessors for attributes of a C4::ItemType object.
91 =head3 $itemtype->itemtype
93 =head3 $itemtype->description
95 =head3 $itemtype->renewalsallowed
97 =head3 $itemtype->rentalcharge
99 =head3 $itemtype->notforloan
101 =head3 $itemtype->imageurl
103 =head3 $itemtype->summary
109 my $attr = $AUTOLOAD;
111 if (exists $self->{$attr}) {
112 return $self->{$attr};
122 # ack itemtypes | grep '\.pm' | awk '{ print $1 }' | sed 's/:.*$//' | sort | uniq | sed -e 's,/,::,g' -e 's/\.pm//' -e 's/^/L<C4::/' -e 's/$/>,/'
126 The following modules make reference to the C<itemtypes> table.
137 L<C4::VirtualShelves::Page>,
138 L<C4::VirtualShelves>,
145 John Beppu <john.beppu@liblime.com>