[Koha-patches] [PATCH] Quick Spine Label Printer - Minors fixes

Kyle M Hall kyle.m.hall at gmail.com
Mon Aug 3 18:26:26 CEST 2009


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?
---
 .../prog/en/modules/labels/spinelabel-print.tmpl   |   29 ++++++++++++++-----
 labels/spinelabel-print.pl                         |    5 +++
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/spinelabel-print.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/spinelabel-print.tmpl
index 8897435..1530f43 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/spinelabel-print.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/spinelabel-print.tmpl
@@ -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
diff --git a/labels/spinelabel-print.pl b/labels/spinelabel-print.pl
index 1cfa103..82c6d51 100755
--- a/labels/spinelabel-print.pl
+++ b/labels/spinelabel-print.pl
@@ -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;
-- 
1.5.6.5




More information about the Koha-patches mailing list