Quick Spine Label Printer - Minors fixes
authorKyle M Hall <kyle.m.hall@gmail.com>
Mon, 3 Aug 2009 16:26:26 +0000 (16:26 +0000)
committerGalen Charlton <gmcharlt@gmail.com>
Tue, 4 Aug 2009 01:18:40 +0000 (21:18 -0400)
This new version of the patch does away with the need for 2 spinelabel css files.

This patch address two points brought up:
[1] (minor) if an item is not found, it should say so and return to
spinelabel-home.pl, not show an empty label
[2] (minor) can the print button be excluded from the printout?

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
koha-tmpl/intranet-tmpl/prog/en/modules/labels/spinelabel-print.tmpl
labels/spinelabel-print.pl

index 8897435..1530f43 100644 (file)
@@ -2,13 +2,26 @@
        <head>
                <title>Koha &rsaquo; Tools &rsaquo; Spine Labels</title>
                <link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/css/spinelabel.css" />
+
+               <style type="text/css">
+                       @media print {
+                               .noprint { display: none; }
+                       }
+               </style>
        </head>
-       <body <!-- TMPL_IF NAME="autoprint">onLoad="window.print()"<!-- /TMPL_IF> >
-               <span id="spinelabel" class="label">
-                       <!-- TMPL_VAR NAME="content" -->
-               </span>
-               <span id="print_button">
-                       <form><input type="button" value="Print This Label" onClick="window.print()" /></form>
-               </span>
-       </body>
+       <!-- TMPL_IF NAME="BarcodeNotFound" -->
+               <body>
+                       <p>The barcode <!-- TMPL_VAR NAME="Barcode" --> was not found.</p>
+                       <p><a href="spinelabel-home.pl">Return To Spine Label Printer</a></p>
+               </body>
+       <!-- TMPL_ELSE -->
+               <body <!-- TMPL_IF NAME="autoprint">onLoad="window.print()"<!-- /TMPL_IF> >
+                       <span id="spinelabel" class="label">
+                               <!-- TMPL_VAR NAME="content" -->
+                       </span>
+                       <span id="print_button" class="noprint">
+                               <form><input type="button" value="Print This Label" onClick="window.print()" /></form>
+                       </span>
+               </body>
+       <!-- /TMPL_IF -->
 </html>
\ No newline at end of file
index 1cfa103..82c6d51 100755 (executable)
@@ -48,6 +48,11 @@ $sth = $dbh->prepare($sql);
 $sth->execute($barcode);
 $item = $sth->fetchrow_hashref;
 
+if ( $item->{'itemnumber'} eq '' ) {
+  $template->param( 'Barcode' => $barcode );
+  $template->param( 'BarcodeNotFound' => 1 );
+}
+
 my $body;
 
 my $data;