Lines 328-339
counts Usage of Authid in bibliorecords.
Link Here
|
328 |
|
328 |
|
329 |
sub CountUsage { |
329 |
sub CountUsage { |
330 |
my ($authid) = @_; |
330 |
my ($authid) = @_; |
331 |
if (C4::Context->preference('NoZebra')) { |
|
|
332 |
# Read the index Koha-Auth-Number for this authid and count the lines |
333 |
my $result = C4::Search::NZanalyse("an=$authid"); |
334 |
my @tab = split /;/,$result; |
335 |
return scalar @tab; |
336 |
} else { |
337 |
### ZOOM search here |
331 |
### ZOOM search here |
338 |
my $query; |
332 |
my $query; |
339 |
$query= "an:".$authid; |
333 |
$query= "an:".$authid; |
Lines 344-350
sub CountUsage {
Link Here
|
344 |
} |
338 |
} |
345 |
|
339 |
|
346 |
return $result; |
340 |
return $result; |
347 |
} |
|
|
348 |
} |
341 |
} |
349 |
|
342 |
|
350 |
=head2 CountUsageChildren |
343 |
=head2 CountUsageChildren |
Lines 1413-1458
sub merge {
Link Here
|
1413 |
my @reccache; |
1406 |
my @reccache; |
1414 |
# search all biblio tags using this authority. |
1407 |
# search all biblio tags using this authority. |
1415 |
#Getting marcbiblios impacted by the change. |
1408 |
#Getting marcbiblios impacted by the change. |
1416 |
if (C4::Context->preference('NoZebra')) { |
1409 |
#zebra connection |
1417 |
#nozebra way |
1410 |
my $oConnection=C4::Context->Zconn("biblioserver",0); |
1418 |
my $dbh=C4::Context->dbh; |
1411 |
# We used to use XML syntax here, but that no longer works. |
1419 |
my $rq=$dbh->prepare(qq(SELECT biblionumbers from nozebra where indexname="an" and server="biblioserver" and value="$mergefrom" )); |
1412 |
# Thankfully, we don't need it. |
1420 |
$rq->execute; |
1413 |
my $query; |
1421 |
while (my $biblionumbers=$rq->fetchrow){ |
1414 |
$query= "an=".$mergefrom; |
1422 |
my @biblionumbers=split /;/,$biblionumbers; |
1415 |
my $oResult = $oConnection->search(new ZOOM::Query::CCL2RPN( $query, $oConnection )); |
1423 |
foreach (@biblionumbers) { |
1416 |
my $count = 0; |
1424 |
if ($_=~/(\d+),.*/) { |
1417 |
if ($oResult) { |
1425 |
my $marc=GetMarcBiblio($1); |
1418 |
$count=$oResult->size(); |
1426 |
push @reccache,$marc; |
1419 |
} |
1427 |
} |
1420 |
my $z=0; |
1428 |
} |
1421 |
while ( $z<$count ) { |
1429 |
} |
1422 |
my $rec; |
1430 |
} else { |
1423 |
$rec=$oResult->record($z); |
1431 |
#zebra connection |
1424 |
my $marcdata = $rec->raw(); |
1432 |
my $oConnection=C4::Context->Zconn("biblioserver",0); |
1425 |
my $marcrecordzebra= MARC::Record->new_from_usmarc($marcdata); |
1433 |
# We used to use XML syntax here, but that no longer works. |
1426 |
my ( $biblionumbertagfield, $biblionumbertagsubfield ) = &GetMarcFromKohaField( "biblio.biblionumber", '' ); |
1434 |
# Thankfully, we don't need it. |
1427 |
my $i = ($biblionumbertagfield < 10) ? $marcrecordzebra->field($biblionumbertagfield)->data : $marcrecordzebra->subfield($biblionumbertagfield, $biblionumbertagsubfield); |
1435 |
my $query; |
1428 |
my $marcrecorddb=GetMarcBiblio($i); |
1436 |
$query= "an=".$mergefrom; |
1429 |
push @reccache, $marcrecorddb; |
1437 |
my $oResult = $oConnection->search(new ZOOM::Query::CCL2RPN( $query, $oConnection )); |
1430 |
$z++; |
1438 |
my $count = 0; |
|
|
1439 |
if ($oResult) { |
1440 |
$count=$oResult->size(); |
1441 |
} |
1442 |
my $z=0; |
1443 |
while ( $z<$count ) { |
1444 |
my $rec; |
1445 |
$rec=$oResult->record($z); |
1446 |
my $marcdata = $rec->raw(); |
1447 |
my $marcrecordzebra= MARC::Record->new_from_usmarc($marcdata); |
1448 |
my ( $biblionumbertagfield, $biblionumbertagsubfield ) = &GetMarcFromKohaField( "biblio.biblionumber", '' ); |
1449 |
my $i = ($biblionumbertagfield < 10) ? $marcrecordzebra->field($biblionumbertagfield)->data : $marcrecordzebra->subfield($biblionumbertagfield, $biblionumbertagsubfield); |
1450 |
my $marcrecorddb=GetMarcBiblio($i); |
1451 |
push @reccache, $marcrecorddb; |
1452 |
$z++; |
1453 |
} |
1454 |
$oResult->destroy(); |
1455 |
} |
1431 |
} |
|
|
1432 |
$oResult->destroy(); |
1456 |
#warn scalar(@reccache)." biblios to update"; |
1433 |
#warn scalar(@reccache)." biblios to update"; |
1457 |
# Get All candidate Tags for the change |
1434 |
# Get All candidate Tags for the change |
1458 |
# (This will reduce the search scope in marc records). |
1435 |
# (This will reduce the search scope in marc records). |