Bugzilla – Attachment 170918 Details for
Bug 32742
Add sorting options to patron list export
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32742: (follow-up) perltidy patroncards/create-pdf.pl and patroncards/print.pl
Bug-32742-follow-up-perltidy-patroncardscreate-pdf.patch (text/plain), 6.87 KB, created by
ByWater Sandboxes
on 2024-08-30 16:01:01 UTC
(
hide
)
Description:
Bug 32742: (follow-up) perltidy patroncards/create-pdf.pl and patroncards/print.pl
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2024-08-30 16:01:01 UTC
Size:
6.87 KB
patch
obsolete
>From 179a60d2b69356570118a3751fa79708cc2797bb Mon Sep 17 00:00:00 2001 >From: Hammat Wele <hammat.wele@inlibro.com> >Date: Thu, 29 Aug 2024 21:10:18 +0000 >Subject: [PATCH] Bug 32742: (follow-up) perltidy patroncards/create-pdf.pl and > patroncards/print.pl > >Signed-off-by: Kelly <kelly@bwatersolutions.com> >--- > patroncards/create-pdf.pl | 59 ++++++++++++++++++++------------------- > patroncards/print.pl | 29 +++++++++++-------- > 2 files changed, 48 insertions(+), 40 deletions(-) > >diff --git a/patroncards/create-pdf.pl b/patroncards/create-pdf.pl >index a6ba2bbd4b..a4a99e3a2d 100755 >--- a/patroncards/create-pdf.pl >+++ b/patroncards/create-pdf.pl >@@ -184,36 +184,39 @@ foreach my $item (@{$items}) { > my $error = undef; > my $images = $print_layout_xml->{'images'}; > PROCESS_IMAGES: >- foreach my $card_image (sort(keys %{$images})) { >- if (grep{m/(source)/} keys(%{$images->{$card_image}->{'data_source'}->[0]})) { >- if ($images->{$card_image}->{'data_source'}->[0]->{'image_source'} eq 'none') { >- } >- elsif ($images->{$card_image}->{'data_source'}->[0]->{'image_source'} eq 'patronimages') { >- my $patron_image = Koha::Patron::Images->find($borrower_number); >- if ($patron_image) { >- $image_data->{'imagefile'} = $patron_image->imagefile; >- } >- else { >- warn sprintf('No image exists for borrower number %s.', $borrower_number); >+ foreach my $card_image ( sort( keys %{$images} ) ) { >+ if ( grep { m/(source)/ } keys( %{ $images->{$card_image}->{'data_source'}->[0] } ) ) { >+ if ( $images->{$card_image}->{'data_source'}->[0]->{'image_source'} eq 'none' ) { >+ } elsif ( $images->{$card_image}->{'data_source'}->[0]->{'image_source'} eq 'patronimages' ) { >+ my $patron_image = Koha::Patron::Images->find($borrower_number); >+ if ($patron_image) { >+ $image_data->{'imagefile'} = $patron_image->imagefile; >+ } else { >+ warn sprintf( 'No image exists for borrower number %s.', $borrower_number ); >+ } >+ } elsif ( $images->{$card_image}->{'data_source'}->[0]->{'image_source'} eq 'creator_images' ) { >+ ## FIXME: The DB stuff here needs to be religated to a Koha::Creator::Images object -chris_n >+ my $dbh = C4::Context->dbh(); >+ $dbh->{LongReadLen} = 1000000; # allows us to read approx 1MB >+ $image_data = $dbh->selectrow_hashref( >+ "SELECT imagefile FROM creator_images WHERE image_name = \'$images->{$card_image}->{'data_source'}->[0]->{'image_name'}\'" >+ ); >+ warn sprintf( 'Database returned the following error: %s.', $error ) if $error; >+ unless ($image_data) { >+ warn sprintf( >+ 'Image does not exists in db table %s.', >+ $images->{$card_image}->{'data_source'}->[0]->{'image_name'} >+ ); >+ } >+ } else { >+ warn sprintf( >+ 'No retrieval method for image source %s.', >+ $images->{$card_image}->{'data_source'}->[0]->{'image_source'} >+ ); > } >+ } else { >+ warn sprintf( "Unrecognized image data source: %s", $images->{$card_image}->{'data_source'} ); > } >- elsif ($images->{$card_image}->{'data_source'}->[0]->{'image_source'} eq 'creator_images') { >- ## FIXME: The DB stuff here needs to be religated to a Koha::Creator::Images object -chris_n >- my $dbh = C4::Context->dbh(); >- $dbh->{LongReadLen} = 1000000; # allows us to read approx 1MB >- $image_data = $dbh->selectrow_hashref("SELECT imagefile FROM creator_images WHERE image_name = \'$images->{$card_image}->{'data_source'}->[0]->{'image_name'}\'"); >- warn sprintf('Database returned the following error: %s.', $error) if $error; >- unless($image_data){ >- warn sprintf('Image does not exists in db table %s.', $images->{$card_image}->{'data_source'}->[0]->{'image_name'}); >- } >- } >- else { >- warn sprintf('No retrieval method for image source %s.', $images->{$card_image}->{'data_source'}->[0]->{'image_source'}); >- } >- } >- else { >- warn sprintf("Unrecognized image data source: %s", $images->{$card_image}->{'data_source'}); >- } > > my $binary_data = $image_data->{'imagefile'} || next PROCESS_IMAGES; > >diff --git a/patroncards/print.pl b/patroncards/print.pl >index c9fb194310..00fde2a3bc 100755 >--- a/patroncards/print.pl >+++ b/patroncards/print.pl >@@ -79,19 +79,24 @@ if ($op eq 'export') { > elsif (@borrower_numbers) { > my $borrower_number_param = '&borrower_number='; > $borrower_number_param .= join ('&borrower_number=',@borrower_numbers); >- push (@batches, {create_script => ($output_format eq 'pdf' ? 'create-pdf.pl' : 'create-csv.pl'), #FIXME csv not supported, no script? >- template_id => $template_id, >- layout_id => $layout_id, >- layout_back_id => $layout_back_id, >- start_card => $start_card, >- borrower_numbers => $borrower_number_param, >- card_count => scalar(@borrower_numbers), >- }); >+ push( >+ @batches, >+ { >+ create_script => ( $output_format eq 'pdf' ? 'create-pdf.pl' : 'create-csv.pl' ) >+ , #FIXME csv not supported, no script? >+ template_id => $template_id, >+ layout_id => $layout_id, >+ layout_back_id => $layout_back_id, >+ start_card => $start_card, >+ borrower_numbers => $borrower_number_param, >+ card_count => scalar(@borrower_numbers), >+ } >+ ); > $template->param( >- batches => \@batches, >- referer => $referer, >- order_by => $order_by, >- ); >+ batches => \@batches, >+ referer => $referer, >+ order_by => $order_by, >+ ); > } > elsif (@batch_ids) { > foreach my $batch_id (@batch_ids) { >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32742
:
155468
|
155469
|
155572
|
167956
|
168069
|
170786
|
170787
|
170882
|
170883
|
170884
|
170916
|
170917
|
170918
|
176400
|
176401
|
176402