View | Details | Raw Unified | Return to bug 11592
Collapse All | Expand All

(-)a/opac/opac-ISBDdetail.pl (-3 / +8 lines)
Lines 55-60 use C4::Review; Link Here
55
use C4::Serials;    # uses getsubscriptionfrom biblionumber
55
use C4::Serials;    # uses getsubscriptionfrom biblionumber
56
use C4::Koha;
56
use C4::Koha;
57
use C4::Members;    # GetMember
57
use C4::Members;    # GetMember
58
use Koha::RecordProcessor;
58
59
59
my $query = CGI->new();
60
my $query = CGI->new();
60
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
61
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 92-102 if (scalar @items >= 1) { Link Here
92
    }
93
    }
93
}
94
}
94
95
95
my $record = GetMarcBiblio($biblionumber);
96
my $record_unfiltered = GetMarcBiblio($biblionumber);
96
if ( ! $record ) {
97
if ( ! $record_unfiltered ) {
97
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
98
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
98
    exit;
99
    exit;
99
}
100
}
101
my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' });
102
my $record_filtered  = $record_unfiltered->clone();
103
my $record           = $record_processor->process($record_filtered);
104
100
# some useful variables for enhanced content;
105
# some useful variables for enhanced content;
101
# in each case, we're grabbing the first value we find in
106
# in each case, we're grabbing the first value we find in
102
# the record and normalizing it
107
# the record and normalizing it
Lines 113-119 $template->param( Link Here
113
    normalized_ean => $ean,
118
    normalized_ean => $ean,
114
    normalized_oclc => $oclc,
119
    normalized_oclc => $oclc,
115
    normalized_isbn => $isbn,
120
    normalized_isbn => $isbn,
116
	content_identifier_exists => $content_identifier_exists,
121
    content_identifier_exists => $content_identifier_exists,
117
);
122
);
118
123
119
#coping with subscriptions
124
#coping with subscriptions
(-)a/opac/opac-detail.pl (-3 / +13 lines)
Lines 51-57 use C4::Images; Link Here
51
use Koha::DateUtils;
51
use Koha::DateUtils;
52
use C4::HTML5Media;
52
use C4::HTML5Media;
53
use C4::CourseReserves qw(GetItemCourseReservesInfo);
53
use C4::CourseReserves qw(GetItemCourseReservesInfo);
54
54
use Koha::RecordProcessor;
55
use Koha::Virtualshelves;
55
use Koha::Virtualshelves;
56
56
57
BEGIN {
57
BEGIN {
Lines 85-95 if (scalar @all_items >= 1) { Link Here
85
    }
85
    }
86
}
86
}
87
87
88
my $record       = GetMarcBiblio($biblionumber);
88
my $record_unfiltered = GetMarcBiblio($biblionumber);
89
if ( ! $record ) {
89
if ( ! $record_unfiltered ) {
90
    print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
90
    print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
91
    exit;
91
    exit;
92
}
92
}
93
my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' });
94
my $record_filtered  = $record_unfiltered->clone();
95
my $record           = $record_processor->process($record_filtered);
93
96
94
# redirect if opacsuppression is enabled and biblio is suppressed
97
# redirect if opacsuppression is enabled and biblio is suppressed
95
if (C4::Context->preference('OpacSuppression')) {
98
if (C4::Context->preference('OpacSuppression')) {
Lines 516-521 if ( C4::Context->preference('HighlightOwnItemsOnOPAC') ) { Link Here
516
}
519
}
517
520
518
my $dat = &GetBiblioData($biblionumber);
521
my $dat = &GetBiblioData($biblionumber);
522
my $HideMARC = $record_processor->filters->[0]->ShouldHideMARC(
523
    {
524
        frameworkcode => $dat->{'frameworkcode'},
525
        interface     => 'opac',
526
    } );
519
527
520
my $itemtypes = GetItemTypes();
528
my $itemtypes = GetItemTypes();
521
# imageurl:
529
# imageurl:
Lines 766-772 if (C4::Context->preference("AlternateHoldingsField") && scalar @items == 0) { Link Here
766
        );
774
        );
