diff --git a/Koha/SimpleMARC.pm b/Koha/SimpleMARC.pm index be7f025ea2..6b15b8d939 100644 --- a/Koha/SimpleMARC.pm +++ b/Koha/SimpleMARC.pm @@ -135,9 +135,9 @@ sub copy_and_replace_field { if ( ! ( $record && $fromFieldName && $toFieldName ) ) { return; } - - if ( !defined $fromSubfieldName or $fromSubfieldName eq '' - or !defined $toSubfieldName or $toSubfieldName eq '' + if ( + ( !defined $fromSubfieldName or $fromSubfieldName eq '' ) + and ( !defined $toSubfieldName or $toSubfieldName eq '' ) ) { _copy_move_field( { record => $record, diff --git a/koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js b/koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js index 39dfd7226d..594985403a 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js +++ b/koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js @@ -14,8 +14,11 @@ $(document).ready(function() { var action = $("#action").val(); if ( action == 'move_field' || action == 'copy_field' || action == 'copy_and_replace_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() >= 10 && $("#to_subfield").val().length > 0 ) && + ( $("#from_field").val() >= 10 && $("#from_subfield").val().length > 0 ) ) { + alert( __("Both subfield values should be filled or empty.") ); + return false; + } } if ( $("#to_field").val().length <= 0 ) { alert( __("The destination should be filled.") ); @@ -26,11 +29,6 @@ $(document).ready(function() { alert( __("If the field is a control field, the subfield should be empty") ); return false; } - if ( ( $("#from_field").val() < 10 && $("#to_field").val() >= 10 ) || - ( $("#to_field").val() < 10 && $("#from_field").val() >= 10 ) ) { - alert( __("A control field cannot be used with a regular field.") ); - return false; - } } if ( action == 'update_field' ) { if ( $("#from_subfield").val().length <= 0 ) {