Bug 17600: Standardize our EXPORT_OK
[srvgit] / Koha / BiblioUtils.pm
index 02c10f5..1ece4a8 100644 (file)
@@ -32,12 +32,11 @@ the new thing that should be used.
 
 =cut
 
-use C4::Biblio; # EmbedItemsInMarcBiblio
+use C4::Biblio;
 use Koha::MetadataIterator;
 use Koha::Database;
 use Modern::Perl;
 
-use Data::Dumper; # TODO remove
 
 use base qw(Koha::MetadataRecord);
 
@@ -134,12 +133,17 @@ sub get_all_biblios_iterator {
         $search_terms = \[ 'mod(biblionumber, ?) = ?', $slice_count, $slice_modulo ];
     }
 
+    my $search_options = { columns => [qw/ biblionumber /] };
+    if ( $options{desc} ){
+        $search_options->{order_by}  = { -desc => 'biblionumber' };
+    }
+
     my $database = Koha::Database->new();
     my $schema   = $database->schema();
     my $rs =
       $schema->resultset('Biblio')->search(
         $search_terms,
-        { columns => [qw/ biblionumber /] } );
+        $search_options );
     my $next_func = sub {
         # Warn and skip bad records, otherwise we break the loop
         while (1) {