1 package C4::Print; #asummes C4/Print.pm
7 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
9 # set the version for version checking
13 @EXPORT = qw(&remoteprint &printreserve);
14 %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
16 # your exported package globals go here,
17 # as well as any optionally exported functions
19 @EXPORT_OK = qw($Var1 %Hashit);
22 # non-exported package globals go here
23 use vars qw(@more $stuff);
25 # initalize package globals, first exported ones
31 # then the others (which are still accessible as $Some::Module::stuff)
35 # all file-scoped lexicals must be created before
36 # the functions below that use them.
38 # file-private lexicals go here
42 # here's a file-private function as a closure,
43 # callable as &$priv_func; it cannot be prototyped.
48 # make all your functions, whether exported or not;
51 my ($env,$items,$borrower)=@_;
52 #open (FILE,">/tmp/olwen");
53 #print FILE "queue $env->{'queue'}";
55 #debug_msg($env,"In print");
57 my $queue = $env->{'queue'};
59 open (PRINTER,">/tmp/kohaiss");
61 open(PRINTER, "| lpr -P $queue") or die "Couldn't write to queue:$!\n";
64 #open (FILE,">/tmp/$file");
66 my $brdata = $env->{'brdata'};
67 print PRINTER "Horowhenua Library Trust\r\n";
68 # print PRINTER "$brdata->{'branchname'}\r\n";
69 print PRINTER "Phone: 368-1953\r\n";
70 print PRINTER "Fax: 367-9218\r\n";
71 print PRINTER "Email: renewals\@library.org.nz\r\n\r\n\r\n";
72 print PRINTER "$borrower->{'cardnumber'}\r\n";
73 print PRINTER "$borrower->{'title'} $borrower->{'initials'} $borrower->{'surname'}\r\n";
76 my $itemdata = $items->[$i];
77 print PRINTER "$i $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)