Bug 14272 - Allow OPAC to show a single news entry
Summary: Allow OPAC to show a single news entry
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Martin Persson
QA Contact: Martin Renvoize
URL:
Keywords:
: 14980 (view as bug list)
Depends on: 20924
Blocks: 15385 22370 24398 27650
  Show dependency treegraph
 
Reported: 2015-05-25 14:48 UTC by Martin Persson
Modified: 2021-02-08 10:25 UTC (History)
11 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Allows to display OPAC news entries on their own page. The news entry will remain accessible by direct URL even after the entry itself has expired.
Version(s) released in:
19.05.00


Attachments
Bug 14272: OPAC show single news (2.92 KB, patch)
2015-12-16 10:49 UTC, Martin Persson
Details | Diff | Splinter Review
Bug 14272: OPAC show single news (3.04 KB, patch)
2015-12-16 22:44 UTC, Martin Persson
Details | Diff | Splinter Review
Bug 14272: OPAC show single news (3.10 KB, patch)
2015-12-16 22:47 UTC, Martin Persson
Details | Diff | Splinter Review
Bug 14272: Show single news item (backend) (1.23 KB, patch)
2015-12-18 12:49 UTC, Martin Persson
Details | Diff | Splinter Review
Bug 14272: Show single news item (OPAC) (3.96 KB, patch)
2015-12-18 12:50 UTC, Martin Persson
Details | Diff | Splinter Review
Bug 14272: Show single news item (backend) (1.75 KB, patch)
2015-12-18 15:44 UTC, Martin Persson
Details | Diff | Splinter Review
Bug 14272: Show single news item (tests) (1.62 KB, patch)
2015-12-18 15:45 UTC, Martin Persson
Details | Diff | Splinter Review
Bug 14272: Show single news item (backend) (3.79 KB, patch)
2015-12-23 08:04 UTC, Martin Persson
Details | Diff | Splinter Review
Bug 14272: Show single news item (OPAC) (4.05 KB, patch)
2015-12-23 08:04 UTC, Martin Persson
Details | Diff | Splinter Review
Bug 14272: Show single news item (OPAC) (4.11 KB, patch)
2015-12-23 09:39 UTC, Martin Persson
Details | Diff | Splinter Review
Bug 14272: Show single news item (tests) (1.62 KB, patch)
2016-02-02 15:18 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 14272: Show single news item (backend) (3.79 KB, patch)
2016-02-02 15:19 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 14272: Show single news item (OPAC) (4.12 KB, patch)
2016-02-02 15:19 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 14272: Show single news item (tests) (1.62 KB, patch)
2016-02-05 01:18 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: Show single news item (tests) (1.62 KB, patch)
2016-02-05 01:18 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: Show single news item (tests) (1.62 KB, patch)
2016-02-05 01:19 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: Show single news item (tests) (1.62 KB, patch)
2016-02-05 01:19 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: Show single news item (tests) (1.62 KB, patch)
2016-02-05 01:20 UTC, Aleisha Amohia
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 14272: Show single news item (backend) (3.86 KB, patch)
2016-02-05 01:20 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: Show single news item (tests) (1.62 KB, patch)
2016-02-05 01:20 UTC, Aleisha Amohia
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 14272: Show single news item (backend) (3.86 KB, patch)
2016-02-05 01:20 UTC, Aleisha Amohia
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 14272: Show single news item (OPAC) (4.19 KB, patch)
2016-02-05 01:20 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: Show single news item (tests) (1.62 KB, patch)
2016-04-22 02:23 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 14272: Show single news item (backend) (3.84 KB, patch)
2016-04-22 02:23 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 14272: Show single news item (OPAC) (4.16 KB, patch)
2016-04-22 02:23 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 14272: [FOLLOW-UP] Show single news item (5.58 KB, patch)
2017-01-24 03:33 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: Show single news item (backend) (3.93 KB, patch)
2018-01-18 23:03 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: Show single news item (OPAC) (4.45 KB, patch)
2018-01-18 23:07 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: [FOLLOW-UP] Show single news item (1.16 KB, patch)
2018-01-18 23:11 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: [FOLLOW-UP] Show single news item (2.32 KB, patch)
2018-01-18 23:14 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: [FOLLOW-UP] Show single news item (2.37 KB, patch)
2018-02-22 03:39 UTC, Dilan Johnpullé
Details | Diff | Splinter Review
Bug 14272: Show single news item (tests) (1.67 KB, patch)
2018-03-09 07:06 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14272: Show single news item (backend) (3.99 KB, patch)
2018-03-09 07:06 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14272: Show single news item (OPAC) (4.50 KB, patch)
2018-03-09 07:06 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14272: (follow-up) Show single news item (2.43 KB, patch)
2018-03-09 07:06 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14272: Show single news item [alternative patch] (5.74 KB, patch)
2018-06-13 02:36 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: (follow-up) only display news available for a particular opac lang [alternative patch] (1.06 KB, patch)
2018-06-22 20:29 UTC, Charles Farmer
Details | Diff | Splinter Review
Bug 14272: (follow-up) only display news available for a particular opac lang [alternative patch] (1.02 KB, patch)
2018-06-29 18:27 UTC, Charles Farmer
Details | Diff | Splinter Review
Bug 14272: [FOLLOW-UP] Fixing template error (1.28 KB, patch)
2018-07-04 01:30 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: (follow-up) Fixing template error and layout (3.45 KB, patch)
2018-08-07 22:17 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: Show single news item [alternative patch] (5.79 KB, patch)
2018-08-08 12:01 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 14272: (follow-up) only display news available for a particular opac lang [alternative patch] (1.07 KB, patch)
2018-08-08 12:01 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 14272: (follow-up) Fixing template error and layout (3.50 KB, patch)
2018-08-08 12:01 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 14272: Show single news item [alternative patch] (5.84 KB, patch)
2018-08-08 12:37 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14272: (follow-up) only display news available for a particular opac lang [alternative patch] (1.12 KB, patch)
2018-08-08 12:37 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14272: (follow-up) Fixing template error and layout (3.56 KB, patch)
2018-08-08 12:37 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14272: (follow-up) Fixing template error and layout (4.84 KB, patch)
2018-08-24 04:07 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: Show single news item [alternative patch] (5.98 KB, patch)
2018-08-28 00:40 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: (follow-up) only display news available for a particular opac lang [alternative patch] (1.12 KB, patch)
2018-08-28 00:40 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: (follow-up) Fixing template error and layout (4.84 KB, patch)
2018-08-28 00:40 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: (follow-up) Fixing layout issues and expiration date hint (4.50 KB, patch)
2018-08-28 22:31 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: Fix missing TT filters (1.94 KB, patch)
2018-10-31 06:26 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14272: (follow-up) Show single display of 'all' news (951 bytes, patch)
2018-11-28 22:03 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14272: Show single news item [alternative patch] (6.05 KB, patch)
2018-12-20 20:55 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14272: (follow-up) only display news available for a particular opac lang [alternative patch] (1.19 KB, patch)
2018-12-20 20:55 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14272: (follow-up) Fixing template error and layout (4.90 KB, patch)
2018-12-20 20:55 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14272: (follow-up) Fixing layout issues and expiration date hint (4.57 KB, patch)
2018-12-20 20:55 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14272: Fix missing TT filters (2.00 KB, patch)
2018-12-20 20:55 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14272: (follow-up) Show single display of 'all' news (1016 bytes, patch)
2018-12-20 20:55 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14272: Show single news item [alternative patch] (6.09 KB, patch)
2019-02-08 14:49 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 14272: (follow-up) only display news available for a particular opac lang [alternative patch] (1.25 KB, patch)
2019-02-08 14:49 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 14272: (follow-up) Fixing template error and layout (4.96 KB, patch)
2019-02-08 14:49 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 14272: (follow-up) Fixing layout issues and expiration date hint (4.62 KB, patch)
2019-02-08 14:50 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 14272: Fix missing TT filters (2.06 KB, patch)
2019-02-08 14:50 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 14272: (follow-up) Show single display of 'all' news (1.06 KB, patch)
2019-02-08 14:50 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 14272: (QA follow-up) Remove superflous filter (1.82 KB, patch)
2019-02-08 14:50 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Persson 2015-05-25 14:48:50 UTC
Bugs 14246, 14247 and 14248 adds functionality to make the news module mimic simple blog functionality. As a first step, we need to be able to let users select a single news entry and display it on a page. Later patches will allow comments and listing all news posts by a specific user.
Comment 1 Martin Persson 2015-12-16 10:49:00 UTC Comment hidden (obsolete)
Comment 2 Martin Persson 2015-12-16 22:24:27 UTC
There is a security issue in this version; the ID supplied from the URL parameter is not checked for expiry. This means people can watch old, expired news by changing the ID. This is known as 'object reference bug'. Whether it is a problem or not is another matter.
Comment 3 Martin Persson 2015-12-16 22:44:28 UTC Comment hidden (obsolete)
Comment 4 Martin Persson 2015-12-16 22:47:45 UTC Comment hidden (obsolete)
Comment 5 Martin Persson 2015-12-18 12:49:58 UTC Comment hidden (obsolete)
Comment 6 Martin Persson 2015-12-18 12:50:44 UTC Comment hidden (obsolete)
Comment 7 Martin Persson 2015-12-18 15:44:30 UTC Comment hidden (obsolete)
Comment 8 Martin Persson 2015-12-18 15:45:02 UTC Comment hidden (obsolete)
Comment 9 Martin Persson 2015-12-18 21:30:53 UTC
I just realized that the ability show arbitrary news items by ID poses a vulnerability; you can view stuff with visbility other than the OPAC.
This would leak internal news to whomever has access to the OPAC.
Comment 10 Martin Persson 2015-12-23 08:04:20 UTC Comment hidden (obsolete)
Comment 11 Martin Persson 2015-12-23 08:04:55 UTC Comment hidden (obsolete)
Comment 12 Martin Persson 2015-12-23 09:39:27 UTC Comment hidden (obsolete)
Comment 13 Marc Véron 2015-12-24 11:22:02 UTC
Hi Martin, I like this feature.

