Dear All,<div>I installed Koha and its working. Cant generate barcodes. Using on Winxp. Internal server error showing whenever trying to generate barcode. <a href="http://barcodesgenerator.pl">barcodesgenerator.pl</a> is as follows. Whenever running the perl module "you have an error in your sql syntax.........." message displaying. plz help. thanx in advance<br clear="all">
<div><br></div>-- #!/usr/bin/perl<div><br></div><div># script to generate items barcodes</div><div># written 07/04</div><div># by Veleda Matias - <a href="mailto:matias_veleda@hotmail.com">matias_veleda@hotmail.com</a> - Physics Library UNLP Argentina and</div>
<div># Castañeda Sebastian - <a href="mailto:seba3c@yahoo.com.ar">seba3c@yahoo.com.ar</a> - Physics Library UNLP Argentina and</div><div><br></div><div># This file is part of Koha.</div><div>#</div><div># Koha is free software; you can redistribute it and/or modify it under the</div>
<div># terms of the GNU General Public License as published by the Free Software</div><div># Foundation; either version 2 of the License, or (at your option) any later</div><div># version.</div><div>#</div><div># Koha is distributed in the hope that it will be useful, but WITHOUT ANY</div>
<div># WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR</div><div># A PARTICULAR PURPOSE. See the GNU General Public License for more details.</div><div>#</div><div># You should have received a copy of the GNU General Public License along with</div>
<div># Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,</div><div># Suite 330, Boston, MA 02111-1307 USA</div><div><br></div><div>require Exporter;</div><div><br></div><div>use strict;</div><div>
<br></div><div>use CGI;</div><div>use C4::Context;</div><div>use C4::Output;</div><div>use HTML::Template;</div><div>use PDF::API2;</div><div>use PDF::API2::Page;</div><div>use PDF::API2::Basic::PDF::Utils;</div><div>use C4::Barcodes::PrinterConfig;</div>
<div>use Time::localtime;</div><div><br></div><div><br></div><div># This function returns the path to deal with the correct files, considering</div><div># templates set and language.</div><div>sub getPath {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my $type = shift @_;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>my $templatesSet = C4::Context->preference('template');</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my $lang = C4::Context->preference('opaclanguages');</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>if ($type eq "intranet") {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>return "$ENV{'DOCUMENT_ROOT'}/intranet-tmpl/$templatesSet/$lang";</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>} else {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>return "$ENV{'DOCUMENT_ROOT'}/opac-tmpl/$templatesSet/$lang";</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div>}</div><div><br></div><div># Load a configuration file. Before use this function, check if that file exists.</div><div>sub loadConfFromFile {</div>
<div> my $fileName = shift @_;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my %keyValues;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>open FILE, "<$fileName";</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>while (<FILE>) {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>chomp;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if (/\s*([\w_]*)\s*=\s*([\[\]\<\>\w_\s:@,\.-]*)\s*/) {</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>$keyValues{$1} = $2;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>close FILE;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>return %keyValues;</div><div>}</div><div><br></div><div># Save settings to a configuration file. It delete previous configuration settings.</div>
<div>sub saveConfToFile {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my $fileName = shift @_;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my %keyValues = %{shift @_};</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>my $i;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>open FILE, ">$fileName";</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my $i;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>foreach $i (keys(%keyValues)) {</div><div> print FILE $i." = ".$keyValues{$i}."\n";</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>close FILE;</div><div>}</div><div><br></div><div># Load the config file.</div><div>my $filenameConf = &getPath("intranet")."/includes/labelConfig/itemsLabelConfig.conf";</div>
<div>my %labelConfig = &loadConfFromFile($filenameConf);</div><div><br></div><div># Creates a CGI object and take its parameters</div><div>my $cgi = new CGI;</div><div>my $from = $cgi->param('from');</div><div>
my $to = $cgi->param('to');</div><div>my $individualCodes = $cgi->param('individualCodes');</div><div>my $rangeType = $cgi->param('rangeType');</div><div>my $pageType = $cgi->param('pages');</div>
<div>my $label = $cgi->param('label');</div><div>my $numbersystem = $cgi->param('numbersystem');</div><div>my $text_under_label = $cgi->param('text_under_label');</div><div><br></div><div>
# Generate the checksum from an inventary code</div><div>sub checksum {</div><div><br></div><div> sub calculateDigit {</div><div> my $code = shift @_;</div><div> my $sum = 0;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> my $odd_parity = 1;</div>
<div> my $i;</div><div> for ($i = length($code) - 1; $i >= 0; $i--){</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> if ( $odd_parity ) {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> $sum = $sum + ( 3 * substr($code, $i, 1) );</div>
<div> } else {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$sum = $sum + substr($code, $i, 1); }</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> $odd_parity = !$odd_parity;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span> }</div><div> my $check_digit = 10 - ($sum%10);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if ($check_digit==10) {</div><div>
<span class="Apple-tab-span" style="white-space:pre"> </span>$check_digit=0;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> return $code.$check_digit;</div>
<div> }</div><div><br></div><div> my $currentCode = shift @_;</div><div> $currentCode = &calculateDigit($currentCode);</div><div> return $currentCode;</div><div>}</div><div><br></div><div># Assigns a temporary name to the PDF file</div>
<div>sub assingFilename {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my ($from, $to) = @_;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my $ip = $cgi->remote_addr();</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>my $random = int(rand(1000000));</div><div> my $timeObj = localtime();</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my ($day, $month, $year, $hour, $min, $sec) = ($timeObj->mday,</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span> $timeObj->mon + 1,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> $timeObj->year + 1900,</div><div>
<span class="Apple-tab-span" style="white-space:pre"> </span> $timeObj->hour,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> $timeObj->min,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> $timeObj->sec);</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>my $tmpFileName = $random.'-'.$ip.'-(From '.$from.' to '.$to.')-['.$day.'.'.$month.'.'.$year.']-['.$hour.':'.$min.':'.$sec.'].pdf';</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>return $tmpFileName;</div><div>}</div><div><br></div><div># Takes inventary codes from database and if they are between</div><div># the interval specify by parameters, it generates the correspond barcodes</div>
<div>sub barcodesGenerator {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my ($from, $to, $rangeType, $individualCodes,$text_under_label) = @_;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Returns a database handler</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>my $dbh = C4::Context->dbh;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Create the query to database</div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Assigns a temporary filename for the pdf file</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>my $tmpFileName = &assingFilename($from, $to);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if ($rangeType eq 'continuous2') {</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span># Set the temp directory for pdf´s files</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if (!defined($ENV{'TEMP'})) {</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>$ENV{'TEMP'} = '/tmp/';</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$tmpFileName = $ENV{'TEMP'}.$tmpFileName;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span># Creates a PDF object</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my $pdf = PDF::API2->new(-file => $tmpFileName);</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span># Set the positions where barcodes are going to be placed</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>C4::Barcodes::PrinterConfig::setPositionsForX($labelConfig{'marginLeft'}, $labelConfig{'labelWidth'}, $labelConfig{'columns'}, $labelConfig{'pageType'});</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>C4::Barcodes::PrinterConfig::setPositionsForY($labelConfig{'marginBottom'}, $labelConfig{'labelHeigth'}, $labelConfig{'rows'}, $labelConfig{'pageType'});</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span># Creates a font object</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my $tr = $pdf->corefont('Helvetica-Bold');</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span># Barcode position</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my ($page, $gfx, $text);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>for (my $code=$from; $code<=$to; $code++) {</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span># Generetase checksum</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my $codeC = &checksum($code);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Generate the corresponde barcode to $code</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>my $barcode = $pdf->barcode(-font => $tr,<span class="Apple-tab-span" style="white-space:pre"> </span># The font object to use</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>-type => 'ean128',<span class="Apple-tab-span" style="white-space:pre"> </span># Standard of codification</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>-code => $codeC, # Text to codify</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>-extn<span class="Apple-tab-span" style="white-space:pre"> </span>=> '012345',<span class="Apple-tab-span" style="white-space:pre"> </span># Barcode extension (if it is aplicable)</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>-umzn => 10,<span class="Apple-tab-span" style="white-space:pre"> </span># Top limit of the finished bar</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>-lmzn => 10,<span class="Apple-tab-span" style="white-space:pre"> </span># Bottom limit of the finished bar</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>-zone => 15,<span class="Apple-tab-span" style="white-space:pre"> </span># Bars size</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>-quzn => 0,<span class="Apple-tab-span" style="white-space:pre"> </span># Space destinated for legend</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>-ofwt => 0.01,<span class="Apple-tab-span" style="white-space:pre"> </span># Bars width</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>-fnsz => 8,<span class="Apple-tab-span" style="white-space:pre"> </span># Font size</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>-text => ''</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>(my $x, my $y, $pdf, $page, $gfx, $text, $tr, $label) = C4::Barcodes::PrinterConfig::getLabelPosition(</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>$label,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$pdf,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$page,</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>$gfx,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$text,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$tr,</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>$pageType);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Assigns a barcodes to $gfx</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$gfx->barcode($barcode, $x, $y , (72/$labelConfig{'systemDpi'}));</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span># Assigns the additional information to the barcode (Legend)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$text->translate($x - 48, $y - 22);</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>if ($text_under_label) {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$text->text($text_under_label);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Writes the objects added in $gfx to $page</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$pdf->finishobjects($page,$gfx, $text);</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span># Save changes to the PDF</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$pdf->saveas;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Close the conection with the PDF file</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>$pdf->end;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Show the PDF file</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>print $cgi->redirect("/cgi-bin/koha/barcodes/pdfViewer.pl?tmpFileName=$tmpFileName");</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>} else {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my $rangeCondition;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if ($individualCodes ne "") {</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>$rangeCondition = "AND (I.barcode IN " . $individualCodes . ")";</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>} else {</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>$rangeCondition = "AND (I.barcode >= " . $from . " AND I.barcode <=" . $to . " )";</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my $query = "SELECT CONCAT('$numbersystem',REPEAT('0',((12 - LENGTH('$numbersystem')) - LENGTH(I.barcode))), I.barcode) AS Codigo, B.title, B.author FROM biblio B, items I WHERE (I.biblionumber = B.biblioNumber ) " .$rangeCondition. " AND (I.barcode <> 'FALTA') ORDER BY Codigo";</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Prepare the query</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my $sth = $dbh->prepare($query);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Executes the query</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>$sth->execute;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if ($sth->rows) { # There are inventary codes</div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Set the temp directory for pdf´s files</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>if (!defined($ENV{'TEMP'})) {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$ENV{'TEMP'} = '/tmp/';</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Assigns a temporary filename for the pdf file</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my $tmpFileName = &assingFilename($from, $to);</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>$tmpFileName = $ENV{'TEMP'}.$tmpFileName;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Creates a PDF object</div><div>
<span class="Apple-tab-span" style="white-space:pre"> </span>my $pdf = PDF::API2->new(-file => $tmpFileName);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Set the positions where barcodes are going to be placed</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>C4::Barcodes::PrinterConfig::setPositionsForX($labelConfig{'marginLeft'}, $labelConfig{'labelWidth'}, $labelConfig{'columns'}, $labelConfig{'pageType'});</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>C4::Barcodes::PrinterConfig::setPositionsForY($labelConfig{'marginBottom'}, $labelConfig{'labelHeigth'}, $labelConfig{'rows'}, $labelConfig{'pageType'});</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span># Creates a font object</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my $tr = $pdf->corefont('Helvetica-Bold');</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span># Barcode position</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>my ($page, $gfx, $text);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>while (my ($code,$title,$author) = $sth->fetchrow_array) {</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span># Generetase checksum</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$code = &checksum($code);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Generate the corresponde barcode to $code</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>my $barcode = $pdf->barcode(-font => $tr,<span class="Apple-tab-span" style="white-space:pre"> </span># The font object to use</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>-type => 'ean13',<span class="Apple-tab-span" style="white-space:pre"> </span># Standard of codification</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>-code => $code, # Text to codify</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>-extn<span class="Apple-tab-span" style="white-space:pre"> </span>=> '012345',<span class="Apple-tab-span" style="white-space:pre"> </span># Barcode extension (if it is aplicable)</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>-umzn => 10,<span class="Apple-tab-span" style="white-space:pre"> </span># Top limit of the finished bar</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>-lmzn => 10,<span class="Apple-tab-span" style="white-space:pre"> </span># Bottom limit of the finished bar</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>-zone => 15,<span class="Apple-tab-span" style="white-space:pre"> </span># Bars size</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>-quzn => 0,<span class="Apple-tab-span" style="white-space:pre"> </span># Space destinated for legend</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>-ofwt => 0.01,<span class="Apple-tab-span" style="white-space:pre"> </span># Bars width</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>-fnsz => 8,<span class="Apple-tab-span" style="white-space:pre"> </span># Font size</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>-text => ''</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>(my $x, my $y, $pdf, $page, $gfx, $text, $tr, $label) = C4::Barcodes::PrinterConfig::getLabelPosition(</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>$label,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$pdf,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$page,</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>$gfx,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$text,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$tr,</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>$pageType);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Assigns a barcodes to $gfx</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$gfx->barcode($barcode, $x, $y , (72/$labelConfig{'systemDpi'}));</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span># Assigns the additional information to the barcode (Legend)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$text->translate($x - 48, $y - 22);</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>if ($text_under_label) {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$text->text($text_under_label);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>} else {</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>$text->text(substr $title, 0, 30);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$text->translate($x - 48, $y - 29);</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>$text->text(substr $author, 0, 30);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span># Writes the objects added in $gfx to $page</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$pdf->finishobjects($page,$gfx, $text);</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span># Save changes to the PDF</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$pdf->saveas;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Close the conection with the PDF file</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>$pdf->end;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Show the PDF file</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>print $cgi->redirect("/cgi-bin/koha/barcodes/pdfViewer.pl?tmpFileName=$tmpFileName");</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>} else {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Rollback and shows the error legend</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>print $cgi->redirect("/cgi-bin/koha/barcodes/<a href="http://barcodes.pl?error=1">barcodes.pl?error=1</a>");</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$sth->finish;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div>
<div>}</div><div><br></div><div>barcodesGenerator($from, $to, $rangeType, $individualCodes,$text_under_label);</div>Prasenjit Ghosh,<br>S.V.I.S.T<br>Contact:9836073978<br>
</div>