for(my $i = 0 ; $i <= $#{$value} ; $i++)
{
if (@$value[$i]){
- ##If mainentry search $a tag
if (@$tags[$i] eq "mainmainentry") {
-# FIXME: 'Heading-Main' index not yet defined in zebra
-# $attr =" \@attr 1=Heading-Main ";
$attr =" \@attr 1=Heading-Main ";
}elsif (@$tags[$i] eq "mainentry") {
my $query;
$query= "an=".$authid;
my ($err,$res,$result) = C4::Search::SimpleSearch($query,0,10);
- return ($result);
+ if ($err) {
+ warn "Error: $err from search $query";
+ $result = 0;
+ }
+
+ return $result;
}
}
}
my ($error, $results, $total_hits) = C4::Search::SimpleSearch( $query, 0, 1, [ "authorityserver" ] );
# there is at least 1 result => return the 1st one
- if (@$results>0) {
+ if (!defined $error && @{$results} ) {
my $marcrecord = MARC::File::USMARC::decode($results->[0]);
return $marcrecord->field('001')->data,BuildSummary($marcrecord,$marcrecord->field('001')->data,$authtypecode);
}
} elsif ($record->field('148')) {
$heading.= $field->as_string('abvxyz68');
} elsif ($record->field('150')) {
- # $heading.= $field->as_string('abvxyz68');
- $heading.= $field->as_formatted();
+ $heading.= $field->as_string('abvxyz68');
+ #$heading.= $field->as_formatted();
my $tag=$field->tag();
$heading=~s /^$tag//g;
$heading =~s /\_/\$/g;
} else {
#zebra connection
my $oConnection=C4::Context->Zconn("biblioserver",0);
+ my $oldSyntax = $oConnection->option("preferredRecordSyntax");
$oConnection->option("preferredRecordSyntax"=>"XML");
my $query;
$query= "an=".$mergefrom;
push @reccache, $marcdata;
$z++;
}
- $oConnection->destroy();
+ $oResult->destroy();
+ $oConnection->option("preferredRecordSyntax"=>$oldSyntax);
}
#warn scalar(@reccache)." biblios to update";
# Get All candidate Tags for the change