| Filename | /usr/share/koha/lib/C4/Category.pm |
| Statements | Executed 11 statements in 347µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 21µs | 25µs | C4::Category::BEGIN@21 |
| 1 | 1 | 1 | 10µs | 12µs | C4::Category::BEGIN@23 |
| 1 | 1 | 1 | 10µs | 22µs | C4::Category::BEGIN@22 |
| 0 | 0 | 0 | 0s | 0s | C4::Category::AUTOLOAD |
| 0 | 0 | 0 | 0s | 0s | C4::Category::DESTROY |
| 0 | 0 | 0 | 0s | 0s | C4::Category::all |
| 0 | 0 | 0 | 0s | 0s | C4::Category::new |
| 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 | 32µs | 2 | 28µs | # spent 25µs (21+4) within C4::Category::BEGIN@21 which was called:
# once (21µs+4µs) by C4::ItemCirculationAlertPreference::BEGIN@23 at line 21 # spent 25µs making 1 call to C4::Category::BEGIN@21
# spent 4µs making 1 call to strict::import |
| 22 | 3 | 26µs | 2 | 34µs | # spent 22µs (10+12) within C4::Category::BEGIN@22 which was called:
# once (10µs+12µs) by C4::ItemCirculationAlertPreference::BEGIN@23 at line 22 # spent 22µs making 1 call to C4::Category::BEGIN@22
# spent 12µs making 1 call to warnings::import |
| 23 | 3 | 286µs | 2 | 14µs | # spent 12µs (10+2) within C4::Category::BEGIN@23 which was called:
# once (10µ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 | 300ns | 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; |