From 3f643211c9c04a30867f11c5fc9726bb5b0ed917 Mon Sep 17 00:00:00 2001 From: Srdjan Jankovic Date: Thu, 7 Apr 2011 10:45:41 -0400 Subject: [PATCH] Bug 6024 : add "Run report" link on the new report creation success page Signed-off-by: Ian Walls Signed-off-by: Chris Cormack (cherry picked from commit b390c657b83961f999baa2be66fb1766056ac8a4) Signed-off-by: Chris Nighswonger --- C4/Reports/Guided.pm | 9 ++++++--- .../prog/en/modules/reports/guided_reports_start.tmpl | 3 +++ reports/guided_reports.pl | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm index 65baf90b3f..539c633ddb 100644 --- a/C4/Reports/Guided.pm +++ b/C4/Reports/Guided.pm @@ -466,7 +466,8 @@ sub execute_query ($;$$$) { =item save_report($sql,$name,$type,$notes) -Given some sql and a name this will saved it so that it can resued +Given some sql and a name this will saved it so that it can reused +Returns id of the newly created report =cut @@ -476,8 +477,10 @@ sub save_report { $sql =~ s/(\s*\;\s*)$//; # removes trailing whitespace and /;/ my $query = "INSERT INTO saved_sql (borrowernumber,date_created,last_modified,savedsql,report_name,type,notes) VALUES (?,now(),now(),?,?,?,?)"; - my $sth = $dbh->prepare($query); - $sth->execute( $borrowernumber, $sql, $name, $type, $notes ); + $dbh->do( $query, undef, $borrowernumber, $sql, $name, $type, $notes ); + my $id = $dbh->selectrow_array("SELECT max(id) FROM saved_sql WHERE borrowernumber=? AND report_name=?", undef, + $borrowernumber, $name); + return $id; } sub update_sql { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tmpl index 52f1051d1d..5bc8188ceb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tmpl @@ -555,6 +555,9 @@ Sub report: