Bug 18244

Summary: Patron card creator does not take in account fields with underscore (B_address etc.)
Product: Koha Reporter: Marc Véron <veron>
Component: Label/patron card printingAssignee: Marc Véron <veron>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: cbrannon, julian.maurice, katrin.fischer, kyle, mtj
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 18244: Patron card creator does not take in account fields with underscore (B_address etc.)
Patron card layout settings to test B_address
My card layout
My card export with field name showing
Re-testing same settings as in screenshot comment #5
[SIGNED OFF] Bug 18244: Patron card creator does not take in account fields with underscore (B_address etc.)
Bug 18244: Patron card creator does not take in account fields with underscore (B_address etc.)

Description Marc Véron 2017-03-10 10:19:13 UTC
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
Comment 1 Marc Véron 2017-03-10 10:26:39 UTC
Created attachment 60984 [details] [review]
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
Comment 2 Christopher Brannon 2017-03-23 19:16:23 UTC
I have applied the patch on two different computers, confirmed the changes in the patch, but I see no difference.  I still get the field name instead of the value.
Comment 3 Marc Véron 2017-03-23 19:59:59 UTC
Created attachment 61590 [details]
Patron card layout settings to test B_address

(In reply to Christopher Brannon from comment #2)
> I have applied the patch on two different computers, confirmed the changes
> in the patch, but I see no difference.  I still get the field name instead
> of the value.

I re-tested with the settings for a test layout, see screenshot attached.
Field <B_address> displays it's contents as expected.

- What are your settings?
- Restart Plack?
Comment 4 Christopher Brannon 2017-03-23 21:12:29 UTC
I've cleared cache, restarted apache2, restarted memcache, restarted all (restart_all), no luck.

I'm using the demo layout that installed with Koha, and just editing the 2nd field to read "Address: <B_address>"

I go to manage Card batches and on my one patron I click Export.  When I open the pdf, I still see <B_address>.

I will attach my screen shots.
Comment 5 Christopher Brannon 2017-03-23 21:13:23 UTC
Created attachment 61591 [details]
My card layout
Comment 6 Christopher Brannon 2017-03-23 21:13:52 UTC
Created attachment 61592 [details]
My card export with field name showing
Comment 7 Marc Véron 2017-03-24 14:30:55 UTC
Created attachment 61611 [details]
Re-testing same settings as in screenshot comment #5

(In reply to Christopher Brannon from comment #4)
> I've cleared cache, restarted apache2, restarted memcache, restarted all
> (restart_all), no luck.
> 
> I'm using the demo layout that installed with Koha, and just editing the 2nd
> field to read "Address: <B_address>"
> 
> I go to manage Card batches and on my one patron I click Export.  When I
> open the pdf, I still see <B_address>.
> 
> I will attach my screen shots.

I repeated with your settings, it works as expected (see screenshot attached). After taking the screenshots, I tested with other B_-fields as well, e.g. <B_city>, they display as expected.

It did not work immediately after applying the patch, I had to re-start Plack and to reload the page for batch management. Tested with single export and with export of entire batch.

Hmm, where is the difference...?
Comment 8 Christopher Brannon 2017-03-24 14:46:13 UTC
> I repeated with your settings, it works as expected (see screenshot
> attached). After taking the screenshots, I tested with other B_-fields as
> well, e.g. <B_city>, they display as expected.
> 
> It did not work immediately after applying the patch, I had to re-start
> Plack and to reload the page for batch management. Tested with single export
> and with export of entire batch.
> 
> Hmm, where is the difference...?

Don't know.  I've tried everything I know. Don't know why loading a patch should be this difficult.  I even tried another browser.  If it is sticking anywhere, it is on the server side, not the browser, since the change is not reflected in a new browser.  I'll keep beating up on it.
Comment 9 Christopher Brannon 2017-03-24 15:12:55 UTC
Are you testing the patch on a dedicated test server, or are you using kohadevbox?
Comment 10 Marc Véron 2017-03-24 15:26:41 UTC
Not kohadevbox. It's a VM with an install from packets that I gitified. Current version is 16.12.00.015

Just an idea because I remember a similar situation:
What happens if you edit the patched C4/Patroncards/Patroncard.pm file and intentionally insert some errors in order to make it crash? - Can you provoke the crash or does export still behave as before?
Comment 11 Christopher Brannon 2017-03-24 15:51:00 UTC
Throwing stray text into the file you patched doesn't seem to effect anything.  I know my test environment is working, as I can apply another patch and see the effects of it right away.  We're missing something.
Comment 12 Christopher Brannon 2017-03-24 18:16:43 UTC
Created attachment 61629 [details] [review]
[SIGNED OFF] 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

Works as expected.

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Comment 13 Christopher Brannon 2017-03-24 18:17:53 UTC
Note to kohadevbox testers: disable plack.  Kohadevbox is not pointing to all the files in the kohaclone environment with plack enabled.  This is an issue with kohadevbox, not the patch.
Comment 14 Jonathan Druart 2017-03-29 18:59:07 UTC
Created attachment 61701 [details] [review]
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>
Comment 15 Kyle M Hall 2017-03-31 13:28:07 UTC
Pushed to master for 17.05, thanks Marc!
Comment 16 Katrin Fischer 2017-04-02 17:10:23 UTC
This patch has been pushed to 16.11.x and will be in 16.11.07.
Comment 17 Julian Maurice 2017-04-21 10:09:26 UTC
Pushed to 3.22.x for 3.22.20
Comment 18 Mason James 2017-05-03 03:56:33 UTC
Pushed to 16.05.x, for 16.05.12 release