projects
/
koha_gimpoz
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
6584: Enable searching on Zebra's Bib-level index
[koha_gimpoz]
/
C4
/
AuthoritiesMarc.pm
diff --git
a/C4/AuthoritiesMarc.pm
b/C4/AuthoritiesMarc.pm
index
a04fe11
..
0164c8d
100644
(file)
--- a/
C4/AuthoritiesMarc.pm
+++ b/
C4/AuthoritiesMarc.pm
@@
-225,11
+225,8
@@
sub SearchAuthorities {
for(my $i = 0 ; $i <= $#{$value} ; $i++)
{
if (@$value[$i]){
for(my $i = 0 ; $i <= $#{$value} ; $i++)
{
if (@$value[$i]){
- ##If mainentry search $a tag
if (@$tags[$i] eq "mainmainentry") {
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") {
$attr =" \@attr 1=Heading-Main ";
}elsif (@$tags[$i] eq "mainentry") {
@@
-367,7
+364,12
@@
sub CountUsage {
my $query;
$query= "an=".$authid;
my ($err,$res,$result) = C4::Search::SimpleSearch($query,0,10);
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;
}
}
}
}
@@
-651,17
+653,21
@@
sub AddAuthority {
}
}
}
}
- if (
($format eq "UNIMARCAUTH") && (!$record->subfield('100','a')))
{
+ if (
$format eq "UNIMARCAUTH")
{
$record->leader(" nx j22 ") unless ($record->leader());
my $date=POSIX::strftime("%Y%m%d",localtime);
$record->leader(" nx j22 ") unless ($record->leader());
my $date=POSIX::strftime("%Y%m%d",localtime);
- if ($record->field('100')){
+ if (my $string=$record->subfield('100',"a")){
+ $string=~s/fre50/frey50/;
+ $record->field('100')->update('a'=>$string);
+ }
+ elsif ($record->field('100')){
$record->field('100')->update('a'=>$date."afrey50 ba0");
$record->field('100')->update('a'=>$date."afrey50 ba0");
-
} else {
-
$record->append_fields(
-
MARC::Field->new('100',' ',' '
-
,'a'=>$date."afrey50 ba0")
-
);
-
}
+ } else {
+ $record->append_fields(
+ MARC::Field->new('100',' ',' '
+ ,'a'=>$date."afrey50 ba0")
+ );
+ }
}
my ($auth_type_tag, $auth_type_subfield) = get_auth_type_location($authtypecode);
if (!$authid and $format eq "MARC21") {
}
my ($auth_type_tag, $auth_type_subfield) = get_auth_type_location($authtypecode);
if (!$authid and $format eq "MARC21") {
@@
-916,7
+922,7
@@
sub FindDuplicateAuthority {
}
my ($error, $results, $total_hits) = C4::Search::SimpleSearch( $query, 0, 1, [ "authorityserver" ] );
# there is at least 1 result => return the 1st one
}
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);
}
my $marcrecord = MARC::File::USMARC::decode($results->[0]);
return $marcrecord->field('001')->data,BuildSummary($marcrecord,$marcrecord->field('001')->data,$authtypecode);
}
@@
-1044,7
+1050,7
@@
sub BuildSummary{
$narrowerterms =~s/-- \n$//;
$seealso =~s/-- \n$//;
$see =~s/-- \n$//;
$narrowerterms =~s/-- \n$//;
$seealso =~s/-- \n$//;
$see =~s/-- \n$//;
- $summary =
"<b>".$heading."</b>
<br />".($notes?"$notes <br />":"");
+ $summary =
$heading."
<br />".($notes?"$notes <br />":"");
$summary.= '<p><div class="label">TG : '.$broaderterms.'</div></p>' if ($broaderterms);
$summary.= '<p><div class="label">TS : '.$narrowerterms.'</div></p>' if ($narrowerterms);
$summary.= '<p><div class="label">TA : '.$seealso.'</div></p>' if ($seealso);
$summary.= '<p><div class="label">TG : '.$broaderterms.'</div></p>' if ($broaderterms);
$summary.= '<p><div class="label">TS : '.$narrowerterms.'</div></p>' if ($narrowerterms);
$summary.= '<p><div class="label">TA : '.$seealso.'</div></p>' if ($seealso);
@@
-1069,8
+1075,8
@@
sub BuildSummary{
} elsif ($record->field('148')) {
$heading.= $field->as_string('abvxyz68');
} elsif ($record->field('150')) {
} 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;
my $tag=$field->tag();
$heading=~s /^$tag//g;
$heading =~s /\_/\$/g;
@@
-1301,6
+1307,7
@@
sub merge {
} else {
#zebra connection
my $oConnection=C4::Context->Zconn("biblioserver",0);
} else {
#zebra connection
my $oConnection=C4::Context->Zconn("biblioserver",0);
+ my $oldSyntax = $oConnection->option("preferredRecordSyntax");
$oConnection->option("preferredRecordSyntax"=>"XML");
my $query;
$query= "an=".$mergefrom;
$oConnection->option("preferredRecordSyntax"=>"XML");
my $query;
$query= "an=".$mergefrom;
@@
-1317,7
+1324,8
@@
sub merge {
push @reccache, $marcdata;
$z++;
}
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
}
#warn scalar(@reccache)." biblios to update";
# Get All candidate Tags for the change