Head & rel_2_2 merged
[koha.git] / barcodes / label-home.pl
1 #!/usr/bin/perl
2
3 use strict;
4 use CGI;
5 use C4::Auth;
6 use C4::Output;
7 use C4::Interface::CGI::Output;
8 use C4::Context;
9 use HTML::Template;
10
11 my $query = new CGI;
12 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
13     {
14         template_name   => "barcodes/label-home.tmpl",
15         query           => $query,
16         type            => "intranet",
17         authnotrequired => 0,
18         flagsrequired   => { catalogue => 1 },
19         debug           => 1,
20     }
21 );
22
23 my $dbh    = C4::Context->dbh;
24 my $query2 = "SELECT * FROM labels_conf LIMIT 1";
25 my $sth    = $dbh->prepare($query2);
26 $sth->execute();
27
28 my $data = $sth->fetchrow_hashref;
29 $sth->finish;
30
31 # next line passes a var like 'EAN13_cheched' to the tmpl ,
32 # which makes the barcodetype sticky in the dropbox
33
34 $template->param( "$data->{'barcodetype'}_checked"              => 1 );
35 $template->param( "startrow" . $data->{'startrow'} . "_checked" => 1 );
36 $template->param(
37     itemtype                => $data->{'itemtype'},
38     papertype               => $data->{'papertype'},
39     author                  => $data->{'author'},
40     barcode                 => $data->{'barcode'},
41     id                      => $data->{'id'},
42     barcodetype             => $data->{'barcodetype'},
43     title                   => $data->{'title'},
44     isbn                    => $data->{'isbn'},
45     dewey                   => $data->{'dewey'},
46     class                   => $data->{'class'},
47     startrow                => $data->{'startrow'},
48     intranetcolorstylesheet =>
49       C4::Context->preference("intranetcolorstylesheet"),
50     intranetstylesheet => C4::Context->preference("intranetstylesheet"),
51     IntranetNav        => C4::Context->preference("IntranetNav"),
52 );
53 output_html_with_http_headers $query, $cookie, $template->output;