Bug 14143

Summary: Patron cards: Crash (confusion between table names creator_templates and club_template_enrollment_fields
Product: Koha Reporter: Marc Véron <veron>
Component: Label/patron card printingAssignee: Marc Véron <veron>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: bgkriegel, gmcharlt, jonathan.druart, katrin.fischer, kyle.m.hall, kyle, mirko
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:
Bug Depends on: 12461    
Bug Blocks:    
Attachments: Bug 14143 - Patron cards: Crash (confusion between table names creator_templates and club_template_enrollment_fields)
Bug 14143 - Patron cards: Crash (confusion between table names creator_templates and club_template_enrollment_fields)
Bug 14143 - Patron cards: Crash (confusion between table names creator_templates and club_template_enrollment_fields)

Description Marc Véron 2015-05-04 21:21:14 UTC
To reproduce:
Go to Home > Tools > Patron card creator
Click on 'Manage profiles' 
Result:
Can't use string ("1") as an ARRAY ref while "strict refs" in use at /usr/share/kohaclone/C4/Creators/Lib.pm line 564.

Reason: 
Select statment to get field 'template code' from table 'club_template_enrollment_fields' (!) instead of 'table creator_templates'.
Comment 1 Marc Véron 2015-05-04 21:31:15 UTC Comment hidden (obsolete)
Comment 2 Marc Véron 2015-05-04 21:48:43 UTC
Note: This is kind of prospective patch, it appeared after testing Bug 12461 - Add patron clubs feature

No changes for Bug 12461 needed though, the reason of the ambiguity waited in C4/Creators/Lib.pm
Comment 3 Mark Tompsett 2015-05-24 16:20:18 UTC
Comment on attachment 38830 [details] [review]
Bug 14143 - Patron cards: Crash (confusion between table names creator_templates and club_template_enrollment_fields)

Review of attachment 38830 [details] [review]:
-----------------------------------------------------------------

::: C4/Creators/Lib.pm
@@ +559,4 @@
>                  next POPULATE_ROW;
>              }
>              elsif ($table_column =~ m/^_((.*)_(.*$))/) {   # this a special case
> +                my $table_name = get_table_names('creator-'.$2); #Bug 14143 fix to remove ambiguity with table 'club_template_enrollment_fields'

underscore, not hypen. :)
Comment 4 Marc Véron 2015-05-26 13:52:07 UTC
Created attachment 39524 [details] [review]
Bug 14143 - Patron cards: Crash (confusion between table names creator_templates and club_template_enrollment_fields)

To reproduce:
Go to Home > Tools > Patron card creator
Click on 'Manage profiles'
Result:
Can't use string ("1") as an ARRAY ref while "strict refs" in use at /usr/share/kohaclone/C4/Creators/Lib.pm line 564.

Reason:
Select statment to get field 'template code' from table 'club_template_enrollment_fields' (!) instead of 'table creator_templates'.

To test:
Apply patch
Try to reproduce issue.

Amended because of typo (_ instead of -)
Comment 5 Bernardo Gonzalez Kriegel 2015-05-27 20:21:50 UTC
This depends on 12461, it's needed to test it, but is FQA
Comment 6 Mirko Tietgen 2015-07-28 14:53:19 UTC
Tried to test this, but 12461 needs a rebase (and QA fixes). We should have a »patch this is depending on does not apply« status. :P
Comment 7 Jonathan Druart 2015-08-19 14:55:45 UTC
Blocked.
Comment 8 Marc Véron 2016-02-10 14:40:40 UTC
Still valid on top of Bug 12461
Comment 9 Kyle M Hall 2017-04-28 12:48:59 UTC
Created attachment 62819 [details] [review]
Bug 14143 - Patron cards: Crash (confusion between table names creator_templates and club_template_enrollment_fields)

To reproduce:
Go to Home > Tools > Patron card creator
Click on 'Manage profiles'
Result:
Can't use string ("1") as an ARRAY ref while "strict refs" in use at /usr/share/kohaclone/C4/Creators/Lib.pm line 564.

Reason:
Select statment to get field 'template code' from table 'club_template_enrollment_fields' (!) instead of 'table creator_templates'.

To test:
Apply patch
Try to reproduce issue.

Amended because of typo (_ instead of -)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 10 Kyle M Hall 2017-04-28 12:49:25 UTC
Pushed to master for 17.05, thanks Marc!
Comment 11 Katrin Fischer 2017-05-13 12:30:56 UTC
Dependency bug 12461 is not part of 16.11.x.