[Koha-cvs] koha/barcodes label-print-pdf.pl [rel_2_2]

Mason James szrj1m at yahoo.com
Wed Apr 12 10:17:29 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch: 	rel_2_2
Changes by:	Mason James <sushi at savannah.gnu.org>	06/04/12 08:17:29

Modified files:
	barcodes       : label-print-pdf.pl 

Log message:
	Fixed hardcoded filename, and general tidyup, removed 2 unused modules.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/barcodes/label-print-pdf.pl.diff?only_with_tag=rel_2_2&tr1=1.1.2.1&tr2=1.1.2.2&r1=text&r2=text

Patches:
Index: koha/barcodes/label-print-pdf.pl
diff -u koha/barcodes/label-print-pdf.pl:1.1.2.1 koha/barcodes/label-print-pdf.pl:1.1.2.2
--- koha/barcodes/label-print-pdf.pl:1.1.2.1	Tue Apr 11 05:50:28 2006
+++ koha/barcodes/label-print-pdf.pl	Wed Apr 12 08:17:29 2006
@@ -9,15 +9,14 @@
 use HTML::Template;
 use PDF::Reuse;
 use PDF::Reuse::Barcode;
+use PDF::Report;
 
 my $htdocs_path = C4::Context->config('intrahtdocs');
 my $cgi         = new CGI;
 
 my $spine_text = "";
 
-#--------------------------------------------------------
 # get the printing settings
-
 my $dbh    = C4::Context->dbh;
 my $query2 = " SELECT * FROM labels_conf LIMIT 1 ";
 my $sth    = $dbh->prepare($query2);
@@ -31,8 +30,6 @@
 
 $sth->finish;
 
-#------------------
-
 # get the actual items to be printed.
 my @data;
 my $query3 = " Select * from labels ";
@@ -66,15 +63,10 @@
 my $upperRightX = 612;
 my $upperRightY = 792;
 
-#----------------------------------
 # setting up the pdf doc
-
 prFile("$htdocs_path/barcodes/new.pdf");
 prLogDir("$htdocs_path/barcodes");
-
-#prMbox ( $lowerLeftX, $lowerLeftY, $upperRightX, $upperRightY );
 prMbox( 0, 0, 612, 792 );
-
 prFont('Times-Roman');    # Just setting a font
 prFontSize(10);
 
@@ -85,36 +77,20 @@
 my $circ_width   = 207;
 my $colspace     = 27;
 
-my $x_pos_spine = 36;
-my $x_pos_circ1 = 135;
-my $x_pos_circ2 = 369;
-
-my $pageheight = 792;
-
-my $y_pos_initial = ( ( $pageheight - $margin ) - $label_height );
+my $x_pos_spine            = 36;
+my $x_pos_circ1            = 135;
+my $x_pos_circ2            = 369;
+my $pageheight             = 792;
+my $y_pos_initial          = ( ( $pageheight - $margin ) - $label_height );
 my $y_pos_initial_startrow =
   ( ( $pageheight - $margin ) - ( $label_height * $startrow ) );
 
-my $y_pos_initial = ( ( 792 - 36 ) - 90 );
-
-my $y_pos = $y_pos_initial_startrow;
-
-#my $y_pos            = $y_pos_initial;
+my $y_pos_initial    = ( ( 792 - 36 ) - 90 );
+my $y_pos            = $y_pos_initial_startrow;
 my $rowspace         = 36;
 my $page_break_count = $startrow;
 my $codetype         = 'Code39';
 
-# do border---------------
-my $str = "q\n";    # save the graphic state
-$str .= "4 w\n";                # border color red
-$str .= "0.0 0.0 0.0  RG\n";    # border color red
-$str .= "1 1 1 rg\n";           # fill color blue
-$str .= "0 0 612 792 re\n";     # a rectangle
-$str .= "B\n";                  # fill (and a little more)
-$str .= "Q\n";                  # save the graphic state
-
-# do border---------------
-
 prAdd($str);
 my $item;
 
