Bug 23824: Add a "Save and run" button to reports

This will save one click every time you want to save and then run
a report.

To test:
- Apply this patch
- Create a new report
- Click the new "Update and run SQL" button
- Verify the report was saved and the results are displayed

Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Magnus Enger 2023-04-01 11:27:26 +02:00 committed by Tomas Cohen Arazi
parent 7fd06b8c3a
commit 2ea5163970
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 6 additions and 3 deletions

View file

@ -1324,7 +1324,6 @@
[% IF ( editsql ) %]
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
<input type="hidden" name="phase" value="Update SQL" />
<input type="hidden" name="id" value="[% id | html %]"/>
<fieldset class="rows">
<legend><h1>Edit SQL report</h1></legend>
@ -1382,7 +1381,8 @@
</fieldset>
<fieldset class="action">
<input type="submit" name="submit" class="btn btn-primary" value="Update SQL" />
<input type="submit" name="phase" class="btn btn-primary" value="Update SQL" />
<input type="submit" name="phase" class="btn btn-primary" value="Update and run SQL" />
<a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
</fieldset>
</form>

View file

@ -209,7 +209,7 @@ elsif ( $phase eq 'Edit SQL'){
);
}
elsif ( $phase eq 'Update SQL'){
elsif ( $phase eq 'Update SQL' || $phase eq 'Update and run SQL' ){
my $id = $input->param('id');
my $sql = $input->param('sql');
my $reportname = $input->param('reportname');
@ -301,6 +301,9 @@ elsif ( $phase eq 'Update SQL'){
cache_expiry_units => $cache_expiry_units,
);
}
if ( $phase eq 'Update and run SQL' ) {
print $input->redirect("/cgi-bin/koha/reports/guided_reports.pl?reports=$id&phase=Run%20this%20report");
}
}
}