View | Details | Raw Unified | Return to bug 11700
Collapse All | Expand All

(-)a/C4/AuthoritiesMarc.pm (-6 / +13 lines)
Lines 1424-1442 sub AddAuthorityTrees{ Link Here
1424
1424
1425
=head2 merge
1425
=head2 merge
1426
1426
1427
  $ref= &merge(mergefrom,$MARCfrom,$mergeto,$MARCto)
1427
  my @edited_biblionumbers = merge(mergefrom, $MARCfrom, $mergeto, $MARCto);
1428
1428
1429
Could add some feature : Migrating from a typecode to an other for instance.
1429
Could add some feature : Migrating from a typecode to an other for instance.
1430
Then we should add some new parameter : bibliotargettag, authtargettag
1430
Then we should add some new parameter : bibliotargettag, authtargettag
1431
1431
1432
Returns a list of biblionumbers of records that were modified.
1433
1432
=cut
1434
=cut
1433
1435
1434
sub merge {
1436
sub merge {
1435
    my ($mergefrom, $MARCfrom, $mergeto, $MARCto) = @_;
1437
    my ($mergefrom, $MARCfrom, $mergeto, $MARCto) = @_;
1436
    my ($counteditedbiblio,$countunmodifiedbiblio,$counterrors)=(0,0,0);
1438
    my @editedbiblios;
1437
    my $dbh = C4::Context->dbh;
1439
    my $dbh = C4::Context->dbh;
1438
    my $authtypecodefrom = GetAuthTypeCode($mergefrom);
1440
    my $authtypecodefrom = GetAuthTypeCode($mergefrom);
1439
    my $authtypecodeto = GetAuthTypeCode($mergeto);
1441
    my $authtypecodeto = GetAuthTypeCode($mergeto);
1442
1443
    $MARCfrom ||= GetAuthority($mergefrom);
1444
    $MARCto ||= GetAuthority($mergeto);
1445
1440
#     warn "mergefrom : $authtypecodefrom $mergefrom mergeto : $authtypecodeto $mergeto ";
1446
#     warn "mergefrom : $authtypecodefrom $mergefrom mergeto : $authtypecodeto $mergeto ";
1441
    # return if authority does not exist
1447
    # return if authority does not exist
1442
    return "error MARCFROM not a marcrecord ".Data::Dumper::Dumper($MARCfrom) if scalar($MARCfrom->fields()) == 0;
1448
    return "error MARCFROM not a marcrecord ".Data::Dumper::Dumper($MARCfrom) if scalar($MARCfrom->fields()) == 0;
Lines 1541-1551 sub merge { Link Here
1541
        }
1547
        }
1542
        if ($update==1){
1548
        if ($update==1){
1543
            &ModBiblio($marcrecord,$biblionumber,GetFrameworkCode($biblionumber)) ;
1549
            &ModBiblio($marcrecord,$biblionumber,GetFrameworkCode($biblionumber)) ;
1544
            $counteditedbiblio++;
1550
            push @editedbiblios, $biblionumber;
1545
            warn $counteditedbiblio if (($counteditedbiblio % 10) and $ENV{DEBUG});
1546
        }
1551
        }
1547
    }#foreach $marc
1552
    }#foreach $marc
1548
    return $counteditedbiblio;
1553
1554
    DelAuthority($mergefrom) if ($mergefrom != $mergeto);
1555
1556
    return @editedbiblios;
1549
}
1557
}
1550
1558
1551
=head2 get_auth_type_location
1559
=head2 get_auth_type_location
1552
- 

Return to bug 11700