[Koha-cvs] CVS: koha/C4 Print.pm,1.6,1.7
Finlay Thompson
finlayt at users.sourceforge.net
Wed Jul 24 05:16:24 CEST 2002
Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv2739/C4
Modified Files:
Print.pm
Log Message:
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.
in circulation.pl I have moved some javascript out to the circulation-top.inc
Index: Print.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Print.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** Print.pm 23 Jul 2002 03:32:42 -0000 1.6
--- Print.pm 24 Jul 2002 03:16:21 -0000 1.7
***************
*** 11,15 ****
@ISA = qw(Exporter);
! @EXPORT = qw(&remoteprint &printreserve);
sub remoteprint {
--- 11,15 ----
@ISA = qw(Exporter);
! @EXPORT = qw(&remoteprint &printreserve &printslip);
sub remoteprint {
***************
*** 59,80 ****
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";
close PRINTER;
}
END { } # module clean-up code here (global destructor)
--- 59,109 ----
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 $slip;
close PRINTER;
}
+
END { } # module clean-up code here (global destructor)
More information about the Koha-cvs
mailing list