[Koha-cvs] koha/C4 Labels.pm [dev_week]

Mason James szrj1m at yahoo.com
Sat Oct 20 08:45:55 CEST 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		dev_week
Changes by:	Mason James <sushi>	07/10/20 06:45:55

Modified files:
	C4             : Labels.pm 

Log message:
	 working with new draw_text_block_manual() sub.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Labels.pm?cvsroot=koha&only_with_tag=dev_week&r1=1.3.4.47&r2=1.3.4.48

Patches:
Index: Labels.pm
===================================================================
RCS file: /sources/koha/koha/C4/Labels.pm,v
retrieving revision 1.3.4.47
retrieving revision 1.3.4.48
diff -u -b -r1.3.4.47 -r1.3.4.48
--- Labels.pm	19 Oct 2007 06:15:54 -0000	1.3.4.47
+++ Labels.pm	20 Oct 2007 06:45:55 -0000	1.3.4.48
@@ -65,7 +65,7 @@
   &add_batch &SetFontSize &printText
   &GetItemFields
   &get_text_fields &get_batch_count
-  get_layout  &add_layout
+  get_layout  &add_layout &get_sorted_text
 
   &save_layout
   &set_active_layout &by_order
@@ -236,6 +236,25 @@
     return @lines;
 }
 
+sub get_sorted_text {
+    my ($conf_data, $item) = @_;
+    my $layout_id = $$conf_data->{'id'};
+
+    my $str_fields = get_text_fields( $layout_id, 'codes');
+    my @fields = split( ' ', $str_fields );
+
+    my @sorted;
+    foreach my $field (@fields) {
+        if ( $$conf_data->{"$field"} && $$item->{"$field"} ) {
+            push (@sorted,  $$item->{"$field"} );
+        }
+    }
+    return (@sorted);
+}
+
+
+
+# return a list of active and sorted fields
 sub get_text_fields {
     my ( $layout_id, $sorttype ) = @_;
 
@@ -715,7 +734,7 @@
         $data1->{'summary'} =
           "$data1->{'barcode'}, $data1->{'title'}, $data1->{'isbn'}";
 
-        # $data1
+        # ## $data1
 
         push( @resultsloop, $data1 );
         $sth1->finish;
@@ -745,7 +764,7 @@
         $gutter,       $justify,  @fields,
     ) = @_;
 
-#### @fields
+### @fields
     my $text_wrap_cols = GetTextWrapCols( $fontsize, $label_width );
 
     # hack to fix column name mismatch betwen labels_conf.class,
@@ -756,16 +775,9 @@
 
     my $str;
 
-    #      $item
-
     my $top_text_margin = ( $fontsize + $gutter );
     my $line_spacer = ($fontsize);    # number of pixels between text rows.
 
-    # add your printable fields manually in here
-
-    # warn Dumper $conf_data;
-    #warn Dumper $item;
-
     my $vPos = ( $y_pos + ( $label_height - $top_text_margin ) );
     $vPos = $vPos - ( $line_spacer * --$startrow ) if $startrow > 0;
 
@@ -780,9 +792,6 @@
 
         # get the string
         $str = $field;
-#### $str
-        
-
                 
         # strip out naughty existing nl/cr's
         $str =~ s/\n//g;
@@ -795,25 +804,21 @@
         $str = wrap( "", "", "$str" );
 
         # split the chunks between newline's, into an array
-
        my @strings = split /\n/, $str;
 
         # then loop for each string line
-        
-
         foreach my $str (@strings) {
 
             if ( $justify eq 'r' ) {
                 my $strwidth = prStrWidth( $str, 'C', $fontsize );
 #### $strwidth
                 $hPos = $x_pos + $label_width - ( $gutter + $strwidth );
-
             }
 
-#            warn "HPOS ,  VPOS $hPos, $vPos\n";
+            warn "HPOS ,  VPOS $hPos, $vPos\n";
 
             # set the font size A
-            $str =~ s/^\*$/ /;
+      #      $str =~ s/^\*$/ /;
             #   prText( $hPos, $vPos, $str );
             PrintText( $hPos, $vPos, $fontsize, $str );
             $vPos = $vPos - $line_spacer;
@@ -825,11 +830,13 @@
 sub DrawSpineText {
 
     my (
-        $x_pos,          $y_pos, $label_height,
+        $y_pos,        $label_height,
         $fontsize,       $x_pos, $left_text_margin,
         $text_wrap_cols, $item,  $conf_data
     ) = @_;
 
+### item
+
     # hack to fix column name mismatch betwen labels_conf.class,
     # and bibitems.classification
     $$item->{'class'} = $$item->{'classification'};





More information about the Koha-cvs mailing list