Bug 27650

Summary: Wrong variable passed to the template in opac-main
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: OPACAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: andrew, dcook, fridolin.somers, victor
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:
21.05.00,20.11.04,20.05.10
Circulation function:
Bug Depends on: 14272    
Bug Blocks: 27634    
Attachments: Bug 27650: Fix variable passed to the template in opac-main
Bug 27650: Fix variable passed to the template in opac-main
Bug 27650: Fix variable passed to the template in opac-main
Bug 27650: Fix variable passed to the template in opac-main
Bug 27650: Fix variable passed to the template in opac-main

Description Jonathan Druart 2021-02-08 10:25:59 UTC
From:
  commit acb455f151ac737613857c58e64a600d760a59e0
  Bug 14272: Show single news item [alternative patch]

$template->param(
+    koha_news           => @all_koha_news,

We must not pass an array, the number of elements of the hash passed to the template may be inconsistent.

It's working because of an error earlier in the script:
+    @all_koha_news   = &GetNewsToDisplay($news_lang,$homebranch);

GetNewsToDisplay returns an arrayref
Comment 1 Jonathan Druart 2021-02-08 10:29:48 UTC
Created attachment 116490 [details] [review]
Bug 27650: Fix variable passed to the template in opac-main

From:
  commit acb455f151ac737613857c58e64a600d760a59e0
  Bug 14272: Show single news item [alternative patch]

$template->param(
+    koha_news           => @all_koha_news,

We must not pass an array, the number of elements of the hash passed to the template may be inconsistent.

It's working because of an error earlier in the script:
+    @all_koha_news   = &GetNewsToDisplay($news_lang,$homebranch);

GetNewsToDisplay returns an arrayref

Test plan:
Define at least 2 news to display on the OPAC main page
Hit opac-main.pl
=> All news are displayed
Click one
=> You see the single news you selected
Comment 2 Owen Leonard 2021-02-09 20:40:08 UTC
Patch doesn't apply:

Applying: Bug 27650: Fix variable passed to the template in opac-main
fatal: empty ident name (for <>) not allowed
Comment 3 Jonathan Druart 2021-02-10 06:22:51 UTC
Created attachment 116628 [details] [review]
Bug 27650: Fix variable passed to the template in opac-main

From:
  commit acb455f151ac737613857c58e64a600d760a59e0
  Bug 14272: Show single news item [alternative patch]

$template->param(
+    koha_news           => @all_koha_news,

We must not pass an array, the number of elements of the hash passed to the template may be inconsistent.

It's working because of an error earlier in the script:
+    @all_koha_news   = &GetNewsToDisplay($news_lang,$homebranch);

GetNewsToDisplay returns an arrayref

Test plan:
Define at least 2 news to display on the OPAC main page
Hit opac-main.pl
=> All news are displayed
Click one
=> You see the single news you selected
Comment 4 Jonathan Druart 2021-02-10 06:26:49 UTC
Created attachment 116629 [details] [review]
Bug 27650: Fix variable passed to the template in opac-main

$template->param(
+    koha_news           => @all_koha_news,

We must not pass an array, the number of elements of the hash passed to the template may be inconsistent.

It's working because of an error earlier in the script:
+    @all_koha_news   = &GetNewsToDisplay($news_lang,$homebranch);

GetNewsToDisplay returns an arrayref

Test plan:
Define at least 2 news to display on the OPAC main page
Hit opac-main.pl
=> All news are displayed
Click one
=> You see the single news you selected
Comment 5 Jonathan Druart 2021-02-10 06:28:16 UTC
(In reply to Owen Leonard from comment #2)
> Patch doesn't apply:
> 
> Applying: Bug 27650: Fix variable passed to the template in opac-main
> fatal: empty ident name (for <>) not allowed

For the record: it didn't like the 'From: ' in the commit body. The 'Author: ' part of the patch was replaced by this 'From: '. Weird git bug!
Comment 6 Fridolin Somers 2021-03-05 14:28:23 UTC
Created attachment 117858 [details] [review]
Bug 27650: Fix variable passed to the template in opac-main

$template->param(
+    koha_news           => @all_koha_news,

We must not pass an array, the number of elements of the hash passed to the template may be inconsistent.

It's working because of an error earlier in the script:
+    @all_koha_news   = &GetNewsToDisplay($news_lang,$homebranch);

GetNewsToDisplay returns an arrayref

Test plan:
Define at least 2 news to display on the OPAC main page
Hit opac-main.pl
=> All news are displayed
Click one
=> You see the single news you selected

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Comment 7 Katrin Fischer 2021-03-06 12:10:22 UTC
Created attachment 117882 [details] [review]
Bug 27650: Fix variable passed to the template in opac-main

$template->param(
+    koha_news           => @all_koha_news,

We must not pass an array, the number of elements of the hash passed to the template may be inconsistent.

It's working because of an error earlier in the script:
+    @all_koha_news   = &GetNewsToDisplay($news_lang,$homebranch);

GetNewsToDisplay returns an arrayref

Test plan:
Define at least 2 news to display on the OPAC main page
Hit opac-main.pl
=> All news are displayed
Click one
=> You see the single news you selected

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Jonathan Druart 2021-03-08 14:17:39 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 9 Fridolin Somers 2021-03-12 08:03:42 UTC
Pushed to 20.11.x for 20.11.04
Comment 10 Andrew Fuerste-Henry 2021-03-14 19:57:49 UTC
Pushed to 20.05.x for 20.05.10
Comment 11 Victor Grousset/tuxayo 2021-03-23 06:27:42 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.