#!/usr/bin/perl
+# This file is part of koha
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA 02111-1307 USA
+
use strict;
use CGI;
use C4::Auth;
use C4::Output;
use C4::Interface::CGI::Output;
use C4::Context;
-use HTML::Template;
+
use GD::Barcode::UPCE;
use Data::Random qw(:all);
my $htdocs_path = C4::Context->config('intrahtdocs');
-use Data::Dumper;
-
my $query = new CGI;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
query => $query,
type => "intranet",
authnotrequired => 0,
- flagsrequired => { catalogue => 1 },
+ flagsrequired => { tools => 1 },
debug => 1,
}
);
my $conf_data = $sth->fetchrow_hashref;
-#warn Dumper $conf_data;
-
$sth->finish;
my @data;
}
$sth->finish;
-#warn Dumper @resultsloop;
-
-
-
-
#------------------------------------------------------
#lets write barcode files to tmp dir for every item in @resultsloop
-
-
binmode(FILE);
-foreach my $item (@resultsloop){
+foreach my $item (@resultsloop) {
+ my $random = int( rand(100000000000) ) + 999999999999;
-my $random = int( rand(100000000000)) + 999999999999;
-#warn "$random\n";
+ #warn "$random\n";
- $item->{'barcode'} = $random;
+ $item->{'barcode'} = $random;
-# my $itembarcode = $item->{'barcode'};
-# warn $item->{'barcode'};
+ # my $itembarcode = $item->{'barcode'};
+ # warn $item->{'barcode'};
+ my $filename = "$htdocs_path/barcodes/$item->{'barcode'}.png";
- my $filename = "$htdocs_path/barcodes/$item->{'barcode'}.png";
- #warn $filename;
- open(FILE, ">$filename");
+ #warn $filename;
+ open( FILE, ">$filename" );
- print FILE GD::Barcode->new('EAN13', $item->{'barcode'})->plot->png;
-# warn $GD::Barcode::errStr;
-
- close(FILE);
-
-#warn Dumper $item->{'barcode'};
-
-}
+ print FILE GD::Barcode->new( 'EAN13', $item->{'barcode'} )->plot->png;
+ # warn $GD::Barcode::errStr;
+ close(FILE);
+ #warn Dumper $item->{'barcode'};
+}
# lets pass the config setting
$template->param(
- resultsloop => \@resultsloop,
-
-
- itemtype_opt => $conf_data->{'itemtype'},
- papertype_opt => $conf_data->{'papertype'},
- author_opt => $conf_data->{'author'},
- barcode_opt => $conf_data->{'barcode'},
- id_opt => $conf_data->{'id'},
- type_opt => $conf_data->{'type'},
- title_opt => $conf_data->{'title'},
- isbn_opt => $conf_data->{'isbn'},
- dewey_opt => $conf_data->{'dewey'},
- class_opt => $conf_data->{'class'},
-
-
-
+ resultsloop => \@resultsloop,
+
+ itemtype_opt => $conf_data->{'itemtype'},
+ papertype_opt => $conf_data->{'papertype'},
+ author_opt => $conf_data->{'author'},
+ barcode_opt => $conf_data->{'barcode'},
+ id_opt => $conf_data->{'id'},
+ type_opt => $conf_data->{'type'},
+ title_opt => $conf_data->{'title'},
+ isbn_opt => $conf_data->{'isbn'},
+ dewey_opt => $conf_data->{'dewey'},
+ class_opt => $conf_data->{'class'},
+ subclass_opt => $conf_data->{'subclass'},
+ itemcallnumber_opt => $conf_data->{'itemcallnumber'},
intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),
);
output_html_with_http_headers $query, $cookie, $template->output;
-