Browse Source

Fixed up the Print module. Added a function printslip that takes a string as an argument. It is easier to prepare the slip and then call the print function.


			
			
				3.0.x
			
			
		
finlayt 22 years ago
parent
commit
51e0e140c2
  1. 57
      C4/Print.pm
  2. 15
      circ/circulation.pl

57
C4/Print.pm

@ -10,7 +10,7 @@ use vars qw($VERSION @ISA @EXPORT);
$VERSION = 0.01;
@ISA = qw(Exporter);
@EXPORT = qw(&remoteprint &printreserve);
@EXPORT = qw(&remoteprint &printreserve &printslip);
sub remoteprint {
my ($env,$items,$borrower)=@_;
@ -57,25 +57,54 @@ sub printreserve {
my($env, $branchname, $bordata, $itemdata)=@_;
my $file=time;
my $printer = $env->{'printer'};
if ($printer eq "" || $printer eq 'nulllp') {
open (PRINTER,">>/tmp/kohares");
} else {
open (PRINTER, "| lpr -P $printer") or die "Couldn't write to queue:$!\n";
}
my @da = localtime(time());
my $todaysdate = "$da[2]:$da[1] $da[3]/$da[4]/$da[5]";
#(1900+$datearr[5]).sprintf ("%0.2d", ($datearr[4]+1)).sprintf ("%0.2d", $datearr[3]);
my $slip = <<"EOF";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Date: $todaysdate;
ITEM RESERVED:
$itemdata->{'title'} ($itemdata->{'author'})
barcode: $itemdata->{'barcode'}
COLLECT AT: $branchname
BORROWER:
$bordata->{'surname'}, $bordata->{'firstname'}
card number: $bordata->{'cardnumber'}
Phone: $bordata->{'phone'}
$bordata->{'streetaddress'}
$bordata->{'suburb'}
$bordata->{'town'}
$bordata->{'emailaddress'}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EOF
print PRINTER $slip;
close PRINTER;
return $slip;
}
sub printslip {
my($env, $slip)=@_;
my $printer = $env->{'printer'};
if ($printer eq "" || $printer eq 'nulllp') {
open (PRINTER,">/tmp/kohares");
} else {
open (PRINTER, "| lpr -P $printer") or die "Couldn't write to queue:$!\n";
}
print PRINTER "Collect at $branchname \r\n\r\n";
print PRINTER "$bordata->{'surname'}; $bordata->{'firstname'}\r\n";
print PRINTER "$bordata->{'cardnumber'}\r\n";
print PRINTER "Phone: $bordata->{'phone'}\r\n";
print PRINTER "$bordata->{'streetaddress'}\r\n";
print PRINTER "$bordata->{'suburb'}\r\n";
print PRINTER "$bordata->{'town'}\r\n";
print PRINTER "$bordata->{'emailaddress'}\r\n\r\n";
print PRINTER "$itemdata->{'barcode'}\r\n";
print PRINTER "$itemdata->{'title'}\r\n";
print PRINTER "$itemdata->{'author'}";
print PRINTER "\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
}
print PRINTER $slip;
close PRINTER;
}
END { } # module clean-up code here (global destructor)

15
circ/circulation.pl

@ -100,8 +100,7 @@ if (my $qnumber = $query->param('questionnumber')) {
}
# if the barcode is set
# if the barcode is set
my ($iteminformation, $duedate, $rejected, $question, $questionnumber, $defaultanswer);
my $year=$query->param('year');
@ -450,21 +449,11 @@ my @inp=startmenu('circulation');
if ($query->param('barcode') eq '' && $query->param('charges') eq 'yes'){
my $count=@inp;
for (my $i=0;$i<$count;$i++){
$inp[$i]=~ s/onLoad=focusinput\(\)/onLoad=focusinput\(\)\;messenger\(\"\/cgi-bin\/koha\/pay.pl?bornum=$bornum\"\)\;window1.focus\(\)/;
$inp[$i]=~ s/onLoad=focusinput\(\)/onLoad=focusinput\(\)\;messenger\(\"\/cgi-bin\/koha\/pay.pl?bornum=$bornum\",700,600\)\;window1.focus\(\)/;
}
}
print @inp;
print <<EOF
<script language="javascript" type="text/javascript">
<!--
function messenger(url){
window1=window.open(url,"window1","height=700,width=600,left=150,top=50,350,screenY=50");
}
//-->
</script>
EOF
;
#print startmenu('circulation');

Loading…
Cancel
Save