From e0f22f6ff80240f03a8219bc1ad404fb8d603dcd Mon Sep 17 00:00:00 2001
From: Jonathan Druart
Date: Mon, 22 Jun 2015 18:00:32 +0200
Subject: [PATCH] Bug 14435: Drop table saved_reports
The table saved_reports is never populated and is not used since
14be4400d84b28369d095b3b0bfa79c3396f44d4 (2009).
The 2 subroutines store_results and format_results are never reachable
and will also be removed.
Note that an empty column "Saved results" were always displayed on the saved
report list.
Test plan:
0/ Confirm that there is nothing in the saved_reports table and that you
have never seen something in it before.
1/ After applying the patch, confirm that you have still acess to the
saved report list (reports/guided_reports.pl?phase=Use saved)
Signed-off-by: Indranil Das Gupta (L2C2 Technologies)
---
C4/Reports/Guided.pm | 57 ++--------------------
.../en/modules/reports/guided_reports_start.tt | 5 +-
misc/cronjobs/runreport.pl | 4 --
reports/guided_reports.pl | 12 -----
4 files changed, 5 insertions(+), 73 deletions(-)
diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm
index c714213..5db2408 100644
--- a/C4/Reports/Guided.pm
+++ b/C4/Reports/Guided.pm
@@ -43,7 +43,7 @@ BEGIN {
get_report_types get_report_areas get_report_groups get_columns build_query get_criteria
save_report get_saved_reports execute_query get_saved_report create_compound run_compound
get_column_type get_distinct_values save_dictionary get_from_dictionary
- delete_definition delete_report format_results get_sql
+ delete_definition delete_report get_sql
nb_rows update_sql build_authorised_value_list
GetReservedAuthorisedValues
GetParametersFromSQL
@@ -537,10 +537,6 @@ sub execute_query {
$sth->execute(@$sql_params, $offset, $limit);
return ( $sth, { queryerr => $sth->errstr } ) if ($sth->err);
return ( $sth );
- # my @xmlarray = ... ;
- # my $url = "/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&id=$id";
- # my $xml = XML::Dumper->new()->pl2xml( \@xmlarray );
- # store_results($id,$xml);
}
=head2 save_report($sql,$name,$type,$notes)
@@ -594,49 +590,6 @@ sub update_sql {
$dbh->do($query, undef, $sql, $name, $group, $subgroup, $notes, $cache_expiry, $public, $id );
}
-sub store_results {
- my ($id,$xml)=@_;
- my $dbh = C4::Context->dbh();
- my $query = "SELECT * FROM saved_reports WHERE report_id=?";
- my $sth = $dbh->prepare($query);
- $sth->execute($id);
- if (my $data=$sth->fetchrow_hashref()){
- my $query2 = "UPDATE saved_reports SET report=?,date_run=now() WHERE report_id=?";
- my $sth2 = $dbh->prepare($query2);
- $sth2->execute($xml,$id);
- }
- else {
- my $query2 = "INSERT INTO saved_reports (report_id,report,date_run) VALUES (?,?,now())";
- my $sth2 = $dbh->prepare($query2);
- $sth2->execute($id,$xml);
- }
-}
-
-sub format_results {
- my ($id) = @_;
- my $dbh = C4::Context->dbh();
- my $query = "SELECT * FROM saved_reports WHERE report_id = ?";
- my $sth = $dbh->prepare($query);
- $sth->execute($id);
- my $data = $sth->fetchrow_hashref();
- my $dump = new XML::Dumper;
- my $perl = $dump->xml2pl( $data->{'report'} );
- foreach my $row (@$perl) {
- my $htmlrow="";
- foreach my $key (keys %$row){
- $htmlrow .= "$row->{$key} | ";
- }
- $htmlrow .= "
";
- $row->{'row'} = $htmlrow;
- }
- $sth->finish;
- $query = "SELECT * FROM saved_sql WHERE id = ?";
- $sth = $dbh->prepare($query);
- $sth->execute($id);
- $data = $sth->fetchrow_hashref();
- return ($perl,$data->{'report_name'},$data->{'notes'});
-}
-
sub delete_report {
my (@ids) = @_;
return unless @ids;
@@ -653,10 +606,9 @@ sub delete_report {
sub get_saved_reports_base_query {
my $area_name_sql_snippet = get_area_name_sql_snippet;
return <{date}) {
$date = format_date_in_iso($date);
- push @cond, "DATE(date_run) = ? OR
- DATE(date_created) = ? OR
+ push @cond, "DATE(date_created) = ? OR
DATE(last_modified) = ? OR
DATE(last_run) = ?";
- push @args, $date, $date, $date, $date;
+ push @args, $date, $date, $date;
}
if (my $author = $filter->{author}) {
$author = "%$author%";
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
index 283a1cf..25cc807 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
@@ -81,7 +81,7 @@ $(document).ready(function(){
{ "aTargets": [ 1, 2 ], "sType": "natural" }
],
"aoColumns": [
- null,null,null,null,null,null,null,null,{ "sType": "title-string" },null,[% IF (usecache) %]null,[% END %]null,null
+ null,null,null,null,null,null,null,null,{ "sType": "title-string" },null,[% IF (usecache) %]null,[% END %]null
],
'oLanguage': {
'sZeroRecords': _("No matching reports found")
@@ -315,7 +315,6 @@ canned reports and writing custom SQL reports.
Creation date |
Public |
[% IF (usecache) %] Cache expiry (seconds) | [% END %]
- Saved results |
|
@@ -343,8 +342,6 @@ canned reports and writing custom SQL reports.
No |
[% END %]
[% IF (usecache) %] [% savedreport.cache_expiry %] | [% END %]
- [% IF ( savedreport.date_run ) %][% savedreport.date_run %][% END %]
- |
diff --git a/misc/cronjobs/runreport.pl b/misc/cronjobs/runreport.pl
index 5cc000d..ba5f65f 100755
--- a/misc/cronjobs/runreport.pl
+++ b/misc/cronjobs/runreport.pl
@@ -296,8 +296,4 @@ foreach my $report_id (@ARGV) {
} else {
print $message;
}
- # my @xmlarray = ... ;
- # my $url = "/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&id=$id";
- # my $xml = XML::Dumper->new()->pl2xml( \@xmlarray );
- # store_results($id,$xml);
}
diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl
index 9cfa8ce..8e53653 100755
--- a/reports/guided_reports.pl
+++ b/reports/guided_reports.pl
@@ -250,18 +250,6 @@ elsif ( $phase eq 'Update SQL'){
}
}
-elsif ($phase eq 'retrieve results') {
- my $id = $input->param('id');
- my ($results,$name,$notes) = format_results($id);
- # do something
- $template->param(
- 'retresults' => 1,
- 'results' => $results,
- 'name' => $name,
- 'notes' => $notes,
- );
-}
-
elsif ( $phase eq 'Report on this Area' ) {
my $cache_expiry_units = $input->param('cache_expiry_units'),
my $cache_expiry = $input->param('cache_expiry');
--
1.9.1 |