Bug 18512

Summary: GetAuthorisedValues.GetByCode Template plugin should return code (not empty string) if value not found
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: TemplatesAssignee: Nick Clemens (kidclamp) <nick>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: athieschafer, jonathan.druart, katrin.fischer, kyle, mtj
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 16908    
Bug Blocks:    
Attachments: Bug 18512 - GetAuthorisedValues.GetByCode Template plguin should return code (not empty string) if value not found
Bug 18512 - GetAuthorisedValues.GetByCode Template plguin should return code (not empty string) if value not found
Bug 18512 - GetAuthorisedValues.GetByCode Template plguin should return code (not empty string) if value not found
Bug 18512: Add tests
Bug 18512: Add tests 16.11.X version

Description Nick Clemens (kidclamp) 2017-04-28 18:09:35 UTC

    
Comment 1 Nick Clemens (kidclamp) 2017-04-28 18:10:47 UTC
To recreate:
1 - Create or edit a borrower with info in Sort1 and Sort2 field, not mapped to authorized values
2 - Note this info does not display on moremember.tt
Comment 2 Nick Clemens (kidclamp) 2017-04-28 18:12:08 UTC
Created attachment 62859 [details] [review]
Bug 18512 - GetAuthorisedValues.GetByCode Template plguin should return code (not empty string) if value not found

To test:
1 - Create or edit a borrower with info in Sort1 and Sort2 field, not
mapped to authorized values
2 - Note this info does not display on moremember.tt
3 - Apply patch
4 - Note value is passed through
Comment 3 Mark Tompsett 2017-04-29 01:43:13 UTC
Created attachment 62893 [details] [review]
Bug 18512 - GetAuthorisedValues.GetByCode Template plguin should return code (not empty string) if value not found

To test:
1 - Create or edit a borrower with info in Sort1 and Sort2 field, not
mapped to authorized values
2 - Note this info does not display on moremember.tt
3 - Apply patch
4 - Note value is passed through

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 4 Jonathan Druart 2017-05-02 16:26:12 UTC
Hard to say...
Indeed, bug 16908 modified the behaviour, but with this patch you are going to modify the behaviour for all other AuthorisedValues.GetByCode calls.

Bug 16908 did not modify the behaviour of GetByCode.
Comment 5 Nick Clemens (kidclamp) 2017-05-02 17:20:57 UTC
I did a git grep on 'GetByCode' - I didn't see anything that would break on the code - it will just add to the display for anything unmapped so helps root out old data and cruft that has been hidden
Comment 6 Jonathan Druart 2017-05-02 20:28:36 UTC
Created attachment 62988 [details] [review]
Bug 18512 - GetAuthorisedValues.GetByCode Template plguin should return code (not empty string) if value not found

To test:
1 - Create or edit a borrower with info in Sort1 and Sort2 field, not
mapped to authorized values
2 - Note this info does not display on moremember.tt
3 - Apply patch
4 - Note value is passed through

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Jonathan Druart 2017-05-02 20:28:40 UTC
Created attachment 62989 [details] [review]
Bug 18512: Add tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Jesse Maseto 2017-05-03 16:17:36 UTC
*** Bug 18180 has been marked as a duplicate of this bug. ***
Comment 9 Kyle M Hall 2017-05-08 12:38:25 UTC
Pushed to master for 17.05, thanks Nick, Jonathan!
Comment 10 Katrin Fischer 2017-05-13 12:44:32 UTC
Tests don't pass applied on 16.11.x - not pushing this, please check.
Test Summary Report
-------------------
t/db_dependent/Template/Plugin/AuthorisedValues.t (Wstat: 65280 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 255
Comment 11 Nick Clemens (kidclamp) 2017-05-25 13:02:30 UTC
Created attachment 63714 [details] [review]
Bug 18512: Add tests 16.11.X version

Remove use of build_object

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 12 Nick Clemens (kidclamp) 2017-05-25 13:03:26 UTC
(In reply to Katrin Fischer from comment #10)
> Tests don't pass applied on 16.11.x - not pushing this, please check.
> Test Summary Report
> -------------------
> t/db_dependent/Template/Plugin/AuthorisedValues.t (Wstat: 65280 Tests: 1
> Failed: 1)
>   Failed test:  1
>   Non-zero exit status: 255

Tests were using build_object which doesn't seem to be in 16.11.X

New tests attached
Comment 13 Katrin Fischer 2017-06-05 13:31:09 UTC
Thx Nick!

These patches have been pushed to 16.11.x and will be in 16.11.09.
Comment 14 Mason James 2017-07-31 11:07:11 UTC
Pushed to 16.05.x, for 16.05.15 release