Questions: 

- When I display the single item, the news header has still the same link (on itself). Could this be changed to a link back to where I came from?

- The single display shows the html from syspref OpacMainUserBlock. Is that necessary or could the single view display the contents of the news item only?
Comment 14 Mark Tompsett 2016-02-02 15:18:52 UTC Comment hidden (obsolete)
Comment 15 Mark Tompsett 2016-02-02 15:19:00 UTC Comment hidden (obsolete)
Comment 16 Mark Tompsett 2016-02-02 15:19:05 UTC Comment hidden (obsolete)
Comment 17 Mark Tompsett 2016-02-02 15:19:41 UTC
I did not sign this off. I rebased it to apply cleanly.
Comment 18 Aleisha Amohia 2016-02-05 01:10:56 UTC
(In reply to M. Tompsett from comment #14)
> Created attachment 47556 [details] [review] [review]
> Bug 14272: Show single news item (tests)
> 
> Updates tests to match the modified NewsChannels module.
> 
> Sponsored-by: Halland County Library

The tests fail:

t/db_dependent/NewsChannels.t .. 1/12 # Category CAT1 not found, inserting
# Borrower BRWR1 not found, inserting

#   Failed test 'got back expected news item via get_opac_new - ID 1'
#   at t/db_dependent/NewsChannels.t line 131.
#     Structures begin differing at:
#          $got->{newdate} = Does not exist
#     $expected->{newdate} = '01/01/2000'

#   Failed test 'got back expected news item via get_opac_new - ID 2'
#   at t/db_dependent/NewsChannels.t line 158.
#     Structures begin differing at:
#          $got->{newdate} = Does not exist
#     $expected->{newdate} = '01/01/2000'
# Looks like you failed 2 tests of 12.
t/db_dependent/NewsChannels.t .. Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/12 subtests 

Test Summary Report
-------------------
t/db_dependent/NewsChannels.t (Wstat: 512 Tests: 12 Failed: 2)
  Failed tests:  8-9
  Non-zero exit status: 2
Files=1, Tests=12,  1 wallclock secs ( 0.02 usr  0.00 sys +  0.59 cusr  0.04 csys =  0.65 CPU)
Result: FAIL
Comment 19 Aleisha Amohia 2016-02-05 01:18:09 UTC Comment hidden (obsolete)
Comment 20 Aleisha Amohia 2016-02-05 01:18:36 UTC Comment hidden (obsolete)
Comment 21 Aleisha Amohia 2016-02-05 01:19:00 UTC Comment hidden (obsolete)
Comment 22 Aleisha Amohia 2016-02-05 01:19:42 UTC Comment hidden (obsolete)
Comment 23 Aleisha Amohia 2016-02-05 01:20:04 UTC Comment hidden (obsolete)
Comment 24 Aleisha Amohia 2016-02-05 01:20:11 UTC Comment hidden (obsolete)
Comment 25 Aleisha Amohia 2016-02-05 01:20:36 UTC Comment hidden (obsolete)
Comment 26 Aleisha Amohia 2016-02-05 01:20:41 UTC Comment hidden (obsolete)
Comment 27 Aleisha Amohia 2016-02-05 01:20:50 UTC Comment hidden (obsolete)
Comment 28 Aleisha Amohia 2016-02-05 01:22:36 UTC
Sorry for all the comments, git kept timing out >.< so annoying! Won't change this to Signed Off as those tests don't pass, but will sign off once they're fixed to pass!
Comment 29 Marc Véron 2016-04-21 14:10:07 UTC
Sorry, does not apply:

Auto-merging koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt
CONFLICT (content): Merge conflict in koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt
Comment 30 Mark Tompsett 2016-04-22 02:23:00 UTC Comment hidden (obsolete)
Comment 31 Mark Tompsett 2016-04-22 02:23:08 UTC Comment hidden (obsolete)
Comment 32 Mark Tompsett 2016-04-22 02:23:15 UTC Comment hidden (obsolete)
Comment 33 Mark Tompsett 2016-04-22 02:29:08 UTC Comment hidden (obsolete)
Comment 34 Mark Tompsett 2016-04-22 02:30:53 UTC
I've moved this back to assigned, since I only rebased it.
The issue was .raw which was removed because the security patch which escaped all the data was removed. Also, 'new'? Can we try to have keys/fields which aren't reserved words?
Comment 35 Aleisha Amohia 2017-01-24 03:33:36 UTC Comment hidden (obsolete)
Comment 36 Eric 2017-03-24 13:46:13 UTC
Patch didn't apply, 

Some problems occurred applying patches from bug 14272:
<h1>Something went wrong !</h1>Applying: Bug 14272: Show single news item (tests)
Applying: Bug 14272: Show single news item (backend)
Using index info to reconstruct a base tree...
M	C4/NewsChannels.pm
Falling back to patching base and 3-way merge...
Auto-merging C4/NewsChannels.pm
CONFLICT (content): Merge conflict in C4/NewsChannels.pm
Patch failed at 0001 Bug 14272: Show single news item (backend)
Comment 37 Aleisha Amohia 2018-01-18 23:03:16 UTC Comment hidden (obsolete)
Comment 38 Aleisha Amohia 2018-01-18 23:07:02 UTC Comment hidden (obsolete)
Comment 39 Aleisha Amohia 2018-01-18 23:11:16 UTC Comment hidden (obsolete)
Comment 40 Aleisha Amohia 2018-01-18 23:14:46 UTC Comment hidden (obsolete)
Comment 41 Dilan Johnpullé 2018-02-22 03:39:53 UTC Comment hidden (obsolete)
Comment 42 Katrin Fischer 2018-03-09 07:05:23 UTC
Just some questions, but I don't feel any of this is a blocker:

- In the breadcrumbs the link says "News item" - why not use the heading in the breadcrumbs?
- The RSS feed remains visible - is that intended?
- OpacMainUserBlock remains at the bottom - is that intended?
Comment 43 Katrin Fischer 2018-03-09 07:06:07 UTC Comment hidden (obsolete)
Comment 44 Katrin Fischer 2018-03-09 07:06:11 UTC Comment hidden (obsolete)
Comment 45 Katrin Fischer 2018-03-09 07:06:15 UTC Comment hidden (obsolete)
Comment 46 Katrin Fischer 2018-03-09 07:06:20 UTC Comment hidden (obsolete)
Comment 47 Jonathan Druart 2018-03-19 20:01:00 UTC
(In reply to Katrin Fischer from comment #42)
> Just some questions, but I don't feel any of this is a blocker:
> 
> - In the breadcrumbs the link says "News item" - why not use the heading in
> the breadcrumbs?
> - The RSS feed remains visible - is that intended?
> - OpacMainUserBlock remains at the bottom - is that intended?

- Should not we add a message if news_id is passed but wrong?

Also (blocker):
- parameter $time is added to GetNewsToDisplay but not used, we should remove it
Comment 48 Aleisha Amohia 2018-06-13 02:36:58 UTC
Created attachment 76015 [details] [review]
Bug 14272: Show single news item [alternative patch]

This is a new patch for this bug that shows a single news item on the
OPAC using Koha Objects (Koha::News).

To test:
1) Go to Tools -> News on staff interface, make a news item to show on
the OPAC
2) Go to OPAC
3) Notice news item shows and title cannot be clicked
4) Apply patch, refresh page
5) Notice title is now a link. Click title
6) Confirm breadcrumbs shows title of news item
7) Confirm RSS feed and OpacMainUserBlock are not visible
8) In the URL, change the news_id param to an ID that does not exist
9) Confirm that an appropriate error message shows

