Bugzilla – Attachment 110118 Details for
Bug 26464
Code correction in opac-main when news_id passed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26464: Code correction in opac-main when news_id passed
Bug-26464-Code-correction-in-opac-main-when-newsid.patch (text/plain), 1.44 KB, created by
Katrin Fischer
on 2020-09-15 19:43:18 UTC
(
hide
)
Description:
Bug 26464: Code correction in opac-main when news_id passed
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-09-15 19:43:18 UTC
Size:
1.44 KB
patch
obsolete
>From 4b2c930fb13914e567efe61d42e8b1fbb09e585a Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 15 Sep 2020 12:09:56 +0000 >Subject: [PATCH] Bug 26464: Code correction in opac-main when news_id passed > >Theoretical change. If somehow the search would return more than one result, the code is wrong. > >The if test can be simplified: remove scalar and >0. >We should not pass @array to one param. It would theoretically add wrong items or >trigger an odd number warning. If it is only one, it is no problem. But it is buggy. > >Test plan: >Pass an existing news_id to opac-main. Item visible? >And pass a not-existing. Error message? > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > opac/opac-main.pl | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/opac/opac-main.pl b/opac/opac-main.pl >index b5a5b284e9..74755a05a5 100755 >--- a/opac/opac-main.pl >+++ b/opac/opac-main.pl >@@ -64,8 +64,8 @@ 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 (scalar @all_koha_news > 0){ >- $template->param( news_item => @all_koha_news ); >+ if( @all_koha_news ) { # we only expect one btw >+ $template->param( news_item => $all_koha_news[0] ); > } else { > $template->param( single_news_error => 1 ); > } >-- >2.11.0
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 26464
:
110105
| 110118