3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along with
15 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16 # Suite 330, Boston, MA 02111-1307 USA
24 my $scheme = C4
::Context
->preference('SpineLabelFormat');
26 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
27 { template_name
=> "labels/spinelabel-print.tmpl",
31 flagsrequired
=> { catalogue
=> 1 },
36 my $barcode = $query->param('barcode');
38 my $dbh = C4
::Context
->dbh;
43 my $sql = "SELECT * FROM biblio, biblioitems, items
44 WHERE biblio.biblionumber = items.biblionumber
45 AND biblioitems.biblioitemnumber = items.biblioitemnumber
46 AND items.barcode = ?";
47 $sth = $dbh->prepare($sql);
48 $sth->execute($barcode);
49 $item = $sth->fetchrow_hashref;
51 unless (defined $item) {
52 $template->param( 'Barcode' => $barcode );
53 $template->param( 'BarcodeNotFound' => 1 );
59 while ( my ( $key, $value ) = each(%$item) ) {
60 $data->{$key} .= "<span class='field' id='$key'>";
62 $value = '' unless defined $value;
63 my @characters = split( //, $value );
67 foreach my $char (@characters) {
69 $data->{$key} .= "<span class='character word$wordernumber character$charnum' id='$key$i'>$char</span>";
71 $data->{$key} .= "<span class='space character$charnum' id='$key$i'>$char</span>";
79 $data->{$key} .= "</span>";
82 while ( my ( $key, $value ) = each(%$data) ) {
83 $scheme =~ s/<$key>/$value/g;
88 $template->param( autoprint
=> C4
::Context
->preference("SpineLabelAutoPrint") );
89 $template->param( content
=> $body );
91 output_html_with_http_headers
$query, $cookie, $template->output;