koha-cvs
[Top][All Lists]
Advanced

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

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


From: Mason James
Subject: [Koha-cvs] koha/barcodes label-print-pdf.pl [dev_week]
Date: Thu, 05 Jul 2007 15:19:43 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         dev_week
Changes by:     Mason James <sushi>     07/07/05 15:19:43

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

Log message:
        barcode and spine text , now sitting inside same label.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/label-print-pdf.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.1.2.2.2.9&r2=1.1.2.2.2.10

Patches:
Index: label-print-pdf.pl
===================================================================
RCS file: /sources/koha/koha/barcodes/label-print-pdf.pl,v
retrieving revision 1.1.2.2.2.9
retrieving revision 1.1.2.2.2.10
diff -u -b -r1.1.2.2.2.9 -r1.1.2.2.2.10
--- label-print-pdf.pl  18 Jan 2007 04:43:56 -0000      1.1.2.2.2.9
+++ label-print-pdf.pl  5 Jul 2007 15:19:43 -0000       1.1.2.2.2.10
@@ -12,6 +12,7 @@
 use PDF::Reuse::Barcode;
 use POSIX;
 use C4::Labels;
+use Smart::Comments;
 
 my $htdocs_path = C4::Context->config('intrahtdocs');
 my $cgi         = new CGI;
@@ -23,6 +24,13 @@
 my $template     = GetActiveLabelTemplate();
 my $conf_data    = get_label_options();
 my @resultsloop  = get_label_items();
+
+$DB::single = 1;
+
+### $template
+### $conf_data
+# @resultsloop
+
 my $barcodetype  = $conf_data->{'barcodetype'};
 my $printingtype = $conf_data->{'printingtype'};
 my $guidebox     = $conf_data->{'guidebox'};
@@ -30,15 +38,26 @@
 my $fontsize     = $template->{'fontsize'};
 my $units        = $template->{'units'};
 
+my $printingtype = 'BAR';
+my $guidebox     = 1;
+
+=c
+################### defaults for testing
+my $barcodetype  = 'CODE39';
+my $printingtype = 'BARBIB';
+my $guidebox     = 1;
+my $start_label  = 1;
+my $units        = 'POINTS'
+=cut
+
+my $fontsize = 3;
+
 #warn "UNITS $units";
 #warn "fontsize = $fontsize";
 #warn Dumper $template;
 
 my $unitvalue = GetUnitsValue($units);
 
-#warn $unitvalue;
-#warn $units;
-
 my $tmpl_code = $template->{'tmpl_code'};
 my $tmpl_desc = $template->{'tmpl_desc'};
 
@@ -108,7 +127,13 @@
 }
 
 else {
+
+    #eval {
     $rowcount = ceil( $start_label / $label_cols );
+
+    #} ;
+    #$rowcount = 1 if $@;
+
     $colcount = ( $start_label - ( ( $rowcount - 1 ) * $label_cols ) );
 
     $x_pos = $left_margin + ( $label_width * ( $colcount - 1 ) ) +
@@ -121,38 +146,66 @@
 
 warn "ROW COL $rowcount, $colcount";
 
-#my $barcodetype = 'Code39';
+my $barcodetype = 'Code39';
 
+#
+#    main foreach loop
+#
+
+    $printingtype = 'BARBIB';
 foreach $item (@resultsloop) {
+        warn "$x_pos, $y_pos, $label_width, $label_height";
+    my $barcode = $item->{'barcode'};
 
-    warn "-----------------\nbar: $item->{'barcode'}";
     if ($guidebox) {
         drawbox( $x_pos, $y_pos, $label_width, $label_height );
     }
 
-    if ( $printingtype eq 'spine' || $printingtype eq 'both' ) {
-        if ($guidebox) {
-            drawbox( $x_pos, $y_pos, $label_width, $label_height );
+
+    if ( $printingtype eq 'BAR' ) {
+        DrawBarcode( $x_pos, $y_pos, $label_height, $label_width, $barcode,
+            $barcodetype );
+        CalcNextLabelPos();
         }
+    elsif ( $printingtype =~ m/BARBIB/ ) {
+# reposoitioning barcode up the top of label
+        my $barcode_height = $label_height/2;
+        my $text_height = $label_height/2;
+        my $barcode_y = $y_pos +  ($label_height/2);
+
+        DrawBarcode( $x_pos, $barcode_y , $barcode_height, $label_width, 
$barcode,
+            $barcodetype );
+        DrawSpineText( $y_pos, $text_height, $fontsize, $x_pos,
+            $left_text_margin, $text_wrap_cols, \$item, \$conf_data );
+
+        CalcNextLabelPos();
 
+    } # correct
+    elsif ( $printingtype eq  'BIBBAR' ) {
+        my $barcode_height = $label_height/2;
+        DrawBarcode( $x_pos, $y_pos, $barcode_height, $label_width, $barcode,
+            $barcodetype );
         DrawSpineText( $y_pos, $label_height, $fontsize, $x_pos,
             $left_text_margin, $text_wrap_cols, \$item, \$conf_data );
+
         CalcNextLabelPos();
     }
 
-    if ( $printingtype eq 'barcode' || $printingtype eq 'both' ) {
-        if ($guidebox) {
-            drawbox( $x_pos, $y_pos, $label_width, $label_height );
-        }
 
-        DrawBarcode( $x_pos, $y_pos, $label_height, $label_width,
-            $item->{'barcode'}, $barcodetype );
-        CalcNextLabelPos();
-    }
+
+
+
+
+
 
 }    # end for item loop
 prEnd();
 
+#
+#
+#
+#
+#
 sub CalcNextLabelPos {
     if ( $colcount lt $label_cols ) {
 




reply via email to

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