item rework: moved various accessor functions
[koha.git] / labels / label-create-template.pl
blob183ae66fb66e06a66858b8beea0ac5453f885394
1 #!/usr/bin/perl
3 use strict;
4 use CGI;
5 use C4::Auth;
6 use C4::Context;
7 use C4::Output;
8 use C4::Labels;
9 use HTML::Template::Pro;
10 use POSIX;
12 #use Data::Dumper;
13 #use Smart::Comments;
15 my $dbh = C4::Context->dbh;
16 my $query = new CGI;
17 ### $query
19 my $tmpl_code = $query->param('tmpl_code');
20 my $tmpl_desc = $query->param('tmpl_desc');
21 my $page_height = $query->param('page_height');
22 my $page_width = $query->param('page_width');
23 my $label_height = $query->param('label_height');
24 my $label_width = $query->param('label_width');
25 my $topmargin = $query->param('topmargin');
26 my $leftmargin = $query->param('leftmargin');
27 my $cols = $query->param('cols');
28 my $rows = $query->param('rows');
29 my $colgap = $query->param('colgap');
30 my $rowgap = $query->param('rowgap');
31 my $units = $query->param('units');
32 my $fontsize = $query->param('fontsize');
34 my $batch_id = $query->param('batch_id');
37 my $op = $query->param('op');
38 my @resultsloop;
40 my ( $template, $loggedinuser, $cookie );
42 if ( $op eq 'blank' ) {
44 my @units = (
45 { unit => 'INCH', desc => 'Inches' },
46 { unit => 'CM', desc => 'Centimeters' },
47 { unit => 'MM', desc => 'Millimeters' },
48 { unit => 'POINT', desc => 'Postscript Points' },
51 ( $template, $loggedinuser, $cookie ) = get_template_and_user(
53 template_name => "labels/label-create-template.tmpl",
54 query => $query,
55 type => "intranet",
56 authnotrequired => 1,
57 flagsrequired => { catalogue => 1 },
58 debug => 1,
62 $template->param(
63 units => \@units,
68 elsif ( $op eq 'create' ) {
69 CreateTemplate(
71 $tmpl_code, $tmpl_desc, $page_width,
72 $page_height, $label_width, $label_height, $topmargin,
73 $leftmargin, $cols, $rows, $colgap,
74 $rowgap, $fontsize, $units );
76 print $query->redirect("./label-templates.pl");
77 exit;
81 output_html_with_http_headers $query, $cookie, $template->output;