This is a small tool for quickly printing spine labels using dedicated label printers.
It is located in the Tools page as Quick Spine Label Creator.
The system preference SpineLabelFormat defines which fields will be displayed.
The pref SpineLabelAutoPrint will make the print dialog pop up automatically.
The CSS file spinelabel.css controls all presentation for the labels.
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('viewLabeledMARC','0','Allow display of labeled MARC view of bibiographic records','','YesNo');
INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('viewMARC','1','Allow display of MARC view of bibiographic records','','YesNo');
INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('FilterBeforeOverdueReport','0','Do not run overdue report until filter selected','','YesNo');
+INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelFormat', '<itemcallnumber><copynumber>', '', 'This preference defines the format for the quick spine label printer. Just list the fields you would like to see in the order you would like to see them, surrounded by <>, for example <itemcallnumber>.', 'Textarea');
+INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelAutoPrint', '0', '', 'If this setting is turned on, a print dialog will automatically pop up for the quick spine label printer.', 'YesNo');
INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('viewLabeledMARC','0','Autoriser l''affichage MARC labellis des notices bibliographiques','','YesNo');
INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('viewMARC','1','Autoriser l''affichage de la vue MARC des notices bibliographiques','','YesNo');
INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('FilterBeforeOverdueReport','0','Ne pas lancer le rapport sur les retards tant qu''il n''y a pas de filtre','','YesNo');
+INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelFormat', '<itemcallnumber><copynumber>', '', 'This preference defines the format for the quick spine label printer. Just list the fields you would like to see in the order you would like to see them, surrounded by <>, for example <itemcallnumber>.', 'Textarea');
+INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelAutoPrint', '0', '', 'If this setting is turned on, a print dialog will automatically pop up for the quick spine label printer.', 'YesNo');
SetVersion ($DBversion);
}
+$DBversion = '3.01.00.038';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelFormat', '<itemcallnumber><copynumber>', '', 'This preference defines the format for the quick spine label printer. Just list the fields you would like to see in the order you would like to see them, surrounded by <>, for example <itemcallnumber>.', 'Textarea')");
+ SetVersion ($DBversion);
+ print "Upgrade to $DBversion done (added SpineLabelFormat syspref)\n";
+}
+
=item DropAllForeignKeys($table)
Drop all foreign keys of the table $table
--- /dev/null
+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;
+}
\ No newline at end of file
--- /dev/null
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --><title>Koha › Tools › Labels</title>
+<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+</head>
+<body>
+<!-- TMPL_INCLUDE NAME="header.inc" -->
+<!-- TMPL_INCLUDE NAME="cat-search.inc" -->
+
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › Spine Labels</div>
+
+<div id="doc3" class="yui-t2">
+
+ <div id="bd">
+ <div id="yui-main">
+ <div class="yui-b">
+ <form action="/cgi-bin/koha/labels/spinelabel-print.pl" method="post">
+ <label>Barcode: </label>
+ <input type="text" name="barcode" id="barcode" />
+ <input type="submit" value="View Spine Label" />
+ </form>
+ </div>
+ </div>
+ </div>
+</div>
+<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
--- /dev/null
+<html>
+ <head>
+ <title>Koha › Tools › Spine Labels</title>
+ <link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/css/spinelabel.css" />
+ </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>
+</html>
\ No newline at end of file
<dd>Create printable labels and barcodes from catalog data and patron cards from patron data</dd>
<!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="CAN_user_tools_label_creator" -->
+ <dt><a href="/cgi-bin/koha/labels/spinelabel-home.pl">Quick Spine Label Creator</a></dt>
+ <dd>Enter a barcode to generate a printable spine label</dd>
+ <!-- /TMPL_IF -->
+
<!-- TMPL_IF NAME="CAN_user_tools_edit_calendar" -->
<dt><a href="/cgi-bin/koha/tools/holidays.pl">Calendar</a></dt>
<dd>Define days when the library is closed</dd>
--- /dev/null
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+use CGI;
+use C4::Auth;
+use C4::Output;
+use C4::Labels;
+use C4::Output;
+use C4::Context;
+use HTML::Template::Pro;
+
+# use Smart::Comments;
+
+my $query = new CGI;
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "labels/spinelabel-home.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { catalogue => 1 },
+ debug => 1,
+ }
+);
+
+output_html_with_http_headers $query, $cookie, $template->output;
--- /dev/null
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+use CGI;
+use C4::Auth;
+use C4::Output;
+use HTML::Template::Pro;
+
+my $scheme = C4::Context->preference('SpineLabelFormat');
+my $query = new CGI;
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "labels/spinelabel-print.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { catalogue => 1 },
+ debug => 1,
+ }
+);
+
+
+my $barcode = $query->param('barcode');
+
+my $dbh = C4::Context->dbh;
+my $sth;
+
+my $item;
+
+my $sql = "SELECT * FROM biblio, biblioitems, items
+ WHERE biblio.biblionumber = items.biblionumber
+ AND biblioitems.biblioitemnumber = items.biblioitemnumber
+ AND items.barcode = ?";
+$sth = $dbh->prepare( $sql );
+$sth->execute( $barcode );
+$item = $sth->fetchrow_hashref;
+
+my $body;
+
+my $data;
+while ( my ($key, $value ) = each(%$item) ) {
+ $data->{$key} .= "<span class='field' id='$key'>";
+
+ my @characters = split(//, $value );
+ my $charnum = 1;
+ my $wordnum = 1;
+ my $i = 1;
+ foreach my $char ( @characters ) {
+ if ( $char ne ' ' ) {
+ $data->{$key} .= "<span class='character word$wordnum character$charnum' id='$key$i'>$char</span>";
+ } else {
+ $data->{$key} .= "<span class='space character$charnum' id='$key$i'>$char</span>";
+ $wordnum++;
+ $charnum = 1;
+ }
+ $charnum++;
+ $i++;
+ }
+
+ $data->{$key} .= "</span>";
+}
+
+while ( my ($key, $value ) = each(%$data) ) {
+ $scheme =~ s/<$key>/$value/g;
+}
+
+$body = $scheme;
+
+$template->param( autoprint => C4::Context->preference("SpineLabelAutoPrint") );
+$template->param( content => $body );
+
+output_html_with_http_headers $query, $cookie, $template->output;