Adding labels generator.
[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;
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
36 my $data = get_label_options();
37 my $op =  $query->param('op');
38 my $layout_id =  $query->param('layout_id');
39
40 my @label_templates = GetAllLabelTemplates();
41 my @printingtypes       = get_printingtypes();
42 my @layouts       = get_layouts();
43 my @barcode_types = get_barcode_types();
44 my @batches = get_batches();
45
46 if ($op = 'delete_layout') {
47 delete_layout($layout_id);
48 }
49
50
51
52  
53 ###  $data
54
55 $template->param( guidebox => 1 ) if ( $data->{'guidebox'} );
56 $template->param( "papertype_$data->{'papertype'}"       => 1 );
57 $template->param( "$data->{'barcodetype'}_checked" => 1 );
58 $template->param( "startrow" . $data->{'startrow'} . "_checked" => 1 );
59
60 $template->param(
61     op => $op,
62     active_layout_name => $active_layout_name,
63     active_template_name => $active_template_name,
64
65     label_templates => \@label_templates,
66     barcode_types   => \@barcode_types,
67     printingtypes    => \@printingtypes,
68 layout_loop => \@layouts,
69
70 batches => \@batches,
71      id             => $data->{'id'},
72     barcodetype    => $data->{'barcodetype'},
73       papertype => $data->{'papertype'},
74
75     tx_author         => $data->{'author'},
76     tx_barcode        => $data->{'barcode'},
77    tx_title          => $data->{'title'},
78     tx_isbn           => $data->{'isbn'},
79     tx_issn           => $data->{'issn'},
80     tx_itemtype            => $data->{'itemtype'},
81     tx_dewey          => $data->{'dewey'},
82     tx_class          => $data->{'class'},
83     tx_subclass       => $data->{'subclass'},
84     tx_itemcallnumber => $data->{'itemcallnumber'},
85
86     startlabel     => $data->{'startlabel'},
87     fontsize       => $active_template->{'fontsize'},
88
89     intranetcolorstylesheet =>
90       C4::Context->preference("intranetcolorstylesheet"),
91     intranetstylesheet => C4::Context->preference("intranetstylesheet"),
92     IntranetNav        => C4::Context->preference("IntranetNav"),
93 );
94
95 output_html_with_http_headers $query, $cookie, $template->output;