Bugzilla – Attachment 40753 Details for
Bug 14435
Recover feature to store and access results of a report
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14435: Drop table saved_reports
Bug-14435-Drop-table-savedreports.patch (text/plain), 8.00 KB, created by
Jonathan Druart
on 2015-07-02 08:42:50 UTC
(
hide
)
Description:
Bug 14435: Drop table saved_reports
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-07-02 08:42:50 UTC
Size:
8.00 KB
patch
obsolete
>From 2c0873ed2542c062448ed212811b9c821585f1b8 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@koha-community.org> >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) >--- > 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="<tr>"; >- foreach my $key (keys %$row){ >- $htmlrow .= "<td>$row->{$key}</td>"; >- } >- $htmlrow .= "</tr>"; >- $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 <<EOQ; >-SELECT s.*, r.report, r.date_run, $area_name_sql_snippet, av_g.lib AS groupname, av_sg.lib AS subgroupname, >+SELECT s.*, $area_name_sql_snippet, av_g.lib AS groupname, av_sg.lib AS subgroupname, > b.firstname AS borrowerfirstname, b.surname AS borrowersurname > FROM saved_sql s >-LEFT JOIN saved_reports r ON r.report_id = s.id > LEFT OUTER JOIN authorised_values av_g ON (av_g.category = 'REPORT_GROUP' AND av_g.authorised_value = s.report_group) > LEFT OUTER JOIN authorised_values av_sg ON (av_sg.category = 'REPORT_SUBGROUP' AND av_sg.lib_opac = s.report_group AND av_sg.authorised_value = s.report_subgroup) > LEFT OUTER JOIN borrowers b USING (borrowernumber) >@@ -676,11 +628,10 @@ sub get_saved_reports { > if ($filter) { > if (my $date = $filter->{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.</p> > <th>Creation date</th> > <th>Public</th> > [% IF (usecache) %] <th>Cache expiry (seconds)</th> [% END %] >- <th>Saved results</th> > <th> </th> > </tr> > </thead> >@@ -343,8 +342,6 @@ canned reports and writing custom SQL reports.</p> > <td>No</td> > [% END %] > [% IF (usecache) %] <td>[% savedreport.cache_expiry %]</td> [% END %] >- <td>[% IF ( savedreport.date_run ) %]<a href="/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&id=[% savedreport.id %]">[% savedreport.date_run %]</a>[% END %] >- </td> > <td> > <div class="dropdown"> > <a class="btn btn-mini dropdown-toggle" id="reportactions[% savedreport.id %]" role="button" data-toggle="dropdown" href="#"> >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'); >-- >2.1.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14435
:
40488
|
40489
|
40753
|
40796
|
40797
|
40929
|
40930
|
42196
|
44767
|
44795
|
51987
|
55814