Bug 3390 Enabling ZIP compression in pdf generation to reduce file size
[koha.git] / labels / 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::Labels;
8 use C4::Output;
9 use C4::Context;
10 use HTML::Template::Pro;
11
12 # use Smart::Comments;
13
14 my $query = new CGI;
15 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
16     {
17         template_name   => "labels/label-home.tmpl",
18         query           => $query,
19         type            => "intranet",
20         authnotrequired => 0,
21         flagsrequired   => { catalogue => 1 },
22         debug           => 1,
23     }
24 );
25
26 # little block for displaying active layout/template/batch in templates
27 # ----------
28 my $batch_id     = $query->param('batch_id');
29 my $active_layout = get_active_layout();
30 my $active_template = GetActiveLabelTemplate();
31 my $active_layout_name = $active_layout->{'layoutname'};
32 my $active_template_name = $active_template->{'tmpl_code'};
33 # ----------
34
35 my $data = get_label_options();
36 my $op =  $query->param('op');
37 my $layout_id =  $query->param('layout_id');
38
39 my @label_templates = GetAllLabelTemplates();
40 my @printingtypes       = get_printingtypes();
41 my @layouts       = get_layouts();
42 my @barcode_types = get_barcode_types();
43 #my @batches = get_batches();   #This is not used afaics -fbcit
44
45 if ($op eq 'delete_layout') {   # had been assignment! serious error!
46         delete_layout($layout_id);
47 }
48
49 ###  $data
50
51 $template->param( guidebox => 1 ) if ( $data->{'guidebox'} );
52 $template->param( "papertype_$data->{'papertype'}"       => 1 );
53 $template->param( "$data->{'barcodetype'}_checked" => 1 );
54 $template->param( "startrow" . $data->{'startrow'} . "_checked" => 1 );
55 $template->param(
56     op => $op,
57     active_layout_name => $active_layout_name,
58     active_template_name => $active_template_name,
59
60     label_templates => \@label_templates,
61     barcode_types   => \@barcode_types,
62     printingtypes    => \@printingtypes,
63 layout_loop => \@layouts,
64
65 #batches => \@batches, #This is not used afaics -fbcit
66      id             => $data->{'id'},
67     barcodetype    => $data->{'barcodetype'},
68       papertype => $data->{'papertype'},
69
70     tx_author         => $data->{'author'},
71     tx_barcode        => $data->{'barcode'},
72    tx_title          => $data->{'title'},
73     tx_isbn           => $data->{'isbn'},
74     tx_issn           => $data->{'issn'},
75     tx_itemtype            => $data->{'itemtype'},
76     tx_dewey          => $data->{'dewey'},
77     tx_class          => $data->{'class'},
78     tx_subclass       => $data->{'subclass'},
79     tx_itemcallnumber => $data->{'itemcallnumber'},
80
81     startlabel     => $data->{'startlabel'},
82     fontsize       => $active_template->{'fontsize'},
83
84 );
85
86 output_html_with_http_headers $query, $cookie, $template->output;