@@ -, +, @@ --- C4/Koha.pm | 10 +- C4/MarcModificationTemplates.pm | 38 +- Koha/SimpleMARC.pm | 16 +- .../intranet-tmpl/prog/en/includes/tools-menu.inc | 2 +- .../modules/tools/marc_modification_templates.tt | 799 ++++++++++---------- tools/marc_modification_templates.pl | 15 +- 6 files changed, 438 insertions(+), 442 deletions(-) --- a/C4/Koha.pm +++ a/C4/Koha.pm @@ -1488,9 +1488,7 @@ sub _isbn_cleanup { return; } -=head2 - - Log( $message ); +=head2 Log( $message ); Writes data to /tmp/koha.log. @@ -1502,9 +1500,9 @@ sub _isbn_cleanup { sub Log { my ($data) = @_; warn $data; - open (MYFILE, '>>/tmp/koha.log'); - print MYFILE "$data\n"; - close (MYFILE); + open my $fh, '>>/tmp/koha.log'; + print $fh "$data\n"; + close $fh; } 1; --- a/C4/MarcModificationTemplates.pm +++ a/C4/MarcModificationTemplates.pm @@ -35,24 +35,24 @@ use vars qw($VERSION @ISA @EXPORT); use constant DEBUG => 0; BEGIN { - $VERSION = 1.00; # set the version for version checking - @ISA = qw(Exporter); - @EXPORT = qw( - &GetModificationTemplates - &AddModificationTemplate - &DelModificationTemplate - - &GetModificationTemplateAction - &GetModificationTemplateActions - - &AddModificationTemplateAction - &ModModificationTemplateAction - &DelModificationTemplateAction - &MoveModificationTemplateAction - - &ModifyRecordsWithTemplate - &ModifyRecordWithTemplate - ); + $VERSION = 1.00; # set the version for version checking + @ISA = qw(Exporter); + @EXPORT = qw( + &GetModificationTemplates + &AddModificationTemplate + &DelModificationTemplate + + &GetModificationTemplateAction + &GetModificationTemplateActions + + &AddModificationTemplateAction + &ModModificationTemplateAction + &DelModificationTemplateAction + &MoveModificationTemplateAction + + &ModifyRecordsWithTemplate + &ModifyRecordWithTemplate + ); } @@ -564,7 +564,7 @@ sub ModifyRecordWithTemplate { C4::Koha::Log("eval $eval") if DEBUG >= 2; warn("eval $eval") if DEBUG >= 2; - eval $eval; + eval {$eval}; C4::Koha::Log( $record->as_formatted() ) if DEBUG >= 10; warn( $record->as_formatted() ) if DEBUG >= 10; --- a/Koha/SimpleMARC.pm +++ a/Koha/SimpleMARC.pm @@ -60,7 +60,7 @@ at your option, any later version of Perl 5 you may have available. =head1 FUNCTIONS -=head2 +=head2 copy_field copy_field( $record, $fromFieldName, $fromSubfieldName, $toFieldName, $toSubfieldName[, $regex[, $n ] ] ); @@ -94,7 +94,7 @@ sub copy_field { } -=head2 +=head2 update_field update_field( $record, $fieldName, $subfieldName, $dont_erase, $value[, $value,[ $value ... ] ] ); @@ -157,7 +157,7 @@ sub update_field { } } -=head2 +=head2 read_field my @values = read_field( $record, $fieldName[, $subfieldName, [, $n ] ] ); @@ -189,7 +189,7 @@ sub read_field { } } -=head2 +=head2 field_exists $bool = field_exists( $record, $fieldName[, $subfieldName ]); @@ -214,7 +214,7 @@ sub field_exists { return $return; } -=head2 +=head2 field_equals $bool = field_equals( $record, $value, $fieldName[, $subfieldName[, $regex [, $n ] ] ]); @@ -246,7 +246,7 @@ sub field_equals { } } -=head2 +=head2 move_field move_field( $record, $fromFieldName, $fromSubfieldName, $toFieldName, $toSubfieldName[, $regex [, $n ] ] ); @@ -266,7 +266,7 @@ sub move_field { delete_field( $record, $fromFieldName, $fromSubfieldName, $n ); } -=head2 +=head2 delete_field delete_field( $record, $fieldName[, $subfieldName [, $n ] ] ); @@ -296,7 +296,7 @@ sub delete_field { } } -=head2 +=head2 _update_repeatable_field_with_single_value _update_repeatable_field_with_single_value( $record, $fieldName, $subfieldName, $value ); --- a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc @@ -69,7 +69,7 @@ [% END %] --> [% IF ( CAN_user_tools_marc_modification_templates ) %] -
Change Order | +Order | +Action | +Description | +  | +  | +
---|---|---|---|---|---|
+ + + + + + + + + + + + + + + + | + +[% ActionsLoo.ordering %] | ++ [% IF ( ActionsLoo.action_delete_field ) %] Delete [% END %] + [% IF ( ActionsLoo.action_update_field ) %] Update [% END %] + [% IF ( ActionsLoo.action_move_field ) %] Move [% END %] + [% IF ( ActionsLoo.action_copy_field ) %] Copy [% END %] + + [% UNLESS ( ActionsLoo.action_update_field ) %] + [% IF ( ActionsLoo.field_number ) %] + 1st + [% END %] + [% END %] + + field + + [% ActionsLoo.from_field %][% IF ( ActionsLoo.from_subfield ) %]$[% ActionsLoo.from_subfield %][% END %] + + [% IF ( ActionsLoo.field_value ) %] + with value [% ActionsLoo.field_value %] + [% END %] + + [% IF ( ActionsLoo.to_field ) %] + to [% ActionsLoo.to_field %][% IF ( ActionsLoo.to_subfield ) %]$[% ActionsLoo.to_subfield %][% END %] + + [% IF ( ActionsLoo.to_regex ) %] + using RegEx s[% ActionsLoo.to_regex %] + [% END %] + [% END %] + + [% IF ( ActionsLoo.conditional ) %] + [% IF ( ActionsLoo.conditional_if ) %] if [% END %] + [% IF ( ActionsLoo.conditional_unless ) %] unless [% END %] + + [% ActionsLoo.conditional_field %][% IF ( ActionsLoo.conditional_subfield ) %]$[% ActionsLoo.conditional_subfield %][% END %] + + [% IF ( ActionsLoo.conditional_comparison_exists ) %] exists [% END %] + [% IF ( ActionsLoo.conditional_comparison_not_exists ) %] does not exist [% END %] + [% IF ( ActionsLoo.conditional_comparison_equals ) %] matches [% END %] + [% IF ( ActionsLoo.conditional_comparison_not_equals ) %] does not match [% END %] + + [% IF ( ActionsLoo.conditional_regex ) %] RegEx m[% END %][% ActionsLoo.conditional_value %] + [% END %] + | +[% ActionsLoo.description %] | +Edit | +Delete | +