Bug 24398

Summary: Error when viewing single news item and NewsAuthorDisplay pref set to OPAC
Product: Koha Reporter: Owen Leonard <oleonard>
Component: OPACAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: andrewfh, caroline.cyr-la-rose, fridolin.somers, jonathan.druart, victor
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.01,20.05.10,19.11.16
Bug Depends on: 14272    
Bug Blocks: 27714    
Attachments: Bug 24398: Fix 500 when viewing a single news item at the OPAC
Bug 24398: Fix 500 when viewing a single news item at the OPAC
Bug 24398: Fix 500 when viewing a single news item at the OPAC
Bug 24398: Fix 500 when viewing a single news item at the OPAC
Bug 24398: (QA follow-up) Add POD

Description Owen Leonard 2020-01-10 15:00:15 UTC
Steps to reproduce:

 - Set the NewsAuthorDisplay preference to 'OPAC' or 'Both OPAC and staff client.'
 - Open the OPAC main page and click on an individual news item

The page for that single news item shows an error:

Template process failed: undef error - The method Koha::NewsItem->author_title is not covered by tests!
Comment 1 Jonathan Druart 2020-12-10 14:07:51 UTC
This is terrible.
Comment 2 Jonathan Druart 2020-12-10 14:12:10 UTC
Created attachment 114309 [details] [review]
Bug 24398: Fix 500 when viewing a single news item at the OPAC

Test plan:
0. Set the NewsAuthorDisplay preference to 'OPAC' or 'Both OPAC and staff client.'
1. Open the OPAC main page and click on an individual news item
Without this patch you get an ugly 500
    Template process failed: undef error - The method Koha::NewsItem->author_title is not covered by tests!
With this patch applied you see the news with the author's info
Comment 3 Lucas Gass 2020-12-10 15:50:49 UTC
Created attachment 114312 [details] [review]
Bug 24398: Fix 500 when viewing a single news item at the OPAC

Test plan:
0. Set the NewsAuthorDisplay preference to 'OPAC' or 'Both OPAC and staff client.'
1. Open the OPAC main page and click on an individual news item
Without this patch you get an ugly 500
    Template process failed: undef error - The method Koha::NewsItem->author_title is not covered by tests!
With this patch applied you see the news with the author's info

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 4 Victor Grousset/tuxayo 2020-12-14 20:08:28 UTC
Created attachment 114398 [details] [review]
Bug 24398: Fix 500 when viewing a single news item at the OPAC

Test plan:
0. Set the NewsAuthorDisplay preference to 'OPAC' or 'Both OPAC and staff client.'
1. Open the OPAC main page and click on an individual news item
Without this patch you get an ugly 500
    Template process failed: undef error - The method Koha::NewsItem->author_title is not covered by tests!
With this patch applied you see the news with the author's info

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 5 Victor Grousset/tuxayo 2020-12-14 21:21:10 UTC
As a step towards QA, here is another signoff.

It even works with an account of an organization.
(which only has a name field, but it's actually a surname, so it's normal that it works)
Comment 6 Nick Clemens 2020-12-21 13:44:42 UTC
Created attachment 114554 [details] [review]
Bug 24398: Fix 500 when viewing a single news item at the OPAC

Test plan:
0. Set the NewsAuthorDisplay preference to 'OPAC' or 'Both OPAC and staff client.'
1. Open the OPAC main page and click on an individual news item
Without this patch you get an ugly 500
    Template process failed: undef error - The method Koha::NewsItem->author_title is not covered by tests!
With this patch applied you see the news with the author's info

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 7 Nick Clemens 2020-12-21 13:44:44 UTC
Created attachment 114555 [details] [review]
Bug 24398: (QA follow-up) Add POD

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 8 Jonathan Druart 2020-12-26 17:15:05 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 9 Fridolin Somers 2020-12-28 15:02:12 UTC
Pushed to 20.11.x for 20.11.01
Comment 10 Andrew Fuerste-Henry 2020-12-28 21:55:52 UTC
This applies to 20.05.x and appears to work ok, but I'm getting the following error from the QA tools: "Argument "" isn't numeric in numeric gt (>) at /kohadevbox/koha/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc line 23."

Not backporting, but let me know if needed and I'll chase someone to fix the error
Comment 11 Jonathan Druart 2021-01-05 06:23:10 UTC
(In reply to Andrew Fuerste-Henry from comment #10)
> This applies to 20.05.x and appears to work ok, but I'm getting the
> following error from the QA tools: "Argument "" isn't numeric in numeric gt
> (>) at
> /kohadevbox/koha/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc
> line 23."
> 
> Not backporting, but let me know if needed and I'll chase someone to fix the
> error

It's just a (known) warning, you can ignore it.
Comment 12 Andrew Fuerste-Henry 2021-03-05 14:21:25 UTC
Pushed to 20.05.x for 20.05.10
Comment 13 Victor Grousset/tuxayo 2021-03-19 00:01:36 UTC
Backported: Pushed to 19.11.x branch for 19.11.16