Lines 19-28
Link Here
|
19 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
20 |
|
20 |
|
21 |
use strict; |
21 |
use strict; |
22 |
#use warnings; FIXME - Bug 2505 |
22 |
use warnings; #FIXME - Bug 2505 |
23 |
use C4::Auth; |
23 |
use C4::Auth; |
24 |
use CGI qw ( -utf8 ); |
24 |
use CGI qw ( -utf8 ); |
25 |
use C4::Context; |
|
|
26 |
use C4::Branch; # GetBranches |
25 |
use C4::Branch; # GetBranches |
27 |
use C4::Output; |
26 |
use C4::Output; |
28 |
use C4::Koha; |
27 |
use C4::Koha; |
Lines 30-37
use C4::Reports;
Link Here
|
30 |
use C4::Circulation; |
29 |
use C4::Circulation; |
31 |
use C4::Biblio qw/GetMarcSubfieldStructureFromKohaField/; |
30 |
use C4::Biblio qw/GetMarcSubfieldStructureFromKohaField/; |
32 |
|
31 |
|
|
|
32 |
use Koha::Database; |
33 |
use Koha::DateUtils; |
33 |
use Koha::DateUtils; |
34 |
|
34 |
|
|
|
35 |
use List::MoreUtils qw/none/; |
36 |
|
35 |
=head1 NAME |
37 |
=head1 NAME |
36 |
|
38 |
|
37 |
plugin that shows a stats on borrowers |
39 |
plugin that shows a stats on borrowers |
Lines 41-47
plugin that shows a stats on borrowers
Link Here
|
41 |
=cut |
43 |
=cut |
42 |
|
44 |
|
43 |
our $debug = 0; |
45 |
our $debug = 0; |
44 |
my $input = new CGI; |
46 |
my $input = CGI->new(); |
45 |
my $fullreportname = "reports/catalogue_stats.tt"; |
47 |
my $fullreportname = "reports/catalogue_stats.tt"; |
46 |
my $do_it = $input->param('do_it'); |
48 |
my $do_it = $input->param('do_it'); |
47 |
my $line = $input->param("Line"); |
49 |
my $line = $input->param("Line"); |
Lines 74-79
my ($template, $borrowernumber, $cookie)
Link Here
|
74 |
flagsrequired => {reports => '*'}, |
76 |
flagsrequired => {reports => '*'}, |
75 |
debug => 1, |
77 |
debug => 1, |
76 |
}); |
78 |
}); |
|
|
79 |
|
80 |
my $schema = Koha::Database->new()->schema(); |
81 |
my @biblio_fields = $schema->source('Biblio')->columns(); |
82 |
my @biblioitems_fields = $schema->source('Biblioitem')->columns(); |
83 |
my @items_fields = $schema->source('Item')->columns(); |
84 |
my @valid_fields; |
85 |
push @valid_fields, @biblio_fields; |
86 |
push @valid_fields, @biblioitems_fields; |
87 |
push @valid_fields, @items_fields; |
88 |
if (defined $line) { |
89 |
my $chk_line = $line; |
90 |
$chk_line =~ s/^items[.]//gxsm; |
91 |
if (none { $_ eq $chk_line } @valid_fields) { |
92 |
$line = q{}; |
93 |
} |
94 |
} |
95 |
if (defined $column) { |
96 |
my $chk_column = $column; |
97 |
$chk_column =~ s/^items[.]//gxsm; |
98 |
if (none { $_ eq $chk_column } @valid_fields) { |
99 |
$column = q{}; |
100 |
} |
101 |
} |
102 |
|
103 |
if (defined($line) && !$line && |
104 |
defined($column) && !$column) { |
105 |
$template->param( invalid_parameters => 'line+column' ); |
106 |
$do_it = 0; |
107 |
} |
108 |
elsif (defined($line) && !$line) { |
109 |
$template->param( invalid_parameters => 'line' ); |
110 |
$do_it = 0; |
111 |
} |
112 |
elsif (defined($column) && !$column) { |
113 |
$template->param( invalid_parameters => 'column' ); |
114 |
$do_it = 0; |
115 |
} |
116 |
if (!defined $line || !defined $column) { |
117 |
$do_it = 0; |
118 |
} |
119 |
|
77 |
$template->param(do_it => $do_it); |
120 |
$template->param(do_it => $do_it); |
78 |
if ($do_it) { |
121 |
if ($do_it) { |
79 |
my $results = calculate( $line, $column, $cellvalue, $cotedigits, \@filters ); |
122 |
my $results = calculate( $line, $column, $cellvalue, $cotedigits, \@filters ); |
Lines 113-124
if ($do_it) {
Link Here
|
113 |
exit; |
156 |
exit; |
114 |
} |
157 |
} |
115 |
} else { |
158 |
} else { |
116 |
my $dbh = C4::Context->dbh; |
159 |
my $dbh = $schema->storage->dbh; |
117 |
my @values; |
|
|
118 |
my %labels; |
119 |
my $count=0; |
120 |
my $req; |
121 |
my @select; |
122 |
|
160 |
|
123 |
my $itemtypes = GetItemTypes( style => 'array' ); |
161 |
my $itemtypes = GetItemTypes( style => 'array' ); |
124 |
|
162 |
|
Lines 184-190
sub calculate {
Link Here
|
184 |
my $not; |
222 |
my $not; |
185 |
my $itemstable = ($cellvalue eq 'deleteditems') ? 'deleteditems' : 'items'; |
223 |
my $itemstable = ($cellvalue eq 'deleteditems') ? 'deleteditems' : 'items'; |
186 |
|
224 |
|
187 |
my $dbh = C4::Context->dbh; |
225 |
my $dbh = $schema->storage->dbh; |
188 |
|
226 |
|
189 |
# if barcodefilter is empty set as % |
227 |
# if barcodefilter is empty set as % |
190 |
if ($barcodefilter) { |
228 |
if ($barcodefilter) { |
Lines 407-413
sub calculate {
Link Here
|
407 |
} |
445 |
} |
408 |
|
446 |
|
409 |
my $i = 0; |
447 |
my $i = 0; |
410 |
my @totalcol; |
|
|
411 |
my $hilighted = -1; |
448 |
my $hilighted = -1; |
412 |
|
449 |
|
413 |
#Initialization of cell values..... |
450 |
#Initialization of cell values..... |
414 |
- |
|
|