Bugzilla – Attachment 116628 Details for
Bug 27650
Wrong variable passed to the template in opac-main
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27650: Fix variable passed to the template in opac-main
Bug-27650-Fix-variable-passed-to-the-template-in-o.patch (text/plain), 2.26 KB, created by
Jonathan Druart
on 2021-02-10 06:22:51 UTC
(
hide
)
Description:
Bug 27650: Fix variable passed to the template in opac-main
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-02-10 06:22:51 UTC
Size:
2.26 KB
patch
obsolete
>From 3394030919b0f2a6b407155cb4ef42597900bd63 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 8 Feb 2021 11:27:57 +0100 >Subject: [PATCH] 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 >--- > opac/opac-main.pl | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > >diff --git a/opac/opac-main.pl b/opac/opac-main.pl >index f885a8ab48..af0377f483 100755 >--- a/opac/opac-main.pl >+++ b/opac/opac-main.pl >@@ -61,17 +61,17 @@ elsif (C4::Context->userenv and defined $input->param('branch') and length $inpu > } > > my $news_id = $input->param('news_id'); >-my @all_koha_news; >+my $all_koha_news; > > if (defined $news_id){ >- @all_koha_news = Koha::News->search({ idnew => $news_id, lang => { '!=', 'koha' } }); # get news that is not staff-only news >- if( @all_koha_news ) { # we only expect one btw >- $template->param( news_item => $all_koha_news[0] ); >+ $all_koha_news = Koha::News->search({ idnew => $news_id, lang => { '!=', 'koha' } }); # get news that is not staff-only news >+ if( $all_koha_news->count ) { # we only expect one btw >+ $template->param( news_item => $all_koha_news->next ); > } else { > $template->param( single_news_error => 1 ); > } > } else { >- @all_koha_news = &GetNewsToDisplay( $template->lang, $homebranch); >+ $all_koha_news = &GetNewsToDisplay( $template->lang, $homebranch); > } > > # For dashboard >@@ -104,7 +104,7 @@ if ( $patron ) { > } > > $template->param( >- koha_news => @all_koha_news, >+ koha_news => $all_koha_news, > branchcode => $homebranch, > daily_quote => Koha::Quotes->get_daily_quote(), > ); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27650
:
116490
|
116628
|
116629
|
117858
|
117882