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",
30 flagsrequired
=> { catalogue
=> 1 },
35 my $barcode = $query->param('barcode');
37 my $dbh = C4
::Context
->dbh;
42 my $sql = "SELECT * FROM biblio, biblioitems, items
43 WHERE biblio.biblionumber = items.biblionumber
44 AND biblioitems.biblioitemnumber = items.biblioitemnumber
45 AND items.barcode = ?";
46 $sth = $dbh->prepare($sql);
47 $sth->execute($barcode);
48 $item = $sth->fetchrow_hashref;
50 unless (defined $item) {
51 $template->param( 'Barcode' => $barcode );
52 $template->param( 'BarcodeNotFound' => 1 );
58 while ( my ( $key, $value ) = each(%$item) ) {
59 $data->{$key} .= "<span class='field' id='$key'>";
61 $value = '' unless defined $value;
62 my @characters = split( //, $value );
66 foreach my $char (@characters) {
68 $data->{$key} .= "<span class='character word$wordernumber character$charnum' id='$key$i'>$char</span>";
70 $data->{$key} .= "<span class='space character$charnum' id='$key$i'>$char</span>";
78 $data->{$key} .= "</span>";
81 while ( my ( $key, $value ) = each(%$data) ) {
82 $scheme =~ s/<$key>/$value/g;
87 $template->param( autoprint
=> C4
::Context
->preference("SpineLabelAutoPrint") );
88 $template->param( content
=> $body );
90 output_html_with_http_headers
$query, $cookie, $template->output;