From 12d7e38cd53819d60a482d2b8c8bfd165cfb6dfe Mon Sep 17 00:00:00 2001 From: tipaul Date: Mon, 3 May 2004 09:26:12 +0000 Subject: [PATCH] copying printslip from circulation.pl --- C4/Print.pm | 51 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/C4/Print.pm b/C4/Print.pm index 042f122440..902227195e 100644 --- a/C4/Print.pm +++ b/C4/Print.pm @@ -76,7 +76,6 @@ sub remoteprint { my ($env,$items,$borrower)=@_; (return) unless (C4::Context->boolean_preference('printcirculationslips')); - my $file=time; # FIXME - Not used my $queue = $env->{'queue'}; # FIXME - If 'queue' is undefined or empty, then presumably it should # mean "use the default queue", whatever the default is. Presumably @@ -170,28 +169,42 @@ EOF =item printslip - &printslip($env, $text) - -Prints the string C<$text> to a printer. C<$env-E{queue}> -specifies the queue to print to. - -If C<$env-E{queue}> is empty or set to C, C<&printslip> -will print to the file F. + &printslip($env, $borrowernumber) + print a slip for the given $borrowernumber + =cut #' -# FIXME - There's also a &printslip in circ/circulation.pl sub printslip { - my($env, $slip)=@_; - my $printer = $env->{'printer'}; - (return) unless (C4::Context->boolean_preference('printcirculationslips')); - if ($printer eq "" || $printer eq 'nulllp') { - open (PRINTER,">/tmp/kohares"); - } else { - open (PRINTER, "| lpr -P $printer >/dev/null") or die "Couldn't write to queue:$!\n"; - } - print PRINTER $slip; - close PRINTER; + my ($env,$borrowernumber)=@_; + my ($borrower, $flags) = getpatroninformation($env,$borrowernumber,0); + $env->{'todaysissues'}=1; + my ($borrowerissues) = currentissues($env, $borrower); + $env->{'nottodaysissues'}=1; + $env->{'todaysissues'}=0; + my ($borroweriss2)=currentissues($env, $borrower); + $env->{'nottodaysissues'}=0; + my $i=0; + my @issues; + foreach (sort {$a <=> $b} keys %$borrowerissues) { + $issues[$i]=$borrowerissues->{$_}; + my $dd=$issues[$i]->{'date_due'}; + #convert to nz style dates + #this should be set with some kinda config variable + my @tempdate=split(/-/,$dd); + $issues[$i]->{'date_due'}="$tempdate[2]/$tempdate[1]/$tempdate[0]"; + $i++; + } + foreach (sort {$a <=> $b} keys %$borroweriss2) { + $issues[$i]=$borroweriss2->{$_}; + my $dd=$issues[$i]->{'date_due'}; + #convert to nz style dates + #this should be set with some kinda config variable + my @tempdate=split(/-/,$dd); + $issues[$i]->{'date_due'}="$tempdate[2]/$tempdate[1]/$tempdate[0]"; + $i++; + } + remoteprint($env,\@issues,$borrower); } END { } # module clean-up code here (global destructor) -- 2.39.5