From 8d1f2303f3e40e453bfd8c47779421462a334eb9 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 29 Mar 2013 12:12:06 +0100 Subject: [PATCH] Bug 8015: FIX QA issues This patch fixes some stuffs failing qa tests: POD, indentation (tabs), perlcritic --- 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(-) diff --git a/C4/Koha.pm b/C4/Koha.pm index 2085006..ddc39ce 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -1468,9 +1468,7 @@ sub _isbn_cleanup { return; } -=head2 - - Log( $message ); +=head2 Log( $message ); Writes data to /tmp/koha.log. @@ -1482,9 +1480,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; diff --git a/C4/MarcModificationTemplates.pm b/C4/MarcModificationTemplates.pm index 925f505..8c9212f 100644 --- a/C4/MarcModificationTemplates.pm +++ b/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; diff --git a/Koha/SimpleMARC.pm b/Koha/SimpleMARC.pm index 1d8c486..f72fc2f 100644 --- a/Koha/SimpleMARC.pm +++ b/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 ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc index bdf4da1..18e833c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc @@ -69,7 +69,7 @@ [% END %] --> [% IF ( CAN_user_tools_marc_modification_templates ) %] -
  • Manage MARC modification templates
  • +
  • Manage MARC modification templates
  • [% END %] [% IF ( CAN_user_tools_stage_marc_import ) %]
  • Stage MARC for import
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt index aaffb70..00a6e84 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt @@ -5,233 +5,233 @@ @@ -245,252 +245,249 @@ function setSelectByValue( selectId, value ) {
    -
    -
    -

    MARC modification templates

    +
    +
    +

    MARC modification templates

    - [% IF ( TemplatesLoop ) %] + [% IF ( TemplatesLoop ) %] -
    - - + [% FOREACH TemplatesLoo IN TemplatesLoop %] [% IF ( TemplatesLoo.selected ) %] - + [% ELSE %] - + [% END %] - [% END %] - - - -
    - -
    - - - -
    - - - [% IF ( ActionsLoop ) %] - - - - - - - - - - - - - [% FOREACH ActionsLoo IN ActionsLoop %] - - - - - - - - - - [% END %] -
    Actions for this template
    Change OrderOrderActionDescription  
    - - Go up - - - - Go top - - - - Go bottom - - - - Go down - - [% 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 %]EditDelete
    - [% ELSE %] -

    There are no defined actions for this template.

    - [% END %] - -
    - -
    - Add A New Action - - - - - - - - field(s) - - - - - -

    - - - - - - - - - -

    - - - -

    - - -

    -
    - - [% ELSE %] -

    There are no defined templates. Please create a template first.

    - [% END %] - -
    -
    - Create a new template - - - - - - - - [% IF ( template_id ) %] - - - - [% END %] -
    -
    - - - -
    -
    - -
    - [% INCLUDE 'tools-menu.inc' %] -
    + [% END %] + + + + + +
    + + + +
    + + + [% IF ( ActionsLoop ) %] + + + + + + + + + + + + + [% FOREACH ActionsLoo IN ActionsLoop %] + + + + + + + + + + [% END %] +
    Actions for this template
    Change OrderOrderActionDescription  
    + + Go up + + + + Go top + + + + Go bottom + + + + Go down + + [% 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 %]EditDelete
    + [% ELSE %] +

    There are no defined actions for this template.

    + [% END %] + +
    + +
    + Add A New Action + + + + + + + + field(s) + + + + + +

    + + + + + + + + + +

    + + + +

    + + +

    +
    + + [% ELSE %] +

    There are no defined templates. Please create a template first.

    + [% END %] + +
    +
    + Create a new template + + + + + + + + [% IF ( template_id ) %] + + + + [% END %] +
    +
    +
    +
    + +
    + [% INCLUDE 'tools-menu.inc' %] +
    [% INCLUDE 'intranet-bottom.inc' %] diff --git a/tools/marc_modification_templates.pl b/tools/marc_modification_templates.pl index d3a4d8c..dde2476 100755 --- a/tools/marc_modification_templates.pl +++ b/tools/marc_modification_templates.pl @@ -32,13 +32,14 @@ my $op = $cgi->param('op'); my $template_id = $cgi->param('template_id'); my ($template, $loggedinuser, $cookie) - = get_template_and_user({template_name => "tools/marc_modification_templates.tmpl", - query => $cgi, - type => "intranet", - authnotrequired => 0, - flagsrequired => { tools => 'marc_modfication_templates' }, - debug => 1, - }); + = get_template_and_user({ + template_name => "tools/marc_modification_templates.tmpl", + query => $cgi, + type => "intranet", + authnotrequired => 0, + flagsrequired => { tools => 'marc_modfication_templates' }, + debug => 1, + }); if ( $op eq "create_template" ) { $template_id = '' unless $cgi->param('duplicate_current_template'); -- 1.7.10.4