Bug 37763: Do not show SQL report editor after 'Update and run'

This patch corrects an error where the SQL editor screen would appear
after the report results when using 'Update and run SQL' when editing
reports.
This also corrects a related issue where the saved_sql.id of the report
would be repeatedly appended to SQL code when using 'Update and run
SQL'.

To test:
1) Login to staff client
2) Navigate to Reports -> Create from SQL
3) Create a short report (SELECT * FROM items), name it and SAVE it.
4) On the resulting "Edit SQL report' page, click 'Update and run SQL'
5) See the report runs, but at the 'Edit SQL report' screen shows at the
   bottom.
6) Apply Patch
7) Return to Reports -> Saved Reports and Edit the report you created.
8) On "Edit SQL report' page, click 'Update and run SQL'
9) Verify that the report runs, but the 'Edit SQL report' section is
   gone.

Sponsored-by: Westlake Porter Public Library
Signed-off-by: Sam Sowanick <sam.sowanick@corvallisoregon.gov>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
CJ Lynce 2024-08-28 18:45:24 +00:00 committed by Katrin Fischer
parent 61868152f2
commit bd79cbd858
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -225,11 +225,15 @@ elsif ( $op eq 'cud-update_sql' || $op eq 'cud-update_and_run_sql' ){
public => $public,
cache_expiry => $cache_expiry,
} );
my $editsql = 1;
if ($op eq 'cud-update_and_run_sql') {
$editsql = 0;
}
$template->param(
'save_successful' => 1,
'reportname' => $reportname,
'id' => $id,
'editsql' => 1,
'editsql' => $editsql,
'sql' => $sql,
'groups_with_subgroups' => groups_with_subgroups($group, $subgroup),
'notes' => $notes,