Bug 37684 - Direct links to expired news are broken
Summary: Direct links to expired news are broken
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Baptiste Wojtkowski (bwoj)
QA Contact: Testopia
URL:
Keywords: regression
Depends on: 37629
Blocks:
  Show dependency treegraph
 
Reported: 2024-08-20 10:07 UTC by Baptiste Wojtkowski (bwoj)
Modified: 2024-09-06 18:41 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 37684: Direct link to expired news are broken (5.40 KB, patch)
2024-08-20 12:43 UTC, Baptiste Wojtkowski (bwoj)
Details | Diff | Splinter Review
Bug 37684: Direct link to expired news are broken (5.47 KB, patch)
2024-09-06 18:40 UTC, Olivier V
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Baptiste Wojtkowski (bwoj) 2024-08-20 10:07:37 UTC
When using a direct link to a news (koha.url/cgi-bin/koha/opac-main.pl?news_id=XXX), the link is broken if the news is expired.
Comment 1 Katrin Fischer 2024-08-20 10:14:42 UTC
I think there was some discussion about accessibility of news once they have expired. Might be worth doing a bugzilla search first.
Comment 2 Baptiste Wojtkowski (bwoj) 2024-08-20 12:43:30 UTC
Created attachment 170495 [details] [review]
Bug 37684: Direct link to expired news are broken

When using a direct link to a news (koha.url/cgi-bin/koha/opac-main.pl?news_id=XXX), the link is broken if the news is expired.

Formerly, a using AdditionalContent->get( id => "my_news_id") on an
expired news was returning a news, and calling get without id was
returning all news but the expired ones.

This patch adds tests to check this behaviour by adding one expired news and performing following new tests:
1 - It may not be returned by AdditionalContent.get()
2 - It must be returned by AdditionalContent.get() using its id

This patch fixes the behaviour by addind the new behaviour or
AdditionalContent.get:
1 - Any news must be returned by AdditionalContent.get() using its id;

TEST PLAN:
1 - Apply patch
2 - Remove the changes made to Koha/AdditionalContents.pm
3 - Run tests -> one test must fail
4 - Create a news with a expired expiration date, notice the id of the
  news in the url of the modification panel
5 - Go to "opac.url/cgi-bin/koha/opac-main.pl?news_id=MY_ID" -> notice
  it does not work
6 - Reapply the whole patch
7 - Run test -> all test must pass
8 - Go to "opac.url/cgi-bin/koha/opac-main.pl?news_id=MY_ID" -> notice
  it does work now
Comment 3 Baptiste Wojtkowski (bwoj) 2024-08-20 13:05:48 UTC
(In reply to Katrin Fischer from comment #1)
> I think there was some discussion about accessibility of news once they have
> expired. Might be worth doing a bugzilla search first.

Hi !

I do not think this behaviour is done on purpose. Formerly, direct access to news was working. In BZ 31383 this link has been totally broken, it has been partially restablished with BZ 37629 but we did not test on expired news.

From what I see in discussions, expired news are hidden by default in the intranet list of news -> https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27766
But this is the lonely point is of our concerns when searching for "news" and "expir"

Finally, when picking an expiration date, there is still a tooltip telling the user the link will still be available once expired
Comment 4 Katrin Fischer 2024-08-20 13:11:28 UTC
Hi Baptiste, happy to be wrong. Thanks for figuring that all out!
Comment 5 Olivier V 2024-09-06 18:40:19 UTC
Created attachment 171147 [details] [review]
Bug 37684: Direct link to expired news are broken

When using a direct link to a news (koha.url/cgi-bin/koha/opac-main.pl?news_id=XXX), the link is broken if the news is expired.

Formerly, a using AdditionalContent->get( id => "my_news_id") on an
expired news was returning a news, and calling get without id was
returning all news but the expired ones.

This patch adds tests to check this behaviour by adding one expired news and performing following new tests:
1 - It may not be returned by AdditionalContent.get()
2 - It must be returned by AdditionalContent.get() using its id

This patch fixes the behaviour by addind the new behaviour or
AdditionalContent.get:
1 - Any news must be returned by AdditionalContent.get() using its id;

TEST PLAN:
1 - Apply patch
2 - Remove the changes made to Koha/AdditionalContents.pm
3 - Run tests -> one test must fail
4 - Create a news with a expired expiration date, notice the id of the
  news in the url of the modification panel
5 - Go to "opac.url/cgi-bin/koha/opac-main.pl?news_id=MY_ID" -> notice
  it does not work
6 - Reapply the whole patch
7 - Run test -> all test must pass
8 - Go to "opac.url/cgi-bin/koha/opac-main.pl?news_id=MY_ID" -> notice
  it does work now

Signed-off-by: Olivier V <olivier.vezina@inLibro.com>