Bug 18807: t/db_dependent/www/batch.t fails
[koha.git] / svc / records / preview
blobc1bdc67625a01cf5c54388aacb41cb98dcb7fdb3
1 #!/usr/bin/perl
3 # This file is part of Koha.
5 # Copyright (C) 2013 BibLibre
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
20 use Modern::Perl;
21 use CGI;
22 use C4::Auth qw( get_template_and_user );
23 use C4::Biblio qw( GetMarcBiblio );
24 use C4::MarcModificationTemplates qw( ModifyRecordWithTemplate );
25 use C4::Output qw( output_html_with_http_headers );
26 use Koha::MetadataRecord::Authority;
28 my $query = CGI->new();
29 my $record_id = $query->param('record_id');
30 my $record_type = $query->param('record_type') || 'biblio';
31 my $mmtid = $query->param('mmtid'); # Marc modification template id
33 my $record;
34 if ( $record_type eq 'biblio' ) {
35 $record = GetMarcBiblio( $record_id );
36 } else {
37 my $authority = Koha::MetadataRecord::Authority->get_from_authid( $record_id );
38 $record = $authority->record;
41 if ( $mmtid ) {
42 ModifyRecordWithTemplate( $mmtid, $record );
45 my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
46 template_name => "catalogue/showmarc.tt",
47 query => $query,
48 type => "intranet",
49 authnotrequired => 1,
50 });
52 $template->param( MARC_FORMATTED => $record->as_formatted );
53 output_html_with_http_headers $query, $cookie, $template->output;