From 24265f2a1d5d1178cbcb59192b8f16698644f8de Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 3 Sep 2014 15:08:39 +0200 Subject: [PATCH] [FAILED_QA] Bug 11395: Raise an alert if control field is used Content-Type: text/plain; charset=utf-8 If a control field is used with a copy or move action, the interface should block the user in some cases: - If a control field is used with a regular field - The subfield should be empty Signed-off-by: Brendan Gallagher Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- .../modules/tools/marc_modification_templates.tt | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 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 d42e0ad..9f561db 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 @@ -23,6 +23,16 @@ $(document).ready(function() { alert(_("The destination should be filled.")); return false; } + if ( ( $("#to_field").val() <= 10 && $("#to_subfield").val().length > 0 ) || + ( $("#from_field").val() <= 10 && $("#from_subfield").val().length > 0 ) ) { + alert(_("If the field is a control field, the subfield should be empty")); + return false; + } + if ( ( $("#from_field").val() <= 10 && $("#to_subfield").val().length == 0 ) || + ( $("#to_field").val() <= 10 && $("#from_subfield").val().length == 0 ) ) { + alert(_("A control field cannot be used with a regular field.")); + return false; + } } if ( action == 'update_field' ) { if ( $("#from_subfield").val().length <= 0 ) { -- 1.7.7.6