767
}
775
}
768
776
777
# FIXME: The template uses this hash directly. Need to filter.
769
foreach ( keys %{$dat} ) {
778
foreach ( keys %{$dat} ) {
779
    next if ( $HideMARC->{$_} );
770
    $template->param( "$_" => defined $dat->{$_} ? $dat->{$_} : '' );
780
    $template->param( "$_" => defined $dat->{$_} ? $dat->{$_} : '' );
771
}
781
}
772
782
(-)a/opac/opac-export.pl (-7 / +21 lines)
Lines 27-46 use C4::Biblio; Link Here
27
use CGI qw ( -utf8 );
27
use CGI qw ( -utf8 );
28
use C4::Auth;
28
use C4::Auth;
29
use C4::Ris;
29
use C4::Ris;
30
use Koha::RecordProcessor;
30
31
31
my $query = new CGI;
32
my $query = CGI->new;
32
my $op=$query->param("op")||''; #op=export is currently the only use
33
my $op=$query->param("op")||''; #op=export is currently the only use
33
my $format=$query->param("format")||'utf8';
34
my $format=$query->param("format")||'utf8';
34
my $biblionumber = $query->param("bib")||0;
35
my $biblionumber = $query->param("bib")||0;
35
$biblionumber = int($biblionumber);
36
$biblionumber = int($biblionumber);
36
my ($marc, $error)= ('','');
37
my $error = q{};
37
38
38
$marc = GetMarcBiblio($biblionumber, 1) if $biblionumber;
39
my $marc_unfiltered;
39
if(!$marc) {
40
$marc_unfiltered = GetMarcBiblio($biblionumber, 1) if $biblionumber;
41
if(!$marc_unfiltered) {
40
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
42
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
41
    exit;
43
    exit;
42
}
44
}
43
elsif ($format =~ /endnote/) {
45
46
# ASSERT: There is a biblionumber, because GetMarcBiblio returned something.
47
48
my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' });
49
my $marc_filtered    = $marc_unfiltered->clone();
50
my $marc             = $record_processor->process($marc_filtered);
51
52
my $marc_noitems_unfiltered = GetMarcBiblio($biblionumber);
53
my $marc_noitems_filtered   = $marc_noitems_unfiltered->clone();
54
my $marc_noitems            = $record_processor->process($marc_noitems_filtered);
55
56
if ($format =~ /endnote/) {
44
    $marc = marc2endnote($marc);
57
    $marc = marc2endnote($marc);
45
    $format = 'endnote';
58
    $format = 'endnote';
46
}
59
}
Lines 57-67 elsif ($format =~ /ris/) { Link Here
57
    $format = 'ris';
70
    $format = 'ris';
58
}
71
}
59
elsif ($format =~ /bibtex/) {
72
elsif ($format =~ /bibtex/) {
60
    $marc = marc2bibtex(C4::Biblio::GetMarcBiblio($biblionumber),$biblionumber);
73
    $marc = marc2bibtex($marc_noitems,$biblionumber);
61
    $format = 'bibtex';
74
    $format = 'bibtex';
62
}
75
}
63
elsif ($format =~ /dc$/) {
76
elsif ($format =~ /dc$/) {
64
    $marc = marc2dcxml(undef, undef, $biblionumber, $format);
77
    # TODO: Dublin Core leaks fields marked hidden by framework.
78
    $marc = marc2dcxml($marc, undef, $biblionumber, $format);
65
    $format = "dublin-core.xml";
79
    $format = "dublin-core.xml";
66
}
80
}
67
elsif ($format =~ /marc8/) {
81
elsif ($format =~ /marc8/) {
(-)a/opac/opac-showmarc.pl (-5 / +17 lines)
Lines 32-37 use C4::Biblio; Link Here
32
use C4::ImportBatch;
32
use C4::ImportBatch;
33
use C4::XSLT ();
33
use C4::XSLT ();
34
use C4::Templates;
34
use C4::Templates;
35
use Koha::RecordProcessor;
35
36
36
my $input       = new CGI;
37
my $input       = new CGI;
37
my $biblionumber = $input->param('id');
38
my $biblionumber = $input->param('id');
Lines 39-59 $biblionumber = int($biblionumber); Link Here
39
my $importid= $input->param('importid');
40
my $importid= $input->param('importid');
40
my $view= $input->param('viewas') || 'marc';
41
my $view= $input->param('viewas') || 'marc';
41
42
42
my $record;
43
my $record_unfiltered;
43
if ($importid) {
44
if ($importid) {
44
    my ($marc) = GetImportRecordMarc($importid);
45
    my ($marc) = GetImportRecordMarc($importid);
45
    $record = MARC::Record->new_from_usmarc($marc);
46
    $record_unfiltered = MARC::Record->new_from_usmarc($marc);
46
}
47
}
47
else {
48
else {
48
    $record =GetMarcBiblio($biblionumber);
49
    $record_unfiltered = GetMarcBiblio($biblionumber);
49
}
50
}
50
if(!ref $record) {
51
if(!ref $record_unfiltered) {
51
    print $input->redirect("/cgi-bin/koha/errors/404.pl");
52
    print $input->redirect("/cgi-bin/koha/errors/404.pl");
52
    exit;
53
    exit;
53
}
54
}
54
55
56
my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' });
57
my $record_filtered  = $record_unfiltered->clone();
58
my $record           = $record_processor->process($record_filtered);
59
55
if ($view eq 'card' || $view eq 'html') {
60
if ($view eq 'card' || $view eq 'html') {
61
    # FIXME: GetXmlBiblio needs filtering later.
56
    my $xml = $importid ? $record->as_xml(): GetXmlBiblio($biblionumber);
62
    my $xml = $importid ? $record->as_xml(): GetXmlBiblio($biblionumber);
63
    if (!$importid && $view eq 'html') {
64
        my $unfiltered_record = MARC::Record->new_from_xml($xml);
65
        my $frameworkcode = GetFrameworkCode($biblionumber);
66
        $record_processor->options({ frameworkcode => $frameworkcode});
67
        my $filtered_record = $record_processor->process($unfiltered_record);
68
        $xml = $filtered_record->as_xml();
69
    }
57
    my $xsl =  $view eq 'card' ? 'compact.xsl' : 'plainMARC.xsl';
70
    my $xsl =  $view eq 'card' ? 'compact.xsl' : 'plainMARC.xsl';
58
    my $htdocs = C4::Context->config('opachtdocs');
71
    my $htdocs = C4::Context->config('opachtdocs');
59
    my ($theme, $lang) = C4::Templates::themelanguage($htdocs, $xsl, 'opac', $input);
72
    my ($theme, $lang) = C4::Templates::themelanguage($htdocs, $xsl, 'opac', $input);
60
- 

Return to bug 11592