Bugzilla – Attachment 4268 Details for
Bug 5653
default new label layout and sample data have broken call number placeholder
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] bug 5653: use itemcallnumber in bib label layouts
SIGNED-OFF-bug-5653-use-itemcallnumber-in-bib-labe.patch (text/plain), 8.44 KB, created by
Katrin Fischer
on 2011-05-26 05:39:39 UTC
(
hide
)
Description:
[SIGNED-OFF] bug 5653: use itemcallnumber in bib label layouts
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2011-05-26 05:39:39 UTC
Size:
8.44 KB
patch
obsolete
>From 6920d90fe8bf5259886de019052b333f79090853 Mon Sep 17 00:00:00 2001 >From: Galen Charlton <gmcharlt@gmail.com> >Date: Mon, 24 Jan 2011 16:55:01 -0500 >Subject: [PATCH] [SIGNED-OFF] bug 5653: use itemcallnumber in bib label layouts >Content-Type: text/plain; charset="utf-8" > >The sample bib label layouts and the hard-coded default >format_string for new layouts used 'callnumber' when they >should have used 'itemcallnumber', preventing call numbers >from being printed on spine labels that use the system-supplied >layouts. Besides correcting the sample data, this patch >now also enshrines 'callnumber' as an alias for 'itemcallnumber'. >Signed-off-by: Galen Charlton <gmcharlt@gmail.com> > >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >After applying patch it works for new and old layouts (itemcallnumber and callnumber). >--- > C4/Labels/Label.pm | 4 ++- > .../mysql/de-DE/optional/sample_creator_data.sql | 2 +- > .../data/mysql/en/optional/sample_creator_data.sql | 2 +- > labels/label-create-xml.pl | 5 ++- > labels/label-edit-layout.pl | 2 +- > t/Labels.t | 35 ++++++++++++++++++++ > 6 files changed, 44 insertions(+), 6 deletions(-) > create mode 100644 t/Labels.t > >diff --git a/C4/Labels/Label.pm b/C4/Labels/Label.pm >index 0c98d6f..930e0f6 100644 >--- a/C4/Labels/Label.pm >+++ b/C4/Labels/Label.pm >@@ -100,7 +100,9 @@ sub _get_text_fields { > my $format_string = shift; > my $csv = Text::CSV_XS->new({allow_whitespace => 1}); > my $status = $csv->parse($format_string); >- my @sorted_fields = map {{ 'code' => $_, desc => $_ }} $csv->fields(); >+ my @sorted_fields = map {{ 'code' => $_, desc => $_ }} >+ map { $_ eq 'callnumber' ? 'itemcallnumber' : $_ } # see bug 5653 >+ $csv->fields(); > my $error = $csv->error_input(); > warn sprintf('Text field sort failed with this error: %s', $error) if $error; > return \@sorted_fields; >diff --git a/installer/data/mysql/de-DE/optional/sample_creator_data.sql b/installer/data/mysql/de-DE/optional/sample_creator_data.sql >index bcd610a..91d7d00 100644 >--- a/installer/data/mysql/de-DE/optional/sample_creator_data.sql >+++ b/installer/data/mysql/de-DE/optional/sample_creator_data.sql >@@ -3,7 +3,7 @@ > > LOCK TABLES `creator_layouts` WRITE; > /*!40000 ALTER TABLE `creator_layouts` DISABLE KEYS */; >-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"> >+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"> > <images name="image_1" Dx="72" Ox="0" Oy="0" Sx="0" Sy="0" Tx="4.5" Ty="63"> > <data_source image_name="none" image_source="patronimages" /> > </images> >diff --git a/installer/data/mysql/en/optional/sample_creator_data.sql b/installer/data/mysql/en/optional/sample_creator_data.sql >index bcd610a..91d7d00 100644 >--- a/installer/data/mysql/en/optional/sample_creator_data.sql >+++ b/installer/data/mysql/en/optional/sample_creator_data.sql >@@ -3,7 +3,7 @@ > > LOCK TABLES `creator_layouts` WRITE; > /*!40000 ALTER TABLE `creator_layouts` DISABLE KEYS */; >-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"> >+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"> > <images name="image_1" Dx="72" Ox="0" Oy="0" Sx="0" Sy="0" Tx="4.5" Ty="63"> > <data_source image_name="none" image_source="patronimages" /> > </images> >diff --git a/labels/label-create-xml.pl b/labels/label-create-xml.pl >index a6c5808..dd83f1d 100755 >--- a/labels/label-create-xml.pl >+++ b/labels/label-create-xml.pl >@@ -62,9 +62,10 @@ foreach my $item (@$items) { > format_string => $layout->get_attr('format_string'), > ); > my $format_string = $layout->get_attr('format_string'); >- my @data_fields = split(/, /, $format_string); >+ my @data_fields = map { $_ eq 'callnumber' ? 'itemcallnumber' : $_ } # see bug 5653 >+ split(/, /, $format_string); > my $csv_data = $label->csv_data(); >- for (my $i = 0; $i < (scalar(@data_fields) - 1); $i++) { >+ for (my $i = 0; $i <= (scalar(@data_fields) - 1); $i++) { > push(@{$xml_data->{'label'}[$item_count]->{$data_fields[$i]}}, $$csv_data[$i]); > } > $item_count++; >diff --git a/labels/label-edit-layout.pl b/labels/label-edit-layout.pl >index 470092d..6a70212 100755 >--- a/labels/label-edit-layout.pl >+++ b/labels/label-edit-layout.pl >@@ -130,7 +130,7 @@ elsif ($op eq 'save') { > font_size => $cgi->param('font_size') || 3, > callnum_split => ($cgi->param('callnum_split') ? 1 : 0), > text_justify => $cgi->param('text_justify') || 'L', >- format_string => $cgi->param('format_string') || 'title, author, isbn, issn, itemtype, barcode, callnumber', >+ format_string => $cgi->param('format_string') || 'title, author, isbn, issn, itemtype, barcode, itemcallnumber', > ); > if ($layout_id) { # if a label_id was passed in, this is an update to an existing layout > $layout = C4::Labels::Layout->retrieve(layout_id => $layout_id); >diff --git a/t/Labels.t b/t/Labels.t >new file mode 100644 >index 0000000..2450794 >--- /dev/null >+++ b/t/Labels.t >@@ -0,0 +1,35 @@ >+#!/usr/bin/perl >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 2 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along with >+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, >+# Suite 330, Boston, MA 02111-1307 USA >+# >+# for context, see http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=2691 >+ >+use strict; >+use warnings; >+ >+use Test::More tests => 2; >+ >+BEGIN { >+ use_ok('C4::Labels::Label'); >+} >+ >+my $format_string = "title, callnumber"; >+my $parsed_fields = C4::Labels::Label::_get_text_fields($format_string); >+my $expected_fields = [ >+ { code => 'title', desc => 'title' }, >+ { code => 'itemcallnumber', desc => 'itemcallnumber' }, >+]; >+is_deeply($parsed_fields, $expected_fields, '"callnumber" in label layout alias for "itemcallnumber" per bug 5653'); >-- >1.7.4.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 5653
:
3020
| 4268 |
4269