2 package C4::Print; #asummes C4/Print.pm
8 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
10 # set the version for version checking
14 @EXPORT = qw(&remoteprint &printreserve);
15 %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
17 # your exported package globals go here,
18 # as well as any optionally exported functions
20 @EXPORT_OK = qw($Var1 %Hashit);
23 # non-exported package globals go here
24 use vars qw(@more $stuff);
26 # initalize package globals, first exported ones
32 # then the others (which are still accessible as $Some::Module::stuff)
36 # all file-scoped lexicals must be created before
37 # the functions below that use them.
39 # file-private lexicals go here
43 # here's a file-private function as a closure,
44 # callable as &$priv_func; it cannot be prototyped.
49 # make all your functions, whether exported or not;
52 my ($env,$items,$borrower)=@_;
53 #open (FILE,">/tmp/olwen");
54 #print FILE "queue $env->{'queue'}";
56 #debug_msg($env,"In print");
58 my $queue = $env->{'queue'};
60 open (PRINTER,">/tmp/kohaiss");
62 open(PRINTER, "| lpr -P $queue") or die "Couldn't write to queue:$!\n";
65 #open (FILE,">/tmp/$file");
67 my $brdata = $env->{'brdata'};
68 print PRINTER "Horowhenua Library Trust\r\n";
69 # print PRINTER "$brdata->{'branchname'}\r\n";
70 print PRINTER "Phone: 368-1953\r\n";
71 print PRINTER "Fax: 367-9218\r\n";
72 print PRINTER "Email: renewals\@library.org.nz\r\n\r\n\r\n";
73 print PRINTER "$borrower->{'cardnumber'}\r\n";
74 print PRINTER "$borrower->{'title'} $borrower->{'initials'} $borrower->{'surname'}\r\n";
76 my $itemdata = $items->[$i];
77 print PRINTER "$itemdata->{'title'}\r\n";
78 print PRINTER "$itemdata->{'barcode'}";
80 print PRINTER "$itemdata->{'date_due'}\r\n";
83 print PRINTER "\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
84 if ($env->{'printtype'} eq "docket"){
85 #print chr(27).chr(105);
88 #system("lpr /tmp/$file");
92 my($env,$resrec,$rbordata,$itemdata)=@_;
94 my $queue = $env->{'queue'};
96 open (PRINTER,">/tmp/kohares");
98 # open (PRINTER, "| lpr -P $queue") or die "Couldn't write to queue:$!\n";
100 print PRINTER "Collect at $resrec->{'branchcode'}\r\n\r\n";
101 print PRINTER "$rbordata->{'surname'}; $rbordata->{'firstname'}\r\n";
102 print PRINTER "$rbordata->{'cardnumber'}\r\n";
103 print PRINTER "Phone: $rbordata->{'phone'}\r\n";
104 print PRINTER "$rbordata->{'streetaddress'}\r\n";
105 print PRINTER "$rbordata->{'suburb'}\r\n";
106 print PRINTER "$rbordata->{'town'}\r\n";
107 print PRINTER "$rbordata->{'emailaddress'}\r\n\r\n";
108 print PRINTER "$itemdata->{'barcode'}\r\n";
109 print PRINTER "$itemdata->{'title'}\r\n";
110 print PRINTER "$itemdata->{'author'}";
111 print PRINTER "\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
112 if ($env->{'printtype'} eq "docket"){
113 #print chr(27).char(105);
116 #system("lpr /tmp/$file");
118 END { } # module clean-up code here (global destructor)