Bugzilla – Attachment 1467 Details for
Bug 3618
AuthoritiesMarc : lines 1222 and 1167
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to make BuildUnimarcHierarchies fail more gracefully
0001-Bug-fix-3618.patch (text/plain), 2.23 KB, created by
Chris Cormack
on 2009-09-14 13:53:00 UTC
(
hide
)
Description:
patch to make BuildUnimarcHierarchies fail more gracefully
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2009-09-14 13:53:00 UTC
Size:
2.23 KB
patch
obsolete
>From a6723cfe0cdd579c7779ed4392bfe984947c2ac4 Mon Sep 17 00:00:00 2001 >From: Henri-Damien LAURENT <henridamien.laurent@biblibre.com> >Date: Mon, 14 Sep 2009 15:13:45 +0200 >Subject: [biblibre-integration] Bug fix : 3618 > >Add some error proof on BuildUnimarcHierarchies >--- > C4/AuthoritiesMarc.pm | 43 +++++++++++++++++++++++-------------------- > 1 files changed, 23 insertions(+), 20 deletions(-) > >diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm >index 3be5ee4..a423738 100644 >--- a/C4/AuthoritiesMarc.pm >+++ b/C4/AuthoritiesMarc.pm >@@ -1164,26 +1164,28 @@ sub BuildUnimarcHierarchies{ > } else { > my $record = GetAuthority($authid); > my $found; >- foreach my $field ($record->field('550')){ >- if ($field->subfield('5') && $field->subfield('5') eq 'g'){ >- my $parentrecord = GetAuthority($field->subfield('3')); >- my $localresult=$hierarchies; >- my $trees; >- $trees = BuildUnimarcHierarchies($field->subfield('3')); >- my @trees; >- if ($trees=~/;/){ >- @trees = split(/;/,$trees); >- } else { >- push @trees, $trees; >- } >- foreach (@trees){ >- $_.= ",$authid"; >- } >- @globalresult = (@globalresult,@trees); >- $found=1; >- } >- $hierarchies=join(";",@globalresult); >- } >+ if ($record){ >+ foreach my $field ($record->field('550')){ >+ if ($field->subfield('5') && $field->subfield('5') eq 'g'){ >+ my $parentrecord = GetAuthority($field->subfield('3')); >+ my $localresult=$hierarchies; >+ my $trees; >+ $trees = BuildUnimarcHierarchies($field->subfield('3')); >+ my @trees; >+ if ($trees=~/;/){ >+ @trees = split(/;/,$trees); >+ } else { >+ push @trees, $trees; >+ } >+ foreach (@trees){ >+ $_.= ",$authid"; >+ } >+ @globalresult = (@globalresult,@trees); >+ $found=1; >+ } >+ $hierarchies=join(";",@globalresult); >+ } >+ } > #Unless there is no ancestor, I am alone. > $hierarchies="$authid" unless ($hierarchies); > } >@@ -1217,6 +1219,7 @@ sub BuildUnimarcHierarchy{ > my $record = shift @_; > my $class = shift @_; > my $authid_constructed = shift @_; >+ return undef unless ($record); > my $authid=$record->subfield('2..','3'); > my %cell; > my $parents=""; my $children=""; >-- >1.6.0.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 3618
: 1467