From 7658871739d3f8c08a1af0fed1c1494021c1798e 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 Content-Type: text/plain; charset=utf-8 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 --- Koha/SimpleMARC.pm | 167 +++++++++++++++------------------------------------- 1 file changed, 48 insertions(+), 119 deletions(-) diff --git a/Koha/SimpleMARC.pm b/Koha/SimpleMARC.pm index 991d8a9..c4e4c51 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 ] ] ); -- 1.7.10.4