Bug 11414: warn user about dangerous MARC modification rules

Test plan:
On the MARC modification tool:

Add/edit a new action on a field and define a condition on the same
field.

Verify that you get a warning message in red.

See bug 11413 for more information

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Tested adding and editing a template with the same field in the
action and the condition.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Jonathan Druart 2013-12-18 12:18:52 +01:00 committed by Galen Charlton
parent 95e2754af6
commit 7137ee91e0

View file

@ -11,11 +11,26 @@ $(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
});
});
//]]>
</script>
<script>
function updateWarnings(){
if ( $("#conditional_field").is(":visible") ) {
if ( $("#conditional_field").val() == $("#from_field").val() && $("#from_field").val().length > 0 ) {
$("#warning_multivalued").show();
} else {
$("#warning_multivalued").hide();
}
}
}
function onActionChange(selectObj) {
// get the index of the selected option
var idx = selectObj.selectedIndex;
@ -400,6 +415,7 @@ function setSelectByValue( selectId, value ) {
<a name="modaction"></a>
<fieldset>
<legend id="modaction_legend">Add a new action</legend>
<div id="warning_multivalued" style="color:red; display:none;">You have chosen a condition on the same field as the original field. If your records contain multivalued fields it is highly recommended not to do that.</div>
<select name="action" id="action" onchange="onActionChange(this);">
<option value="delete_field">Delete</option>