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>.
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 },
34 my $barcode = $query->param('barcode');
36 my $dbh = C4
::Context
->dbh;
41 my $sql = "SELECT * FROM biblio, biblioitems, items
42 WHERE biblio.biblionumber = items.biblionumber
43 AND biblioitems.biblioitemnumber = items.biblioitemnumber
44 AND items.barcode = ?";
45 $sth = $dbh->prepare($sql);
46 $sth->execute($barcode);
47 $item = $sth->fetchrow_hashref;
49 unless (defined $item) {
50 $template->param( 'Barcode' => $barcode );
51 $template->param( 'BarcodeNotFound' => 1 );
57 while ( my ( $key, $value ) = each(%$item) ) {
58 $data->{$key} .= "<span class='field' id='$key'>";
60 $value = '' unless defined $value;
61 my @characters = split( //, $value );
65 foreach my $char (@characters) {
67 $data->{$key} .= "<span class='character word$wordernumber character$charnum' id='$key$i'>$char</span>";
69 $data->{$key} .= "<span class='space character$charnum' id='$key$i'>$char</span>";
77 $data->{$key} .= "</span>";
80 while ( my ( $key, $value ) = each(%$data) ) {
81 $scheme =~ s/<$key>/$value/g;
86 $template->param( autoprint
=> C4
::Context
->preference("SpineLabelAutoPrint") );
87 $template->param( content
=> $body );
89 output_html_with_http_headers
$query, $cookie, $template->output;