+ # Some error checking
+ if( $recordid1 eq $recordid2 ) {
+ push @errors, { code => 'DESTRUCTIVE_MERGE' };
+ } elsif( !$typecode || !Koha::Authority::Types->find($typecode) ) {
+ push @errors, { code => 'WRONG_FRAMEWORK' };
+ } elsif( scalar $record->fields == 0 ) {
+ push @errors, { code => 'EMPTY_MARC' };
+ }
+ if( @errors ) {
+ $template->param( errors => \@errors );
+ output_html_with_http_headers $input, $cookie, $template->output;
+ exit;
+ }
+