|
Lines 1407-1425
sub AddAuthorityTrees{
Link Here
|
| 1407 |
|
1407 |
|
| 1408 |
=head2 merge |
1408 |
=head2 merge |
| 1409 |
|
1409 |
|
| 1410 |
$ref= &merge(mergefrom,$MARCfrom,$mergeto,$MARCto) |
1410 |
my @edited_biblionumbers = merge(mergefrom, $MARCfrom, $mergeto, $MARCto); |
| 1411 |
|
1411 |
|
| 1412 |
Could add some feature : Migrating from a typecode to an other for instance. |
1412 |
Could add some feature : Migrating from a typecode to an other for instance. |
| 1413 |
Then we should add some new parameter : bibliotargettag, authtargettag |
1413 |
Then we should add some new parameter : bibliotargettag, authtargettag |
| 1414 |
|
1414 |
|
|
|
1415 |
Returns a list of biblionumbers of records that were modified. |
| 1416 |
|
| 1415 |
=cut |
1417 |
=cut |
| 1416 |
|
1418 |
|
| 1417 |
sub merge { |
1419 |
sub merge { |
| 1418 |
my ($mergefrom, $MARCfrom, $mergeto, $MARCto) = @_; |
1420 |
my ($mergefrom, $MARCfrom, $mergeto, $MARCto) = @_; |
| 1419 |
my ($counteditedbiblio,$countunmodifiedbiblio,$counterrors)=(0,0,0); |
1421 |
my @editedbiblios; |
| 1420 |
my $dbh = C4::Context->dbh; |
1422 |
my $dbh = C4::Context->dbh; |
| 1421 |
my $authtypecodefrom = GetAuthTypeCode($mergefrom); |
1423 |
my $authtypecodefrom = GetAuthTypeCode($mergefrom); |
| 1422 |
my $authtypecodeto = GetAuthTypeCode($mergeto); |
1424 |
my $authtypecodeto = GetAuthTypeCode($mergeto); |
|
|
1425 |
|
| 1426 |
$MARCfrom ||= GetAuthority($mergefrom); |
| 1427 |
$MARCto ||= GetAuthority($mergeto); |
| 1428 |
|
| 1423 |
# warn "mergefrom : $authtypecodefrom $mergefrom mergeto : $authtypecodeto $mergeto "; |
1429 |
# warn "mergefrom : $authtypecodefrom $mergefrom mergeto : $authtypecodeto $mergeto "; |
| 1424 |
# return if authority does not exist |
1430 |
# return if authority does not exist |
| 1425 |
return "error MARCFROM not a marcrecord ".Data::Dumper::Dumper($MARCfrom) if scalar($MARCfrom->fields()) == 0; |
1431 |
return "error MARCFROM not a marcrecord ".Data::Dumper::Dumper($MARCfrom) if scalar($MARCfrom->fields()) == 0; |
|
Lines 1522-1532
sub merge {
Link Here
|
| 1522 |
} |
1528 |
} |
| 1523 |
if ($update==1){ |
1529 |
if ($update==1){ |
| 1524 |
&ModBiblio($marcrecord,$biblionumber,GetFrameworkCode($biblionumber)) ; |
1530 |
&ModBiblio($marcrecord,$biblionumber,GetFrameworkCode($biblionumber)) ; |
| 1525 |
$counteditedbiblio++; |
1531 |
push @editedbiblios, $biblionumber; |
| 1526 |
warn $counteditedbiblio if (($counteditedbiblio % 10) and $ENV{DEBUG}); |
|
|
| 1527 |
} |
1532 |
} |
| 1528 |
}#foreach $marc |
1533 |
}#foreach $marc |
| 1529 |
return $counteditedbiblio; |
1534 |
|
|
|
1535 |
DelAuthority($mergefrom) if ($mergefrom != $mergeto); |
| 1536 |
|
| 1537 |
return @editedbiblios; |
| 1530 |
} |
1538 |
} |
| 1531 |
|
1539 |
|
| 1532 |
=head2 get_auth_type_location |
1540 |
=head2 get_auth_type_location |
| 1533 |
- |
|
|