Bug 18244: Patron card creator does not take in account fields with underscore (B_address etc.)

Fields with underscore like B_address do not print on patron cards.

To reproduce:
- Create patron card layout using fields with underscore in their name
  (e.g. <surname><B_address> )
- Print (export) patron card
- Verify that fields without underscore are replaced by their value,
  but fields with underscore do not replace but show the field name

To test:
- Apply patch
- Try to reproduce and verify that fields with underscore are replace
  as expected

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit a723de2ae0)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
(cherry picked from commit da9371a1d6)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
This commit is contained in:
Marc Véron 2017-03-10 11:22:24 +01:00 committed by Julian Maurice
parent 2a552e68a7
commit cccb8672f5
1 changed files with 3 additions and 3 deletions

View File

@ -92,15 +92,15 @@ sub draw_text {
my $line = shift @$text;
my $parse_line = $line;
my @orig_line = split(/ /,$line);
if ($parse_line =~ m/<[A-Za-z0-9]+>/) { # test to see if the line has db fields embedded...
if ($parse_line =~ m/<[A-Za-z0-9_]+>/) { # test to see if the line has db fields embedded...
my @fields = ();
while ($parse_line =~ m/<([A-Za-z0-9]+)>(.*$)/) {
while ($parse_line =~ m/<([A-Za-z0-9_]+)>(.*$)/) {
push (@fields, $1);
$parse_line = $2;
}
my $borrower_attributes = get_borrower_attributes($self->{'borrower_number'},@fields);
grep{ # substitute data for db fields
if ($_ =~ m/<([A-Za-z0-9]+)>/) {
if ($_ =~ m/<([A-Za-z0-9_]+)>/) {
my $field = $1;
$_ =~ s/$_/$borrower_attributes->{$field}/;
}