Bug 20265 - Add syspref to hide news published date
Summary: Add syspref to hide news published date
Status: CLOSED WONTFIX
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Dilan Johnpullé
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-22 04:04 UTC by Dilan Johnpullé
Modified: 2019-10-14 19:56 UTC (History)
6 users (show)

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


Attachments
This patch adds a system preference that allows a user to toggle the published date for OPAC news items on or off. (87.29 KB, patch)
2018-02-26 04:42 UTC, Dilan Johnpullé
Details | Diff | Splinter Review
This patch adds a system preference that allows a user to toggle the published date for OPAC news items on or off. (87.00 KB, patch)
2018-03-02 21:24 UTC, Roch D'Amour
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Dilan Johnpullé 2018-02-22 04:04:19 UTC
We suppress the display of the published date of news items on client OPACs with some custom CSS code at present in opacusercss.

It would be nice to instead have a syspref to toggle this feature on and off in Koha for those who use it and those who would prefer not to.
Comment 1 Dilan Johnpullé 2018-02-26 04:42:51 UTC
Created attachment 72194 [details] [review]
This patch adds a system preference that allows a user to toggle the published date for OPAC news items on or off.

Test plan:
1. Login to the staff client, navigate to Tools → News and create some news articles that have their display location set to “All”.
2. Navigate to the OPAC and notice that the news items you added have a line at the bottom reading “(published on mm/dd/yyyy)”.
3. Apply the patch.
4. Enter the instance user session - $ sudo koha-shell kohadev
5. Change into your git directory - $ cd kohaclone
6. Update the database - $ perl installer/data/mysql/updatedatabase.pl
7. Exit the instance user session and restart Apache, Memcached and Plack - $ restart_all
8. Open the staff client and navigate to Koha administration→ Global system preferences, click the “OPAC” tab on the left and notice a new option “OPACNoNewsDate” under the “Features” heading.
9. Select “Don’t show”, save and notice that the published date of news items on the OPAC is now suppressed.
10. Select “Show” and notice that the published date of news items on the OPAC is visible once more.
Comment 2 Dilan Johnpullé 2018-02-26 04:56:07 UTC
Sponsored-By: CALYX information essentials
Comment 3 Roch D'Amour 2018-03-02 21:22:32 UTC
You patch's author field says "Your full Name <your_email>". You might want to check your git config and make sure it is configured properly :)
Comment 4 Roch D'Amour 2018-03-02 21:24:14 UTC
Created attachment 72387 [details] [review]
This patch adds a system preference that allows a user to toggle the published date for OPAC news items on or off.

Test plan:
1. Login to the staff client, navigate to Tools → News and create some news articles that have their display location set to “All”.
2. Navigate to the OPAC and notice that the news items you added have a line at the bottom reading “(published on mm/dd/yyyy)”.
3. Apply the patch.
4. Enter the instance user session - $ sudo koha-shell kohadev
5. Change into your git directory - $ cd kohaclone
6. Update the database - $ perl installer/data/mysql/updatedatabase.pl
7. Exit the instance user session and restart Apache, Memcached and Plack - $ restart_all
8. Open the staff client and navigate to Koha administration→ Global system preferences, click the “OPAC” tab on the left and notice a new option “OPACNoNewsDate” under the “Features” heading.
9. Select “Don’t show”, save and notice that the published date of news items on the OPAC is now suppressed.
10. Select “Show” and notice that the published date of news items on the OPAC is visible once more.

Signed-off-by: Roch D'Amour <roch.damour@inlibro.com>
Comment 5 Dilan Johnpullé 2018-03-05 00:01:36 UTC
(In reply to Roch D'Amour from comment #3)
> You patch's author field says "Your full Name <your_email>". You might want
> to check your git config and make sure it is configured properly :)

Oops cheers for the pickup Roch
Comment 6 Katrin Fischer 2018-03-28 06:29:12 UTC
Comment on attachment 72387 [details] [review]
This patch adds a system preference that allows a user to toggle the published date for OPAC news items on or off.