Sponsored-by: Catalyst IT
Comment 49 Charles Farmer 2018-06-22 19:46:55 UTC
Should I refrain from signing this off if the lingering issue mentionned in comment#2 is still reproducible?

I feel like it shouldn't be too hard to add a method like Koha::News::is_displayable that would filter the array from the search method, and return only what's acceptable for the given interface/lang.
Comment 50 Charles Farmer 2018-06-22 20:29:35 UTC Comment hidden (obsolete)
Comment 51 Charles Farmer 2018-06-22 20:39:50 UTC
Went with the path of least resistance: search query now filters based on the news_lang retrieved earlier in the script.

This should avoid retrieving news marked 'slip' or 'koha', and even those in other languages than the one currently displayed.

Also removed a lingering variable, koha_news_count, that was not used anymore, and not even passed to the template.

Test plan for this follow-up patch:

1) Make sure you have news from all different Location to display. At minimum, you should have the 'koha', 'slip' and 'en' locations readily available.
1.1) If you don't, create them at <intranet url>/cgi-bin/koha/tools/koha-news.pl
2) Apply patch "Bug 14272: Show single news item [alternative patch]"
3) Visit the OPAC
4) Click on the news' title
4.1) Not seeing any news? Go back to 1.1
5) Change the news_id parameter in the URL for another news that you've just created
5.1) You should be able to display any news, even those which you shouldn't have access to
6) Apply (follow-up) patch
7) Repeat 3) to 5), but this time, you should see an error message
Comment 52 Charles Farmer 2018-06-29 18:27:52 UTC
Created attachment 76580 [details] [review]
Bug 14272: (follow-up) only display news available for a particular opac lang [alternative patch]
Comment 53 Owen Leonard 2018-07-02 16:40:10 UTC
(In reply to Katrin Fischer from comment #42)

> - OpacMainUserBlock remains at the bottom - is that intended?

I think Quote of the Day and OpacMainUserBlock shouldn't show if you're looking at one news item.

A problem I found: If there is no news to display, OpacMainUserBlock and Quote of the Day don't show at all. I think the [% END %] at line 131 is misplaced.
Comment 54 Aleisha Amohia 2018-07-04 01:30:44 UTC
Created attachment 76662 [details] [review]
Bug 14272: [FOLLOW-UP] Fixing template error

To test, confirm that OpacMainUserBlock and Quote of the Day do not show
if viewing a single news item, but do show otherwise.
Comment 55 Owen Leonard 2018-08-07 16:32:53 UTC
The page layout is not working right now: The login form and user dashboard are displayed below the news (single or multiple) instead of in the sidebar.
Comment 56 Aleisha Amohia 2018-08-07 22:17:50 UTC
Created attachment 77546 [details] [review]
Bug 14272: (follow-up) Fixing template error and layout

To test, confirm that OpacMainUserBlock and Quote of the Day do not show
if viewing a single news item, but do show otherwise. Confirm user
dashboard shows where expected
Comment 57 Owen Leonard 2018-08-08 12:01:44 UTC
Created attachment 77564 [details] [review]
Bug 14272: Show single news item [alternative patch]

This is a new patch for this bug that shows a single news item on the
OPAC using Koha Objects (Koha::News).

To test:
1) Go to Tools -> News on staff interface, make a news item to show on
the OPAC
2) Go to OPAC
3) Notice news item shows and title cannot be clicked
4) Apply patch, refresh page
5) Notice title is now a link. Click title
6) Confirm breadcrumbs shows title of news item
7) Confirm RSS feed and OpacMainUserBlock are not visible
8) In the URL, change the news_id param to an ID that does not exist
9) Confirm that an appropriate error message shows

