From 9ffac50209ce8f67133bbb7a21a29bb6d326ab72 Mon Sep 17 00:00:00 2001 From: Srdjan Date: Mon, 20 Aug 2012 09:20:15 +0200 Subject: [PATCH 2/2] Bug 7993 Follow-up --- C4/Reports/Guided.pm | 24 +++++++-- .../prog/en/modules/reports/dictionary.tt | 2 +- .../en/modules/reports/guided_reports_start.tt | 24 +++++++-- opac/svc/report | 49 +++++++++--------- reports/guided_reports.pl | 4 +- svc/report | 54 ++++++++------------ 6 files changed, 90 insertions(+), 67 deletions(-) diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm index c677f85..0bd1774 100644 --- a/C4/Reports/Guided.pm +++ b/C4/Reports/Guided.pm @@ -400,7 +400,7 @@ sub nb_rows($) { =item execute_query - ($results, $total, $error) = execute_query($sql, $offset, $limit) + ($results, $error) = execute_query($sql, $offset, $limit) When passed C<$sql>, this function returns an array ref containing a result set @@ -648,8 +648,26 @@ sub get_saved_reports { sub get_saved_report { my ($id) = @_; my $dbh = C4::Context->dbh(); - my $query = " SELECT * FROM saved_sql WHERE id = ?"; - return $dbh->selectrow_hashref($query, undef, $id); + my $query; + my $report_arg; + if ($#_ == 0 && ref $_[0] ne 'HASH') { + ($report_arg) = @_; + $query = " SELECT * FROM saved_sql WHERE id = ?"; + } elsif (ref $_[0] eq 'HASH') { + my ($selector) = @_; + if ($selector->{name}) { + $query = " SELECT * FROM saved_sql WHERE report_name = ?"; + $report_arg = $selector->{name}; + } elsif ($selector->{id} || $selector->{id} eq '0') { + $query = " SELECT * FROM saved_sql WHERE id = ?"; + $report_arg = $selector->{id}; + } else { + return; + } + } else { + return; + } + return $dbh->selectrow_hashref($query, undef, $report_arg); } =item create_compound($masterID,$subreportID) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tt index a03a1b6..2e15834 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tt @@ -33,7 +33,7 @@
[% IF ( areas ) %] - Filter by area [% FOREACH area IN areas %] [% IF ( area.selected ) %] 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 fd345d0..4041043 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 @@ -517,7 +517,11 @@ canned reports and writing custom SQL reports.

[% IF groups_with_subgroups %]