Bugzilla – Attachment 43916 Details for
Bug 14248
Optionally display authorship for news items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 14248 - Optionally display authorship for news
PASSED-QA-Bug-14248---Optionally-display-authorshi.patch (text/plain), 9.24 KB, created by
Katrin Fischer
on 2015-10-24 11:34:16 UTC
(
hide
)
Description:
[PASSED QA] Bug 14248 - Optionally display authorship for news
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2015-10-24 11:34:16 UTC
Size:
9.24 KB
patch
obsolete
>From b3de768d7c1241173acac442a221fa9a6ecaaa33 Mon Sep 17 00:00:00 2001 >From: Martin Persson <xarragon@gmail.com> >Date: Fri, 2 Oct 2015 08:06:06 +0200 >Subject: [PATCH] [PASSED QA] Bug 14248 - Optionally display authorship for > news >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Test plan: > >* Apply dependant patches 14246 and 14247. >* Apply current patch. >* Log into the Staff client, go to > 'Administration' -> 'Global Preferences' -> 'Tools', > a new section titled 'News' should appear with a single option named 'NewsAuthorDisplay'. > Available values should be 'Not at all', 'OPAC only', 'Staff client only' and > Both OPAC and staff client'. By default the value should be 'Not at all' > (to mimic existing behaviour, important!). > >* Change the value to something different and save the changes. >* Go to 'Tools' -> 'News' and add some news items (at least 2). >* Use the MySQL command line tool to edit the opac_news table, > removing the user id from one of the news items: > $ mysql -u kohaadmin -p -D koha > > SELECT `idnew`, `title`, `borrowernumber` FROM `opac_news`; > * Make a mental note of one of the 'newid' numbers to change. > > UPDATE `opac_news` SET `borrowernumber` = NULL WHERE `idnew` = <your-id-here>; > * Now one of the news items will have no user id, and no author should be shown for it. >* Go to OPAC and Staff client and make sure the display modes works as intended. > * Repeat for all values, making sure that the settings works as intended. > * The changed news item should have no author info shown at any time. > * The unchanged news item should show your own user name if the > settings match the section where it is displayed. > >Sponsored-By: Halland County Library > >Tested on top of Bugs 1246 and 1247, works as advertised. >Note: Some whitespaces changed / removed in koha-news.tt to pass qa tools. >Signed-off-by: Marc Véron <veron@veron.ch> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/NewsChannels.pm | 14 +++++++++++--- > .../intranet-tmpl/prog/en/modules/help/tools/koha-news.tt | 4 +++- > koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt | 4 +++- > koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt | 2 ++ > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt | 3 ++- > 5 files changed, 21 insertions(+), 6 deletions(-) > >diff --git a/C4/NewsChannels.pm b/C4/NewsChannels.pm >index f7fa1d7..4dfde13 100644 >--- a/C4/NewsChannels.pm >+++ b/C4/NewsChannels.pm >@@ -146,9 +146,13 @@ sub get_opac_news { > my $dbh = C4::Context->dbh; > my $query = q{ > SELECT opac_news.*, branches.branchname, >- timestamp AS newdate >+ timestamp AS newdate, >+ borrowers.title AS author_title, >+ borrowers.firstname AS author_firstname, >+ borrowers.surname AS author_surname > FROM opac_news LEFT JOIN branches > ON opac_news.branchcode=branches.branchcode >+ LEFT JOIN borrowers on borrowers.borrowernumber = opac_news.borrowernumber > }; > $query .= ' WHERE 1'; > if ($lang) { >@@ -190,8 +194,12 @@ sub GetNewsToDisplay { > my $dbh = C4::Context->dbh; > # SELECT *,DATE_FORMAT(timestamp, '%d/%m/%Y') AS newdate > my $query = q{ >- SELECT *,timestamp AS newdate >+ SELECT opac_news.*,timestamp AS newdate, >+ borrowers.title AS author_title, >+ borrowers.firstname AS author_firstname, >+ borrowers.surname AS author_surname > FROM opac_news >+ LEFT JOIN borrowers on borrowers.borrowernumber = opac_news.borrowernumber > WHERE ( > expirationdate >= CURRENT_DATE() > OR expirationdate IS NULL >@@ -199,7 +207,7 @@ sub GetNewsToDisplay { > ) > AND DATE(timestamp) < DATE_ADD(CURDATE(), INTERVAL 1 DAY) > AND (lang = '' OR lang = ?) >- AND (branchcode IS NULL OR branchcode = ?) >+ AND (opac_news.branchcode IS NULL OR opac_news.branchcode = ?) > ORDER BY number > }; # expirationdate field is NOT in ISO format? > # timestamp has HH:mm:ss, CURRENT_DATE generates 00:00:00 >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/koha-news.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/koha-news.tt >index fca0286..f4c3a75 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/koha-news.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/koha-news.tt >@@ -20,8 +20,10 @@ > <li>News in the OPAC will appear above the OpacMainUserBlock</li> > <li>News in the Staff Client will appear on the far left of the screen</li> > <li>News on the circulation receipts will appear below the items that are checked out</li> >+ <li>The news item's author will be set to the currently logged in user.</li> >+ <li>The system preference 'NewsAuthorDisplay' can be used to hide or show the author for news item.</li> > </ul> > > <p><strong>See the full documentation for News in the <a href="http://manual.koha-community.org/[% helpVersion %]/en/tools.html#newstool">manual</a> (online).</strong></p> > >-[% INCLUDE 'help-bottom.inc' %] >\ No newline at end of file >+[% INCLUDE 'help-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >index 8440526..aba7fc0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >@@ -1,3 +1,4 @@ >+[% USE Koha %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha staff client</title> > <link rel="stylesheet" type="text/css" href="[% themelang %]/css/mainpage.css" /> >@@ -170,10 +171,11 @@ > [% IF ( koha_news_count ) %] > <div id="area-news"> > <h3><span="news_title">News</span></h3> >+ [% SET newsdisp = Koha.Preference('NewsAuthorDisplay') %] > [% FOREACH koha_new IN koha_news %] > <div class="newsitem" id="news[% koha_new.idnew %]"><h4>[% koha_new.title %]</h4> > <p>[% koha_new.new %]</p> >- <p class="newsfooter"> Posted on [% koha_new.newdate %] >+ <p class="newsfooter"> Posted on [% koha_new.newdate %][% IF( ( newsdisp == 'staff' || newsdisp == 'both' ) && koha_new.borrowernumber ) %] by [% koha_new.author_title %] [% koha_new.author_firstname %] [% koha_new.author_surname %]<br />[% END %] > [% IF ( CAN_user_tools ) %] > <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&id=[% koha_new.idnew %]">Edit</a> > | <a href="/cgi-bin/koha/tools/koha-news.pl?op=del&ids=[% koha_new.idnew %]">Delete</a> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >index af28ee8..073d9db 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >@@ -213,6 +213,7 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > <th class="title-string">Publication date</th> > <th class="title-string">Expiration date</th> > <th>Title</th> >+ <th>Author</th> > <th>News</th> > <th> </th> > </tr></thead> >@@ -244,6 +245,7 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > <td><span title="[% opac_new.newdate %]">[% opac_new.newdate | $KohaDates %]</span></td> > <td><span title="[% opac_new.expirationdate %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.expired ) %](<span class="expired">expired</span>)[% END %]</span></td> > <td>[% opac_new.title %]</td> >+ <td>[% opac_new.author_title %] [% opac_new.author_firstname %] [% opac_new.author_surname %]</td> > <td> > [% opac_new.new %] > </td> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt >index a8bd6f8..6da2b54 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt >@@ -40,11 +40,12 @@ > > [% IF ( koha_news_count ) %] > <div id="news" class="newscontainer"> >+ [% SET newsdisp = ( Koha.Preference('NewsAuthorDisplay') ) %] > [% FOREACH koha_new IN koha_news %] > <div class="newsitem"> > <a name="newsitem[% koha_new.idnew %]"></a><h4 class="newsheader">[% koha_new.title %]</h4> > <div class="newsbody">[% koha_new.new %]</div> >- <div class="newsfooter">(published on [% koha_new.newdate %])</div> >+ <div class="newsfooter">(published on [% koha_new.newdate %][% IF ( (newsdisp == 'opac' || newsdisp == 'both') && koha_new.borrowernumber ) %] by [% koha_new.author_title %] [% koha_new.author_firstname %] [% koha_new.author_surname %][% END %])</div> > </div> > [% END %] > </div> >-- >1.9.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 14248
:
39363
|
39415
|
39441
|
43046
|
43421
|
43766
|
43769
| 43916 |
43917
|
43918