[Koha-patches] [PATCH] Bug 7546 Do not call routine as bareword

Colin Campbell colin.campbell at ptfs-europe.com
Thu Feb 16 12:18:26 CET 2012


Fixes compilation errors due to calling routine without parens
Also nothing was gained (and obfuscation added) by forcing
the return into a hash ref have changed variable to hash
tidied up the if else chain

These routines should be refactored out future
---
 serials/serials-edit.pl        |   13 +++++++------
 serials/subscription-detail.pl |   13 +++++++------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl
index 9ecd09f..12f568c 100755
--- a/serials/serials-edit.pl
+++ b/serials/serials-edit.pl
@@ -403,14 +403,15 @@ output_html_with_http_headers $query, $cookie, $template->output;
 
 sub get_default_view {
     my $defaultview = C4::Context->preference('IntranetBiblioDefaultView');
-    my $views = { C4::Search::enabled_staff_search_views };
-    if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) {
+    my %views       = C4::Search::enabled_staff_search_views();
+    if ( $defaultview eq 'isbd' && $views{can_view_ISBD} ) {
         return 'ISBDdetail';
-    } elsif  ($defaultview eq 'marc' && $views->{can_view_MARC}) {
+    }
+    elsif ( $defaultview eq 'marc' && $views{can_view_MARC} ) {
         return 'MARCdetail';
-    } elsif  ($defaultview eq 'labeled_marc' && $views->{can_view_labeledMARC}) {
+    }
+    elsif ( $defaultview eq 'labeled_marc' && $views{can_view_labeledMARC} ) {
         return 'labeledMARCdetail';
-    } else {
-        return 'detail';
     }
+    return 'detail';
 }
diff --git a/serials/subscription-detail.pl b/serials/subscription-detail.pl
index 8e7f418..d267bc3 100755
--- a/serials/subscription-detail.pl
+++ b/serials/subscription-detail.pl
@@ -143,14 +143,15 @@ output_html_with_http_headers $query, $cookie, $template->output;
 
 sub get_default_view {
     my $defaultview = C4::Context->preference('IntranetBiblioDefaultView');
-    my $views = { C4::Search::enabled_staff_search_views };
-    if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) {
+    my %views       = C4::Search::enabled_staff_search_views();
+    if ( $defaultview eq 'isbd' && $views{can_view_ISBD} ) {
         return 'ISBDdetail';
-    } elsif  ($defaultview eq 'marc' && $views->{can_view_MARC}) {
+    }
+    elsif ( $defaultview eq 'marc' && $views{can_view_MARC} ) {
         return 'MARCdetail';
-    } elsif  ($defaultview eq 'labeled_marc' && $views->{can_view_labeledMARC}) {
+    }
+    elsif ( $defaultview eq 'labeled_marc' && $views{can_view_labeledMARC} ) {
         return 'labeledMARCdetail';
-    } else {
-        return 'detail';
     }
+    return 'detail';
 }
-- 
1.7.7.6



More information about the Koha-patches mailing list