Bug 27650 - Wrong variable passed to the template in opac-main
Summary: Wrong variable passed to the template in opac-main
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 14272
Blocks: 27634
  Show dependency treegraph
 
Reported: 2021-02-08 10:25 UTC by Jonathan Druart
Modified: 2021-12-13 21:09 UTC (History)
4 users (show)

See Also:
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:


Attachments
Bug 27650: Fix variable passed to the template in opac-main (2.26 KB, patch)
2021-02-08 10:29 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 27650: Fix variable passed to the template in opac-main (2.26 KB, patch)
2021-02-10 06:22 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 27650: Fix variable passed to the template in opac-main (2.15 KB, patch)
2021-02-10 06:26 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 27650: Fix variable passed to the template in opac-main (2.21 KB, patch)
2021-03-05 14:28 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 27650: Fix variable passed to the template in opac-main (2.27 KB, patch)
2021-03-06 12:10 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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.