From f37d9d005c965d5218b9133873616807296b2dbd Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 27 May 2015 13:34:09 +0200 Subject: [PATCH] Bug 14098: Remove unedeed subroutines Just some cleaning before to continue, _copy_field and _copy_subfield did not do anything useful. Signed-off-by: Kyle M Hall Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- Koha/SimpleMARC.pm | 167 +++++++++++++-------------------------------- 1 file changed, 48 insertions(+), 119 deletions(-) diff --git a/Koha/SimpleMARC.pm b/Koha/SimpleMARC.pm index 991d8a9ca4..c4e4c51441 100644 --- a/Koha/SimpleMARC.pm +++ b/Koha/SimpleMARC.pm @@ -85,68 +85,32 @@ sub copy_field { if ( ! ( $record && $fromFieldName && $toFieldName ) ) { return; } - if ( not $fromSubfieldName or $fromSubfieldName eq '' - or not $toSubfieldName or $toSubfieldName eq '' - ) { - _copy_field({ - record => $record, - from_field => $fromFieldName, - to_field => $toFieldName, - regex => $regex, - field_numbers => $field_numbers, - }); + if ( not $fromSubfieldName + or $fromSubfieldName eq '' + or not $toSubfieldName + or $toSubfieldName eq '' ) { + _copy_move_field( + { record => $record, + from_field => $fromFieldName, + to_field => $toFieldName, + regex => $regex, + field_numbers => $field_numbers, + action => 'copy', + } + ); } else { - _copy_subfield({ - record => $record, - from_field => $fromFieldName, - from_subfield => $fromSubfieldName, - to_field => $toFieldName, - to_subfield => $toSubfieldName, - regex => $regex, - field_numbers => $field_numbers, - }); + _copy_move_subfield( + { record => $record, + from_field => $fromFieldName, + from_subfield => $fromSubfieldName, + to_field => $toFieldName, + to_subfield => $toSubfieldName, + regex => $regex, + field_numbers => $field_numbers, + action => 'copy', + } + ); } - -} - -sub _copy_field { - my ( $params ) = @_; - my $record = $params->{record}; - my $fromFieldName = $params->{from_field}; - my $toFieldName = $params->{to_field}; - my $regex = $params->{regex}; - my $field_numbers = $params->{field_numbers} // []; - - _copy_move_field({ - record => $record, - from_field => $fromFieldName, - to_field => $toFieldName, - regex => $regex, - field_numbers => $field_numbers, - action => 'copy', - }); -} - -sub _copy_subfield { - my ( $params ) = @_; - my $record = $params->{record}; - my $fromFieldName = $params->{from_field}; - my $fromSubfieldName = $params->{from_subfield}; - my $toFieldName = $params->{to_field}; - my $toSubfieldName = $params->{to_subfield}; - my $regex = $params->{regex}; - my $field_numbers = $params->{field_numbers} // []; - - _copy_move_subfield({ - record => $record, - from_field => $fromFieldName, - from_subfield => $fromSubfieldName, - to_field => $toFieldName, - to_subfield => $toSubfieldName, - regex => $regex, - field_numbers => $field_numbers, - action => 'copy', - }); } sub update_field { @@ -416,69 +380,34 @@ sub move_field { my $regex = $params->{regex}; my $field_numbers = $params->{field_numbers} // []; - if ( not $fromSubfieldName or $fromSubfieldName eq '' - or not $toSubfieldName or $toSubfieldName eq '' - ) { - _move_field({ - record => $record, - from_field => $fromFieldName, - to_field => $toFieldName, - regex => $regex, - field_numbers => $field_numbers, - }); + if ( not $fromSubfieldName + or $fromSubfieldName eq '' + or not $toSubfieldName + or $toSubfieldName eq '' ) { + _copy_move_field( + { record => $record, + from_field => $fromFieldName, + to_field => $toFieldName, + regex => $regex, + field_numbers => $field_numbers, + action => 'move', + } + ); } else { - _move_subfield({ - record => $record, - from_field => $fromFieldName, - from_subfield => $fromSubfieldName, - to_field => $toFieldName, - to_subfield => $toSubfieldName, - regex => $regex, - field_numbers => $field_numbers, - }); + _copy_move_subfield( + { record => $record, + from_field => $fromFieldName, + from_subfield => $fromSubfieldName, + to_field => $toFieldName, + to_subfield => $toSubfieldName, + regex => $regex, + field_numbers => $field_numbers, + action => 'move', + } + ); } } -sub _move_field { - my ( $params ) = @_; - my $record = $params->{record}; - my $fromFieldName = $params->{from_field}; - my $toFieldName = $params->{to_field}; - my $regex = $params->{regex}; - my $field_numbers = $params->{field_numbers} // []; - - _copy_move_field({ - record => $record, - from_field => $fromFieldName, - to_field => $toFieldName, - regex => $regex, - field_numbers => $field_numbers, - action => 'move', - }); -} - -sub _move_subfield { - my ( $params ) = @_; - my $record = $params->{record}; - my $fromFieldName = $params->{from_field}; - my $fromSubfieldName = $params->{from_subfield}; - my $toFieldName = $params->{to_field}; - my $toSubfieldName = $params->{to_subfield}; - my $regex = $params->{regex}; - my $field_numbers = $params->{field_numbers} // []; - - _copy_move_subfield({ - record => $record, - from_field => $fromFieldName, - from_subfield => $fromSubfieldName, - to_field => $toFieldName, - to_subfield => $toSubfieldName, - regex => $regex, - field_numbers => $field_numbers, - action => 'move', - }); -} - =head2 _delete_field _delete_field( $record, $fieldName[, $subfieldName [, $n ] ] ); -- 2.39.5