-sub remoteprint {
- my ($env,$items,$borrower)=@_;
-
- (return) unless (C4::Context->boolean_preference('printcirculationslips'));
- 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
- # the default depends on the physical location of the machine.
- # FIXME - Perhaps "print to file" should be a supported option. Just
- # set the queue to "file" (or " file", if real queues aren't allowed
- # to have spaces in them). Or perhaps if $queue eq "" and
- # $env->{file} ne "", then that should mean "print to $env->{file}".
- if ($queue eq "" || $queue eq 'nulllp') {
- open (PRINTER,">/tmp/kohaiss");
- } else {
- # FIXME - This assumes that 'lpr' exists, and works as expected.
- # This is a reasonable assumption, but only because every other
- # printing package has a wrapper script called 'lpr'. It'd still
- # be better to be able to customize this.
- open(PRINTER, "| lpr -P $queue > /dev/null") or die "Couldn't write to queue:$queue!\n";
- }
-# print $queue;
- #open (FILE,">/tmp/$file");
- my $i=0;
- my $brdata = $env->{'brdata'}; # FIXME - Not used
- # FIXME - This is HLT-specific. Put this stuff in a customizable
- # site-specific file somewhere.
- print PRINTER "Horowhenua Library Trust\r\n";
-# print PRINTER "$brdata->{'branchname'}\r\n";
- print PRINTER "Phone: 368-1953\r\n";
- print PRINTER "Fax: 367-9218\r\n";
- print PRINTER "Email: renewals\@library.org.nz\r\n\r\n\r\n";
- print PRINTER "$borrower->{'cardnumber'}\r\n";
- print PRINTER "$borrower->{'title'} $borrower->{'initials'} $borrower->{'surname'}\r\n";
- # FIXME - Use for ($i = 0; $items->[$i]; $i++)
- # Or better yet, foreach $item (@{$items})
- while ($items->[$i]){
-# print $i;
- my $itemdata = $items->[$i];
- # FIXME - This is just begging for a Perl format.
- print PRINTER "$i $itemdata->{'title'}\r\n";
- print PRINTER "$itemdata->{'barcode'}";
- print PRINTER " "x15;
- print PRINTER "$itemdata->{'date_due'}\r\n";
- $i++;
- }
- print PRINTER "\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
- if ($env->{'printtype'} eq "docket"){
- #print chr(27).chr(105);
- }
- close PRINTER;
- #system("lpr /tmp/$file");
+sub remoteprint ($$) {
+ my ($items, $borrower) = @_;
+
+ (return)
+ unless ( C4::Context->boolean_preference('printcirculationslips') );
+ my $queue = '';
+
+ # FIXME - If 'queue' is undefined or empty, then presumably it should
+ # mean "use the default queue", whatever the default is. Presumably
+ # the default depends on the physical location of the machine.
+ # FIXME - Perhaps "print to file" should be a supported option. Just
+ # set the queue to "file" (or " file", if real queues aren't allowed
+ # to have spaces in them). Or perhaps if $queue eq "" and
+ # $env->{file} ne "", then that should mean "print to $env->{file}".
+ if ( $queue eq "" || $queue eq 'nulllp' ) {
+ open( PRINTER, ">/tmp/kohaiss" );
+ }
+ else {
+
+ # FIXME - This assumes that 'lpr' exists, and works as expected.
+ # This is a reasonable assumption, but only because every other
+ # printing package has a wrapper script called 'lpr'. It'd still
+ # be better to be able to customize this.
+ open( PRINTER, "| lpr -P $queue > /dev/null" )
+ or die "Couldn't write to queue:$queue!\n";
+ }
+
+ # print $queue;
+ #open (FILE,">/tmp/$file");
+ my $i = 0;
+ # FIXME - This is HLT-specific. Put this stuff in a customizable
+ # site-specific file somewhere.
+ print PRINTER "Horowhenua Library Trust\r\n";
+ print PRINTER "Phone: 368-1953\r\n";
+ print PRINTER "Fax: 367-9218\r\n";
+ print PRINTER "Email: renewals\@library.org.nz\r\n\r\n\r\n";
+ print PRINTER "$borrower->{'cardnumber'}\r\n";
+ print PRINTER
+ "$borrower->{'title'} $borrower->{'initials'} $borrower->{'surname'}\r\n";
+
+ # FIXME - Use for ($i = 0; $items->[$i]; $i++)
+ # Or better yet, foreach $item (@{$items})
+ while ( $items->[$i] ) {
+
+ # print $i;
+ my $itemdata = $items->[$i];
+
+ # FIXME - This is just begging for a Perl format.
+ print PRINTER "$i $itemdata->{'title'}\r\n";
+ print PRINTER "$itemdata->{'barcode'}";
+ print PRINTER " " x 15;
+ print PRINTER "$itemdata->{'date_due'}\r\n";
+ $i++;
+ }
+ print PRINTER "\r\n" x 7 ;
+ close PRINTER;
+
+ #system("lpr /tmp/$file");