From a5dda66f64d73027fa4ede738272cba37e6e9b11 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 11 Dec 2013 17:11:01 +0100 Subject: [PATCH] Bug 11319: Template modifications This patch add template modifications for the restrictions: - the source field is always mandatory - on move and copy, the source and destination subfield should be both filled or blank. - on move and copy, the destination subfield should be filled. - on update, the subfield value should be filled. Test plan: Verify you are not able to create/modify template actions according to these restrictions. Signed-off-by: Kyle M Hall Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- .../tools/marc_modification_templates.tt | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt index 690c4e417e..22fee615f3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt @@ -12,8 +12,28 @@ $(document).ready(function() { $("span.match_regex_prefix" ).hide(); $("span.match_regex_suffix" ).hide(); - $("#conditional_field,#from_field").change(function(){ - updateWarnings(); // For 3.14.x branches only, if bug 11319 is not pushed into + $("#add_action").submit(function(){ + var action = $("#action").val(); + if ( action == 'move_field' || action == 'copy_field' ) { + if ( $("#from_subfield").val().length != $("#to_subfield").val().length ) { + alert(_("Both subfield values should be filled or empty.")); + return false; + } + if ( $("#to_field").val().length <= 0 ) { + alert(_("The destination should be filled.")); + return false; + } + } + if ( action == 'update_field' ) { + if ( $("#from_subfield").val().length <= 0 ) { + alert(_("The source subfield should be filled for update.")); + return false; + } + } + if ( $("#from_field").val().length <= 0 ) { + alert(_("The source field should be filled.")); + return false; + } }); }); //]]> @@ -431,14 +451,14 @@ function setSelectByValue( selectId, value ) { - field(s) + field(s)