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 79-84
sub get_area_name_sql_snippet {
Link Here
|
79 |
[PAT => "Patrons"], |
79 |
[PAT => "Patrons"], |
80 |
[ACQ => "Acquisition"], |
80 |
[ACQ => "Acquisition"], |
81 |
[ACC => "Accounts"], |
81 |
[ACC => "Accounts"], |
|
|
82 |
[SER => "Serials"], |
82 |
); |
83 |
); |
83 |
|
84 |
|
84 |
return "CASE report_area " . |
85 |
return "CASE report_area " . |
Lines 88-94
sub get_area_name_sql_snippet {
Link Here
|
88 |
|
89 |
|
89 |
sub get_report_areas { |
90 |
sub get_report_areas { |
90 |
|
91 |
|
91 |
my $report_areas = [ 'CIRC', 'CAT', 'PAT', 'ACQ', 'ACC' ]; |
92 |
my $report_areas = [ 'CIRC', 'CAT', 'PAT', 'ACQ', 'ACC', 'SER' ]; |
92 |
|
93 |
|
93 |
return $report_areas; |
94 |
return $report_areas; |
94 |
} |
95 |
} |
Lines 100-105
sub get_table_areas {
Link Here
|
100 |
PAT => ['borrowers'], |
101 |
PAT => ['borrowers'], |
101 |
ACQ => [ 'aqorders', 'biblio', 'items' ], |
102 |
ACQ => [ 'aqorders', 'biblio', 'items' ], |
102 |
ACC => [ 'borrowers', 'accountlines' ], |
103 |
ACC => [ 'borrowers', 'accountlines' ], |
|
|
104 |
SER => [ 'serial', 'serialitems', 'subscription', 'subscriptionhistory', 'subscriptionroutinglist', 'biblioitems', 'biblio', 'aqbooksellers' ], |
103 |
); |
105 |
); |
104 |
} |
106 |
} |
105 |
|
107 |
|
Lines 240-245
sub build_query {
Link Here
|
240 |
ACQ => [ 'aqorders.biblionumber=biblio.biblionumber', |
242 |
ACQ => [ 'aqorders.biblionumber=biblio.biblionumber', |
241 |
'biblio.biblionumber=items.biblionumber' ], |
243 |
'biblio.biblionumber=items.biblionumber' ], |
242 |
ACC => ['borrowers.borrowernumber=accountlines.borrowernumber'], |
244 |
ACC => ['borrowers.borrowernumber=accountlines.borrowernumber'], |
|
|
245 |
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'], |
243 |
); |
246 |
); |
244 |
|
247 |
|
245 |
|
248 |
|
Lines 330-335
sub get_criteria {
Link Here
|
330 |
PAT => [ 'borrowers.branchcode', 'borrowers.categorycode' ], |
333 |
PAT => [ 'borrowers.branchcode', 'borrowers.categorycode' ], |
331 |
ACQ => ['aqorders.datereceived|date'], |
334 |
ACQ => ['aqorders.datereceived|date'], |
332 |
ACC => [ 'borrowers.branchcode', 'borrowers.categorycode' ], |
335 |
ACC => [ 'borrowers.branchcode', 'borrowers.categorycode' ], |
|
|
336 |
SER => ['subscription.startdate|date', 'subscription.enddate|date', 'subscription.periodicity', 'subscription.callnumber', 'subscription.location', 'subscription.branchcode'], |
333 |
); |
337 |
); |
334 |
|
338 |
|
335 |
# Adds itemtypes to criteria, according to the syspref |
339 |
# Adds itemtypes to criteria, according to the syspref |
Lines 386-395
sub get_criteria {
Link Here
|
386 |
$list='itemtype' if $column eq 'itype'; |
390 |
$list='itemtype' if $column eq 'itype'; |
387 |
$list='ccode' if $column eq 'ccode'; |
391 |
$list='ccode' if $column eq 'ccode'; |
388 |
# TODO : improve to let the librarian choose the description at runtime |
392 |
# TODO : improve to let the librarian choose the description at runtime |
389 |
push @values, { availablevalues => "<<$column".($list?"|$list":'').">>" }; |
393 |
push @values, { |
|
|
394 |
availablevalues => "<<$column" . ( $list ? "|$list" : '' ) . ">>", |
395 |
display_value => "<<$column" . ( $list ? "|$list" : '' ) . ">>", |
396 |
}; |
390 |
while ( my $row = $sth->fetchrow_hashref() ) { |
397 |
while ( my $row = $sth->fetchrow_hashref() ) { |
|
|
398 |
if ($row->{'availablevalues'} eq '') { $row->{'default'} = 1 } |
399 |
else { $row->{display_value} = _get_display_value( $row->{'availablevalues'}, $column ); } |
391 |
push @values, $row; |
400 |
push @values, $row; |
392 |
if ($row->{'availablevalues'} eq '') { $row->{'default'} = 1 }; |
|
|
393 |
} |
401 |
} |
394 |
$sth->finish(); |
402 |
$sth->finish(); |
395 |
|
403 |
|
Lines 400-406
sub get_criteria {
Link Here
|
400 |
|
408 |
|
401 |
push @criteria_array, \%temp; |
409 |
push @criteria_array, \%temp; |
402 |
} |
410 |
} |
403 |
|
|
|
404 |
} |
411 |
} |
405 |
return ( \@criteria_array ); |
412 |
return ( \@criteria_array ); |
406 |
} |
413 |
} |
Lines 1038-1043
sub ValidateSQLParameters {
Link Here
|
1038 |
return \@problematic_parameters; |
1045 |
return \@problematic_parameters; |
1039 |
} |
1046 |
} |
1040 |
|
1047 |
|
|
|
1048 |
sub _get_display_value { |
1049 |
my ( $original_value, $column ) = @_; |
1050 |
for ( $column ) { |
1051 |
when ("periodicity") { |
1052 |
my $dbh = C4::Context->dbh(); |
1053 |
my $query = "SELECT description FROM subscription_frequencies WHERE id = ?"; |
1054 |
my $sth = $dbh->prepare($query); |
1055 |
$sth->execute($original_value); |
1056 |
return $sth->fetchrow; |
1057 |
} |
1058 |
} |
1059 |
return $original_value; |
1060 |
} |
1061 |
|
1041 |
1; |
1062 |
1; |
1042 |
__END__ |
1063 |
__END__ |
1043 |
|
1064 |
|