Bug 16816: Do not copy parameters used when duplicating a report
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 13 Sep 2016 13:41:51 +0000 (14:41 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Sun, 25 Sep 2016 13:48:08 +0000 (13:48 +0000)
If a report is duplicated from the report list, the new report will
contain the tag (<<YEAR>> for instance), but from the reports results
page it copies the values used for the results.

Test plan:
Create a new sql report with tags
Duplicate it from the report list: no expected changes
Run it and duplicate it: the tags must not have been replaced

Signed-off-by: Andreas Roussos <arouss1980@gmail.com>
Ran and duplicated a report, the tags remained intact.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc
reports/guided_reports.pl

index 232ddd3..aa86bc2 100644 (file)
@@ -19,7 +19,7 @@
                 </div>
             [% END %]
             <div class="btn-group">
-                <a class="btn btn-small" title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from SQL&amp;sql=[% sql |uri %]&amp;reportname=[% reportname |uri %]&amp;notes=[% notes |uri %]">
+                <a class="btn btn-small" title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from SQL&amp;sql=[% original_sql || sql |uri %]&amp;reportname=[% reportname |uri %]&amp;notes=[% notes |uri %]">
                     <i class="fa fa-copy"></i> Duplicate
                 </a>
             </div>
index a9963db..45454b0 100755 (executable)
@@ -638,9 +638,9 @@ elsif ($phase eq 'Run this report'){
         'report_id' => $report_id,
     );
 
-    my ( $sql, $type, $name, $notes );
+    my ( $sql, $original_sql, $type, $name, $notes );
     if (my $report = get_saved_report($report_id)) {
-        $sql   = $report->{savedsql};
+        $sql   = $original_sql = $report->{savedsql};
         $name  = $report->{report_name};
         $notes = $report->{notes};
 
@@ -790,6 +790,7 @@ elsif ($phase eq 'Run this report'){
             $template->param(
                 'results' => \@rows,
                 'sql'     => $sql,
+                original_sql => $original_sql,
                 'id'      => $report_id,
                 'execute' => 1,
                 'name'    => $name,