3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
20 use C4::Auth qw( get_template_and_user );
21 use C4::Output qw( output_html_with_http_headers );
23 my $scheme = C4::Context->preference('SpineLabelFormat');
25 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
26 { template_name => "labels/spinelabel-print.tt",
29 flagsrequired => { catalogue => 1 },
33 my $barcode = $query->param('barcode');
35 my $dbh = C4::Context->dbh;
40 my $sql = "SELECT * FROM biblio, biblioitems, items
41 WHERE biblio.biblionumber = items.biblionumber
42 AND biblioitems.biblioitemnumber = items.biblioitemnumber
43 AND items.barcode = ?";
44 $sth = $dbh->prepare($sql);
45 $sth->execute($barcode);
46 $item = $sth->fetchrow_hashref;
51 ) unless defined $item;
56 while ( my ( $key, $value ) = each(%$item) ) {
57 $data->{$key} .= "<span class='field' id='$key'>";
59 $value = '' unless defined $value;
60 my @characters = split( //, $value );
64 foreach my $char (@characters) {
66 $data->{$key} .= "<span class='character word$wordernumber character$charnum' id='$key$i'>$char</span>";
68 $data->{$key} .= "<span class='space character$charnum' id='$key$i'>$char</span>";
76 $data->{$key} .= "</span>";
79 while ( my ( $key, $value ) = each(%$data) ) {
80 $scheme =~ s/<$key>/$value/g;
86 autoprint => C4::Context->preference("SpineLabelAutoPrint"),
88 itemholdingbranch => $item->{holdingbranch},
89 itemhomebranch => $item->{homebranch},
92 output_html_with_http_headers $query, $cookie, $template->output;