@@ -, +, @@
---
.../atomicupdate/Bug-14098-Add_copy_and_replace_action.sql | 1 +
.../prog/en/modules/tools/marc_modification_templates.tt | 10 +++++++++-
tools/marc_modification_templates.pl | 1 +
3 files changed, 11 insertions(+), 1 deletion(-)
create mode 100644 installer/data/mysql/atomicupdate/Bug-14098-Add_copy_and_replace_action.sql
--- a/installer/data/mysql/atomicupdate/Bug-14098-Add_copy_and_replace_action.sql
+++ a/installer/data/mysql/atomicupdate/Bug-14098-Add_copy_and_replace_action.sql
@@ -0,0 +1, @@
+alter table marc_modification_template_actions modify column action enum('delete_field','update_field','move_field','copy_field','copy_and_replace_field');
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt
@@ -14,7 +14,7 @@ $(document).ready(function() {
$("#add_action").submit(function(){
var action = $("#action").val();
- if ( action == 'move_field' || action == 'copy_field' ) {
+ 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;
@@ -96,6 +96,12 @@ function onActionChange(selectObj) {
show('to_field_block');
break;
+ case 'copy_and_replace_field':
+ show('field_number_block');
+ hide('with_value_block');
+ show('to_field_block');
+ break;
+
}
}
@@ -375,6 +381,7 @@ function setSelectByValue( selectId, value ) {
[% IF ( ActionsLoo.action_update_field ) %] Update [% END %]
[% IF ( ActionsLoo.action_move_field ) %] Move [% END %]
[% IF ( ActionsLoo.action_copy_field ) %] Copy [% END %]
+ [% IF ( ActionsLoo.action_copy_and_replace_field ) %] Copy and replace [% END %]
[% UNLESS ( ActionsLoo.action_update_field ) %]
[% IF ( ActionsLoo.field_number ) %]
@@ -455,6 +462,7 @@ function setSelectByValue( selectId, value ) {
+
--- a/tools/marc_modification_templates.pl
+++ a/tools/marc_modification_templates.pl
@@ -124,6 +124,7 @@ foreach my $action ( @actions ) {
$action->{'action_update_field'} = ( $action->{'action'} eq 'update_field' );
$action->{'action_move_field'} = ( $action->{'action'} eq 'move_field' );
$action->{'action_copy_field'} = ( $action->{'action'} eq 'copy_field' );
+ $action->{'action_copy_and_replace_field'} = ( $action->{'action'} eq 'copy_and_replace_field' );
$action->{'conditional_if'} = ( $action->{'conditional'} eq 'if' );
$action->{'conditional_unless'} = ( $action->{'conditional'} eq 'unless' );
--