X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=patroncards%2Fcreate-pdf.pl;h=6a1b67a57326883ccdb2d100efaf9834a7c6ce42;hb=11b62318f445ca514d8c55d8c2973b45bdaa6295;hp=5604f17fa0223a803e95a3564938e741ad0fb7bf;hpb=c165df96c0ace7064a01150dfdfffbcd10b64f5e;p=koha.git diff --git a/patroncards/create-pdf.pl b/patroncards/create-pdf.pl index 5604f17fa0..6a1b67a573 100755 --- a/patroncards/create-pdf.pl +++ b/patroncards/create-pdf.pl @@ -21,6 +21,7 @@ use strict; use warnings; use CGI; +use C4::Auth; use Graphics::Magick; use XML::Simple; use POSIX qw(ceil); @@ -29,11 +30,21 @@ use autouse 'Data::Dumper' => qw(Dumper); use C4::Debug; use C4::Context; use autouse 'C4::Members' => qw(GetPatronImage GetMember); -use C4::Creators 1.000000; -use C4::Patroncards 1.000000; +use C4::Creators; +use C4::Patroncards; my $cgi = new CGI; +my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ + template_name => "labels/label-home.tt", + query => $cgi, + type => "intranet", + authnotrequired => 0, + flagsrequired => { tools => 'label_creator' }, + debug => 1, + }); + + 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; @@ -141,13 +152,13 @@ foreach my $item (@{$items}) { elsif ($images->{$_}->{'data_source'}->[0]->{'image_source'} eq 'creator_images') { 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 = \'$$layout_xml{'images'}{$_}{'data_source'}{'image_name'}\'"); + $image_data = $dbh->selectrow_hashref("SELECT imagefile FROM creator_images WHERE image_name = \'$images->{$_}->{'data_source'}->[0]->{'image_name'}\'"); warn sprintf('Database returned the following error: %s.', $error) if $error; - warn sprintf('Image does not exists in db table %s.', $$layout_xml{'images'}{$_}{'data_source'}{'image_source'}) if !$image_data; + warn sprintf('Image does not exists in db table %s.', $images->{$_}->{'data_source'}->[0]->{'image_name'}) if !$image_data; next PROCESS_IMAGES if !$image_data; } else { - warn sprintf('No retrieval method for image source %s.', $$layout_xml{'images'}{$_}{'data_source'}{'image_source'}); + warn sprintf('No retrieval method for image source %s.', $images->{$_}->{'data_source'}->[0]->{'image_source'}); next PROCESS_IMAGES; } }