Skip to content

Commit

Permalink
Bug 14098: Add copy_and_replace action to MMT
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Marcel de Rooy <[email protected]>
Signed-off-by: Tomas Cohen Arazi <[email protected]>
  • Loading branch information
joubu authored and tomascohen committed Sep 7, 2015
1 parent f37d9d0 commit 0f74321
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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');
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

}
}

Expand Down Expand Up @@ -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 ) %]
Expand Down Expand Up @@ -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">
Expand Down
1 change: 1 addition & 0 deletions tools/marc_modification_templates.pl
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
$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' );
Expand Down

0 comments on commit 0f74321

Please sign in to comment.