Bugzilla – Attachment 83827 Details for
Bug 20689
Improve usability of Item search fields administration page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20689: (follow-up) Make it possible to add capital letter subfields to item search fields
Bug-20689-follow-up-Make-it-possible-to-add-capita.patch (text/plain), 6.64 KB, created by
José-Mario Monteiro-Santos
on 2019-01-11 20:20:42 UTC
(
hide
)
Description:
Bug 20689: (follow-up) Make it possible to add capital letter subfields to item search fields
Filename:
MIME Type:
Creator:
José-Mario Monteiro-Santos
Created:
2019-01-11 20:20:42 UTC
Size:
6.64 KB
patch
obsolete
>From 5e796a8877e03ebdc0bc22994a7933e320d4bd74 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 12 Oct 2018 15:46:43 +0000 >Subject: [PATCH] Bug 20689: (follow-up) Make it possible to add capital letter > subfields to item search fields > >This patch adds some custom validation to the MARC tag and subfield >fields so that they are limited to alphanumeric characters. > >Both templates (the main view and the edit view) have been modified so >that item_search_fields.js can be included in both. > >To test, apply the patch and test the form by entering a variety of >different character combinations. The "MARC field" and "MARC subfield" >inputs should only accept alphanumeric entries. > >Test both "new" and "edit" operations. >Test other operations like delete and cancel. > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >Signed-off-by: Jose-Mario <jose-mario.monteiro-santos@inLibro.com> >--- > .../en/includes/admin-items-search-field-form.inc | 8 ++--- > .../prog/en/modules/admin/items_search_field.tt | 3 +- > .../prog/en/modules/admin/items_search_fields.tt | 4 +-- > .../intranet-tmpl/prog/js/item_search_fields.js | 37 ++++++++++++++++++++-- > 4 files changed, 43 insertions(+), 9 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-items-search-field-form.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-items-search-field-form.inc >index 7232766..b95e263 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-items-search-field-form.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-items-search-field-form.inc >@@ -23,18 +23,18 @@ > <li> > <label class="required" for="tagfield">MARC field: </label> > [% IF field && field.tagfield == tagfield %] >- <input type="text" id="tagfield" name="tagfield" maxlength="3" size="3" class="required" required="required" value="[% tagfield | html %]" /> >+ <input type="text" id="tagfield" name="tagfield" maxlength="3" size="3" class="required" pattern="[a-zA-Z0-9]+" required="required" value="[% tagfield | html %]" /> > [% ELSE %] >- <input type="text" id="tagfield" name="tagfield" maxlenght="3" size="3" class="required" required="required" /> >+ <input type="text" id="tagfield" name="tagfield" maxlenght="3" size="3" class="required" pattern="[a-zA-Z0-9]+" required="required" /> > [% END %] > <span class="required">Required</span> > </li> > <li> > <label for="tagsubfield">MARC subfield: </label> > [% IF field && field.tagsubfield == tagsubfield %] >- <input type="text" id="tagsubfield" name="tagsubfield" maxlength="1" size="1" value="[% tagsubfield | html %]" /> >+ <input type="text" id="tagsubfield" name="tagsubfield" pattern="[a-zA-Z0-9]+" maxlength="1" size="1" value="[% tagsubfield | html %]" /> > [% ELSE %] >- <input type="text" id="tagsubfield" name="tagsubfield" maxlength="1" size="1" /> >+ <input type="text" id="tagsubfield" name="tagsubfield" pattern="[a-zA-Z0-9]+" maxlength="1" size="1" /> > [% END %] > </li> > <li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/items_search_field.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/items_search_field.tt >index 3cf8791..779fe18 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/items_search_field.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/items_search_field.tt >@@ -23,7 +23,7 @@ > > <h1>Item search field: [% field.label | html %]</h1> > >- <form action="/cgi-bin/koha/admin/items_search_field.pl" method="POST" class="validated"> >+ <form action="/cgi-bin/koha/admin/items_search_field.pl" method="POST" id="edit_search_fields"> > <fieldset class="rows"> > <legend>Edit field</legend> > [% INCLUDE 'admin-items-search-field-form.inc' field=field %] >@@ -49,6 +49,7 @@ > > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/admin-menu.js") | $raw %] >+ [% Asset.js("js/item_search_fields.js") | $raw %] > [% END %] > > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/items_search_fields.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/items_search_fields.tt >index bc3abf2..bd30170 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/items_search_fields.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/items_search_fields.tt >@@ -91,7 +91,7 @@ > </div> > [% END %] > >- <form id="add_field_form" action="/cgi-bin/koha/admin/items_search_fields.pl" method="POST" class="validated"> >+ <form id="add_field_form" action="/cgi-bin/koha/admin/items_search_fields.pl" method="POST"> > <fieldset class="rows"> > <legend>Add a new field</legend> > [% INCLUDE 'admin-items-search-field-form.inc' field=undef %] >@@ -99,7 +99,7 @@ > </fieldset> > <fieldset class="action"> > <input type="submit" value="Submit" /> >- <a href="#" class="cancel">Cancel</a> >+ <a href="#" class="cancel hide_form">Cancel</a> > </fieldset> > </form> > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/item_search_fields.js b/koha-tmpl/intranet-tmpl/prog/js/item_search_fields.js >index 32418b5..2901d7d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/item_search_fields.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/item_search_fields.js >@@ -1,3 +1,9 @@ >+/* global _ MSG_ITEM_SEARCH_DELETE_CONFIRM */ >+ >+jQuery.validator.addMethod("marcfield", function(value, element) { >+ return this.optional(element) || /^[0-9a-zA-Z]+$/.test(value); >+}, _("Please enter letters or numbers") ); >+ > $(document).ready(function(){ > $("#add_field_form").hide(); > $("#new_search_field").on("click",function(e){ >@@ -6,7 +12,7 @@ $(document).ready(function(){ > $(".dialog").hide(); > $("#search_fields_list,#toolbar").hide(); > }); >- $(".cancel").on("click",function(e){ >+ $(".hide_form").on("click",function(e){ > e.preventDefault(); > $("#add_field_form").hide(); > $(".dialog").show(); >@@ -21,4 +27,31 @@ $(document).ready(function(){ > return false; > } > }); >-}); >\ No newline at end of file >+ >+ $("#add_field_form").validate({ >+ rules: { >+ label: "required", >+ tagfield: { >+ required: true, >+ marcfield: true >+ }, >+ tagsubfield: { >+ marcfield: true >+ } >+ } >+ }); >+ >+ $("#edit_search_fields").validate({ >+ rules: { >+ label: "required", >+ tagfield: { >+ required: true, >+ marcfield: true >+ }, >+ tagsubfield: { >+ marcfield: true >+ } >+ } >+ }); >+ >+}); >-- >2.7.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 20689
:
77640
|
79554
|
79779
|
80538
|
80539
|
80712
|
80713
|
81137
|
81150
|
81151
|
83795
|
83796
|
83827
|
87955
|
87956
|
87957
|
88294
|
124056
|
124057
|
124058
|
124059
|
131038
|
131039
|
131040
|
131041