Bug 22818: (QA follow-up) Translation fix + Branch notices
[koha.git] / cataloguing / editor.pl
blobb52c8505dec138d61435566c005005207e4a2eb6
1 #!/usr/bin/perl
3 # Copyright 2013 ByWater
5 # This file is part of Koha.
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>.
21 use Modern::Perl;
23 use CGI;
24 use MARC::Record;
26 use C4::Auth;
27 use C4::Biblio;
28 use C4::Context;
29 use C4::Output;
30 use DBIx::Class::ResultClass::HashRefInflator;
31 use Koha::Database;
32 use Koha::MarcSubfieldStructures;
33 use Koha::BiblioFrameworks;
34 use Koha::KeyboardShortcuts;
36 my $input = CGI->new;
38 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
40 template_name => 'cataloguing/editor.tt',
41 query => $input,
42 type => 'intranet',
43 flagsrequired => {
44 editcatalogue => {
45 'edit_catalogue' => 1,
46 'advanced_editor' => 1
52 my $schema = Koha::Database->new->schema;
54 my @keyboard_shortcuts = Koha::KeyboardShortcuts->search();
56 # Keyboard shortcuts
57 $template->param(
58 shortcuts => \@keyboard_shortcuts,
61 # Available import batches
62 $template->{VARS}->{editable_batches} = [ $schema->resultset('ImportBatch')->search(
64 batch_type => [ 'batch', 'webservice' ],
65 import_status => 'staged',
67 { result_class => 'DBIx::Class::ResultClass::HashRefInflator' },
68 ) ];
70 # Needed information for cataloging plugins
71 $template->{VARS}->{DefaultLanguageField008} = pack( 'A3', C4::Context->preference('DefaultLanguageField008') || 'eng' );
73 my $authtags = Koha::MarcSubfieldStructures->search({ authtypecode => { '!=' => '' }, 'frameworkcode' => '' });
74 $template->{VARS}->{authtags} = $authtags;
76 my $frameworks = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] });
77 $template->{VARS}->{frameworks} = $frameworks;
79 # Z39.50 servers
80 my $dbh = C4::Context->dbh;
81 $template->{VARS}->{z3950_servers} = $dbh->selectall_arrayref( q{
82 SELECT * FROM z3950servers
83 WHERE recordtype != 'authority' AND servertype = 'zed'
84 ORDER BY rank,servername
85 }, { Slice => {} } );
87 output_html_with_http_headers $input, $cookie, $template->output;