[PATCH] Fixes Bug 2969: Report Name should be mandatory for saved

Amit Gupta amit.gupta at osslabs.biz
Wed Jul 14 08:43:49 CEST 2010


reports

---
 installer/data/mysql/kohastructure.sql             |    2 +-
 .../en/modules/reports/guided_reports_start.tmpl   |   26
++++++++++++++++++-
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/installer/data/mysql/kohastructure.sql
b/installer/data/mysql/kohastructure.sql
index e42cecd..6d712df 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -1589,7 +1589,7 @@ CREATE TABLE saved_sql (
   `last_modified` datetime default NULL,
   `savedsql` text,
   `last_run` datetime default NULL,
-   `report_name` varchar(255) default NULL,
+   `report_name` varchar(255) NOT NULL default '',
   `type` varchar(255) default NULL,
   `notes` text,
   PRIMARY KEY  (`id`),
diff --git
a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tmpl
b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tmpl
index 7a24859..aa8ce67 100644
---
a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tmpl
+++
b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tmpl
@@ -406,6 +406,17 @@ NAME="name" -->"><!-- TMPL_VAR
NAME="name"--></label></td><td>
 <!-- /TMPL_IF -->

 <!-- TMPL_IF NAME="save" -->
+<script type="text/javascript">
+//<![CDATA[
+function check(f) {
+if (f.reportname.value == "") {
+    alert(_("You must specify a Report name."));
+    return false;
+}
+    f.submit();
+}
+//]]>
+</script>
 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
 <input type="hidden" name="sql" value="<!-- TMPL_VAR NAME="sql"
ESCAPE="html" -->" />
 <input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->" />
@@ -416,7 +427,7 @@ NAME="name" -->"><!-- TMPL_VAR
NAME="name"--></label></td><td>
    <li><label for="notes">Notes:</label> <textarea name="notes"
id="notes"></textarea></li>
 </ol></fieldset>
 <fieldset class="action"><input type="hidden" name="phase" value="Save
Report" />
-<input type="submit" name="submit" value="Save Report" /></fieldset>
+<input type="button" value="Save" onclick="check(this.form);"/></fieldset>
 </form>
 <!-- /TMPL_IF -->

@@ -531,6 +542,17 @@ Sub report:<select name="subreport">
 <!-- /TMPL_IF -->

 <!-- TMPL_IF NAME="editsql" -->
+<script type="text/javascript">
+//<![CDATA[
+function check(f) {
+if (f.reportname.value == "") {
+    alert(_("You must specify a Report name."));
+    return false;
+}
+    f.submit();
+}
+//]]>
+</script>
 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
 <input type="hidden" name="phase" value="Update SQL" />
 <input type="hidden" name="id" value="<!-- TMPL_VAR NAME="id" -->"/>
@@ -544,7 +566,7 @@ Sub report:<select name="subreport">
 </fieldset>

 <fieldset class="action">
-<input type="submit" name="submit" value="Update SQL" /></fieldset>
+<input type="button" value="Update SQL" onclick="check(this.form);"
/></fieldset>
 </form>


--
1.5.4.5

--0016362845cc19da3c048b5396d9
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div class=3D"gmail_quote">From 4404a9069067f2c937d6dbb78a4b2b3ee3479751 Mo=
n Sep 17 00:00:00 2001<br>From: Amit Gupta &lt;<a href=3D"mailto:amit.gupta=
@osslabs.biz">amit.gupta at osslabs.biz</a>&gt;<br>Date: Wed, 14 Jul 2010 12:1=
3:49 +0530<br>
Subject: [PATCH] Fixes Bug 2969: Report Name should be mandatory for saved =
reports<br><br>
---<br>
=A0installer/data/mysql/kohastructure.sql =A0 =A0 =A0 =A0 =A0 =A0 | =A0 =A0=
2 +-<br>
=A0.../en/modules/reports/guided_reports_start.tmpl =A0 | =A0 26 ++++++++++=
++++++++-<br>
=A02 files changed, 25 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/=
kohastructure.sql<br>
index e42cecd..6d712df 100644<br>
--- a/installer/data/mysql/kohastructure.sql<br>
+++ b/installer/data/mysql/kohastructure.sql<br>
@@ -1589,7 +1589,7 @@ CREATE TABLE saved_sql (<br>
 =A0 =A0`last_modified` datetime default NULL,<br>
 =A0 =A0`savedsql` text,<br>
 =A0 =A0`last_run` datetime default NULL,<br>
- =A0 `report_name` varchar(255) default NULL,<br>
+ =A0 `report_name` varchar(255) NOT NULL default &#39;&#39;,<br>
 =A0 =A0`type` varchar(255) default NULL,<br>
 =A0 =A0`notes` text,<br>
 =A0 =A0PRIMARY KEY =A0(`id`),<br>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports=
_start.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_report=
s_start.tmpl<br>
index 7a24859..aa8ce67 100644<br>
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.=
tmpl<br>
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.=
tmpl<br>
@@ -406,6 +406,17 @@ NAME=3D&quot;name&quot; --&gt;&quot;&gt;&lt;!-- TMPL_V=
AR NAME=3D&quot;name&quot;--&gt;&lt;/label&gt;&lt;/td&gt;&lt;td&gt;<br>
=A0&lt;!-- /TMPL_IF --&gt;<br>
<br>
=A0&lt;!-- TMPL_IF NAME=3D&quot;save&quot; --&gt;<br>
+&lt;script type=3D&quot;text/javascript&quot;&gt;<br>
+//&lt;![CDATA[<br>
+function check(f) {<br>
+if (f.reportname.value =3D=3D &quot;&quot;) {<br>
+ =A0 =A0alert(_(&quot;You must specify a Report name.&quot;));<br>
+ =A0 =A0return false;<br>
+}<br>
+ =A0 =A0f.submit();<br>
+}<br>
+//]]&gt;<br>
+&lt;/script&gt;<br>
=A0&lt;form action=3D&quot;/cgi-bin/koha/reports/<a href=3D"http://guided_r=
eports.pl" target=3D"_blank">guided_reports.pl</a>&quot; method=3D&quot;pos=
t&quot;&gt;<br>
=A0&lt;input type=3D&quot;hidden&quot; name=3D&quot;sql&quot; value=3D&quot=
;&lt;!-- TMPL_VAR NAME=3D&quot;sql&quot; ESCAPE=3D&quot;html&quot; --&gt;&q=
uot; /&gt;<br>
=A0&lt;input type=3D&quot;hidden&quot; name=3D&quot;type&quot; value=3D&quo=
t;&lt;!-- TMPL_VAR NAME=3D&quot;type&quot; --&gt;&quot; /&gt;<br>
@@ -416,7 +427,7 @@ NAME=3D&quot;name&quot; --&gt;&quot;&gt;&lt;!-- TMPL_VA=
R NAME=3D&quot;name&quot;--&gt;&lt;/label&gt;&lt;/td&gt;&lt;td&gt;<br>
 =A0 =A0 &lt;li&gt;&lt;label for=3D&quot;notes&quot;&gt;Notes:&lt;/label&gt=
; &lt;textarea name=3D&quot;notes&quot; id=3D&quot;notes&quot;&gt;&lt;/text=
area&gt;&lt;/li&gt;<br>
=A0&lt;/ol&gt;&lt;/fieldset&gt;<br>
=A0&lt;fieldset class=3D&quot;action&quot;&gt;&lt;input type=3D&quot;hidden=
&quot; name=3D&quot;phase&quot; value=3D&quot;Save Report&quot; /&gt;<br>
-&lt;input type=3D&quot;submit&quot; name=3D&quot;submit&quot; value=3D&quo=
t;Save Report&quot; /&gt;&lt;/fieldset&gt;<br>
+&lt;input type=3D&quot;button&quot; value=3D&quot;Save&quot; onclick=3D&qu=
ot;check(this.form);&quot;/&gt;&lt;/fieldset&gt;<br>
=A0&lt;/form&gt;<br>
=A0&lt;!-- /TMPL_IF --&gt;<br>
<br>
@@ -531,6 +542,17 @@ Sub report:&lt;select name=3D&quot;subreport&quot;&gt;=
<br>
=A0&lt;!-- /TMPL_IF --&gt;<br>
<br>
=A0&lt;!-- TMPL_IF NAME=3D&quot;editsql&quot; --&gt;<br>
+&lt;script type=3D&quot;text/javascript&quot;&gt;<br>
+//&lt;![CDATA[<br>
+function check(f) {<br>
+if (f.reportname.value =3D=3D &quot;&quot;) {<br>
+ =A0 =A0alert(_(&quot;You must specify a Report name.&quot;));<br>
+ =A0 =A0return false;<br>
+}<br>
+ =A0 =A0f.submit();<br>
+}<br>
+//]]&gt;<br>
+&lt;/script&gt;<br>
=A0&lt;form action=3D&quot;/cgi-bin/koha/reports/<a href=3D"http://guided_r=
eports.pl" target=3D"_blank">guided_reports.pl</a>&quot; method=3D&quot;pos=
t&quot;&gt;<br>
=A0&lt;input type=3D&quot;hidden&quot; name=3D&quot;phase&quot; value=3D&qu=
ot;Update SQL&quot; /&gt;<br>
=A0&lt;input type=3D&quot;hidden&quot; name=3D&quot;id&quot; value=3D&quot;=
&lt;!-- TMPL_VAR NAME=3D&quot;id&quot; --&gt;&quot;/&gt;<br>
@@ -544,7 +566,7 @@ Sub report:&lt;select name=3D&quot;subreport&quot;&gt;<=
br>
=A0&lt;/fieldset&gt;<br>
<br>
=A0&lt;fieldset class=3D&quot;action&quot;&gt;<br>
-&lt;input type=3D&quot;submit&quot; name=3D&quot;submit&quot; value=3D&quo=
t;Update SQL&quot; /&gt;&lt;/fieldset&gt;<br>
+&lt;input type=3D&quot;button&quot; value=3D&quot;Update SQL&quot; onclick=
=3D&quot;check(this.form);&quot; /&gt;&lt;/fieldset&gt;<br>
=A0&lt;/form&gt;<br>
<font color=3D"#888888"><br>
<br>
--<br>
1.5.4.5<br>
<br>
</font></div><br><br>

--0016362845cc19da3c048b5396d9--


More information about the Koha-patches mailing list