Bug 30952: Show the search catalog form by default in cat-search.inc
[koha-ffzg.git] / tools / batch_delete_records.pl
index b35d703..a178180 100755 (executable)
@@ -27,7 +27,7 @@ use Try::Tiny;
 use C4::Auth qw( get_template_and_user );
 use C4::Output qw( output_html_with_http_headers );
 use C4::Auth qw( get_template_and_user );
-use C4::Biblio qw( GetMarcBiblio );
+use C4::Biblio;
 use C4::AuthoritiesMarc;
 use Koha::Virtualshelves;
 
@@ -54,7 +54,7 @@ if ( $op eq 'form' ) {
     # Display the form
     $template->param(
         op => 'form',
-        lists => scalar Koha::Virtualshelves->search(
+        lists => Koha::Virtualshelves->search(
             [
                 { public => 0, owner => $loggedinuser },
                 { public => 1 }
@@ -85,14 +85,14 @@ if ( $op eq 'form' ) {
         }
     } else {
         # The user enters manually the list of id
-        push @record_ids, split( /\s\n/, $input->param('recordnumber_list') );
+        push @record_ids, split( /\s\n/, scalar $input->param('recordnumber_list') );
     }
 
     for my $record_id ( uniq @record_ids ) {
         if ( $recordtype eq 'biblio' ) {
             # Retrieve biblio information
-            my $biblio = Koha::Biblios->find( $record_id );
-            unless ( $biblio ) {
+            my $biblio_object = Koha::Biblios->find( $record_id );
+            unless ( $biblio_object ) {
                 push @messages, {
                     type => 'warning',
                     code => 'biblio_not_exists',
@@ -100,12 +100,12 @@ if ( $op eq 'form' ) {
                 };
                 next;
             }
-            my $holds_count = $biblio->holds->count;
-            $biblio = $biblio->unblessed;
-            my $record = &GetMarcBiblio({ biblionumber => $record_id });
+            my $biblio = $biblio_object->unblessed;
+            my $record = $biblio_object->metadata->record;
             $biblio->{itemnumbers} = [Koha::Items->search({ biblionumber => $record_id })->get_column('itemnumber')];
-            $biblio->{holds_count} = $holds_count;
+            $biblio->{holds_count} = $biblio_object->holds->count;
             $biblio->{issues_count} = C4::Biblio::CountItemsIssued( $record_id );
+            $biblio->{subscriptions_count} = $biblio_object->subscriptions->count;
             push @records, $biblio;
         } else {
             # Retrieve authority information