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

(-)a/C4/AuthoritiesMarc.pm (-9 / +11 lines)
Lines 1418-1432 sub merge { Link Here
1418
    # Search authtypes and reporting tags
1418
    # Search authtypes and reporting tags
1419
    my $authfrom = Koha::Authorities->find($mergefrom);
1419
    my $authfrom = Koha::Authorities->find($mergefrom);
1420
    my $authto = Koha::Authorities->find($mergeto);
1420
    my $authto = Koha::Authorities->find($mergeto);
1421
    my $authtypefrom = $authfrom ? Koha::Authority::Types->find($authfrom->authtypecode) : undef;
1421
    my $authtypefrom;
1422
    # If it is a mod ($authfrom == $authto) and there was a change of a heading tag $authtypefrom read from the database is of the current version of the auth rec., which is misleading, so we ignore it
1423
    if ($mergeto && $mergefrom == $mergeto && $MARCfrom && $MARCto &&
1424
        $MARCfrom->field('1..', '2..') && $MARCto->field('1..', '2..') && ($MARCfrom->field('1..', '2..'))[0]->tag ne ($MARCto->field('1..', '2..'))[0]->tag) {
1425
    undef $authtypefrom;
1426
    undef $authfrom;
1427
    }
1428
1429
    my $authtypeto   = $authto ? Koha::Authority::Types->find($authto->authtypecode) : undef;
1422
    my $authtypeto   = $authto ? Koha::Authority::Types->find($authto->authtypecode) : undef;
1423
    if( $mergeto && $mergefrom == $mergeto && $MARCfrom ) {
1424
        # bulkmarcimport may have changed the authtype; see BZ 19693
1425
        my $old_type = $MARCfrom->subfield( get_auth_type_location() ); # going via default
1426
        if( $old_type && $authto && $old_type ne $authto->authtypecode ) {
1427
            # Type change: handled by simulating a postponed merge where the auth record has been deleted already
1428
            # This triggers a walk through all auth controlled tags
1429
            undef $authfrom;
1430
        }
1431
    }
1432
    $authtypefrom = Koha::Authority::Types->find($authfrom->authtypecode) if $authfrom;
1430
    my $auth_tag_to_report_from = $authtypefrom ? $authtypefrom->auth_tag_to_report : '';
1433
    my $auth_tag_to_report_from = $authtypefrom ? $authtypefrom->auth_tag_to_report : '';
1431
    my $auth_tag_to_report_to   = $authtypeto ? $authtypeto->auth_tag_to_report : '';
1434
    my $auth_tag_to_report_to   = $authtypeto ? $authtypeto->auth_tag_to_report : '';
1432
1435
1433
- 

Return to bug 19693