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

(-)a/C4/AuthoritiesMarc.pm (-3 / +13 lines)
Lines 1248-1254 sub BuildAuthHierarchy{ Link Here
1248
    $cell{"children"}=\@loopchildren;
1248
    $cell{"children"}=\@loopchildren;
1249
    $cell{"class"}=$class;
1249
    $cell{"class"}=$class;
1250
    $cell{"authid"}=$authid;
1250
    $cell{"authid"}=$authid;
1251
    $cell{"current_value"} =1 if $authid eq $authid_constructed;
1251
    $cell{"current_value"} =1 if ($authid eq $authid_constructed);
1252
    $cell{"value"}=C4::Context->preference('marcflavour') eq 'UNIMARC' ? $record->subfield('2..',"a") : $record->subfield('1..', 'a');
1252
    $cell{"value"}=C4::Context->preference('marcflavour') eq 'UNIMARC' ? $record->subfield('2..',"a") : $record->subfield('1..', 'a');
1253
    return \%cell;
1253
    return \%cell;
1254
}
1254
}
Lines 1275-1281 sub BuildAuthHierarchyBranch { Link Here
1275
    if (scalar @$tree > 0) {
1275
    if (scalar @$tree > 0) {
1276
        my $nextBranch = BuildAuthHierarchyBranch($tree, $authid, ++$cnt);
1276
        my $nextBranch = BuildAuthHierarchyBranch($tree, $authid, ++$cnt);
1277
        my $nextAuthid = $nextBranch->{authid};
1277
        my $nextAuthid = $nextBranch->{authid};
1278
        push @{$branch->{children}}, $nextBranch unless grep {$_->{authid} == $nextAuthid} @{$branch->{children}};
1278
        my $found;
1279
        # If we already have the next branch listed as a child, let's
1280
        # replace the old listing with the new one. If not, we will add
1281
        # the branch at the end.
1282
        foreach my $cell (@{$branch->{children}}) {
1283
            if ($cell->{authid} eq $nextAuthid) {
1284
                $cell = $nextBranch;
1285
                $found = 1;
1286
                last;
1287
            }
1288
        }
1289
        push @{$branch->{children}}, $nextBranch unless $found;
1279
    }
1290
    }
1280
    return $branch;
1291
    return $branch;
1281
}
1292
}
1282
- 

Return to bug 8523