From 0f74321977c50ef45daa4897933ee0fac378dcb6 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 27 May 2015 13:38:38 +0200 Subject: [PATCH] Bug 14098: Add copy_and_replace action to MMT This patch add the new value for the MTT action. It updates the marc_modification_template_actions.action DB field to allow 'copy_and_replace_field'. Signed-off-by: Kyle M Hall Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- .../Bug-14098-Add_copy_and_replace_action.sql | 1 + .../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 diff --git a/installer/data/mysql/atomicupdate/Bug-14098-Add_copy_and_replace_action.sql b/installer/data/mysql/atomicupdate/Bug-14098-Add_copy_and_replace_action.sql new file mode 100644 index 0000000000..bfee4e118c --- /dev/null +++ b/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'); 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 6c26d838d9..5cbc88db60 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 @@ -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 ) { + diff --git a/tools/marc_modification_templates.pl b/tools/marc_modification_templates.pl index 31c663baef..10589e4141 100755 --- a/tools/marc_modification_templates.pl +++ b/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' ); -- 2.39.5