Bug 12629 - Software error when trying to merge records from different frameworks
authorKyle M Hall <kyle@bywatersolutions.com>
Wed, 23 Jul 2014 16:43:54 +0000 (12:43 -0400)
committerKyle M Hall <kyle@bywatersolutions.com>
Thu, 15 Sep 2016 13:44:10 +0000 (13:44 +0000)
Test Plan:
1) Choose a bib record that has the default framework.
2) Add a second record using that fast add framework.
3) Merge the records; switch to "Using framework: Default", and choose the original record (i.e. the one that had the default framework) as the merge reference. Clicking 'Next' will trigger the error.
4) Apply this patch
5) Repeat steps 1 - 3, no error should occur

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Koha/Util/MARC.pm

index 22774b6..63477ea 100644 (file)
@@ -43,8 +43,11 @@ sub createMergeHash {
     foreach my $field (@fields) {
         my $fieldtag = $field->tag();
         if ( $fieldtag < 10 ) {
-            if ( !defined($tagslib)
-                || $tagslib->{$fieldtag}->{'@'}->{'tab'} >= 0 )
+            if (
+                !defined($tagslib)
+                || ( defined( $tagslib->{$fieldtag} )
+                    && $tagslib->{$fieldtag}->{'@'}->{'tab'} >= 0 )
+              )
             {
                 push @array, {
                     tag   => $fieldtag,