Sponsored-by: Catalyst IT

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 58 Owen Leonard 2018-08-08 12:01:49 UTC
Created attachment 77565 [details] [review]
Bug 14272: (follow-up) only display news available for a particular opac lang [alternative patch]

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 59 Owen Leonard 2018-08-08 12:01:54 UTC
Created attachment 77566 [details] [review]
Bug 14272: (follow-up) Fixing template error and layout

To test, confirm that OpacMainUserBlock and Quote of the Day do not show
if viewing a single news item, but do show otherwise. Confirm user
dashboard shows where expected

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 60 Katrin Fischer 2018-08-08 12:26:23 UTC
I notice that an expired news entry is still visible using the direct link to it, is this intended? 

It could be seen as a change of behaviour as right now there is no way to access an expired entry. Owen and others, what do you think?
Comment 61 Owen Leonard 2018-08-08 12:32:55 UTC
(In reply to Katrin Fischer from comment #60)
> I notice that an expired news entry is still visible using the direct link
> to it, is this intended? 

A blog or a news site would keep articles around even after they're gone from their front page, so I think it's okay. Libraries have the ability to delete entries which they don't want anyone to see again.

It is a change of behavior, but my vote is to consider it a feature not a bug.
Comment 62 Katrin Fischer 2018-08-08 12:37:09 UTC
Created attachment 77567 [details] [review]
Bug 14272: Show single news item [alternative patch]

This is a new patch for this bug that shows a single news item on the
OPAC using Koha Objects (Koha::News).

To test:
1) Go to Tools -> News on staff interface, make a news item to show on
the OPAC
2) Go to OPAC
3) Notice news item shows and title cannot be clicked
4) Apply patch, refresh page
5) Notice title is now a link. Click title
6) Confirm breadcrumbs shows title of news item
7) Confirm RSS feed and OpacMainUserBlock are not visible
8) In the URL, change the news_id param to an ID that does not exist
9) Confirm that an appropriate error message shows

