[Koha-patches] [PATCH] Fix bug 3330 - Report notes modification

Frédéric Demians f.demians at tamil.fr
Mon Jun 15 19:18:51 CEST 2009


---
 C4/Reports/Guided.pm                               |    5 +++--
 .../en/modules/reports/guided_reports_start.tmpl   |    1 +
 reports/guided_reports.pl                          |    6 ++++--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm
index f4f86d1..537867e 100644
--- a/C4/Reports/Guided.pm
+++ b/C4/Reports/Guided.pm
@@ -451,11 +451,12 @@ sub update_sql {
     my $id = shift || croak "No Id given";
     my $sql = shift;
     my $reportname = shift;
+    my $notes = shift;
     my $dbh = C4::Context->dbh();
     $sql =~ s/(\s*\;\s*)$//; # removes trailing whitespace and /;/
-    my $query = "UPDATE saved_sql SET savedsql = ?, last_modified = now(), report_name = ? WHERE id = ? ";
+    my $query = "UPDATE saved_sql SET savedsql = ?, last_modified = now(), report_name = ?, notes = ? WHERE id = ? ";
     my $sth = $dbh->prepare($query);
-    $sth->execute( $sql, $reportname, $id );
+    $sth->execute( $sql, $reportname, $notes, $id );
     $sth->finish();
 }
 
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 b7c4e5a..a172fb4 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
@@ -465,6 +465,7 @@ Sub report:<select name="subreport">
 <legend>Edit SQL</legend>
 <ol>
 <li><label for="reportname">Report Name:</label><input type="text" id="reportname" name="reportname" value="<!-- TMPL_VAR NAME="reportname" -->" /></li>
+<li><label for="notes">Notes:</label><textarea id="notes" name="notes" cols="50" rows="2"><!-- TMPL_VAR NAME="notes" --></textarea></li>
 <li><textarea id="sql" name="sql" rows="10" cols="60"><!-- TMPL_VAR NAME="sql" --></textarea></li>
 </ol>
 </fieldset>
diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl
index e9a31bf..e86c72a 100755
--- a/reports/guided_reports.pl
+++ b/reports/guided_reports.pl
@@ -96,7 +96,8 @@ elsif ( $phase eq 'Edit SQL'){
     $template->param(
 	    'sql'        => $sql,
 	    'reportname' => $reportname,
-            'id'         => $id,
+        'notes'      => $notes,
+        'id'         => $id,
 	    'editsql'    => 1,
     );
 }
@@ -105,6 +106,7 @@ elsif ( $phase eq 'Update SQL'){
     my $id         = $input->param('id');
     my $sql        = $input->param('sql');
     my $reportname = $input->param('reportname');
+    my $notes      = $input->param('notes');
     my @errors;
     if ($sql =~ /;?\W?(UPDATE|DELETE|DROP|INSERT|SHOW|CREATE)\W/i) {
         push @errors, {sqlerr => $1};
@@ -119,7 +121,7 @@ elsif ( $phase eq 'Update SQL'){
         );
     }
     else {
-        update_sql( $id, $sql, $reportname );
+        update_sql( $id, $sql, $reportname, $notes );
         $template->param(
             'save_successful'       => 1,
         );
-- 
1.5.6.5




More information about the Koha-patches mailing list