diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/print.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/print.tt index 969d203bba..4033175c9d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/print.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/print.tt @@ -23,17 +23,17 @@ [% IF ( batche.label_ids ) %] [% batche.card_count | html %] Single patron cards

- label_single_[% batche.card_count | html %].pdf + label_single_[% batche.card_count | html %].pdf

[% ELSIF ( batche.borrower_numbers ) %] [% batche.card_count | html %] Single patron cards

- label_single_[% batche.card_count | html %].pdf + label_single_[% batche.card_count | html %].pdf

[% ELSE %] Card batch number [% batche.batch_id | html %]

- label_batch_[% batche.batch_id | html %].pdf + label_batch_[% batche.batch_id | html %].pdf

[% END %] [% END %] @@ -76,17 +76,6 @@ [% IF (patronlist_id) %] [% END %]
    - [% IF (patronlist_id) %] -
  1. - - -
  2. - [% END %]
  3. + [% IF patronlist_id || batch_id %] +
  4. + + +
  5. + [% END %]
diff --git a/patroncards/create-pdf.pl b/patroncards/create-pdf.pl index 5e86deac45..a6ba2bbd4b 100755 --- a/patroncards/create-pdf.pl +++ b/patroncards/create-pdf.pl @@ -86,12 +86,25 @@ my ($llx, $lly) = 0,0; if (@label_ids) { my $batch_items = $batch->get_attr('items'); + my @borrowernumbers; grep { my $label_id = $_; - push(@{$items}, grep{$_->{'label_id'} == $label_id;} @{$batch_items}); + push( @borrowernumbers, grep { $_->{'label_id'} == $label_id; } @{$batch_items} ); } @label_ids; + @borrowernumbers = map { $_->{borrower_number} } @borrowernumbers; + @borrowernumbers = + map { $_->borrowernumber } + Koha::Patrons->search( { borrowernumber => { -in => \@borrowernumbers } }, { order_by => [$order_by] } ) + ->as_list + if ($order_by); + grep { push( @{$items}, { borrower_number => $_ } ); } @borrowernumbers; } elsif (@borrower_numbers) { + @borrower_numbers = + map { $_->borrowernumber } + Koha::Patrons->search( { borrowernumber => { -in => \@borrower_numbers } }, { order_by => [$order_by] } ) + ->as_list + if ($order_by); grep { push(@{$items}, {borrower_number => $_}); } @borrower_numbers; @@ -106,7 +119,16 @@ elsif ( $patronlist_id ) { } @borrowerlist; } else { - $items = $batch->get_attr('items'); + my $batch_items = $batch->get_attr('items'); + my @borrowernumbers = map { $_->{borrower_number} } @{$batch_items}; + @borrowernumbers = + map { $_->borrowernumber } + Koha::Patrons->search( { borrowernumber => { -in => \@borrowernumbers } }, { order_by => [$order_by] } ) + ->as_list + if ($order_by); + grep { + push(@{$items}, {borrower_number => $_}); + } @borrowernumbers; } my $layout_xml = XMLin($layout->get_attr('layout_xml'), ForceArray => 1); diff --git a/patroncards/print.pl b/patroncards/print.pl index efee812233..c9fb194310 100755 --- a/patroncards/print.pl +++ b/patroncards/print.pl @@ -73,6 +73,7 @@ if ($op eq 'export') { $template->param( batches => \@batches, referer => $referer, + order_by => $order_by, ); } elsif (@borrower_numbers) { @@ -89,6 +90,7 @@ if ($op eq 'export') { $template->param( batches => \@batches, referer => $referer, + order_by => $order_by, ); } elsif (@batch_ids) { @@ -104,6 +106,7 @@ if ($op eq 'export') { $template->param( batches => \@batches, referer => $referer, + order_by => $order_by, ); } elsif ($patronlist_id ) {