Kumara - predecessor to Koha
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
3.1 KiB

  1. package C4::Print; #asummes C4/Print.pm
  2. use strict;
  3. require Exporter;
  4. use C4::InterfaceCDK;
  5. use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
  6. # set the version for version checking
  7. $VERSION = 0.01;
  8. @ISA = qw(Exporter);
  9. @EXPORT = qw(&remoteprint &printreserve);
  10. %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
  11. # your exported package globals go here,
  12. # as well as any optionally exported functions
  13. @EXPORT_OK = qw($Var1 %Hashit);
  14. # non-exported package globals go here
  15. use vars qw(@more $stuff);
  16. # initalize package globals, first exported ones
  17. my $Var1 = '';
  18. my %Hashit = ();
  19. # then the others (which are still accessible as $Some::Module::stuff)
  20. my $stuff = '';
  21. my @more = ();
  22. # all file-scoped lexicals must be created before
  23. # the functions below that use them.
  24. # file-private lexicals go here
  25. my $priv_var = '';
  26. my %secret_hash = ();
  27. # here's a file-private function as a closure,
  28. # callable as &$priv_func; it cannot be prototyped.
  29. my $priv_func = sub {
  30. # stuff goes here.
  31. };
  32. # make all your functions, whether exported or not;
  33. sub remoteprint {
  34. my ($env,$items,$borrower)=@_;
  35. #open (FILE,">/tmp/olwen");
  36. #print FILE "queue $env->{'queue'}";
  37. #close FILE;
  38. #debug_msg($env,"In print");
  39. my $file=time;
  40. my $queue = $env->{'queue'};
  41. open(PRINTER, "| lpr -P $queue") or die "Couldn't write to queue:$!\n";
  42. # print $queue;
  43. #open (FILE,">/tmp/$file");
  44. my $i=0;
  45. my $brdata = $env->{'brdata'};
  46. print PRINTER "Horowhenua Library Trust\r\n";
  47. print PRINTER "$brdata->{'branchname'}\r\n";
  48. print PRINTER "Phone: 368-1953\r\n";
  49. print PRINTER "Fax: 367-9218\r\n";
  50. print PRINTER "Email: renewals\@library.org.nz\r\n\r\n\r\n";
  51. print PRINTER "$borrower->{'cardnumber'}\r\n";
  52. print PRINTER "$borrower->{'firstname'} $borrower->{'surname'}\r\n";
  53. while ($items->[$i]){
  54. my $itemdata = $items->[$i];
  55. print PRINTER "$itemdata->{'title'}\r\n";
  56. print PRINTER "$itemdata->{'barcode'}";
  57. print PRINTER " "x15;
  58. print PRINTER "$itemdata->{'datedue'}\r\n";
  59. $i++;
  60. }
  61. print PRINTER "\r\n\r\n";
  62. if ($env->{'printtype'} eq "docket"){
  63. print chr(27).chr(105);
  64. }
  65. close PRINTER;
  66. #system("lpr /tmp/$file");
  67. }
  68. sub printreserve {
  69. my($env,$resrec,$rbordata,$itemdata)=@_;
  70. my $file=time;
  71. my $queue = $env->{'queue'};
  72. open(PRINTER, "| lpr -P $queue") or die "Couldn't write to queue:$!\n";
  73. #open (FILE,">/tmp/$file");
  74. print PRINTER "Collect at $resrec->{'branchcode'}\r\n\r\n";
  75. print PRINTER "$rbordata->{'surname'}; $rbordata->{'firstname'}\r\n";
  76. print PRINTER "$rbordata->{'cardnumber'}\r\n";
  77. print PRINTER "Phone: $rbordata->{'phone'}\r\n";
  78. print PRINTER "$rbordata->{'streetaddress'}\r\n";
  79. print PRINTER "$rbordata->{'suburb'}\r\n";
  80. print PRINTER "$rbordata->{'town'}\r\n";
  81. print PRINTER "$rbordata->{'emailaddress'}\r\n\r\n";
  82. print PRINTER "$itemdata->{'barcode'}\r\n";
  83. print PRINTER "$itemdata->{'title'}\r\n";
  84. print PRINTER "$itemdata->{'author'}";
  85. print PRINTER "\r\n\r\n";
  86. if ($env->{'printtype'} eq "docket"){
  87. print chr(27).chr(105);
  88. }
  89. close PRINTER;
  90. #system("lpr /tmp/$file");
  91. }
  92. END { } # module clean-up code here (global destructor)