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

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

Return to bug 11592