Filename | /usr/share/koha/lib/C4/ItemType.pm |
Statements | Executed 11 statements in 342µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 19µs | 24µs | BEGIN@21 | C4::ItemType::
1 | 1 | 1 | 11µs | 24µs | BEGIN@22 | C4::ItemType::
1 | 1 | 1 | 10µs | 12µs | BEGIN@23 | C4::ItemType::
0 | 0 | 0 | 0s | 0s | AUTOLOAD | C4::ItemType::
0 | 0 | 0 | 0s | 0s | DESTROY | C4::ItemType::
0 | 0 | 0 | 0s | 0s | all | C4::ItemType::
0 | 0 | 0 | 0s | 0s | new | C4::ItemType::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package C4::ItemType; | ||||
2 | |||||
3 | # Copyright Liblime 2009 | ||||
4 | # Parts Copyright Tamil 2011 | ||||
5 | # | ||||
6 | # This file is part of Koha. | ||||
7 | # | ||||
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 | ||||
11 | # version. | ||||
12 | # | ||||
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. | ||||
16 | # | ||||
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. | ||||
20 | |||||
21 | 3 | 30µs | 2 | 29µs | # spent 24µs (19+5) within C4::ItemType::BEGIN@21 which was called:
# once (19µs+5µs) by C4::ItemCirculationAlertPreference::BEGIN@24 at line 21 # spent 24µs making 1 call to C4::ItemType::BEGIN@21
# spent 5µs making 1 call to strict::import |
22 | 3 | 27µs | 2 | 36µs | # spent 24µs (11+13) within C4::ItemType::BEGIN@22 which was called:
# once (11µs+13µs) by C4::ItemCirculationAlertPreference::BEGIN@24 at line 22 # spent 24µs making 1 call to C4::ItemType::BEGIN@22
# spent 13µs making 1 call to warnings::import |
23 | 3 | 282µs | 2 | 14µs | # spent 12µs (10+2) within C4::ItemType::BEGIN@23 which was called:
# once (10µs+2µs) by C4::ItemCirculationAlertPreference::BEGIN@24 at line 23 # spent 12µs making 1 call to C4::ItemType::BEGIN@23
# spent 2µs making 1 call to C4::Context::import |
24 | |||||
25 | 1 | 200ns | our $AUTOLOAD; | ||
26 | |||||
- - | |||||
30 | =head1 NAME | ||||
31 | |||||
- - | |||||
54 | =head3 C4::ItemType->new(\%opts) | ||||
55 | |||||
- - | |||||
61 | sub new { | ||||
62 | my ($class, $opts) = @_; | ||||
63 | bless $opts => $class; | ||||
64 | } | ||||
65 | |||||
- - | |||||
69 | =head3 C4::ItemType->all | ||||
70 | |||||
- - | |||||
76 | sub all { | ||||
77 | my ($class) = @_; | ||||
78 | my $dbh = C4::Context->dbh; | ||||
79 | |||||
80 | my @itypes; | ||||
81 | for ( @{$dbh->selectall_arrayref( | ||||
82 | "SELECT * FROM itemtypes ORDER BY description", { Slice => {} })} ) | ||||
83 | { | ||||
84 | utf8::encode($_->{description}); | ||||
85 | push @itypes, $class->new($_); | ||||
86 | } | ||||
87 | return @itypes; | ||||
88 | } | ||||
89 | |||||
- - | |||||
93 | =head2 Object Methods | ||||
94 | |||||
- - | |||||
101 | =head3 $itemtype->description | ||||
102 | |||||
- - | |||||
105 | =head3 $itemtype->renewalsallowed | ||||
106 | |||||
- - | |||||
109 | =head3 $itemtype->rentalcharge | ||||
110 | |||||
- - | |||||
113 | =head3 $itemtype->notforloan | ||||
114 | |||||
- - | |||||
117 | =head3 $itemtype->imageurl | ||||
118 | |||||
- - | |||||
121 | =head3 $itemtype->summary | ||||
122 | |||||
- - | |||||
125 | sub AUTOLOAD { | ||||
126 | my $self = shift; | ||||
127 | my $attr = $AUTOLOAD; | ||||
128 | $attr =~ s/.*://; | ||||
129 | if (exists $self->{$attr}) { | ||||
130 | return $self->{$attr}; | ||||
131 | } else { | ||||
132 | return undef; | ||||
133 | } | ||||
134 | } | ||||
135 | |||||
136 | sub DESTROY { } | ||||
137 | |||||
- - | |||||
140 | # ack itemtypes | grep '\.pm' | awk '{ print $1 }' | sed 's/:.*$//' | sort | uniq | sed -e 's,/,::,g' -e 's/\.pm//' -e 's/^/L<C4::/' -e 's/$/>,/' | ||||
141 | |||||
142 | =head1 SEE ALSO | ||||
143 | |||||
- - | |||||
167 | 1 | 3µs | 1; |