Sponsored-by: Catalyst IT

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 63 Katrin Fischer 2018-08-08 12:37:16 UTC
Created attachment 77568 [details] [review]
Bug 14272: (follow-up) only display news available for a particular opac lang [alternative patch]

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 64 Katrin Fischer 2018-08-08 12:37:22 UTC
Created attachment 77569 [details] [review]
Bug 14272: (follow-up) Fixing template error and layout

To test, confirm that OpacMainUserBlock and Quote of the Day do not show
if viewing a single news item, but do show otherwise. Confirm user
dashboard shows where expected

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 65 Jonathan Druart 2018-08-08 15:58:55 UTC
(In reply to Owen Leonard from comment #61)
> It is a change of behavior, but my vote is to consider it a feature not a
> bug.

Usually it means it would be considered as a bug for someone else :)

I would add a hint close to "Expiration date:" and highlight in the release notes.
Comment 66 Jonathan Druart 2018-08-08 15:59:31 UTC
(In reply to Jonathan Druart from comment #65)
> (In reply to Owen Leonard from comment #61)
> > It is a change of behavior, but my vote is to consider it a feature not a
> > bug.
> 
> Usually it means it would be considered as a bug for someone else :)
> 
> I would add a hint close to "Expiration date:" and highlight in the release
> notes.

Katrin updated the release notes on QAing!
Comment 67 Nick Clemens 2018-08-22 14:08:48 UTC
Owen, can you rebase on 13618 and add the hint to expiration date as Jonathan suggested?
Comment 68 Aleisha Amohia 2018-08-24 04:07:02 UTC
Created attachment 78104 [details] [review]
Bug 14272: (follow-up) Fixing template error and layout

To test, confirm that OpacMainUserBlock and Quote of the Day do not show
if viewing a single news item, but do show otherwise. Confirm user
dashboard shows where expected

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

UPDATE 24/Aug: Add expiration date text
Comment 69 Aleisha Amohia 2018-08-28 00:40:17 UTC
Created attachment 78206 [details] [review]
Bug 14272: Show single news item [alternative patch]

This is a new patch for this bug that shows a single news item on the
OPAC using Koha Objects (Koha::News).

To test:
1) Go to Tools -> News on staff interface, make a news item to show on
the OPAC
2) Go to OPAC
3) Notice news item shows and title cannot be clicked
4) Apply patch, refresh page
5) Notice title is now a link. Click title
6) Confirm breadcrumbs shows title of news item
7) Confirm RSS feed and OpacMainUserBlock are not visible
8) In the URL, change the news_id param to an ID that does not exist
9) Confirm that an appropriate error message shows

