#
# This file is part of Koha.
#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 3 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
=head1 NAME
=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);
if ($options{slice}) {
$slice_count = $options{slice}->{count};
$slice_modulo = $options{slice}->{index};
- $search_terms = \[ ' mod(biblionumber, ?) = ?', $slice_count, $slice_modulo];
+ $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 $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) {