Bug 23900: Teach label maker to concat database fields

Test plan:
- define a label layout with this field list: "100a 245s","enumchron copynumber"
- find or create a record with values for all of those fields
- generate a label for that record
- the 100a and 245s successfully display on one line
- the enumchron and copynumber are displayed and separated by a space

Try other combinations

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2019-11-11 17:54:56 +01:00 committed by Martin Renvoize
parent 50f0ba0a3a
commit 743eead9fd
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 9 additions and 4 deletions

View File

@ -148,11 +148,16 @@ sub _get_barcode_data {
next FIELD_LIST;
}
elsif ( $f =~ /^($match_kohatable).*/ ) {
if ($item->{$f}) {
$datastring .= $item->{$f};
} else {
$debug and warn sprintf("The '%s' field contains no data.", $f);
my @fields = split ' ', $f;
my @data;
for my $field ( @fields ) {
if ($item->{$field}) {
push @data, $item->{$field};
} else {
$debug and warn sprintf("The '%s' field contains no data.", $field);
}
}
$datastring .= join ' ', @data;
$f = $';
next FIELD_LIST;
}