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

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


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?
---
 .../intranet-tmpl/prog/en/css/spinelabel-print.css |   31 ++++++++++++++++++++
 .../prog/en/modules/labels/spinelabel-print.tmpl   |   24 ++++++++++-----
 labels/spinelabel-print.pl                         |    5 +++
 3 files changed, 52 insertions(+), 8 deletions(-)
 create mode 100644 koha-tmpl/intranet-tmpl/prog/en/css/spinelabel-print.css

diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/spinelabel-print.css b/koha-tmpl/intranet-tmpl/prog/en/css/spinelabel-print.css
new file mode 100644
index 0000000..cf60975
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/prog/en/css/spinelabel-print.css
@@ -0,0 +1,31 @@
+body {
+	font-family: arial, geneva, sans-serif;
+	font-size: 12px;
+	margin: 0px 0px 0px 0px;
+}
+
+/* Line break after each field */
+.field{
+	display: block;
+}
+
+/* Line break after each space in the itemcallnumber field */
+#itemcallnumber .space {
+	display: block;
+}
+
+/* Put the copynumber on the bottom of the label */
+#copynumber {
+	position: absolute;
+	top: 75px;
+}
+
+#print_button {
+	position: absolute;
+	top: 25px;
+	left: 500px;
+}
+
+.hide {
+	display: none;
+}
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..ddbf209 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,21 @@
 	<head>
 		<title>Koha &rsaquo; Tools &rsaquo; Spine Labels</title>
 		<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/css/spinelabel.css" />
+		<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/css/spinelabel-print.css" media="print" />
 	</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="hide">
+				<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