When browsing news in the opac (opac-main.pl), links in the titles of news are broken. The id pasted in the link is the id from the additional_contents_localizations instead of the id from additional_contents.
This behaviour is due to the behavior of Koha::AdditionnalContents->search_for_display It calls : Koha::AdditionalContentsLocalizations->search( $search_params, $attribs ), which returns a set of AdditionalContentsLocalizationsn which are very close to AdditionnalContents and whose interface allows to deal with them as if they were AdditionnalContents EXCEPT that the field "id" contains the id of the AdditionalContentsLocalizations. Hence, when searching for the id of the news, one should use the field AdditionalContentLocalization->additional_content->id. Note : the fix I am about to propose fixes the issue but I am not sure about the function search_for_display itself : the function AdditionnalContent::search_for_display() should return objects with the exact same interface as an AdditionnalContent, thus an AdditionnalContent.id that allows to search and find for an additional_content. Moreover it looks like it is a static method declared as an object method since $self is declared as parameter but never used. Do you think I should open a bug to fix that method or are these points normal ?
Created attachment 170266 [details] [review] Bug 37629: Link to news are broken When browsing news in the opac (opac-main.pl), links in the titles of news are broken. The id pasted in the link is the id from the additional_contents_localizations instead of the id from additional_contents. TEST PLAN: 1 - In intranet create a news with multiple languages 2 - Create a second news 3 - In OPAC, the link of the title of the second news (and maybe the first) should be broken APPLY PATCH 4 - In OPAC, the link of the title of both news should work
Created attachment 170318 [details] [review] Bug 37629: Link to news are broken When browsing news in the opac (opac-main.pl), links in the titles of news are broken. The id pasted in the link is the id from the additional_contents_localizations instead of the id from additional_contents. TEST PLAN: 1 - In intranet create a news with multiple languages 2 - Create a second news 3 - In OPAC, the link of the title of the second news (and maybe the first) should be broken APPLY PATCH 4 - In OPAC, the link of the title of both news should work Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 170426 [details] [review] Bug 37629: Link to news are broken When browsing news in the opac (opac-main.pl), links in the titles of news are broken. The id pasted in the link is the id from the additional_contents_localizations instead of the id from additional_contents. TEST PLAN: 1 - In intranet create a news with multiple languages 2 - Create a second news 3 - In OPAC, the link of the title of the second news (and maybe the first) should be broken APPLY PATCH 4 - In OPAC, the link of the title of both news should work Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Pushed for 24.11! Well done everyone, thank you!
Backported to 24.05.x for upcoming 24.05.06