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 <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2015-05-27 13:38:38 +02:00 committed by Tomas Cohen Arazi
parent f37d9d005c
commit 0f74321977
3 changed files with 11 additions and 1 deletions

View File

@ -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');

View File

@ -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 ) {
<option value="update_field">Add/Update</option>
<option value="move_field">Move</option>
<option value="copy_field">Copy</option>
<option value="copy_and_replace_field">Copy and replace</option>
</select>
<span id="field_number_block">

View File

@ -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' );