Bug 3150: (follow-up) Send list and cart emails immediately again
[koha-ffzg.git] / tools / showdiffmarc.pl
index cfd9811..f981342 100755 (executable)
@@ -26,16 +26,17 @@ use CGI qw(:standard -utf8);
 
 # Koha modules used
 use C4::Context;
-use C4::Output;
-use C4::Auth;
-use C4::Biblio;
-use C4::AuthoritiesMarc;
-use C4::ImportBatch;
+use C4::Output qw( output_html_with_http_headers );
+use C4::Auth qw( get_template_and_user );
+use C4::Auth qw( get_template_and_user );
+use C4::ImportBatch qw( GetImportBiblios );
+use C4::AuthoritiesMarc qw( GetAuthority );
 
 use Koha::Biblios;
+use Koha::Import::Records;
 
 # Input params
-my $input        = new CGI;
+my $input        = CGI->new;
 my $recordid = $input->param('id');
 my $importid     = $input->param('importid');
 my $batchid      = $input->param('batchid');
@@ -55,18 +56,13 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
         template_name   => "tools/showdiffmarc.tt",
         query           => $input,
         type            => "intranet",
-        authnotrequired => 0,
         flagsrequired   => { tools => 'manage_staged_marc' },
-        debug           => 1,
     }
 );
 
 if ( $type eq 'biblio' ) {
-    $record = GetMarcBiblio({
-        biblionumber => $recordid,
-        embed_items  => 1,
-    });
     my $biblio = Koha::Biblios->find( $recordid );
+    $record = $biblio->metadata->record({ embed_items => 1 });
     $recordTitle = $biblio->title;
 }
 elsif ( $type eq 'auth' ) {
@@ -80,7 +76,8 @@ if( $record ) {
 }
 
 if( $importid ) {
-    $recordImportid = C4::ImportBatch::GetRecordFromImportBiblio( $importid, 'embed_items' );
+    my $import_record = Koha::Import::Records->find($importid);
+    my $recordImportid = $import_record->get_marc_record();
     $formatted2 = $recordImportid->as_formatted;
     my $biblio = GetImportBiblios($importid);
     $importTitle = $biblio->[0]->{'title'};