9 use HTML::Template::Pro;
13 my $dbh = C4::Context->dbh;
16 my $op = $query->param('op');
17 my $prof_id = $query->param('prof_id');
18 my $offset_horz = $query->param('offset_horz');
19 my $offset_vert = $query->param('offset_vert');
20 my $creep_horz = $query->param('creep_horz');
21 my $creep_vert = $query->param('creep_vert');
22 my $units = $query->param('unit');
24 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
26 template_name => "labels/label-edit-profile.tmpl",
30 flagsrequired => { catalogue => 1 },
35 if ($op eq '' || undef) {
36 my $prof = GetSinglePrinterProfile($prof_id);
38 my $tmpl = GetSingleLabelTemplate($prof->{'tmpl_id'});
47 { unit => 'INCH', desc => 'Inches' },
48 { unit => 'CM', desc => 'Centimeters' },
49 { unit => 'MM', desc => 'Millimeters' },
50 { unit => 'POINT', desc => 'Postscript Points' },
53 foreach my $unit (@units) {
54 if ( $unit->{'unit'} eq $prof->{'unit'} ) {
55 $unit->{'selected'} = 1;
63 prof_id => $prof->{'prof_id'},
64 printername => $prof->{'printername'},
65 paper_bin => $prof->{'paper_bin'},
66 tmpl_code => $tmpl->{'tmpl_code'},
67 prof_code => $prof->{'prof_code'},
68 offset_horz => $prof->{'offset_horz'},
69 offset_vert => $prof->{'offset_vert'},
70 creep_horz => $prof->{'creep_horz'},
71 creep_vert => $prof->{'creep_vert'},
75 elsif ($op eq 'Save') {
76 warn "Units are now $units";
78 SaveProfile( $prof_id, $offset_horz, $offset_vert, $creep_horz, $creep_vert, $units );
79 print $query->redirect("./label-profiles.pl");
83 elsif ($op eq 'Cancel') {
84 print $query->redirect("./label-profiles.pl");
88 output_html_with_http_headers $query, $cookie, $template->output;