@@ -122,7 +98,8 @@
 foreach $item (@resultsloop) {
     if ( $i2 == 1 ) {
 
-        #draw_boxes();
+       # uncomment this for guide boxes around barcode labels, good for testing.
+       #draw_boxes();
     }
 
     #building up spine text
@@ -154,20 +131,10 @@
 
 prEnd();
 
-#----------------------------------------------------------------------------
-
-use PDF::Table;
-use Acme::Comment;
-
-$file = '/usr/local/opus-dev/intranet/htdocs/intranet-tmpl/barcodes/new.pdf';
-use PDF::Report;
+$file = "$htdocs_path/barcodes/new.pdf";
 
 my $pdf = new PDF::Report( File => $file );
 
-# my $pdf = new PDF::Report(PageSize => "letter",
-#                                  PageOrientation => "Landscape");
-
-#$pdf->newpage($nopage);
 my $pagenumber = 1;
 $pdf->openpage($pagenumber);
 
@@ -238,11 +205,8 @@
         $firstrow = 1;
     }
 
-    #$pdf->drawRect(
-    #    $x_pos_spine, $y_pos,
-    #    ( $x_pos_spine + $spine_width ),
-    #    ( $y_pos - $label_height )
-    #);
+# uncomment this for guide boxes around spine labels, good for testing.
+#$pdf->drawRect( $x_pos_spine, $y_pos, ( $x_pos_spine + $spine_width ), ( $y_pos - $label_height ));
 
     $y_pos = ( $y_pos - $label_height );
     if ( $page_break_count == 8 ) {
@@ -253,51 +217,34 @@
         $i2               = 0;
         $y_pos            = ( $y_pos_initial + 90 );
     }
-
     $page_break_count++;
     $i2++;
-
 }
-$DB::single = 1;
 $pdf->saveAs($file);
 
-#------------------------------------------------
-
 print $cgi->redirect("/intranet-tmpl/barcodes/new.pdf");
 
-# draw boxes------------------
 sub draw_boxes {
-
     my $y_pos_initial = ( ( 792 - 36 ) - 90 );
     my $y_pos         = $y_pos_initial;
     my $i             = 1;
 
     for ( $i = 1 ; $i <= 8 ; $i++ ) {
-
         &drawbox( $x_pos_spine, $y_pos, ($spine_width), ($label_height) );
-
-        &drawbox( $x_pos_circ1, $y_pos, ($circ_width), ($label_height) );
-        &drawbox( $x_pos_circ2, $y_pos, ($circ_width), ($label_height) );
-
+        &drawbox( $x_pos_circ1, $y_pos, ($circ_width),  ($label_height) );
+        &drawbox( $x_pos_circ2, $y_pos, ($circ_width),  ($label_height) );
         $y_pos = ( $y_pos - $label_height );
-
     }
 }
 
-# draw boxes------------------
-
 sub build_circ_barcode {
     my ( $x_pos_circ, $y_pos, $value, $barcodetype ) = @_;
-
-    #$DB::single = 1;
-
     if ( $barcodetype eq 'EAN13' ) {
 
         #testing EAN13 barcodes hack
         $value = $value . '000000000';
         $value =~ s/-//;
         $value = substr( $value, 0, 12 );
-
         eval {
             PDF::Reuse::Barcode::EAN13(
                 x     => ( $x_pos_circ + 27 ),
@@ -317,7 +264,6 @@
         if ($@) {
             $item->{'barcodeerror'} = 1;
         }
-
     }
     elsif ( $barcodetype eq 'Code39' ) {
 
@@ -508,8 +454,6 @@
     }
 }
 
-#-----------------------------
-
 sub drawbox {
     my ( $llx, $lly, $urx, $ury ) = @_;
 
@@ -521,6 +465,5 @@
     $str .= "Q\n";                         # save the graphic state
 
     prAdd($str);
-
 }
 





More information about the Koha-cvs mailing list