← 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 11:58:52 2013
Reported on Tue Oct 15 12:02:11 2013

Filename/usr/share/koha/lib/C4/Stats.pm
StatementsExecuted 21 statements in 943µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11135µs174µsC4::Stats::::BEGIN@25C4::Stats::BEGIN@25
11122µs28µsC4::Stats::::BEGIN@21C4::Stats::BEGIN@21
11115µs15µsC4::Stats::::BEGIN@30C4::Stats::BEGIN@30
11112µs34µsC4::Stats::::BEGIN@22C4::Stats::BEGIN@22
11111µs70µsC4::Stats::::BEGIN@26C4::Stats::BEGIN@26
11111µs13µsC4::Stats::::BEGIN@24C4::Stats::BEGIN@24
0000s0sC4::Stats::::TotalPaidC4::Stats::TotalPaid
0000s0sC4::Stats::::UpdateStatsC4::Stats::UpdateStats
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package C4::Stats;
2
3
4# Copyright 2000-2002 Katipo Communications
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
21332µs234µs
# spent 28µs (22+6) within C4::Stats::BEGIN@21 which was called: # once (22µs+6µs) by C4::Circulation::BEGIN@26 at line 21
use strict;
# spent 28µs making 1 call to C4::Stats::BEGIN@21 # spent 6µs making 1 call to strict::import
22336µs255µs
# spent 34µs (12+22) within C4::Stats::BEGIN@22 which was called: # once (12µs+22µs) by C4::Circulation::BEGIN@26 at line 22
use warnings;
# spent 34µs making 1 call to C4::Stats::BEGIN@22 # spent 22µs making 1 call to warnings::import
2311µsrequire Exporter;
243507µs215µs
# spent 13µs (11+2) within C4::Stats::BEGIN@24 which was called: # once (11µs+2µs) by C4::Circulation::BEGIN@26 at line 24
use C4::Context;
# spent 13µs making 1 call to C4::Stats::BEGIN@24 # spent 2µs making 1 call to C4::Context::import
25350µs2312µs
# spent 174µs (35+139) within C4::Stats::BEGIN@25 which was called: # once (35µs+139µs) by C4::Circulation::BEGIN@26 at line 25
use C4::Debug;
# spent 174µs making 1 call to C4::Stats::BEGIN@25 # spent 139µs making 1 call to Exporter::import
26362µs2128µs
# spent 70µs (11+59) within C4::Stats::BEGIN@26 which was called: # once (11µs+59µs) by C4::Circulation::BEGIN@26 at line 26
use vars qw($VERSION @ISA @EXPORT);
# spent 70µs making 1 call to C4::Stats::BEGIN@26 # spent 59µs making 1 call to vars::import
27
281200nsour $debug;
29
30
# spent 15µs within C4::Stats::BEGIN@30 which was called: # once (15µs+0s) by C4::Circulation::BEGIN@26 at line 38
BEGIN {
31 # set the version for version checking
3211µs $VERSION = 3.07.00.049;
3319µs @ISA = qw(Exporter);
3415µs @EXPORT = qw(
35 &UpdateStats
36 &TotalPaid
37 );
381236µs115µs}
# spent 15µs making 1 call to C4::Stats::BEGIN@30
39
40
41=head1 NAME
42
- -
72#'
73sub UpdateStats {
74
75 #module to insert stats data into stats table
76 my (
77 $branch, $type,
78 $amount, $other, $itemnum,
79 $itemtype, $borrowernumber, $accountno, $ccode
80 )
81 = @_;
82 my $dbh = C4::Context->dbh;
83 my $sth = $dbh->prepare(
84 "INSERT INTO statistics
85 (datetime, branch, type, value,
86 other, itemnumber, itemtype, borrowernumber, proccode, ccode)
87 VALUES (now(),?,?,?,?,?,?,?,?,?)"
88 );
89 $sth->execute(
90 $branch, $type, $amount,
91 $other, $itemnum, $itemtype, $borrowernumber,
92 $accountno, $ccode
93 );
94}
95
96# Otherwise, it'd need a POD.
97sub TotalPaid {
98 my ( $time, $time2, $spreadsheet ) = @_;
99 $time2 = $time unless $time2;
100 my $dbh = C4::Context->dbh;
101 my $query = "SELECT * FROM statistics
102 LEFT JOIN borrowers ON statistics.borrowernumber= borrowers.borrowernumber
103 WHERE (statistics.type='payment' OR statistics.type='writeoff') ";
104 if ( $time eq 'today' ) {
105 $query .= " AND datetime = now()";
106 } else {
107 $query .= " AND datetime > '$time'"; # FIXME: use placeholders
108 }
109 if ( $time2 ne '' ) {
110 $query .= " AND datetime < '$time2'"; # FIXME: use placeholders
111 }
112 if ($spreadsheet) {
113 $query .= " ORDER BY branch, type";
114 }
115 $debug and warn "TotalPaid query: $query";
116 my $sth = $dbh->prepare($query);
117 $sth->execute();
118 return @{$sth->fetchall_arrayref({})};
119}
120
12114µs1;
122__END__