|
Lines 39-72
$biblionumber = int($biblionumber);
Link Here
|
| 39 |
my $importid= $input->param('importid'); |
39 |
my $importid= $input->param('importid'); |
| 40 |
my $view= $input->param('viewas') || 'marc'; |
40 |
my $view= $input->param('viewas') || 'marc'; |
| 41 |
|
41 |
|
| 42 |
my $record_unfiltered; |
42 |
my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' }); |
|
|
43 |
|
| 44 |
my $record; |
| 43 |
if ($importid) { |
45 |
if ($importid) { |
| 44 |
my ($marc) = GetImportRecordMarc($importid); |
46 |
my ($marc) = GetImportRecordMarc($importid); |
| 45 |
$record_unfiltered = MARC::Record->new_from_usmarc($marc); |
47 |
$record = MARC::Record->new_from_usmarc($marc); |
| 46 |
} |
48 |
} |
| 47 |
else { |
49 |
else { |
| 48 |
$record_unfiltered = GetMarcBiblio($biblionumber); |
50 |
$record = GetMarcBiblio($biblionumber); |
|
|
51 |
my $frameworkcode = GetFrameworkCode($biblionumber); |
| 52 |
$record_processor->options({ frameworkcode => $frameworkcode}); |
| 49 |
} |
53 |
} |
| 50 |
if(!ref $record_unfiltered) { |
54 |
|
|
|
55 |
if(!ref $record) { |
| 51 |
print $input->redirect("/cgi-bin/koha/errors/404.pl"); |
56 |
print $input->redirect("/cgi-bin/koha/errors/404.pl"); |
| 52 |
exit; |
57 |
exit; |
| 53 |
} |
58 |
} |
| 54 |
|
59 |
|
| 55 |
my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' }); |
60 |
$record_processor->process($record); |
| 56 |
my $record_filtered = $record_unfiltered->clone(); |
|
|
| 57 |
my $record = $record_processor->process($record_filtered); |
| 58 |
|
61 |
|
| 59 |
if ($view eq 'card' || $view eq 'html') { |
62 |
if ($view eq 'card' || $view eq 'html') { |
| 60 |
# FIXME: GetXmlBiblio needs filtering later. |
63 |
my $xml = $record->as_xml; |
| 61 |
my $xml = $importid ? $record->as_xml(): GetXmlBiblio($biblionumber); |
64 |
my $xsl = $view eq 'card' ? 'compact.xsl' : 'plainMARC.xsl'; |
| 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 |
} |
| 69 |
my $xsl = $view eq 'card' ? 'compact.xsl' : 'plainMARC.xsl'; |
| 70 |
my $htdocs = C4::Context->config('opachtdocs'); |
65 |
my $htdocs = C4::Context->config('opachtdocs'); |
| 71 |
my ($theme, $lang) = C4::Templates::themelanguage($htdocs, $xsl, 'opac', $input); |
66 |
my ($theme, $lang) = C4::Templates::themelanguage($htdocs, $xsl, 'opac', $input); |
| 72 |
$xsl = "$htdocs/$theme/$lang/xslt/$xsl"; |
67 |
$xsl = "$htdocs/$theme/$lang/xslt/$xsl"; |
| 73 |
- |
|
|