Filename | /usr/share/koha/lib/C4/Category.pm |
Statements | Executed 11 statements in 399µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 18µs | 22µs | BEGIN@21 | C4::Category::
1 | 1 | 1 | 11µs | 24µs | BEGIN@22 | C4::Category::
1 | 1 | 1 | 11µs | 12µs | BEGIN@23 | C4::Category::
0 | 0 | 0 | 0s | 0s | AUTOLOAD | C4::Category::
0 | 0 | 0 | 0s | 0s | DESTROY | C4::Category::
0 | 0 | 0 | 0s | 0s | all | C4::Category::
0 | 0 | 0 | 0s | 0s | new | C4::Category::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package C4::Category; | ||||
2 | |||||
3 | # Copyright 2009 Liblime | ||||
4 | # Parts Copyright 2011 Tamil | ||||
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 | 28µs | 2 | 26µs | # spent 22µs (18+4) within C4::Category::BEGIN@21 which was called:
# once (18µs+4µs) by C4::ItemCirculationAlertPreference::BEGIN@23 at line 21 # spent 22µs making 1 call to C4::Category::BEGIN@21
# spent 4µs making 1 call to strict::import |
22 | 3 | 27µs | 2 | 36µs | # spent 24µs (11+12) within C4::Category::BEGIN@22 which was called:
# once (11µs+12µs) by C4::ItemCirculationAlertPreference::BEGIN@23 at line 22 # spent 24µs making 1 call to C4::Category::BEGIN@22
# spent 12µs making 1 call to warnings::import |
23 | 3 | 341µs | 2 | 14µs | # spent 12µs (11+2) within C4::Category::BEGIN@23 which was called:
# once (11µs+2µs) by C4::ItemCirculationAlertPreference::BEGIN@23 at line 23 # spent 12µs making 1 call to C4::Category::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::Category->new(\%opts) | ||||
55 | |||||
- - | |||||
61 | sub new { | ||||
62 | my ($class, $opts) = @_; | ||||
63 | bless $opts => $class; | ||||
64 | } | ||||
65 | |||||
- - | |||||
69 | =head3 C4::Category->all | ||||
70 | |||||
- - | |||||
76 | sub all { | ||||
77 | my ( $class ) = @_; | ||||
78 | my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; | ||||
79 | my $dbh = C4::Context->dbh; | ||||
80 | # The categories table is small enough for | ||||
81 | # `SELECT *` to be harmless. | ||||
82 | my $query = "SELECT categories.* FROM categories"; | ||||
83 | $query .= qq{ | ||||
84 | LEFT JOIN categories_branches ON categories_branches.categorycode = categories.categorycode | ||||
85 | WHERE categories_branches.branchcode = ? OR categories_branches.branchcode IS NULL | ||||
86 | } if $branch_limit; | ||||
87 | $query .= " ORDER BY description"; | ||||
88 | return map { $class->new($_) } @{ | ||||
89 | $dbh->selectall_arrayref( | ||||
90 | $query, | ||||
91 | { Slice => {} }, | ||||
92 | $branch_limit ? $branch_limit : () | ||||
93 | ) | ||||
94 | }; | ||||
95 | } | ||||
96 | |||||
- - | |||||
100 | =head2 Object Methods | ||||
101 | |||||
- - | |||||
108 | =head3 $category->description | ||||
109 | |||||
- - | |||||
112 | =head3 $category->enrolmentperiod | ||||
113 | |||||
- - | |||||
116 | =head3 $category->upperagelimit | ||||
117 | |||||
- - | |||||
120 | =head3 $category->dateofbirthrequired | ||||
121 | |||||
- - | |||||
124 | =head3 $category->finetype | ||||
125 | |||||
- - | |||||
128 | =head3 $category->bulk | ||||
129 | |||||
- - | |||||
132 | =head3 $category->enrolmentfee | ||||
133 | |||||
- - | |||||
136 | =head3 $category->overduenoticerequired | ||||
137 | |||||
- - | |||||
140 | =head3 $category->issuelimit | ||||
141 | |||||
- - | |||||
144 | =head3 $category->reservefee | ||||
145 | |||||
- - | |||||
148 | =head3 $category->category_type | ||||
149 | |||||
- - | |||||
152 | sub AUTOLOAD { | ||||
153 | my $self = shift; | ||||
154 | my $attr = $AUTOLOAD; | ||||
155 | $attr =~ s/.*://; | ||||
156 | if (exists $self->{$attr}) { | ||||
157 | return $self->{$attr}; | ||||
158 | } else { | ||||
159 | return undef; | ||||
160 | } | ||||
161 | } | ||||
162 | |||||
163 | sub DESTROY { } | ||||
164 | |||||
- - | |||||
168 | =head1 SEE ALSO | ||||
169 | |||||
- - | |||||
181 | 1 | 3µs | 1; |