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

(-)a/C4/AuthoritiesMarc.pm (-6 / +12 lines)
Lines 1390-1409 sub AddAuthorityTrees{ Link Here
1390
1390
1391
=head2 merge
1391
=head2 merge
1392
1392
1393
  $ref= &merge(mergefrom,$MARCfrom,$mergeto,$MARCto)
1393
  my @edited_biblionumbers = merge(mergefrom, $MARCfrom, $mergeto, $MARCto);
1394
1394
1395
Could add some feature : Migrating from a typecode to an other for instance.
1395
Could add some feature : Migrating from a typecode to an other for instance.
1396
Then we should add some new parameter : bibliotargettag, authtargettag
1396
Then we should add some new parameter : bibliotargettag, authtargettag
1397
1397
1398
Returns a list of biblionumbers of records that were modified.
1399
1398
=cut
1400
=cut
1399
1401
1400
sub merge {
1402
sub merge {
1401
    my ($mergefrom, $MARCfrom, $mergeto, $MARCto) = @_;
1403
    my ($mergefrom, $MARCfrom, $mergeto, $MARCto) = @_;
1402
    my ($counteditedbiblio,$countunmodifiedbiblio,$counterrors)=(0,0,0);        
1404
    my @editedbiblios;
1403
    my $dbh = C4::Context->dbh;
1405
    my $dbh = C4::Context->dbh;
1404
    my $authtypefrom = Koha::Authority::Types->find($mergefrom);
1406
    my $authtypefrom = Koha::Authority::Types->find($mergefrom);
1405
    my $authtypeto   = Koha::Authority::Types->find($mergeto);
1407
    my $authtypeto   = Koha::Authority::Types->find($mergeto);
1406
1408
1409
    $MARCfrom ||= GetAuthority($mergefrom);
1410
    $MARCto ||= GetAuthority($mergeto);
1411
1407
    return "error MARCFROM not a marcrecord ".Data::Dumper::Dumper($MARCfrom) if scalar($MARCfrom->fields()) == 0;
1412
    return "error MARCFROM not a marcrecord ".Data::Dumper::Dumper($MARCfrom) if scalar($MARCfrom->fields()) == 0;
1408
    return "error MARCTO not a marcrecord".Data::Dumper::Dumper($MARCto) if scalar($MARCto->fields()) == 0;
1413
    return "error MARCTO not a marcrecord".Data::Dumper::Dumper($MARCto) if scalar($MARCto->fields()) == 0;
1409
    # search the tag to report
1414
    # search the tag to report
Lines 1503-1513 sub merge { Link Here
1503
        }
1508
        }
1504
        if ($update==1){
1509
        if ($update==1){
1505
            &ModBiblio($marcrecord,$biblionumber,GetFrameworkCode($biblionumber)) ;
1510
            &ModBiblio($marcrecord,$biblionumber,GetFrameworkCode($biblionumber)) ;
1506
            $counteditedbiblio++;
1511
            push @editedbiblios, $biblionumber;
1507
            warn $counteditedbiblio if (($counteditedbiblio % 10) and $ENV{DEBUG});
1508
        }
1512
        }
1509
    }#foreach $marc
1513
    }#foreach $marc
1510
    return $counteditedbiblio;
1514
1515
    DelAuthority($mergefrom) if ($mergefrom != $mergeto);
1516
1517
    return @editedbiblios;
1511
}
1518
}
1512
1519
1513
=head2 get_auth_type_location
1520
=head2 get_auth_type_location
1514
- 

Return to bug 11700