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

(-)a/C4/AuthoritiesMarc.pm (-6 / +11 lines)
Lines 1399-1420 sub AddAuthorityTrees{ Link Here
1399
1399
1400
=head2 merge
1400
=head2 merge
1401
1401
1402
  $ref= &merge(mergefrom,$MARCfrom,$mergeto,$MARCto)
1402
  my @edited_biblionumbers = merge(mergefrom, $MARCfrom, $mergeto, $MARCto);
1403
1403
1404
Could add some feature : Migrating from a typecode to an other for instance.
1404
Could add some feature : Migrating from a typecode to an other for instance.
1405
Then we should add some new parameter : bibliotargettag, authtargettag
1405
Then we should add some new parameter : bibliotargettag, authtargettag
1406
1406
1407
Returns a list of biblionumbers of records that were modified.
1408
1407
=cut
1409
=cut
1408
1410
1409
sub merge {
1411
sub merge {
1410
    my ($mergefrom, $MARCfrom, $mergeto, $MARCto) = @_;
1412
    my ($mergefrom, $MARCfrom, $mergeto, $MARCto) = @_;
1411
    my ($counteditedbiblio,$countunmodifiedbiblio,$counterrors)=(0,0,0);        
1413
    my @editedbiblios;
1412
    my $dbh = C4::Context->dbh;
1414
    my $dbh = C4::Context->dbh;
1413
    my $authfrom = Koha::Authorities->find($mergefrom);
1415
    my $authfrom = Koha::Authorities->find($mergefrom);
1414
    my $authto = Koha::Authorities->find($mergeto);
1416
    my $authto = Koha::Authorities->find($mergeto);
1415
    my $authtypefrom = Koha::Authority::Types->find($authfrom->authtypecode);
1417
    my $authtypefrom = Koha::Authority::Types->find($authfrom->authtypecode);
1416
    my $authtypeto   = Koha::Authority::Types->find($authto->authtypecode);
1418
    my $authtypeto   = Koha::Authority::Types->find($authto->authtypecode);
1417
1419
1420
    $MARCfrom ||= GetAuthority($mergefrom);
1421
    $MARCto ||= GetAuthority($mergeto);
1422
1418
    return "error MARCFROM not a marcrecord ".Data::Dumper::Dumper($MARCfrom) if scalar($MARCfrom->fields()) == 0;
1423
    return "error MARCFROM not a marcrecord ".Data::Dumper::Dumper($MARCfrom) if scalar($MARCfrom->fields()) == 0;
1419
    return "error MARCTO not a marcrecord".Data::Dumper::Dumper($MARCto) if scalar($MARCto->fields()) == 0;
1424
    return "error MARCTO not a marcrecord".Data::Dumper::Dumper($MARCto) if scalar($MARCto->fields()) == 0;
1420
    # search the tag to report
1425
    # search the tag to report
Lines 1514-1525 sub merge { Link Here
1514
        }
1519
        }
1515
        if ($update==1){
1520
        if ($update==1){
1516
            &ModBiblio($marcrecord,$biblionumber,GetFrameworkCode($biblionumber)) ;
1521
            &ModBiblio($marcrecord,$biblionumber,GetFrameworkCode($biblionumber)) ;
1517
            $counteditedbiblio++;
1522
            push @editedbiblios, $biblionumber;
1518
            warn $counteditedbiblio if (($counteditedbiblio % 10) and $ENV{DEBUG});
1519
        }
1523
        }
1520
    }#foreach $marc
1524
    }#foreach $marc
1521
1525
1522
    return $counteditedbiblio;
1526
    DelAuthority($mergefrom) if ($mergefrom != $mergeto);
1527
1528
    return @editedbiblios;
1523
}
1529
}
1524
1530
1525
=head2 get_auth_type_location
1531
=head2 get_auth_type_location
1526
- 

Return to bug 11700