Review of attachment 72387 [details] [review]:
-----------------------------------------------------------------

Hi Dilan,

I am a bit reluctant about this patch, as it's a really easy fix with CSS that could go into the CSS library on the wiki:
https://wiki.koha-community.org/wiki/HTML_%26_CSS_Library

There are some sentiments about not adding too many new system preferences and while I am in sys prefs fan club, this appears to be a very granular one with an easy fix using existing customizing patterns. Please still feel free to ask for others opinions!

I still have done a full review and hope you'll find the comments helpful:

1) Patch file:
Author is missing, pleas check your git configuration so the patch is properly attributed to you.
Author: Your Full Name <your_email>

The first line of a patch always needs to start with: Bug XXXXX: short description, see here:
https://wiki.koha-community.org/wiki/Commit_messages

There are some special characters in your patch that don't work so well on command line, 
better to stick with ASCII where possible: → ” This might be from copying from word or similar? 
Better to stick with a simple editor.

2) There are a lot of unrelated changes in opac-main.tt and I am not sure about your approach with the CSS. If using a pref, no CSS should be necessary, as you can just 'kill' the element form the output. Maybe I am misunderstanding what you were trying to do?

3) Splinter comments:

::: installer/data/mysql/atomicupdate/bug_20265-OPACNoNewsDate_syspref.perl
@@ +1,4 @@
> +$DBversion = 'XXX';  # will be replaced by the RM
> +if( CheckVersion( $DBversion ) ) {
> +    # you can use $dbh here like:
> +    $dbh->do( "INSERT INTO `systempreferences` VALUES ('OPACNoNewsDate','1','','the published date in news items on the OPAC.','YesNo');" );

Please always use INSERT IGNORE when adding new system preferences.

::: installer/data/mysql/sysprefs.sql
@@ +281,4 @@
>  ('NoIssuesChargeGuarantees','','','Define maximum amount withstanding before check outs are blocked','Integer'),
>  ('noItemTypeImages','0',NULL,'If ON, disables item-type images','YesNo'),
>  ('NoLoginInstructions', '', '60|10', 'Instructions to display on the OPAC login form when a patron is not logged in', 'Textarea'),
> +('OPACNoNewsDate','1','','the published date in news items on the OPAC.','YesNo'),

The sysprefs.sql file is sorted alphabetically to minimize conflicts - please make sure to always add your new line in the right spot.

::: koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
@@ +1,2 @@
> +---
> +opac.pref:

You have removed the first line and a lot of whitespace changes have happened - something has really gone wrong here. Please take another look at the file.
Comment 7 Dilan Johnpullé 2018-06-22 02:33:20 UTC
Hi Katrin, 

I can definitely make the changes to the patch file but I think I'd like to first hear others' opinions on this feature and whether it is worth implementing.

Calyx always removes the date from our clients' OPACs unless otherwise requested so we figured this might be a neat little preference to have, especially for those who are less code savvy and choose to use Koha without any CSS modifications.

Thanks for the feedback and apologies for the late reply.
Comment 8 Dilan Johnpullé 2018-06-22 02:35:44 UTC
Just generally asking everyone, is a system preference for suppressing the published date of news items desirable?
Comment 9 Katrin Fischer 2018-06-22 05:43:53 UTC
Maybe another idea: There is already a system preference for hiding the author - in this case CSS doesn't work, because of data privacy/personal information. Maybe it could be changed to be a multi-select preference, where you pick what to display.
Comment 10 Marcel de Rooy 2018-07-12 13:33:32 UTC
Dilan:
I have the impression that something like
.newsitem .newsfooter { display:none; }
does not really need a syspref.
Comment 11 Katrin Fischer 2018-10-27 11:52:53 UTC
Closing this for now - please feel free to reopen if you are still interested in the change.