Bug 13124

Summary: Record titles with parentheses causing label weirdness
Product: Koha Reporter: Kyle M Hall <kyle>
Component: Label/patron card printingAssignee: Chris Nighswonger <cnighswonger>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P1 - high CC: chris, fridolin.somers, katrin.fischer, mtj, philippe.blouin, tomascohen
Version: 3.16   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Label PDF with weirdness
Label PDF after patch
Bug 13124 - Record titles with parentheses causing label weirdness
Bug 13124 - Record titles with parentheses causing label weirdness
[SIGNED OFF] Bug 13124 - Record titles with parentheses causing label weirdness
[PASSED QA] Bug 13124 - Record titles with parentheses causing label weirdness

Description Kyle M Hall 2014-10-21 18:43:54 UTC
See the attached image
Comment 1 Kyle M Hall 2014-10-21 18:45:32 UTC
Created attachment 32563 [details]
Label PDF with weirdness
Comment 2 Chris Nighswonger 2014-10-21 18:47:33 UTC
That is due to the embedded parenthesis. The inner parenthesis are not being escaped properly by the code which handles that. Without looking, I'd say its a pretty trivial fix.
Comment 3 Kyle M Hall 2014-10-21 18:47:45 UTC
Created attachment 32564 [details]
Label PDF after patch
Comment 4 Kyle M Hall 2014-10-21 18:56:08 UTC Comment hidden (obsolete)
Comment 5 Chris Nighswonger 2014-10-21 19:02:08 UTC
That fix will cause problems with the postscript stream. I don't remember exactly the case, but do remember it took some hours to find and fix. At a minimum these lines should only be commented out rather than removed and a commend added to the effect of what I've mentioned.
Comment 6 Kyle M Hall 2014-10-21 19:03:09 UTC
Test Plan ( using sample data included with Koha )
1) Catalog a record and item with the title "Oh no! or, (How my science project destroyed the world) /"
2) Edit the DEFAULT template
  a) Set layout type to Biblio
  b) Set data fields to "title, author, isbn, issn, itemtype, barcode, itemcallnumber"
  c) Set font size to 10
3) Create a batch with just the one item you created
4) Export the PDF with the Avery template and the DEFAULT layout
5) Note the weirdness
6) Apply this patch
7) Re-export the PDF, note it's no longer weird ; )
Comment 7 Kyle M Hall 2014-10-21 19:04:09 UTC
(In reply to Chris Nighswonger from comment #5)
> That fix will cause problems with the postscript stream. I don't remember
> exactly the case, but do remember it took some hours to find and fix. At a
> minimum these lines should only be commented out rather than removed and a
> commend added to the effect of what I've mentioned.

Will do! I don't see any negative effects. Possibly the need for them was fixed  downstream.
Comment 8 Kyle M Hall 2014-10-21 19:06:32 UTC Comment hidden (obsolete)
Comment 9 Jeremie 2014-11-11 17:05:03 UTC
I'm not able to reproduce the bug.
I followed the instructions but the exports just gives me that result :
0
0
0
0
and the XML files give to me correct informations.
Comment 10 Kyle M Hall 2014-12-11 13:33:58 UTC
Not only is this bug still valid, it's worse than I had believed. It appears that parens in other parts of the label will stop the reset of the labels in a batch from printing!
Comment 11 Chris Nighswonger 2014-12-11 13:47:35 UTC
(In reply to Kyle M Hall from comment #10)
> Not only is this bug still valid, it's worse than I had believed. It appears
> that parens in other parts of the label will stop the reset of the labels in
> a batch from printing!

I can see how this would be a problem, however. PDF::Reuse::prText presently attempts to escape parentheses. I don't remember why I saw the need to escape them in the label module, but it certainly results in double escapment which could lead to various strange results.
Comment 12 Chris Nighswonger 2014-12-11 14:22:55 UTC
Bumping the importance of this fix. I'll try to sign off today or tomorrow.
Comment 13 Nick Clemens 2014-12-12 00:09:14 UTC Comment hidden (obsolete)
Comment 14 Katrin Fischer 2014-12-27 15:59:28 UTC
Created attachment 34725 [details] [review]
[PASSED QA] Bug 13124 - Record titles with parentheses causing label weirdness

Test Plan ( using sample data included with Koha )
1) Catalog a record and item with the title "Oh no! or, (How my
   science project destroyed the world) /"
2) Edit the DEFAULT template
   a) Set layout type to Biblio
   b) Set data fields to "title, author, isbn, issn, itemtype,
      barcode, itemcallnumber"
   c) Set font size to 10
3) Create a batch with just the one item you created
4) Export the PDF with the Avery template and the DEFAULT layout
5) Note the weirdness
6) Apply this patch
7) Re-export the PDF, note it's no longer weird ; )

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 15 Tomás Cohen Arazi 2014-12-28 23:05:09 UTC
Patch pushed to master.

Thanks Kyle!
Comment 16 Chris Cormack 2014-12-30 21:26:19 UTC
Pushed to 3.18.x will be in 3.18.3
Comment 17 Mason James 2015-01-16 19:34:13 UTC
Pushed to 3.16.x, patch will be in 3.16.7
Comment 18 Fridolin Somers 2015-03-24 08:19:41 UTC
Pushed to 3.14, will be in 3.14.14.

In my opinion, dead code must be removed instead of commented.