Sponsored-by: Catalyst IT

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 70 Aleisha Amohia 2018-08-28 00:40:31 UTC
Created attachment 78207 [details] [review]
Bug 14272: (follow-up) only display news available for a particular opac lang [alternative patch]

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 71 Aleisha Amohia 2018-08-28 00:40:43 UTC
Created attachment 78208 [details] [review]
Bug 14272: (follow-up) Fixing template error and layout

To test, confirm that OpacMainUserBlock and Quote of the Day do not show
if viewing a single news item, but do show otherwise. Confirm user
dashboard shows where expected

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

UPDATE 24/Aug: Add expiration date text
Comment 72 Aleisha Amohia 2018-08-28 00:42:20 UTC
Rebased, ready for testing
Comment 73 Katrin Fischer 2018-08-28 05:52:26 UTC
If it's only the hint being added, I'd be ok putting this back into the QA queue.
Comment 74 Owen Leonard 2018-08-28 15:24:21 UTC
(In reply to Owen Leonard from comment #53)
> 
> A problem I found: If there is no news to display, OpacMainUserBlock and
> Quote of the Day don't show at all.

This problem is back.

Why do we note the expiration date of the news item? That doesn't seem relevant to me. If we must keep it the date should be formatted according to dateformat preference.
Comment 75 Katrin Fischer 2018-08-28 17:33:51 UTC
Hm, yes, I didn't sign off on that, I think? Please always do follow-ups for changes like that once a patch has reached signed-off status.

I also think this is a misunderstanding entirely. We were not asking for the expiration date to show on the news item, but for a hint on the news form in staff that the news will still be accessible by direct URL even if expired.
Comment 76 Aleisha Amohia 2018-08-28 22:31:36 UTC
Created attachment 78231 [details] [review]
Bug 14272: (follow-up) Fixing layout issues and expiration date hint

Misunderstood the first time.

I've added the hint to the news form on staff side.
I've fixed the layout on OPAC.
The RSS feed shows on the main page, but is hidden if there is no news
and if viewing one news item.
Comment 77 Katrin Fischer 2018-10-31 06:24:37 UTC
Hi Aleisha, I found a little problem: When location is set to "all" (staff and opac), then the page view doesn't work. You see the news on the front page, but when you click on the headline it claims news item doesn't exist.

I think this would be nice to have, maybe it can be fixed easily?
Comment 78 Katrin Fischer 2018-10-31 06:26:29 UTC
Created attachment 81643 [details] [review]
Bug 14272: Fix missing TT filters
Comment 79 Aleisha Amohia 2018-11-28 22:03:09 UTC
Created attachment 82713 [details] [review]
Bug 14272: (follow-up) Show single display of 'all' news

This patch ensures that news items with location set to 'all' can be
clicked on and shown individually also.
Comment 80 Katrin Fischer 2018-12-20 20:55:04 UTC
Created attachment 83425 [details] [review]
Bug 14272: Show single news item [alternative patch]

This is a new patch for this bug that shows a single news item on the
OPAC using Koha Objects (Koha::News).

To test:
1) Go to Tools -> News on staff interface, make a news item to show on
the OPAC
2) Go to OPAC
3) Notice news item shows and title cannot be clicked
4) Apply patch, refresh page
5) Notice title is now a link. Click title
6) Confirm breadcrumbs shows title of news item
7) Confirm RSS feed and OpacMainUserBlock are not visible
8) In the URL, change the news_id param to an ID that does not exist
9) Confirm that an appropriate error message shows

