Bug 14659: Allow patrons to enter card number and patron category on OPAC registratio...
[koha.git] / C4 / AuthoritiesMarc.pm
index 43c5faf..a88d4fa 100644 (file)
@@ -855,15 +855,17 @@ sub BuildSummary {
     # handle $authtypecode is NULL or eq ""
     if ($authtypecode) {
         my $authref = Koha::Authority::Types->find($authtypecode);
-        $summary{authtypecode} = $authref->authtypecode;
-        $summary{type} = $authref->authtypetext;
-        $summary_template = $authref->summary;
-        # for MARC21, the authority type summary displays a label meant for
-        # display
-        if (C4::Context->preference('marcflavour') ne 'UNIMARC') {
-            $summary{label} = $authref->summary;
-        } else {
-            $summary{summary} = $authref->summary;
+        if ( $authref ) {
+            $summary{authtypecode} = $authref->authtypecode;
+            $summary{type} = $authref->authtypetext;
+            $summary_template = $authref->summary;
+            # for MARC21, the authority type summary displays a label meant for
+            # display
+            if (C4::Context->preference('marcflavour') ne 'UNIMARC') {
+                $summary{label} = $authref->summary;
+            } else {
+                $summary{summary} = $authref->summary;
+            }
         }
     }
     my $marc21subfields = 'abcdfghjklmnopqrstuvxyz68';
@@ -1401,8 +1403,10 @@ sub merge {
     my ($mergefrom,$MARCfrom,$mergeto,$MARCto) = @_;
     my ($counteditedbiblio,$countunmodifiedbiblio,$counterrors)=(0,0,0);        
     my $dbh=C4::Context->dbh;
-    my $authtypefrom = Koha::Authority::Types->find($mergefrom);
-    my $authtypeto   = Koha::Authority::Types->find($mergeto);
+    my $authfrom = Koha::Authorities->find($mergefrom);
+    my $authto = Koha::Authorities->find($mergeto);
+    my $authtypefrom = Koha::Authority::Types->find($authfrom->authtypecode);
+    my $authtypeto   = Koha::Authority::Types->find($authto->authtypecode);
 
     return "error MARCFROM not a marcrecord ".Data::Dumper::Dumper($MARCfrom) if scalar($MARCfrom->fields()) == 0;
     return "error MARCTO not a marcrecord".Data::Dumper::Dumper($MARCto) if scalar($MARCto->fields()) == 0;