Bug Fixing : Memberentry was broken.
[koha.git] / labels / label-edit-template.pl
1 #!/usr/bin/perl
2
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;
10 use POSIX;
11
12 # use Data::Dumper;
13
14 my $dbh       = C4::Context->dbh;
15 my $query     = new CGI;
16
17 my $tmpl_id = $query->param('tmpl_id');
18
19 my $width      = $query->param('width');
20 my $height     = $query->param('height');
21 my $topmargin  = $query->param('topmargin');
22 my $leftmargin = $query->param('leftmargin');
23 my $columns    = $query->param('columns');
24 my $rows       = $query->param('rows');
25 my $colgap     = $query->param('colgap');
26 my $rowgap     = $query->param('rowgap');
27
28 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
29     {
30         template_name   => "labels/label-edit-template.tmpl",
31         query           => $query,
32         type            => "intranet",
33         authnotrequired => 1,
34         flagsrequired   => { catalogue => 1 },
35         debug           => 1,
36     }
37 );
38
39 my $tmpl = GetSingleLabelTemplate($tmpl_id);
40
41 my @units = (
42     { unit => 'INCH',  desc => 'Inches' },
43     { unit => 'CM',    desc => 'Centimeters' },
44     { unit => 'MM',    desc => 'Millimeters' },
45     { unit => 'POINT', desc => 'Postscript Points' },
46 );
47
48 foreach my $unit (@units) {
49     if ( $unit->{'unit'} eq $tmpl->{'units'} ) {
50         $unit->{'selected'} = 1;
51     }
52 }
53
54 $template->param(
55
56     units => \@units,
57
58     tmpl_id      => $tmpl->{'tmpl_id'},
59     tmpl_code    => $tmpl->{'tmpl_code'},
60     tmpl_desc    => $tmpl->{'tmpl_desc'},
61     page_width   => $tmpl->{'page_width'},
62     page_height  => $tmpl->{'page_height'},
63     label_width  => $tmpl->{'label_width'},
64     label_height => $tmpl->{'label_height'},
65     topmargin    => $tmpl->{'topmargin'},
66     leftmargin   => $tmpl->{'leftmargin'},
67     cols         => $tmpl->{'cols'},
68     rows         => $tmpl->{'rows'},
69     colgap       => $tmpl->{'colgap'},
70     rowgap       => $tmpl->{'rowgap'},
71     fontsize     => $tmpl->{'fontsize'},
72     active       => $tmpl->{'active'},
73
74     intranetcolorstylesheet =>
75       C4::Context->preference("intranetcolorstylesheet"),
76     intranetstylesheet => C4::Context->preference("intranetstylesheet"),
77     IntranetNav        => C4::Context->preference("IntranetNav"),
78 );
79
80 output_html_with_http_headers $query, $cookie, $template->output;