Bug 23900

Summary: Label maker cannot concatenate database fields
Product: Koha Reporter: Andrew Fuerste-Henry <andrewfh>
Component: Label/patron card printingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: 1joynelson, barton, hayleypelham, jonathan.druart, katrin.fischer, lucas, m.de.rooy
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00, 19.11.05, 19.05.10
Attachments: Bug 23900: Teach label maker to concat database fields
Bug 23900: Teach label maker to concat database fields
Bug 23900: Add tests
Bug 23900: Teach label maker to concat database fields
Bug 23900: Add tests

Description Andrew Fuerste-Henry 2019-10-25 13:21:41 UTC
The manual explains that one can use double quotes when listing fields for one's label layout to make two or more values concatenate onto a single line in one's label. 

From https://koha-community.org/manual//18.11/en/html/tools.html#layouts:
"You can also enclose a whitespace-separated list of fields to concatenate on one line in double quotes, for example “099a 099b” or “itemcallnumber barcode”. 

Testing this on both 18.11 and 19.05, this works for MARC fields but not for database fields.

To test:
- 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 do not display at all
Comment 1 Jonathan Druart 2019-11-11 16:56:53 UTC
Created attachment 95273 [details] [review]
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
Comment 2 ByWater Sandboxes 2019-11-12 13:21:16 UTC
Created attachment 95307 [details] [review]
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>
Comment 3 Katrin Fischer 2019-11-13 14:48:19 UTC
Hi Jonathan, could we have a regression test for this please?
Comment 4 Jonathan Druart 2019-11-13 15:03:46 UTC
(In reply to Katrin Fischer from comment #3)
> Hi Jonathan, could we have a regression test for this please?

I tried but failed. I do not think the whole thing is tested at all.
Comment 5 Marcel de Rooy 2019-11-21 08:47:17 UTC
Please add tests :)
Comment 6 Jonathan Druart 2019-11-21 10:22:59 UTC
(In reply to Marcel de Rooy from comment #5)
> Please add tests :)

I have answered previously, I will not.
Comment 7 Marcel de Rooy 2019-11-21 10:42:57 UTC
(In reply to Jonathan Druart from comment #6)
> (In reply to Marcel de Rooy from comment #5)
> > Please add tests :)
> 
> I have answered previously, I will not.

Didnt even see that, reading so fast :)
Comment 8 Marcel de Rooy 2019-11-21 10:54:51 UTC
(In reply to Jonathan Druart from comment #4)
> (In reply to Katrin Fischer from comment #3)
> > Hi Jonathan, could we have a regression test for this please?
> 
> I tried but failed. I do not think the whole thing is tested at all.

t/Labels.t
t/Labels_split_ccn.t
t/Labels_split_lccn.t
t/db_dependent/Labels/t_Label.t
Comment 9 Jonathan Druart 2020-02-26 11:51:24 UTC
Created attachment 99641 [details] [review]
Bug 23900: Add tests
Comment 10 Kyle M Hall 2020-03-20 11:04:42 UTC
Created attachment 101072 [details] [review]
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>
Comment 11 Kyle M Hall 2020-03-20 11:04:52 UTC
Created attachment 101073 [details] [review]
Bug 23900: Add tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 12 Martin Renvoize 2020-03-20 15:43:30 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 13 Joy Nelson 2020-04-03 21:03:25 UTC
backported to 19.11.x for 19.11.05
Comment 14 Lucas Gass 2020-04-13 19:19:42 UTC
backported to 19.05.x for 19.05.10
Comment 15 Hayley Pelham 2020-04-15 23:10:23 UTC
I cannot get any of the data fields showing on my labels in 18.11.x, following this test plan. Is somebody able to confirm that this works in 18.11 and that this patch fixes any issues?
Comment 16 Katrin Fischer 2020-04-18 22:47:31 UTC
*** Bug 16503 has been marked as a duplicate of this bug. ***