Those fixes solves the "internal server error" with MARC::Record 1.12.

It was due to an illegal contruction in Koha : we tried to retrive subfields from <10 tags.
That's not possible. MARC::Record accepted this in 0.93 version, but it was fixed after.
Now, the construct/retrieving is OK !
This commit is contained in:
tipaul 2003-04-28 13:07:14 +00:00
parent 6878f647a1
commit e5bbeace3d
3 changed files with 29 additions and 22 deletions

View File

@ -1,6 +1,12 @@
package C4::Biblio;
# $Id$
# $Log$
# Revision 1.44 2003/04/28 13:07:14 tipaul
# Those fixes solves the "internal server error" with MARC::Record 1.12.
# It was due to an illegal contruction in Koha : we tried to retrive subfields from <10 tags.
# That's not possible. MARC::Record accepted this in 0.93 version, but it was fixed after.
# Now, the construct/retrieving is OK !
#
# Revision 1.43 2003/04/10 13:56:02 tipaul
# Fix some bugs :
# * worked in 1.9.0, but not in 1.9.1 :
@ -631,9 +637,9 @@ sub MARCgetbiblio {
if ($row->{tagorder} ne $prevtagorder || $row->{tag} ne $prevtag) {
$previndicator.=" ";
if ($prevtag <10) {
$record->add_fields((sprintf "%03s",$prevtag),$prevvalue);
$record->add_fields((sprintf "%03s",$prevtag),$prevvalue) unless $prevtag eq "XXX"; # ignore the 1st loop
} else {
$record->add_fields($field);
$record->add_fields($field) unless $prevtag eq "XXX";
}
undef $field;
$prevtagorder=$row->{tagorder};
@ -749,8 +755,6 @@ sub MARCmoditem {
if ($oldrecord eq $record) {
return;
}
# warn "MARCmoditem : ".$record->as_formatted;
# warn "OLD : ".$oldrecord->as_formatted;
# otherwise, skip through each subfield...
my @fields = $record->fields();

View File

@ -88,23 +88,27 @@ for (my $tabloop = 0; $tabloop<=10;$tabloop++) {
my @fields = $record->fields();
my @loop_data =();
foreach my $field (@fields) {
my @subf=$field->subfields;
# my $previous_tag = '';
my @subfields_data;
# loop through each subfield
for my $i (0..$#subf) {
# $previous_tag = $field->tag();
$subf[$i][0] = "@" unless $subf[$i][0];
next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} ne $tabloop);
my @subfields_data;
# if tag <10, there's no subfield, use the "@" trick
if ($field->tag()<10) {
next if ($tagslib->{$field->tag()}->{'@'}->{tab} ne $tabloop);
my %subfield_data;
$subfield_data{marc_lib}=$tagslib->{$field->tag()}->{$subf[$i][0]}->{lib};
if ($field->tag()<10) {
$subfield_data{marc_value}=$field->data();
} else {
$subfield_data{marc_value}=$subf[$i][1];
}
$subfield_data{marc_tag}=$subf[$i][0];
$subfield_data{marc_lib}=$tagslib->{$field->tag()}->{'@'}->{lib};
$subfield_data{marc_value}=$field->data();
$subfield_data{marc_tag}='@';
push(@subfields_data, \%subfield_data);
} else {
my @subf=$field->subfields;
# loop through each subfield
for my $i (0..$#subf) {
$subf[$i][0] = "@" unless $subf[$i][0];
next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} ne $tabloop);
my %subfield_data;
$subfield_data{marc_lib}=$tagslib->{$field->tag()}->{$subf[$i][0]}->{lib};
$subfield_data{marc_value}=$subf[$i][1];
$subfield_data{marc_tag}=$subf[$i][0];
push(@subfields_data, \%subfield_data);
}
}
if ($#subfields_data>=0) {
my %tag_data;
@ -124,6 +128,7 @@ my @fields = $record->fields();
my %witness; #---- stores the list of subfields used at least once, with the "meaning" of the code
my @big_array;
foreach my $field (@fields) {
next if ($field->tag()<10);
my @subf=$field->subfields;
my %this_row;
# loop through each subfield
@ -140,7 +145,6 @@ foreach my $field (@fields) {
foreach my $subfield_code (keys(%witness)) {
for (my $i=0;$i<=$#big_array;$i++) {
$big_array[$i]{$subfield_code}="&nbsp;" unless ($big_array[$i]{$subfield_code});
# warn "filled : ".$big_array[$i]{$subfield_code};
}
}
# now, construct template !
@ -151,7 +155,6 @@ for (my $i=0;$i<=$#big_array; $i++) {
foreach my $subfield_code (keys(%witness)) {
$items_data .="<td>".$big_array[$i]{$subfield_code}."</td>";
}
# warn $items_data;
my %row_data;
$row_data{item_value} = $items_data;
push(@item_value_loop,\%row_data);

View File

@ -32,7 +32,6 @@ use MARC::File::USMARC;
sub find_value {
my ($tagfield,$insubfield,$record) = @_;
# warn "$tagfield / $insubfield // ";
my $result;
my $indicator;
foreach my $field ($record->field($tagfield)) {
@ -121,6 +120,7 @@ my @big_array;
my ($itemtagfield,$itemtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"items.itemnumber");
my @itemnums; # array to store itemnums
foreach my $field (@fields) {
next if ($field->tag()<10);
my @subf=$field->subfields;
my %this_row;
# loop through each subfield