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();
}
<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>
$template->param(
'sql' => $sql,
'reportname' => $reportname,
- 'id' => $id,
+ 'notes' => $notes,
+ 'id' => $id,
'editsql' => 1,
);
}
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};
);
}
else {
- update_sql( $id, $sql, $reportname );
+ update_sql( $id, $sql, $reportname, $notes );
$template->param(
'save_successful' => 1,
);