koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha/acqui.simple marcimport.pl,1.6.2.26,1.6.2.27


From: Alan Millar
Subject: [Koha-cvs] CVS: koha/acqui.simple marcimport.pl,1.6.2.26,1.6.2.27
Date: Wed, 26 Jun 2002 08:52:57 -0700

Update of /cvsroot/koha/koha/acqui.simple
In directory usw-pr-cvs1:/tmp/cvs-serv18824/acqui.simple

Modified Files:
      Tag: rel-1-2
        marcimport.pl 
Log Message:
Fix display of marc tag labels and indicators

Index: marcimport.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/marcimport.pl,v
retrieving revision 1.6.2.26
retrieving revision 1.6.2.27
diff -C2 -r1.6.2.26 -r1.6.2.27
*** marcimport.pl       26 Jun 2002 14:28:35 -0000      1.6.2.26
--- marcimport.pl       26 Jun 2002 15:52:55 -0000      1.6.2.27
***************
*** 1018,1070 ****
      )address@hidden;
      # Return
  
      my (
-         $marctext,
        $color,
        $field,
        $tag,
        $label,
        $subfieldcode,$subfieldvalue,
        @values, $value
      );
  
!       #return "MARC text here";
  
!     $marctext="<table border=0 cellspacing=0>
!       <tr><th colspan=3 bgcolor=black>
                <font color=white>MARC RECORD</font>
        </th></tr>\n";
  
      foreach $field ( @$fields ) {
        ($color eq $lc1) ? ($color=$lc2) : ($color=$lc1);
        $tag=$field->{'tag'};
!       $label=$tagtext{$tag};
!       if ( $tag eq 'Leader' ) {
                $tag='';
                $label="Leader:";
        }
        $marctext.="<tr><td bgcolor=$color valign=top>$label</td> \n" .
                "<td bgcolor=$color valign=top>$tag</td> \n";
!       if ( ! $field->{'subfields'} )  {
!           $marctext.="<td bgcolor=$color 
valign=top>$field->{'indicator'}</td>";
        } else {
            # start another table for subfields
!           $marctext.="<td bgcolor=$color valign=top>\n " .
!               "  <table border=0 cellspacing=0>\n";
            foreach $subfieldcode ( sort( keys %{ $field->{'subfields'} }   )) {
                $subfieldvalue=$field->{'subfields'}->{$subfieldcode};
                if (ref($subfieldvalue) eq 'ARRAY' ) {
!                   # if it's a pointer to array, get the values
                    @address@hidden;
                } else {
                    @values=( $subfieldvalue );
                } # if subfield array
                foreach $value ( @values ) {
!                 $marctext.="<tr><td>$subfieldcode </td>" .
                    "<td>$value</td></tr>\n";
                } # foreach value
            } # foreach subfield
!           $marctext.="</table></td>\n";
        } # if subfields
        $marctext.="</tr>\n";
  
--- 1018,1101 ----
      )address@hidden;
      # Return
+     my $marctext;
  
      my (
        $color,
        $field,
        $tag,
        $label,
+       $indicator,
        $subfieldcode,$subfieldvalue,
        @values, $value
      );
+     my $debug=0;
  
!     #-----------------------------------------
  
!     $marctext="<table border=0 cellspacing=1>
!       <tr><th colspan=4 bgcolor=black>
                <font color=white>MARC RECORD</font>
        </th></tr>\n";
  
      foreach $field ( @$fields ) {
+ 
+       # Swap colors on alternating lines
        ($color eq $lc1) ? ($color=$lc2) : ($color=$lc1);
+ 
        $tag=$field->{'tag'};
!       $label=taglabel($tag);
! 
!       if ( $tag eq 'LDR' ) {
                $tag='';
                $label="Leader:";
        }
+       print "<pre>Format tag=$tag label=$label</pre>\n" if $debug;
+ 
        $marctext.="<tr><td bgcolor=$color valign=top>$label</td> \n" .
                "<td bgcolor=$color valign=top>$tag</td> \n";
! 
!       $indicator=$field->{'indicator'};
!       $indicator=~s/ +$//;    # drop trailing blanks
! 
!       # Third table column has indicator if it is short.
!       # Fourth column has embedded table of subfields, and indicator
!       #  if it is long (leader or fixed-position fields)
! 
!       print "<pre>Format indicator=$indicator" .
!               " length=" . length( $indicator ) .  "</pre>\n" if $debug;
!       if ( length( $indicator <= 3 ) ) {
!           $marctext.="<td bgcolor=$color valign=top><pre>" .
!               "$indicator</pre></td>" .
!               "<td bgcolor=$color valign=top>" ;
        } else {
+           $marctext.="<td bgcolor=$color valign=top></td>" .
+               "<td bgcolor=$color valign=top>" .
+               "$indicator ";
+       } # if length
+ 
+       # Subfields
+       if ( $field->{'subfields'} )  {
            # start another table for subfields
!           $marctext.= "<table border=0 cellspacing=2>\n";
            foreach $subfieldcode ( sort( keys %{ $field->{'subfields'} }   )) {
                $subfieldvalue=$field->{'subfields'}->{$subfieldcode};
                if (ref($subfieldvalue) eq 'ARRAY' ) {
!                   # if it's a pointer to array, get all the values
                    @address@hidden;
                } else {
+                   # otherwise get the one value
                    @values=( $subfieldvalue );
                } # if subfield array
                foreach $value ( @values ) {
!                 $marctext.="<tr><td><strong>$subfieldcode</strong></td>" .
                    "<td>$value</td></tr>\n";
                } # foreach value
            } # foreach subfield
!           $marctext.="</table>\n";
        } # if subfields
+       # End of indicator and subfields column
+       $marctext.="</td>\n";
+ 
+       # End of columns
        $marctext.="</tr>\n";
  
***************
*** 1080,1083 ****
--- 1111,1117 ----
  #---------------
  # $Log$
+ # Revision 1.6.2.27  2002/06/26 15:52:55  amillar
+ # Fix display of marc tag labels and indicators
+ #
  # Revision 1.6.2.26  2002/06/26 14:28:35  amillar
  # Removed subroutines now existing in modules: extractmarcfields,




reply via email to

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