Sponsored-by: Catalyst IT

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 81 Katrin Fischer 2018-12-20 20:55:10 UTC
Created attachment 83426 [details] [review]
Bug 14272: (follow-up) only display news available for a particular opac lang [alternative patch]

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 82 Katrin Fischer 2018-12-20 20:55:16 UTC
Created attachment 83427 [details] [review]
Bug 14272: (follow-up) Fixing template error and layout

To test, confirm that OpacMainUserBlock and Quote of the Day do not show
if viewing a single news item, but do show otherwise. Confirm user
dashboard shows where expected

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

UPDATE 24/Aug: Add expiration date text

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 83 Katrin Fischer 2018-12-20 20:55:21 UTC
Created attachment 83428 [details] [review]
Bug 14272: (follow-up) Fixing layout issues and expiration date hint

Misunderstood the first time.

I've added the hint to the news form on staff side.
I've fixed the layout on OPAC.
The RSS feed shows on the main page, but is hidden if there is no news
and if viewing one news item.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 84 Katrin Fischer 2018-12-20 20:55:26 UTC
Created attachment 83429 [details] [review]
Bug 14272: Fix missing TT filters

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 85 Katrin Fischer 2018-12-20 20:55:31 UTC
Created attachment 83430 [details] [review]
Bug 14272: (follow-up) Show single display of 'all' news

