@@ -, +, @@ fields can be copied to subfields Copy and replace field 001 to 099$a unless 099$a exists --- Koha/SimpleMARC.pm | 6 +++--- .../prog/js/marc_modification_templates.js | 12 +++++------- 2 files changed, 8 insertions(+), 10 deletions(-) --- a/Koha/SimpleMARC.pm +++ a/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, --- a/koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js +++ a/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 ) { --