← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/share/koha/opac/cgi-bin/opac/opac-search.pl
  Run on Tue Oct 15 17:10:45 2013
Reported on Tue Oct 15 17:11:25 2013

Filename/usr/share/koha/lib/C4/ClassSource.pm
StatementsExecuted 20 statements in 1.45ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1112.47ms63.2msC4::ClassSource::::BEGIN@25C4::ClassSource::BEGIN@25
11177µs220µsC4::ClassSource::::BEGIN@27C4::ClassSource::BEGIN@27
11122µs29µsC4::ClassSource::::BEGIN@20C4::ClassSource::BEGIN@20
11117µs21µsC4::ClassSource::::BEGIN@24C4::ClassSource::BEGIN@24
11114µs37µsC4::ClassSource::::BEGIN@21C4::ClassSource::BEGIN@21
0000s0sC4::ClassSource::::AddClassSortRuleC4::ClassSource::AddClassSortRule
0000s0sC4::ClassSource::::AddClassSourceC4::ClassSource::AddClassSource
0000s0sC4::ClassSource::::DelClassSortRuleC4::ClassSource::DelClassSortRule
0000s0sC4::ClassSource::::DelClassSourceC4::ClassSource::DelClassSource
0000s0sC4::ClassSource::::GetClassSortC4::ClassSource::GetClassSort
0000s0sC4::ClassSource::::GetClassSortRuleC4::ClassSource::GetClassSortRule
0000s0sC4::ClassSource::::GetClassSortRulesC4::ClassSource::GetClassSortRules
0000s0sC4::ClassSource::::GetClassSourceC4::ClassSource::GetClassSource
0000s0sC4::ClassSource::::GetClassSourcesC4::ClassSource::GetClassSources
0000s0sC4::ClassSource::::GetSourcesForSortRuleC4::ClassSource::GetSourcesForSortRule
0000s0sC4::ClassSource::::ModClassSortRuleC4::ClassSource::ModClassSortRule
0000s0sC4::ClassSource::::ModClassSourceC4::ClassSource::ModClassSource
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package C4::ClassSource;
2
3# Copyright (C) 2007 LibLime
4#
5# This file is part of Koha.
6#
7# Koha is free software; you can redistribute it and/or modify it under the
8# terms of the GNU General Public License as published by the Free Software
9# Foundation; either version 2 of the License, or (at your option) any later
10# version.
11#
12# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License along
17# with Koha; if not, write to the Free Software Foundation, Inc.,
18# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20331µs236µs
# spent 29µs (22+7) within C4::ClassSource::BEGIN@20 which was called: # once (22µs+7µs) by C4::Biblio::BEGIN@36 at line 20
use strict;
# spent 29µs making 1 call to C4::ClassSource::BEGIN@20 # spent 7µs making 1 call to strict::import
21338µs259µs
# spent 37µs (14+23) within C4::ClassSource::BEGIN@21 which was called: # once (14µs+23µs) by C4::Biblio::BEGIN@36 at line 21
use warnings;
# spent 37µs making 1 call to C4::ClassSource::BEGIN@21 # spent 23µs making 1 call to warnings::import
22
2314µsrequire Exporter;
24331µs225µs
# spent 21µs (17+4) within C4::ClassSource::BEGIN@24 which was called: # once (17µs+4µs) by C4::Biblio::BEGIN@36 at line 24
use C4::Context;
# spent 21µs making 1 call to C4::ClassSource::BEGIN@24 # spent 4µs making 1 call to C4::Context::import
253177µs263.4ms
# spent 63.2ms (2.47+60.7) within C4::ClassSource::BEGIN@25 which was called: # once (2.47ms+60.7ms) by C4::Biblio::BEGIN@36 at line 25
use C4::ClassSortRoutine;
# spent 63.2ms making 1 call to C4::ClassSource::BEGIN@25 # spent 282µs making 1 call to Exporter::import
26
2731.09ms2362µs
# spent 220µs (77+142) within C4::ClassSource::BEGIN@27 which was called: # once (77µs+142µs) by C4::Biblio::BEGIN@36 at line 27
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
# spent 220µs making 1 call to C4::ClassSource::BEGIN@27 # spent 142µs making 1 call to vars::import
28
29# set the version for version checking
30124µs$VERSION = 3.07.00.049;
31
32=head1 NAME
33
- -
50128µs@ISA = qw(Exporter);
5118µs@EXPORT = qw(
52 &GetClassSources
53 &AddClassSource
54 &GetClassSource
55 &ModClassSource
56 &DelClassSource
57 &GetClassSortRules
58 &AddClassSortRule
59 &GetClassSortRule
60 &ModClassSortRule
61 &DelClassSortRule
62
63 &GetSourcesForSortRule
64 &GetClassSort
65
66);
67
68=head2 GetClassSources
69
- -
92sub GetClassSources {
93
94 my %class_sources = ();
95 my $dbh = C4::Context->dbh;
96 my $sth = $dbh->prepare_cached("SELECT * FROM `class_sources`");
97 $sth->execute();
98 while (my $source = $sth->fetchrow_hashref) {
99 $class_sources{ $source->{'cn_source'} } = $source;
100 }
101 $sth->finish();
102
103 return \%class_sources;
104
105}
106
107=head2 AddClassSource
108
- -
115sub AddClassSource {
116
117 my ($cn_source, $description, $used, $class_sort_rule) = @_;
118 my $dbh = C4::Context->dbh;
119 my $sth = $dbh->prepare_cached("INSERT INTO `class_sources`
120 (`cn_source`, `description`, `used`, `class_sort_rule`)
121 VALUES (?, ?, ?, ?)");
122 $sth->execute($cn_source, $description, $used, $class_sort_rule);
123 $sth->finish();
124
125}
126
127=head2 GetClassSource
128
- -
135sub GetClassSource {
136
137 my ($cn_source) = (@_);
138 my $dbh = C4::Context->dbh;
139 my $sth = $dbh->prepare_cached("SELECT * FROM `class_sources` WHERE cn_source = ?");
140 $sth->execute($cn_source);
141 my $row = $sth->fetchrow_hashref();
142 $sth->finish();
143 return $row;
144}
145
146=head2 ModClassSource
147
- -
154sub ModClassSource {
155
156 my ($cn_source, $description, $used, $class_sort_rule) = @_;
157 my $dbh = C4::Context->dbh;
158 my $sth = $dbh->prepare_cached("UPDATE `class_sources`
159 SET `description` = ?,
160 `used` = ?,
161 `class_sort_rule` = ?
162 WHERE `cn_source` = ?");
163 $sth->execute($description, $used, $class_sort_rule, $cn_source);
164 $sth->finish();
165
166}
167
168=head2 DelClassSource
169
- -
176sub DelClassSource {
177
178 my ($cn_source) = @_;
179 my $dbh = C4::Context->dbh;
180 my $sth = $dbh->prepare_cached("DELETE FROM `class_sources` WHERE `cn_source` = ?");
181 $sth->execute($cn_source);
182 $sth->finish();
183
184}
185
186=head2 GetClassSortRules
187
- -
209sub GetClassSortRules {
210
211 my %class_sort_rules = ();
212 my $dbh = C4::Context->dbh;
213 my $sth = $dbh->prepare_cached("SELECT * FROM `class_sort_rules`");
214 $sth->execute();
215 while (my $sort_rule = $sth->fetchrow_hashref) {
216 $class_sort_rules{ $sort_rule->{'class_sort_rule'} } = $sort_rule;
217 }
218 $sth->finish();
219
220 return \%class_sort_rules;
221
222}
223
224=head2 AddClassSortRule
225
- -
232sub AddClassSortRule {
233
234 my ($class_sort_rule, $description, $sort_routine) = @_;
235 my $dbh = C4::Context->dbh;
236 my $sth = $dbh->prepare_cached("INSERT INTO `class_sort_rules`
237 (`class_sort_rule`, `description`, `sort_routine`)
238 VALUES (?, ?, ?)");
239 $sth->execute($class_sort_rule, $description, $sort_routine);
240 $sth->finish();
241
242}
243
244=head2 GetClassSortRule
245
- -
252sub GetClassSortRule {
253
254 my ($class_sort_rule) = (@_);
255 my $dbh = C4::Context->dbh;
256 my $sth = $dbh->prepare_cached("SELECT * FROM `class_sort_rules` WHERE `class_sort_rule` = ?");
257 $sth->execute($class_sort_rule);
258 my $row = $sth->fetchrow_hashref();
259 $sth->finish();
260 return $row;
261}
262
263=head2 ModClassSortRule
264
- -
271sub ModClassSortRule {
272
273 my ($class_sort_rule, $description, $sort_routine) = @_;
274 my $dbh = C4::Context->dbh;
275 my $sth = $dbh->prepare_cached("UPDATE `class_sort_rules`
276 SET `description` = ?,
277 `sort_routine` = ?
278 WHERE `class_sort_rule` = ?");
279 $sth->execute($description, $sort_routine, $class_sort_rule);
280 $sth->finish();
281
282}
283
284=head2 DelClassSortRule
285
- -
292sub DelClassSortRule {
293
294 my ($class_sort_rule) = @_;
295 my $dbh = C4::Context->dbh;
296 my $sth = $dbh->prepare_cached("DELETE FROM `class_sort_rules` WHERE `class_sort_rule` = ?");
297 $sth->execute($class_sort_rule);
298 $sth->finish();
299
300}
301
302=head2 GetSourcesForSortRule
303
- -
311sub GetSourcesForSortRule {
312
313 my ($class_sort_rule) = @_;
314
315 my $dbh = C4::Context->dbh;
316 my $sth = $dbh->prepare_cached("SELECT cn_source FROM class_sources WHERE class_sort_rule = ?");
317 $sth->execute($class_sort_rule);
318 my @sources = ();
319 while (my ($source) = $sth->fetchrow_array()) {
320 push @sources, $source;
321 }
322 $sth->finish();
323 return @sources;
324
325}
326
327=head2 GetClassSort
328
- -
336sub GetClassSort {
337
338 my ($cn_source, $cn_class, $cn_item) = @_;
339
340 my $source_ref = GetClassSource($cn_source);
341 unless (defined $source_ref) {
342 $source_ref = GetClassSource(C4::Context->preference("DefaultClassificationSource"));
343 }
344 my $routine = "";
345 if (defined $source_ref) {
346 my $rule_ref = GetClassSortRule($source_ref->{'class_sort_rule'});
347 if (defined $rule_ref) {
348 $routine = $rule_ref->{'sort_routine'};
349 }
350 }
351
352 return GetClassSortKey($routine, $cn_class, $cn_item);
353
354}
355
356118µs1;
357
358=head1 AUTHOR
359
- -