koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/barcodes barcodesGenerator.pl,1.4,1.5


From: Joshua Ferraro
Subject: [Koha-cvs] CVS: koha/barcodes barcodesGenerator.pl,1.4,1.5
Date: Sun, 11 Sep 2005 18:52:43 -0700

Update of /cvsroot/koha/koha/barcodes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3661

Modified Files:
        barcodesGenerator.pl 
Log Message:
Several fixes to allow for creation of valid Code 128 barcodes.
A new function allows for printing of call number rather than title/author
(default behavior). These barcodes should work fine now with any scanner
capable of Code 128 (with a checksum).


Index: barcodesGenerator.pl
===================================================================
RCS file: /cvsroot/koha/koha/barcodes/barcodesGenerator.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** barcodesGenerator.pl        8 Nov 2004 19:47:16 -0000       1.4
--- barcodesGenerator.pl        12 Sep 2005 01:52:41 -0000      1.5
***************
*** 134,138 ****
        return $tmpFileName;
  }
! 
  # Takes inventary codes from database and if they are between
  # the interval specify by parameters, it generates the correspond barcodes
--- 134,148 ----
        return $tmpFileName;
  }
! sub getCallnum {
! #grabs a callnumber for the specified barcode
! my ($barcode) = @_;
! my $query = "select dewey from items,biblioitems where 
items.biblionumber=biblioitems.biblionumber and items.barcode=?";
! my $dbh = C4::Context->dbh;
! my $sth = $dbh->prepare($query);
! $sth->execute($barcode);
! my ($callnum) = $sth->fetchrow_array();
! warn "Call number is:".$barcode;
! return $callnum;
! }
  # Takes inventary codes from database and if they are between
  # the interval specify by parameters, it generates the correspond barcodes
***************
*** 144,148 ****
        # Assigns a temporary filename for the pdf file
        my $tmpFileName = &assingFilename($from, $to);
!       if ($rangeType eq 'continuous2') {
                # Set the temp directory for pdf´s files
                if (!defined($ENV{'TEMP'})) {
--- 154,159 ----
        # Assigns a temporary filename for the pdf file
        my $tmpFileName = &assingFilename($from, $to);
!       # warn "range type: ".$rangeType;
!       if ($rangeType eq 'continuous') {
                # Set the temp directory for pdf´s files
                if (!defined($ENV{'TEMP'})) {
***************
*** 163,166 ****
--- 174,178 ----
                        my $codeC = &checksum($code);
                        # Generate the corresponde barcode to $code
+                       # warn "Code is :-->".$codeC."<--";
                        my $barcode = $pdf->barcode(-font => $tr,       # The 
font object to use
                                                                                
-type => 'ean128',      # Standard of codification
***************
*** 188,193 ****
--- 200,208 ----
                        # Assigns the additional information to the barcode 
(Legend)
                        $text->translate($x - 48, $y - 22);
+                       warn "code is ".$codeC;
                        if ($text_under_label) {
                                $text->text($text_under_label);
+                       } else {
+                       $text->text(getCallnum($code));
                        }
                }
***************
*** 207,212 ****
                        $rangeCondition =  "AND (I.barcode >= " . $from . " AND 
I.barcode <="  . $to . " )";
                }
!                       
!               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";
                
                # Prepare the query
--- 222,227 ----
                        $rangeCondition =  "AND (I.barcode >= " . $from . " AND 
I.barcode <="  . $to . " )";
                }
!               warn "above the query"; 
!               my $query = "SELECT CONCAT('$numbersystem',REPEAT('0',((12 - 
LENGTH('$numbersystem')) - LENGTH(I.barcode))), I.barcode) AS Codigo, I.dewey 
as dewey B.title, B.author FROM biblio B, items I WHERE (I.biblionumber = 
B.biblioNumber ) " .$rangeCondition. " AND (I.barcode <> 'FALTA') ORDER BY 
Codigo";
                
                # Prepare the query
***************
*** 231,235 ****
                        # Barcode position
                        my ($page, $gfx, $text);
!                       while (my ($code,$title,$author) = 
$sth->fetchrow_array) {
                                # Generetase checksum
                                $code = &checksum($code);
--- 246,250 ----
                        # Barcode position
                        my ($page, $gfx, $text);
!                       while (my ($code,$dewey,$title,$author) = 
$sth->fetchrow_array) {
                                # Generetase checksum
                                $code = &checksum($code);
***************
*** 263,269 ****
                                        $text->text($text_under_label);
                                } else {
!                                       $text->text(substr $title, 0, 30);
                                        $text->translate($x - 48, $y - 29);
!                                       $text->text(substr $author, 0, 30);
                                }
                        }
--- 278,285 ----
                                        $text->text($text_under_label);
                                } else {
!                                       warn "here a dewey:".$dewey;
!                                       $text->text(substr $dewey, 0, 30);
                                        $text->translate($x - 48, $y - 29);
!                                       #$text->text(substr $author, 0, 30);
                                }
                        }
***************
*** 284,286 ****
  }
  
! barcodesGenerator($from, $to, $rangeType, $individualCodes,$text_under_label);
\ No newline at end of file
--- 300,302 ----
  }
  
! barcodesGenerator($from, $to, $rangeType, $individualCodes,$text_under_label);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]