View | Details | Raw Unified | Return to bug 3311
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt (-1 / +44 lines)
Lines 4-9 Link Here
4
[% INCLUDE 'calendar.inc' %]
4
[% INCLUDE 'calendar.inc' %]
5
<script type="text/javascript">
5
<script type="text/javascript">
6
//<![CDATA[
6
//<![CDATA[
7
    function validateLineColumn() {
8
        var Line = $("input[name='Line']:checked").val();
9
        var Column = $("input[name='Column']:checked").val();
10
        var divParameterWarning = $("div[id='parameter_warning']");
11
        if (Line && Column) {
12
            return;
13
        } else if (Line) {
14
            <!-- Column is not defined -->
15
            divParameterWarning.html('<p><strong><i class="fa fa-exclamation-triangle"> </i> ' + _("Warning:") + '</strong> ' + _("A column value must be selected.") + '</p>');
16
        } else if (Column) {
17
            <!-- Line is not defined -->
18
            divParameterWarning.html('<p><strong><i class="fa fa-exclamation-triangle"> </i> ' + _("Warning:") + '</strong> ' + _("A row value must be selected.") + '</p>');
19
        } else {
20
            <!-- Neither are defined -->
21
            divParameterWarning.html('<p><strong><i class="fa fa-exclamation-triangle"> </i> ' + _("Warning:") + '</strong> ' + _("Both row and column values must be selected.") + '</p>');
22
        }
23
        return false;
24
    }
25
7
    function changeRemovedDateTrStatus() {
26
    function changeRemovedDateTrStatus() {
8
        var Cellvalue = $("input[name='Cellvalue']:checked").val();
27
        var Cellvalue = $("input[name='Cellvalue']:checked").val();
9
        if(Cellvalue == "deleteditems") {
28
        if(Cellvalue == "deleteditems") {
Lines 98-104 Link Here
98
	[% END %]
117
	[% END %]
99
[% ELSE %]
118
[% ELSE %]
100
119
101
	<form method="post" action="/cgi-bin/koha/reports/catalogue_stats.pl">
120
        <div id="parameter_warning" class="dialog alert">
121
        [% SWITCH invalid_parameters %]
122
        [%     CASE 'line+column' %]
123
            <p>
124
<strong><i class="fa fa-exclamation-triangle"> </i> Warning:</strong>
125
Both row and column values must be selected.
126
            </p>
127
        [%     CASE 'line' %]
128
            <p>
129
<strong><i class="fa fa-exclamation-triangle"> </i> Warning:</strong>
130
A row value must be selected.
131
            </p>
132
        [%     CASE 'column' %]
133
            <p>
134
<strong><i class="fa fa-exclamation-triangle"> </i> Warning:</strong>
135
A column value must be selected.
136
            </p>
137
        [%     CASE %]
138
            <p>
139
<strong><i class="fa fa-info-circle"> </i> Information:</strong>
140
Both row and column values must be selected.
141
            </p>
142
        [% END %]
143
        </div>
144
        <form method="post" action="/cgi-bin/koha/reports/catalogue_stats.pl" onsubmit="return validateLineColumn();">
102
	<fieldset class="rows">
145
	<fieldset class="rows">
103
	<legend>Catalog statistics</legend>
146
	<legend>Catalog statistics</legend>
104
	<table>
147
	<table>
(-)a/reports/catalogue_stats.pl (-12 / +48 lines)
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
- 

Return to bug 3311