From 78c976aa0f5299205145ccad2551622813c13897 Mon Sep 17 00:00:00 2001 From: rangi Date: Tue, 18 Jun 2002 22:46:59 +0000 Subject: [PATCH] issues printing issue slips again --- C4/Print.pm | 4 ++-- circ/circulation.pl | 55 +++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 53 insertions(+), 6 deletions(-) diff --git a/C4/Print.pm b/C4/Print.pm index 26b388317e..5abb636ed4 100644 --- a/C4/Print.pm +++ b/C4/Print.pm @@ -55,10 +55,10 @@ sub remoteprint { #debug_msg($env,"In print"); my $file=time; my $queue = $env->{'queue'}; - if ($queue eq "") { + if ($queue eq "" || $queue eq 'nulllp') { open (PRINTER,">/tmp/kohaiss"); } else { - open(PRINTER, "| lpr -P $queue") or die "Couldn't write to queue:$!\n"; + open(PRINTER, "| lpr -P $queue") or die "Couldn't write to queue:$queue!\n"; } # print $queue; #open (FILE,">/tmp/$file"); diff --git a/circ/circulation.pl b/circ/circulation.pl index 5668378d0e..95f3d993bb 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -8,7 +8,7 @@ use CGI; use C4::Circulation::Circ2; use C4::Search; use C4::Output; - +use C4::Print; my %env; my $headerbackgroundcolor='#99cc33'; @@ -67,6 +67,20 @@ if ($findborrower) { my $borrowernumber = $query->param('borrnumber'); +# check and see if we should print +my $print=$query->param('print'); +my $barcode = $query->param('barcode'); +#if ($barcode eq '' ){ +# $print = 'yes'; +#} +if ($print eq 'yes' && $borrowernumber ne ''){ + printslip(\%env,$borrowernumber); + $query->param('borrnumber',''); + $borrowernumber=''; +} + + + # get the currently issued books...... my $borrower; my $flags; @@ -87,7 +101,7 @@ if (my $qnumber = $query->param('questionnumber')) { # if the barcode is set -my $barcode = $query->param('barcode'); + my ($iteminformation, $duedate, $rejected, $question, $questionnumber, $defaultanswer); my $year=$query->param('year'); @@ -154,7 +168,7 @@ EOF # title.... my $title = <<"EOF"; +
- + Next Borrower   Returns @@ -179,6 +193,7 @@ my $cardnumberinput = << "EOF";
Enter borrower card number
or partial last name
EOF @@ -302,6 +317,7 @@ my $barcodeentrytext = <<"EOF"; + @@ -417,6 +433,7 @@ if ($question) { print $rejectedtext; print $messagetable; + unless ($borrower) { if ($borrowerslist) { print $selectborrower; @@ -547,4 +564,34 @@ EOF - +sub printslip { + 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 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 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); +} -- 2.39.5