Bug 26464

Summary: Code correction in opac-main when news_id passed
Product: Koha Reporter: Marcel de Rooy <m.de.rooy>
Component: Architecture, internals, and plumbingAssignee: Marcel de Rooy <m.de.rooy>
Status: Pushed to stable --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: aleisha, lucas
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.05
Attachments: Bug 26464: Code correction in opac-main when news_id passed
Bug 26464: Code correction in opac-main when news_id passed

Description Marcel de Rooy 2020-09-15 12:09:32 UTC
Theoretical change. If somehow the search would return more than one result, the code is wrong.
Comment 1 Marcel de Rooy 2020-09-15 12:16:22 UTC
Created attachment 110105 [details] [review]
Bug 26464: Code correction in opac-main when news_id passed

Theoretical change. If somehow the search would return more than one result, the code is wrong.

The if test can be simplified: remove scalar and >0.
We should not pass @array to one param. It would theoretically add wrong items or
trigger an odd number warning. If it is only one, it is no problem. But it is buggy.

Test plan:
Pass an existing news_id to opac-main. Item visible?
And pass a not-existing. Error message?

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 2 Marcel de Rooy 2020-09-15 12:16:48 UTC
Trivial. Taking liberty to self sign off.
Comment 3 Katrin Fischer 2020-09-15 19:43:18 UTC
Created attachment 110118 [details] [review]
Bug 26464: Code correction in opac-main when news_id passed

Theoretical change. If somehow the search would return more than one result, the code is wrong.

The if test can be simplified: remove scalar and >0.
We should not pass @array to one param. It would theoretically add wrong items or
trigger an odd number warning. If it is only one, it is no problem. But it is buggy.

Test plan:
Pass an existing news_id to opac-main. Item visible?
And pass a not-existing. Error message?

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 4 Jonathan Druart 2020-09-18 09:54:50 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 5 Lucas Gass 2020-10-16 15:05:28 UTC
backported to 20.05.x for 20.05.05
Comment 6 Aleisha Amohia 2020-10-20 01:38:12 UTC
minor trivial fix, not backported to 19.11.x