From 016b111d4e6281c5d8618acd8a5563f627957952 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 1 Jan 2015 16:38:34 -0500 Subject: [PATCH] Bug 13441 - Branchcodes should not be allowed to have spaces in them MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In multiple cases I've seen issues arise in Koha where a librarian accidentally puts a space at the end of a new branchcode. This of course causes endless confusion because the branchcode looks perfectly fine in every case unless you wrap the code with some characters to reveal the hidden space! Test Plan: 1) Try creating a new branch with one or more spaces in the branchcode 2) Note you are able to 3) Apply this patch 4) Repeat step 1 5) Note you are no longer able to Followed test plan with cache cleared. Works as expected. Signed-off-by: Marc Véron Signed-off-by: Katrin Fischer Works as described, passes tests and QA script. Signed-off-by: Tomas Cohen Arazi (cherry picked from commit a7c41e6073a2719e21f86909a37daab6410b2b96) Signed-off-by: Chris Cormack --- .../prog/en/modules/admin/branches.tt | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt index 2275f57c57..887b81ffd6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt @@ -24,6 +24,18 @@ "iDisplayLength": 10, "sPaginationType": "four_button" })); + + [% IF ( heading_branches_add_branch_p ) %] + $("#Aform").on("submit", function( event ) { + if ( $("#branchcode").val().match(/\s/) ) { + event.preventDefault(); + alert(_("The library code entered contains whitespace characters. Please remove any whitespace characters from the library code")); + return false; + } else { + return true; + } + }); + [% END %] }); tinyMCE.init({ mode : "textareas", @@ -62,7 +74,7 @@ tinyMCE.init({
- +
@@ -247,7 +259,7 @@ tinyMCE.init({ [% ELSE %]
There are no libraries defined. Start defining libraries.
[% END %] - + [% IF ( branchcategories ) %] [% FOREACH branchcategorie IN branchcategories %]

Group(s): [% IF ( branchcategorie.properties ) %]Properties[% ELSE %][% IF ( branchcategorie.searchdomain ) %]Search domain[% END %][% END %]

@@ -297,7 +309,7 @@ tinyMCE.init({ [% END %]
- +
  1. [% IF ( categorycode ) %] Category code: @@ -344,7 +356,7 @@ tinyMCE.init({ [% IF ( delete_category ) %] [% UNLESS ( MESSAGE8 ) %] -
    +
    Confirm delete:
    -- 2.39.5