Bugzilla – Attachment 25489 Details for
Bug 11792
Use validation plugin when creating new currency
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11792 - Use validation plugin when creating new currency
Bug-11792---Use-validation-plugin-when-creating-ne.patch (text/plain), 4.35 KB, created by
Jonathan Druart
on 2014-02-20 10:47:56 UTC
(
hide
)
Description:
Bug 11792 - Use validation plugin when creating new currency
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-02-20 10:47:56 UTC
Size:
4.35 KB
patch
obsolete
>From fd1690f825ed771247e856795acd52ef7ac7ec6f Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 19 Feb 2014 11:59:33 -0500 >Subject: [PATCH] Bug 11792 - Use validation plugin when creating new currency > >The page for adding a new currency includes some custom form >validation JavaScript which can be removed in favor of HTML5 validation >attributes and Koha's built-in validation plugin. This patch does so. > >To test, apply the patch and go to Administration -> Currencies & >Exchange rates -> New currency. Try submitting the form without entering >a currency, rate, and/or symbol. This should trigger a validation warning. > >Submission of the form with valid data should work correctly. Editing an >existing currency should also work correctly. > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > .../prog/en/modules/admin/currency.tt | 37 +++++--------------- > 1 file changed, 8 insertions(+), 29 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt >index def9a02..670b653 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt >@@ -7,27 +7,6 @@ > [% INCLUDE 'doc-head-close.inc' %] > <script type="text/javascript"> > //<![CDATA[ >- function Check(f) { >- var _alertString=""; >- var alertString2; >- if (f.currency.value.length==0) { >- _alertString += _("- Currency name missing") + "\n"; >- } >- if (f.rate.value.length==0) { >- _alertString += _("- Rate missing") + "\n"; >- } >- if (f.symbol.value.length==0) { >- _alertString += _("- Symbol missing") + "\n"; >- } >- if (_alertString.length==0) { >- document.Aform.submit(); >- } else { >- alertString2 = _("Form not submitted because of the following problem(s)") + "\n"; >- alertString2 += "------------------------------------------------------------------------------------\n"; >- alertString2 += _alertString; >- alert(alertString2); >- } >- } > > function check_currency(val) { > if ( val == 1.0 ) { >@@ -76,7 +55,7 @@ > > [% IF ( add_form ) %] > >-<form action="[% script_name %]" name="Aform" method="post"> >+<form action="[% script_name %]" name="Aform" method="post" class="validated"> > <input type="hidden" name="op" value="save" /> > <fieldset class="rows"> > <legend>[% IF ( searchfield ) %] >@@ -90,17 +69,17 @@ > <span class="label">Currency: </span> > <input type="hidden" name="currency" id="currency" value="[% searchfield %]" />[% searchfield %] > [% ELSE %] >- <label for="currency">Currency: </label> >- <input type="text" name="currency" id="currency" size="50" maxlength="50" onblur="toUC(this);" /> >+ <label for="currency" class="required">Currency: </label> >+ <input type="text" name="currency" id="currency" size="50" maxlength="50" onblur="toUC(this);" required="required" class="required" /> <span class="required">Required</span> > [% END %] > </li> > <li> >- <label for="rate">Rate: </label> >- <input type="text" name="rate" id="rate" size="10" maxlength="10" value="[% rate %]" /> >+ <label for="rate" class="required">Rate: </label> >+ <input type="text" name="rate" id="rate" size="10" maxlength="10" value="[% rate %]" required="required" class="required" /> <span class="required">Required</span> > </li> > <li> >- <label for="symbol">Symbol: </label> >- <input type="text" name="symbol" id="symbol" size="5" maxlength="5" value="[% symbol %]" /> >+ <label for="symbol" class="required">Symbol: </label> >+ <input type="text" name="symbol" id="symbol" size="5" maxlength="5" value="[% symbol %]" required="required" class="required" /> <span class="required">Required</span> > </li> > > <li> >@@ -120,7 +99,7 @@ > </fieldset> > > <fieldset class="action"> >- <input type="submit" value="Submit" onclick="Check(this.form); return false;" /> >+ <input type="submit" value="Submit" /> > <a href="/cgi-bin/koha/admin/currency.pl" class="cancel">Cancel</a> > </fieldset> > </form> >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11792
:
25460
|
25476
| 25489