#
# 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 2 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>.
use strict;
use warnings;
use C4::Debug;
use C4::Context;
-use autouse 'C4::Members' => qw(GetPatronImage GetMember);
+use autouse 'C4::Members' => qw(GetMember);
use C4::Creators;
use C4::Patroncards;
+use Koha::List::Patron;
+use Koha::Patron::Images;
my $cgi = new CGI;
my $batch_id = $cgi->param('batch_id') if $cgi->param('batch_id');
my $template_id = $cgi->param('template_id') || undef;
my $layout_id = $cgi->param('layout_id') || undef;
-my $start_label = $cgi->param('start_label') || 1;
-my @label_ids = $cgi->param('label_id') if $cgi->param('label_id');
-my @borrower_numbers = $cgi->param('borrower_number') if $cgi->param('borrower_number');
+my $start_card = $cgi->param('start_card') || 1;
+my @label_ids = $cgi->multi_param('label_id') if $cgi->param('label_id');
+my @borrower_numbers = $cgi->multi_param('borrower_number') if $cgi->param('borrower_number');
+my $patronlist_id = $cgi->param('patronlist_id');
my $items = undef; # items = cards
my $new_page = 0;
$pdf->Mbox($lower_left_x, $lower_left_y, $upper_right_x, $upper_right_y);
my ($llx, $lly) = 0,0;
-(undef, undef, $llx, $lly) = $pc_template->get_label_position($start_label);
+(undef, undef, $llx, $lly) = $pc_template->get_label_position($start_card);
if (@label_ids) {
my $batch_items = $batch->get_attr('items');
}
elsif (@borrower_numbers) {
grep {
- push(@{$items}, {item_number => $_});
+ push(@{$items}, {borrower_number => $_});
} @borrower_numbers;
}
+elsif ( $patronlist_id ) {
+ my ($list) = GetPatronLists( { patron_list_id => $patronlist_id } );
+ my @borrowerlist = $list->patron_list_patrons()->search_related('borrowernumber')
+ ->get_column('borrowernumber')->all();
+ grep {
+ push(@{$items}, {borrower_number => $_});
+ } @borrowerlist;
+}
else {
$items = $batch->get_attr('items');
}
height => $pc_template->get_attr('label_height'), # of the card
width => $pc_template->get_attr('label_width'),
layout => $layout_xml,
- text_wrap_cols => 30, #FIXME: hardcoded
+ text_wrap_cols => 30, #FIXME: hardcoded,
);
+
$patron_card->draw_guide_box($pdf) if $layout_xml->{'guide_box'};
$patron_card->draw_barcode($pdf) if $layout_xml->{'barcode'};
next PROCESS_IMAGES;
}
elsif ($images->{$_}->{'data_source'}->[0]->{'image_source'} eq 'patronimages') {
- ($image_data, $error) = GetPatronImage($borrower_number);
- warn sprintf('No image exists for borrower number %s.', $borrower_number) if !$image_data;
- next PROCESS_IMAGES if !$image_data;
+ my $patron_image = Koha::Patron::Images->find($borrower_number);
+ warn sprintf('No image exists for borrower number %s.', $borrower_number) unless $patron_image;
+ next PROCESS_IMAGES unless $patron_image;
}
elsif ($images->{$_}->{'data_source'}->[0]->{'image_source'} eq 'creator_images') {
my $dbh = C4::Context->dbh();