This patch ensures that news items with location set to 'all' can be
clicked on and shown individually also.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 86 Martin Renvoize 2019-02-08 14:49:50 UTC
Created attachment 84868 [details] [review]
Bug 14272: Show single news item [alternative patch]

This is a new patch for this bug that shows a single news item on the
OPAC using Koha Objects (Koha::News).

To test:
1) Go to Tools -> News on staff interface, make a news item to show on
the OPAC
2) Go to OPAC
3) Notice news item shows and title cannot be clicked
4) Apply patch, refresh page
5) Notice title is now a link. Click title
6) Confirm breadcrumbs shows title of news item
7) Confirm RSS feed and OpacMainUserBlock are not visible
8) In the URL, change the news_id param to an ID that does not exist
9) Confirm that an appropriate error message shows

Sponsored-by: Catalyst IT
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 87 Martin Renvoize 2019-02-08 14:49:55 UTC
Created attachment 84869 [details] [review]
Bug 14272: (follow-up) only display news available for a particular opac lang [alternative patch]

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 88 Martin Renvoize 2019-02-08 14:49:59 UTC
Created attachment 84870 [details] [review]
Bug 14272: (follow-up) Fixing template error and layout

To test, confirm that OpacMainUserBlock and Quote of the Day do not show
if viewing a single news item, but do show otherwise. Confirm user
dashboard shows where expected

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
UPDATE 24/Aug: Add expiration date text
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 89 Martin Renvoize 2019-02-08 14:50:04 UTC
Created attachment 84871 [details] [review]
Bug 14272: (follow-up) Fixing layout issues and expiration date hint

Misunderstood the first time.

I've added the hint to the news form on staff side.
I've fixed the layout on OPAC.
The RSS feed shows on the main page, but is hidden if there is no news
and if viewing one news item.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 90 Martin Renvoize 2019-02-08 14:50:09 UTC
Created attachment 84872 [details] [review]
Bug 14272: Fix missing TT filters

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 91 Martin Renvoize 2019-02-08 14:50:13 UTC
Created attachment 84873 [details] [review]
Bug 14272: (follow-up) Show single display of 'all' news

This patch ensures that news items with location set to 'all' can be
clicked on and shown individually also.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 92 Martin Renvoize 2019-02-08 14:50:18 UTC
Created attachment 84874 [details] [review]
Bug 14272: (QA follow-up) Remove superflous filter

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 93 Martin Renvoize 2019-02-08 14:52:21 UTC
Passing QA as the feature works as expected and I can't find any regressions at this time.

It would be nice to have some selenium integration tests for this feature to prevent future regressions, but as they're not yet widespread I can't fail on that point.

Also, can we get a relevant update patch submitted to the manual, please.
Comment 94 Nick Clemens 2019-02-19 12:45:51 UTC
I can input ids manually and access staff news items via the opac interface. I think this should be prevented
Comment 95 Nick Clemens 2019-02-19 13:55:30 UTC
Awesome work all!

Pushed to master for 19.05
Comment 96 Nick Clemens 2019-02-19 13:57:53 UTC
(In reply to Nick Clemens from comment #94)
> I can input ids manually and access staff news items via the opac interface.
> I think this should be prevented

I pushed this one, filed a followup bug 22370
Comment 97 Martin Renvoize 2019-02-26 09:01:30 UTC
Enhancement, will not be backported to 18.11.x series.
Comment 98 Katrin Fischer 2019-07-13 10:06:15 UTC
*** Bug 14980 has been marked as a duplicate of this bug. ***