Lines 17-24
package C4::Reports::Guided;
Link Here
|
17 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
17 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
18 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
18 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
19 |
|
19 |
|
20 |
use strict; |
20 |
use Modern::Perl; |
21 |
#use warnings; FIXME - Bug 2505 this module needs a lot of repair to run clean under warnings |
|
|
22 |
use CGI; |
21 |
use CGI; |
23 |
use Carp; |
22 |
use Carp; |
24 |
|
23 |
|
Lines 49-54
BEGIN {
Link Here
|
49 |
GetParametersFromSQL |
48 |
GetParametersFromSQL |
50 |
IsAuthorisedValueValid |
49 |
IsAuthorisedValueValid |
51 |
ValidateSQLParameters |
50 |
ValidateSQLParameters |
|
|
51 |
nb_rows update_sql |
52 |
); |
52 |
); |
53 |
} |
53 |
} |
54 |
|
54 |
|
Lines 78-83
my @REPORT_AREA = (
Link Here
|
78 |
[PAT => "Patrons"], |
78 |
[PAT => "Patrons"], |
79 |
[ACQ => "Acquisition"], |
79 |
[ACQ => "Acquisition"], |
80 |
[ACC => "Accounts"], |
80 |
[ACC => "Accounts"], |
|
|
81 |
[SER => "Serials"], |
81 |
); |
82 |
); |
82 |
my $AREA_NAME_SQL_SNIPPET |
83 |
my $AREA_NAME_SQL_SNIPPET |
83 |
= "CASE report_area " . |
84 |
= "CASE report_area " . |
Lines 93-98
my %table_areas = (
Link Here
|
93 |
PAT => ['borrowers'], |
94 |
PAT => ['borrowers'], |
94 |
ACQ => [ 'aqorders', 'biblio', 'items' ], |
95 |
ACQ => [ 'aqorders', 'biblio', 'items' ], |
95 |
ACC => [ 'borrowers', 'accountlines' ], |
96 |
ACC => [ 'borrowers', 'accountlines' ], |
|
|
97 |
SER => [ 'serial', 'serialitems', 'subscription', 'subscriptionhistory', 'subscriptionroutinglist', 'biblioitems', 'biblio', 'aqbooksellers' ], |
96 |
); |
98 |
); |
97 |
my %keys = ( |
99 |
my %keys = ( |
98 |
CIRC => [ 'statistics.borrowernumber=borrowers.borrowernumber', |
100 |
CIRC => [ 'statistics.borrowernumber=borrowers.borrowernumber', |
Lines 104-109
my %keys = (
Link Here
|
104 |
ACQ => [ 'aqorders.biblionumber=biblio.biblionumber', |
106 |
ACQ => [ 'aqorders.biblionumber=biblio.biblionumber', |
105 |
'biblio.biblionumber=items.biblionumber' ], |
107 |
'biblio.biblionumber=items.biblionumber' ], |
106 |
ACC => ['borrowers.borrowernumber=accountlines.borrowernumber'], |
108 |
ACC => ['borrowers.borrowernumber=accountlines.borrowernumber'], |
|
|
109 |
SER => [ 'serial.serialid=serialitems.serialid', 'serial.subscriptionid=subscription.subscriptionid', 'serial.subscriptionid=subscriptionhistory.subscriptionid', 'serial.subscriptionid=subscriptionroutinglist.subscriptionid', 'biblioitems.biblionumber=serial.biblionumber', 'biblio.biblionumber=biblioitems.biblionumber', 'subscription.aqbooksellerid=aqbooksellers.id'], |
107 |
); |
110 |
); |
108 |
|
111 |
|
109 |
# have to do someting here to know if its dropdown, free text, date etc |
112 |
# have to do someting here to know if its dropdown, free text, date etc |
Lines 120-125
my %criteria = (
Link Here
|
120 |
PAT => [ 'borrowers.branchcode', 'borrowers.categorycode' ], |
123 |
PAT => [ 'borrowers.branchcode', 'borrowers.categorycode' ], |
121 |
ACQ => ['aqorders.datereceived|date'], |
124 |
ACQ => ['aqorders.datereceived|date'], |
122 |
ACC => [ 'borrowers.branchcode', 'borrowers.categorycode' ], |
125 |
ACC => [ 'borrowers.branchcode', 'borrowers.categorycode' ], |
|
|
126 |
SER => ['subscription.startdate|date', 'subscription.enddate|date', 'subscription.periodicity', 'subscription.callnumber', 'subscription.location', 'subscription.branchcode'], |
123 |
); |
127 |
); |
124 |
|
128 |
|
125 |
# Adds itemtypes to criteria, according to the syspref |
129 |
# Adds itemtypes to criteria, according to the syspref |
Lines 371-380
sub get_criteria {
Link Here
|
371 |
$list='itemtype' if $column eq 'itype'; |
375 |
$list='itemtype' if $column eq 'itype'; |
372 |
$list='ccode' if $column eq 'ccode'; |
376 |
$list='ccode' if $column eq 'ccode'; |
373 |
# TODO : improve to let the librarian choose the description at runtime |
377 |
# TODO : improve to let the librarian choose the description at runtime |
374 |
push @values, { availablevalues => "<<$column".($list?"|$list":'').">>" }; |
378 |
push @values, { |
|
|
379 |
availablevalues => "<<$column" . ( $list ? "|$list" : '' ) . ">>", |
380 |
display_value => "<<$column" . ( $list ? "|$list" : '' ) . ">>", |
381 |
}; |
375 |
while ( my $row = $sth->fetchrow_hashref() ) { |
382 |
while ( my $row = $sth->fetchrow_hashref() ) { |
|
|
383 |
if ($row->{'availablevalues'} eq '') { $row->{'default'} = 1 } |
384 |
else { $row->{display_value} = _get_display_value( $row->{'availablevalues'}, $column ); } |
376 |
push @values, $row; |
385 |
push @values, $row; |
377 |
if ($row->{'availablevalues'} eq '') { $row->{'default'} = 1 }; |
|
|
378 |
} |
386 |
} |
379 |
$sth->finish(); |
387 |
$sth->finish(); |
380 |
|
388 |
|
Lines 385-391
sub get_criteria {
Link Here
|
385 |
|
393 |
|
386 |
push @criteria_array, \%temp; |
394 |
push @criteria_array, \%temp; |
387 |
} |
395 |
} |
388 |
|
|
|
389 |
} |
396 |
} |
390 |
return ( \@criteria_array ); |
397 |
return ( \@criteria_array ); |
391 |
} |
398 |
} |
Lines 1017-1022
sub ValidateSQLParameters {
Link Here
|
1017 |
return \@problematic_parameters; |
1024 |
return \@problematic_parameters; |
1018 |
} |
1025 |
} |
1019 |
|
1026 |
|
|
|
1027 |
sub _get_display_value { |
1028 |
my ( $original_value, $column ) = @_; |
1029 |
for ( $column ) { |
1030 |
when ("periodicity") { |
1031 |
my $dbh = C4::Context->dbh(); |
1032 |
my $query = "SELECT description FROM subscription_frequencies WHERE id = ?"; |
1033 |
my $sth = $dbh->prepare($query); |
1034 |
$sth->execute($original_value); |
1035 |
return $sth->fetchrow; |
1036 |
} |
1037 |
} |
1038 |
return $original_value; |
1039 |
} |
1040 |
|
1020 |
1; |
1041 |
1; |
1021 |
__END__ |
1042 |
__END__ |
1022 |
|
1043 |
|