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

(-)a/C4/AuthoritiesMarc.pm (-6 / +13 lines)
Lines 1438-1456 sub AddAuthorityTrees{ Link Here
1438
1438
1439
=head2 merge
1439
=head2 merge
1440
1440
1441
  $ref= &merge(mergefrom,$MARCfrom,$mergeto,$MARCto)
1441
  my @edited_biblionumbers = merge(mergefrom, $MARCfrom, $mergeto, $MARCto);
1442
1442
1443
Could add some feature : Migrating from a typecode to an other for instance.
1443
Could add some feature : Migrating from a typecode to an other for instance.
1444
Then we should add some new parameter : bibliotargettag, authtargettag
1444
Then we should add some new parameter : bibliotargettag, authtargettag
1445
1445
1446
Returns a list of biblionumbers of records that were modified.
1447
1446
=cut
1448
=cut
1447
1449
1448
sub merge {
1450
sub merge {
1449
    my ($mergefrom, $MARCfrom, $mergeto, $MARCto) = @_;
1451
    my ($mergefrom, $MARCfrom, $mergeto, $MARCto) = @_;
1450
    my ($counteditedbiblio,$countunmodifiedbiblio,$counterrors)=(0,0,0);
1452
    my @editedbiblios;
1451
    my $dbh = C4::Context->dbh;
1453
    my $dbh = C4::Context->dbh;
1452
    my $authtypecodefrom = GetAuthTypeCode($mergefrom);
1454
    my $authtypecodefrom = GetAuthTypeCode($mergefrom);
1453
    my $authtypecodeto = GetAuthTypeCode($mergeto);
1455
    my $authtypecodeto = GetAuthTypeCode($mergeto);
1456
1457
    $MARCfrom ||= GetAuthority($mergefrom);
1458
    $MARCto ||= GetAuthority($mergeto);
1459
1454
#     warn "mergefrom : $authtypecodefrom $mergefrom mergeto : $authtypecodeto $mergeto ";
1460
#     warn "mergefrom : $authtypecodefrom $mergefrom mergeto : $authtypecodeto $mergeto ";
1455
    # return if authority does not exist
1461
    # return if authority does not exist
1456
    return "error MARCFROM not a marcrecord ".Data::Dumper::Dumper($MARCfrom) if scalar($MARCfrom->fields()) == 0;
1462
    return "error MARCFROM not a marcrecord ".Data::Dumper::Dumper($MARCfrom) if scalar($MARCfrom->fields()) == 0;
Lines 1555-1565 sub merge { Link Here
1555
        }
1561
        }
1556
        if ($update==1){
1562
        if ($update==1){
1557
            &ModBiblio($marcrecord,$biblionumber,GetFrameworkCode($biblionumber)) ;
1563
            &ModBiblio($marcrecord,$biblionumber,GetFrameworkCode($biblionumber)) ;
1558
            $counteditedbiblio++;
1564
            push @editedbiblios, $biblionumber;
1559
            warn $counteditedbiblio if (($counteditedbiblio % 10) and $ENV{DEBUG});
1560
        }
1565
        }
1561
    }#foreach $marc
1566
    }#foreach $marc
1562
    return $counteditedbiblio;
1567
1568
    DelAuthority($mergefrom) if ($mergefrom != $mergeto);
1569
1570
    return @editedbiblios;
1563
}
1571
}
1564
1572
1565
=head2 get_auth_type_location
1573
=head2 get_auth_type_location
1566
- 

Return to bug 11700