bounce browser to printer URL and return with station
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 8 Feb 2012 13:47:53 +0000 (14:47 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 25 Mar 2019 14:41:15 +0000 (15:41 +0100)
This allows us to recurect to printer REST API, send ZPL file to printer
and return to Koha with station/printer IP address to record in log.

labels/spinelabel-print.pl

index d1e81ea..c722840 100755 (executable)
@@ -52,6 +52,35 @@ unless (defined $item) {
   $template->param( 'BarcodeNotFound' => 1 );
 }
 
+# XXX FFZG #1059 -- dpavlin 2012-02-07 print spine labels
+
+use URI::Escape;
+
+my $ip = $query->remote_addr;
+
+if ( my $station = $query->param('station') ) {
+
+       warn "PRINTED $barcode on $station\n";
+
+       my $insert = $dbh->prepare(qq{
+               insert into items_print_log (barcode,itemnumber,station) values (?,?,?)
+       });
+       $insert->execute( $item->{barcode}, $item->{biblioitemnumber}, $station );
+
+} else {
+
+       my $print_data = join(' ',
+               $item->{barcode},
+               $item->{itemcallnumber},
+       );
+
+       print $query->redirect( 'http://printer-zebra.vbz.ffzg.hr/print.cgi?print=' . uri_escape($print_data) . '&return=' . uri_escape($query->self_url) );
+       exit 0;
+
+}
+
+# XXX /FFZG
+
 my $body;
 
 my $data;
@@ -84,6 +113,26 @@ while ( my ( $key, $value ) = each(%$data) ) {
 
 $body = $scheme;
 
+# XXX FFZG
+
+$body .= qq|
+<style type="text/css">
+#printed_label {
+       display: block;
+       border: 1px solid #ccc;
+       position: absolute;
+       top: 0;
+       left: 0;
+}
+#print_button {
+       display: none;
+}
+</style>
+<img id="printed_label" src="http://printer-zebra.vbz.ffzg.hr/$barcode.png">
+|;
+
+# XXX /FFZG
+
 $template->param( autoprint => C4::Context->preference("SpineLabelAutoPrint") );
 $template->param( content   => $body );