[10/40] Work on Label Tool Homepage.
[koha.git] / labels / label-profiles.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::Pro;
10 use POSIX;
11
12
13 my $dbh         = C4::Context->dbh;
14 my $query       = new CGI;
15 my $op          = $query->param('op');
16 #my $prof_code   = $query->param('prof_code');
17 my $prof_id     = $query->param('prof_id');
18 #my $printername = $query->param('printername');
19 #my $tmpl_id     = $query->param('tmpl_id');
20 #my $paper_bin   = $query->param('paper_bin');
21 #my $offset_horz = $query->param('offset_horz');
22 #my $offset_vert = $query->param('offset_vert');
23 #my $creep_horz  = $query->param('creep_horz');
24 #my $creep_vert  = $query->param('creep_vert');
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 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
36     {
37         template_name   => "labels/label-profiles.tmpl",
38         query           => $query,
39         type            => "intranet",
40         authnotrequired => 1,
41         flagsrequired   => { catalogue => 1 },
42         debug           => 1,
43     }
44 );
45
46 my @resultsloop;
47
48 if ( $op eq 'delete' ) {
49     my $dberror = DeleteProfile($prof_id);
50     warn "DB returned error: $dberror" if $dberror;
51 }
52
53 @resultsloop = GetAllPrinterProfiles();
54
55 $template->param(
56     batch_id => $batch_id,
57     active_layout_name => $active_layout_name,
58     active_template_name => $active_template_name,
59
60     resultsloop => \@resultsloop,
61 );
62
63 output_html_with_http_headers $query, $cookie, $template->output;