Bug 19957: Allow continued editing of report after saving
authorNick Clemens <nick@bywatersolutions.com>
Thu, 11 Jan 2018 18:19:33 +0000 (18:19 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 26 Mar 2018 20:31:17 +0000 (17:31 -0300)
To test:
 1 - Edit or create a report
 2 - Save it
 3 - Note the report is saved but you can't keep editing
 4 - Clicking 'Edit' returns you to editing
 5 - Apply patch
 6 - Save report
 7 - Note success message remains, but report is still open for editing
 8 - Note when you click the saved/updated message dissappears
 9 - Try again after inserting erros into report (No Select, bad
        authorised value, etc.)
10 - Note errors stil display as expected
11 - Verify message works on update of existing report and save of new
      new report

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Joubu: amended patch to fix alignment

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
reports/guided_reports.pl

index 706e1d6..ba47ba4 100644 (file)
@@ -812,6 +812,17 @@ Sub report:<select name="subreport">
 </fieldset>
 [% END %]
 
+[% IF ( save_successful ) %]
+[% UNLESS ( errors ) %]
+</br>
+<div id="report_updated">
+    <div class="dialog message">
+        <p>Your report "[% reportname %]" has been saved</p>
+    </div>
+</div>
+[% END %]
+[% END %]
+
 [% IF ( editsql ) %]
 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated">
 <input type="hidden" name="phase" value="Update SQL" />
@@ -854,21 +865,6 @@ Sub report:<select name="subreport">
 
 [% END %]
 
-[% IF ( save_successful ) %]
-[% UNLESS ( errors ) %]
-<h2>Your report has been saved</h2>
-<h4>[% reportname %]</h4>
-<ul>
-    [% IF ( id ) %]
-    <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id %]&amp;phase=Run%20this%20report">Run this report</a></li>
-    [% END %]
-    <li>Access this report from the: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports page</a></li>
-    <li>Schedule this report to run using the: <a href="/cgi-bin/koha/tools/scheduler.pl">Scheduler tool</a></li>
-    <li>Return to: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Guided reports</a></li>
-</ul>
-[% END %]
-[% END %]
-
 [% IF ( errors ) %]
 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
 <div class="dialog alert">
@@ -963,6 +959,10 @@ Sub report:<select name="subreport">
                 $('#limitselect').submit();
             });
 
+            $(document).click(function() {
+                $('#report_updated').hide();
+            });
+
             $(".goback").on("click",function(e){
                 e.preventDefault();
                 window.history.back();
index 67d28c9..8809b81 100755 (executable)
@@ -144,12 +144,12 @@ elsif ( $phase eq 'Build new' ) {
         }
     }
     $template->param(
-        'saved1' => 1,
-        'savedreports' => $reports,
-        'usecache' => $usecache,
-        'groups_with_subgroups'=> groups_with_subgroups($group, $subgroup),
-        filters => $filter,
-        has_obsolete_reports => $has_obsolete_reports,
+        'saved1'                => 1,
+        'savedreports'          => $reports,
+        'usecache'              => $usecache,
+        'groups_with_subgroups' => groups_with_subgroups( $group, $subgroup ),
+        filters                 => $filter,
+        has_obsolete_reports    => $has_obsolete_reports,
     );
 }
 
@@ -279,6 +279,13 @@ elsif ( $phase eq 'Update SQL'){
                 'save_successful'       => 1,
                 'reportname'            => $reportname,
                 'id'                    => $id,
+                'editsql'               => 1,
+                'sql'                   => $sql,
+                'groups_with_subgroups' => groups_with_subgroups($group, $subgroup),
+                'notes'                 => $notes,
+                'cache_expiry'          => $cache_expiry,
+                'public'                => $public,
+                'usecache'              => $usecache,
             );
             logaction( "REPORTS", "MODIFY", $id, "$reportname | $sql" ) if C4::Context->preference("ReportsLog");
         }
@@ -648,6 +655,13 @@ elsif ( $phase eq 'Save Report' ) {
                 'save_successful' => 1,
                 'reportname'      => $name,
                 'id'              => $id,
+                'editsql'         => 1,
+                'sql'             => $sql,
+                'groups_with_subgroups' => groups_with_subgroups($group, $subgroup),
+                'notes'      => $notes,
+                'cache_expiry' => $cache_expiry,
+                'public' => $public,
+                'usecache' => $usecache,
             );
         }
     }