Bug 13161 - Report name should be mandatory when editing saved reports
authorOwen Leonard <oleonard@myacpl.org>
Wed, 29 Oct 2014 17:34:03 +0000 (13:34 -0400)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Thu, 30 Oct 2014 03:39:30 +0000 (00:39 -0300)
When Bug 2969 made report name required for SQL reports, it did so only
for new reports. This patch makes the same requirement true when editing
existing reports.

Other changes:

- Removed unused "type" setting from edit screen (already removed from
  creation form).
- Added form field size attribute to report name field to match creation
  form.
- Moved SQL textarea into its own fieldset and marked it as required,
  matching the report creation form.

To test, apply the patch and edit an existing saved SQL report. You
should be prevented from saving your report with either the report name
or SQL field blank. Test with JavaScript enable and disabled.

Confirm that after entering valid data your report runs correctly.
Compare the new SQL report form with the update SQL report form. They
should be structured the same.

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes tests and QA script. Works as described.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt

index 7508730..6b630a4 100644 (file)
@@ -856,8 +856,8 @@ $(document).ready(function() {
 <legend>Create report from SQL</legend>
 <ol>
     <li><label for="reportname" class="required">Report name:</label>
-        [% IF ( reportname ) %]<input type="text" class="required" required="required" id="reportname" name="reportname" value="[% reportname %]" />
-        [% ELSE %]<input type="text" class="required" required="required" id="reportname" name="reportname" />[% END %] <span class="required">Required</span>
+        [% IF ( reportname ) %]<input type="text" class="required" required="required" id="reportname" name="reportname" value="[% reportname %]" size="50"/>
+        [% ELSE %]<input type="text" class="required" required="required" id="reportname" name="reportname" size="50" />[% END %] <span class="required">Required</span>
     </li>
     [% PROCESS group_and_subgroup_selection %]
 
@@ -876,13 +876,6 @@ $(document).ready(function() {
 </select>
 </li>[% END %]
     <li><label for="notes">Notes:</label> <textarea id="notes" name="notes" cols="50" rows="2">[% notes %]</textarea></li>
-    <li><label for="types">Type:</label>
-        <select id="types" name="types">
-            <option value="1">Tabular</option>
-            <option value="2" disabled="disabled">Summary</option>
-            <option value="3" disabled="disabled">Matrix</option>
-        </select>
-    </li>
 </ol>
 </fieldset>
 <fieldset class="rows">
@@ -945,13 +938,13 @@ Sub report:<select name="subreport">
 [% END %]
 
 [% IF ( editsql ) %]
-<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
+<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated">
 <input type="hidden" name="phase" value="Update SQL" />
 <input type="hidden" name="id" value="[% id %]"/>
 <fieldset class="rows">
 <legend>Edit SQL report</legend>
 <ol>
-<li><label for="reportname">Report name:</label><input type="text" id="reportname" name="reportname" value="[% reportname %]" size="50" /></li>
+<li><label for="reportname" class="required">Report name: </label><input type="text" id="reportname" name="reportname" value="[% reportname %]" size="50" class="required" required="required" /> <span class="required">Required</span></li>
 [% PROCESS group_and_subgroup_selection %]
 [% IF (public) %]
   <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0">No (default)</option> <option value="1" selected="selected">Yes</option> </select></li>
@@ -968,10 +961,16 @@ Sub report:<select name="subreport">
 </select>
 </li>[% END %]
 <li><label for="notes">Notes:</label><textarea id="notes" name="notes" cols="50" rows="2">[% notes %]</textarea></li>
-<li><textarea id="sql" name="sql" rows="10" cols="60">[% sql %]</textarea></li>
 </ol>
 </fieldset>
 
+<fieldset class="rows">
+    <legend>SQL:</legend>
+    <div style="margin:1em;">
+        <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql %]</textarea> <span class="required">Required</span>
+    </div>
+</fieldset>
+
 <fieldset class="action">
 <input type="submit" name="submit" value="Update SQL" /> <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
 </fieldset>