From d813ee2b02dce24435c83d53cc3db7d4f1b0e3b4 Mon Sep 17 00:00:00 2001 From: Liz Rea Date: Wed, 15 Feb 2012 14:13:49 -0600 Subject: [PATCH] Bug 7546 - cannot view subscription detail This patch adds a C4::Search to subscription-detail.pl to compensate for a removed one from auth.pm during the denesting effort. Signed-off-by: Paul Poulain Bug 7546 Do not call routine as bareword 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 Signed-off-by: Paul Poulain bug 7546 follow-up, enabled_staff_search_views problem * enabled_staff_search_views was not exported by C4::Search, should have been * serials/serials-edit.pl were also missing it Comments: * checked with for file in */*.pl; do perl -wc $file; done that no script was still having this problem Signed-off-by: Liz Rea Final sign off for all 3 patches Note: I had some problems with tests, but it is probably related to my data and not this patch. (cherry picked from commit 1ddc9322dfc13ef7f1e930692bfd2cb3771b102b) Signed-off-by: Chris Nighswonger (cherry picked from commit f6c55445ed2ef6fe5eaf99831b9ec180d12707ec) Signed-off-by: Chris Nighswonger --- C4/Search.pm | 1 + serials/serials-edit.pl | 14 ++++++++------ serials/subscription-detail.pl | 14 ++++++++------ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 87c0b6c285..64fc8ce3ba 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -71,6 +71,7 @@ This module provides searching functions for Koha's bibliographic databases &AddSearchHistory &GetDistinctValues &BiblioAddAuthorities + &enabled_staff_search_views ); #FIXME: i had to add BiblioAddAuthorities here because in Biblios.pm it caused circular dependencies (C4::Search uses C4::Biblio, and BiblioAddAuthorities uses SimpleSearch from C4::Search) diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl index 9ecd09fe91..1a606323ad 100755 --- a/serials/serials-edit.pl +++ b/serials/serials-edit.pl @@ -72,6 +72,7 @@ use C4::Koha; use C4::Output; use C4::Context; use C4::Serials; +use C4::Search qw/enabled_staff_search_views/; use List::MoreUtils qw/uniq/; my $query = CGI->new(); @@ -403,14 +404,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 8e7f418133..0b6d35afa4 100755 --- a/serials/subscription-detail.pl +++ b/serials/subscription-detail.pl @@ -24,6 +24,7 @@ use C4::Dates qw/format_date/; use C4::Serials; use C4::Output; use C4::Context; +use C4::Search qw/enabled_staff_search_views/; use Date::Calc qw/Today Day_of_Year Week_of_Year Add_Delta_Days/; use Carp; @@ -143,14 +144,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'; } -- 2.39.5