7 use C4::Interface::CGI::Output;
10 use GD::Barcode::UPCE;
12 my $htdocs_path = C4::Context->config('intrahtdocs');
14 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
16 template_name => "barcodes/label-print.tmpl",
20 flagsrequired => { catalogue => 1 },
25 my $dbh = C4::Context->dbh;
26 my $query2 = "SELECT * FROM labels_conf LIMIT 1";
27 my $sth = $dbh->prepare($query2);
29 my $conf_data = $sth->fetchrow_hashref;
31 # get barcode type from $conf_data
32 my $barcodetype = $conf_data->{'barcodetype'};
36 my $query3 = "Select * from labels";
37 my $sth = $dbh->prepare($query3);
42 while ( my $data = $sth->fetchrow_hashref ) {
44 # lets get some summary info from each item
46 SELECT * FROM biblio,biblioitems,items WHERE itemnumber=? AND
47 items.biblioitemnumber=biblioitems.biblioitemnumber AND
48 biblioitems.biblionumber=biblio.biblionumber";
50 my $sth1 = $dbh->prepare($query1);
51 $sth1->execute( $data->{'itemnumber'} );
52 my $data1 = $sth1->fetchrow_hashref();
53 push( @resultsloop, $data1 );
60 #lets write barcode files to tmp dir for every item in @resultsloop
63 foreach my $item (@resultsloop) {
64 my $filename = "$htdocs_path/barcodes/$barcodetype-$item->{'barcode'}.png";
65 open( FILE, ">$filename" );
67 print FILE GD::Barcode->new( $barcodetype, $item->{'barcode'} )
71 $item->{'barcodeerror'} = 1;
77 resultsloop => \@resultsloop,
78 itemtype_opt => $conf_data->{'itemtype'},
79 papertype_opt => $conf_data->{'papertype'},
80 author_opt => $conf_data->{'author'},
81 id_opt => $conf_data->{'id'},
82 barcodetype_opt => $conf_data->{'barcodetype'},
83 title_opt => $conf_data->{'title'},
84 isbn_opt => $conf_data->{'isbn'},
85 dewey_opt => $conf_data->{'dewey'},
86 class_opt => $conf_data->{'class'},
87 intranetcolorstylesheet =>
88 C4::Context->preference("intranetcolorstylesheet"),
89 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
90 IntranetNav => C4::Context->preference("IntranetNav"),
92 output_html_with_http_headers $query, $cookie, $template->output;