9 use HTML
::Template
::Pro
;
15 my $dbh = C4
::Context
->dbh;
19 my $op = $query->param('op');
21 my $prof_id = $query->param('prof_id');
22 my $printername = $query->param('printername');
23 my $paper_bin = $query->param('paper_bin');
24 my $tmpl_id = $query->param('tmpl_id');
25 my $offset_horz = $query->param('offset_horz');
26 my $offset_vert = $query->param('offset_vert');
27 my $creep_horz = $query->param('creep_horz');
28 my $creep_vert = $query->param('creep_vert');
29 my $units = $query->param('unit');
34 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
36 template_name
=> "labels/label-create-profile.tmpl",
40 flagsrequired
=> { catalogue
=> 1 },
45 if ( $op eq 'blank' || $op eq '' ) {
48 { unit
=> 'INCH', desc
=> 'Inches' },
49 { unit
=> 'CM', desc
=> 'Centimeters' },
50 { unit
=> 'MM', desc
=> 'Millimeters' },
51 { unit
=> 'POINT', desc
=> 'Postscript Points' },
54 my @tmpl = GetAllLabelTemplates
();
56 foreach my $data (@tmpl) {
57 push ( @tmpllist, {tmpl_id
=> $data->{'tmpl_id'},
58 tmpl_code
=> $data->{'tmpl_code'}} );
62 tmpllist
=> \
@tmpllist,
68 elsif ( $op eq 'Save' ) {
70 my $dberror = CreateProfile
(
71 $prof_id, $printername, $paper_bin, $tmpl_id, $offset_horz,
72 $offset_vert, $creep_horz, $creep_vert, $units
75 print $query->redirect("./label-profiles.pl");
79 # FIXME: This exposes all CGI vars. Surely there is a better way to do it? -fbcit
80 if ( $dberror =~ /Duplicate/ && $dberror =~ /$paper_bin/ ) {
81 $errmsg = "You cannot create duplicate profiles for $printername/$paper_bin.
82 Click the Back button on your browser and enter a different paper bin
95 warn "DB error: $dberror";
98 elsif ( $op eq 'Cancel' ) {
99 print $query->redirect("./label-profiles.pl");
103 output_html_with_http_headers
$query, $cookie, $template->output;