View | Details | Raw Unified | Return to bug 5653
Collapse All | Expand All

(-)a/C4/Labels/Label.pm (-1 / +3 lines)
Lines 100-106 sub _get_text_fields { Link Here
100
    my $format_string = shift;
100
    my $format_string = shift;
101
    my $csv = Text::CSV_XS->new({allow_whitespace => 1});
101
    my $csv = Text::CSV_XS->new({allow_whitespace => 1});
102
    my $status = $csv->parse($format_string);
102
    my $status = $csv->parse($format_string);
103
    my @sorted_fields = map {{ 'code' => $_, desc => $_ }} $csv->fields();
103
    my @sorted_fields = map {{ 'code' => $_, desc => $_ }} 
104
                        map { $_ eq 'callnumber' ? 'itemcallnumber' : $_ } # see bug 5653
105
                        $csv->fields();
104
    my $error = $csv->error_input();
106
    my $error = $csv->error_input();
105
    warn sprintf('Text field sort failed with this error: %s', $error) if $error;
107
    warn sprintf('Text field sort failed with this error: %s', $error) if $error;
106
    return \@sorted_fields;
108
    return \@sorted_fields;
(-)a/installer/data/mysql/de-DE/optional/sample_creator_data.sql (-1 / +1 lines)
Lines 3-9 Link Here
3
3
4
LOCK TABLES `creator_layouts` WRITE;
4
LOCK TABLES `creator_layouts` WRITE;
5
/*!40000 ALTER TABLE `creator_layouts` DISABLE KEYS */;
5
/*!40000 ALTER TABLE `creator_layouts` DISABLE KEYS */;
6
INSERT INTO `creator_layouts` VALUES (17,'CODE39',1,'BIBBAR','Label Test',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, callnumber','<opt></opt>','Labels'),(18,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, callnumber','<opt></opt>','Labels'),(19,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, callnumber','<opt></opt>','Labels'),(20,'CODE39',1,'BAR','Test Layout',0,'TR',10,'POINT',0,'L','barcode','<opt page_side="F" units="POINT">
6
INSERT INTO `creator_layouts` VALUES (17,'CODE39',1,'BIBBAR','Label Test',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, itemcallnumber','<opt></opt>','Labels'),(18,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, itemcallnumber','<opt></opt>','Labels'),(19,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, itemcallnumber','<opt></opt>','Labels'),(20,'CODE39',1,'BAR','Test Layout',0,'TR',10,'POINT',0,'L','barcode','<opt page_side="F" units="POINT">
7
  <images name="image_1" Dx="72" Ox="0" Oy="0" Sx="0" Sy="0" Tx="4.5" Ty="63">
7
  <images name="image_1" Dx="72" Ox="0" Oy="0" Sx="0" Sy="0" Tx="4.5" Ty="63">
8
    <data_source image_name="none" image_source="patronimages" />
8
    <data_source image_name="none" image_source="patronimages" />
9
  </images>
9
  </images>
(-)a/installer/data/mysql/en/optional/sample_creator_data.sql (-1 / +1 lines)
Lines 3-9 Link Here
3
3
4
LOCK TABLES `creator_layouts` WRITE;
4
LOCK TABLES `creator_layouts` WRITE;
5
/*!40000 ALTER TABLE `creator_layouts` DISABLE KEYS */;
5
/*!40000 ALTER TABLE `creator_layouts` DISABLE KEYS */;
6
INSERT INTO `creator_layouts` VALUES (17,'CODE39',1,'BIBBAR','Label Test',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, callnumber','<opt></opt>','Labels'),(18,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, callnumber','<opt></opt>','Labels'),(19,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, callnumber','<opt></opt>','Labels'),(20,'CODE39',1,'BAR','Test Layout',0,'TR',10,'POINT',0,'L','barcode','<opt page_side="F" units="POINT">
6
INSERT INTO `creator_layouts` VALUES (17,'CODE39',1,'BIBBAR','Label Test',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, itemcallnumber','<opt></opt>','Labels'),(18,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, itemcallnumber','<opt></opt>','Labels'),(19,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, itemcallnumber','<opt></opt>','Labels'),(20,'CODE39',1,'BAR','Test Layout',0,'TR',10,'POINT',0,'L','barcode','<opt page_side="F" units="POINT">
7
  <images name="image_1" Dx="72" Ox="0" Oy="0" Sx="0" Sy="0" Tx="4.5" Ty="63">
7
  <images name="image_1" Dx="72" Ox="0" Oy="0" Sx="0" Sy="0" Tx="4.5" Ty="63">
8
    <data_source image_name="none" image_source="patronimages" />
8
    <data_source image_name="none" image_source="patronimages" />
9
  </images>
9
  </images>
(-)a/labels/label-create-xml.pl (-2 / +3 lines)
Lines 62-70 foreach my $item (@$items) { Link Here
62
                                    format_string       => $layout->get_attr('format_string'),
62
                                    format_string       => $layout->get_attr('format_string'),
63
                                      );
63
                                      );
64
    my $format_string = $layout->get_attr('format_string');
64
    my $format_string = $layout->get_attr('format_string');
65
    my @data_fields = split(/, /, $format_string);
65
    my @data_fields = map { $_ eq 'callnumber' ? 'itemcallnumber' : $_ } # see bug 5653 
66
                      split(/, /, $format_string);
66
    my $csv_data = $label->csv_data();
67
    my $csv_data = $label->csv_data();
67
    for (my $i = 0; $i < (scalar(@data_fields) - 1); $i++) {
68
    for (my $i = 0; $i <= (scalar(@data_fields) - 1); $i++) {
68
        push(@{$xml_data->{'label'}[$item_count]->{$data_fields[$i]}}, $$csv_data[$i]);
69
        push(@{$xml_data->{'label'}[$item_count]->{$data_fields[$i]}}, $$csv_data[$i]);
69
    }
70
    }
70
    $item_count++;
71
    $item_count++;
(-)a/labels/label-edit-layout.pl (-1 / +1 lines)
Lines 130-136 elsif ($op eq 'save') { Link Here
130
                    font_size       => $cgi->param('font_size') || 3,
130
                    font_size       => $cgi->param('font_size') || 3,
131
                    callnum_split   => ($cgi->param('callnum_split') ? 1 : 0),
131
                    callnum_split   => ($cgi->param('callnum_split') ? 1 : 0),
132
                    text_justify    => $cgi->param('text_justify') || 'L',
132
                    text_justify    => $cgi->param('text_justify') || 'L',
133
                    format_string   => $cgi->param('format_string') || 'title, author, isbn, issn, itemtype, barcode, callnumber',
133
                    format_string   => $cgi->param('format_string') || 'title, author, isbn, issn, itemtype, barcode, itemcallnumber',
134
    );
134
    );
135
    if ($layout_id) {   # if a label_id was passed in, this is an update to an existing layout
135
    if ($layout_id) {   # if a label_id was passed in, this is an update to an existing layout
136
        $layout = C4::Labels::Layout->retrieve(layout_id => $layout_id);
136
        $layout = C4::Labels::Layout->retrieve(layout_id => $layout_id);
(-)a/t/Labels.t (-1 / +35 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
#
3
# This file is part of Koha.
4
#
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
8
# version.
9
#
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.
13
#
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
17
#
18
# for context, see http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=2691
19
20
use strict;
21
use warnings;
22
23
use Test::More tests => 2;
24
25
BEGIN {
26
    use_ok('C4::Labels::Label');
27
}
28
29
my $format_string = "title, callnumber";
30
my $parsed_fields = C4::Labels::Label::_get_text_fields($format_string);
31
my $expected_fields = [
32
    { code => 'title', desc => 'title' }, 
33
    { code => 'itemcallnumber', desc => 'itemcallnumber' }, 
34
];
35
is_deeply($parsed_fields, $expected_fields, '"callnumber" in label layout alias for "itemcallnumber" per bug 5653');

Return to bug 5653