View | Details | Raw Unified | Return to bug 14248
Collapse All | Expand All

(-)a/C4/NewsChannels.pm (-3 / +11 lines)
Lines 146-154 sub get_opac_news { Link Here
146
    my $dbh = C4::Context->dbh;
146
    my $dbh = C4::Context->dbh;
147
    my $query = q{
147
    my $query = q{
148
                  SELECT opac_news.*, branches.branchname,
148
                  SELECT opac_news.*, branches.branchname,
149
                         timestamp AS newdate
149
                         timestamp AS newdate,
150
                         borrowers.title AS author_title,
151
                         borrowers.firstname AS author_firstname,
152
                         borrowers.surname AS author_surname
150
                  FROM opac_news LEFT JOIN branches
153
                  FROM opac_news LEFT JOIN branches
151
                      ON opac_news.branchcode=branches.branchcode
154
                      ON opac_news.branchcode=branches.branchcode
155
                  LEFT JOIN borrowers on borrowers.borrowernumber = opac_news.borrowernumber
152
                };
156
                };
153
    $query .= ' WHERE 1';
157
    $query .= ' WHERE 1';
154
    if ($lang) {
158
    if ($lang) {
Lines 190-197 sub GetNewsToDisplay { Link Here
190
    my $dbh = C4::Context->dbh;
194
    my $dbh = C4::Context->dbh;
191
    # SELECT *,DATE_FORMAT(timestamp, '%d/%m/%Y') AS newdate
195
    # SELECT *,DATE_FORMAT(timestamp, '%d/%m/%Y') AS newdate
192
    my $query = q{
196
    my $query = q{
193
     SELECT *,timestamp AS newdate
197
     SELECT opac_news.*,timestamp AS newdate,
198
     borrowers.title AS author_title,
199
     borrowers.firstname AS author_firstname,
200
     borrowers.surname AS author_surname
194
     FROM   opac_news
201
     FROM   opac_news
202
     LEFT JOIN borrowers on borrowers.borrowernumber = opac_news.borrowernumber
195
     WHERE   (
203
     WHERE   (
196
        expirationdate >= CURRENT_DATE()
204
        expirationdate >= CURRENT_DATE()
197
        OR    expirationdate IS NULL
205
        OR    expirationdate IS NULL
Lines 199-205 sub GetNewsToDisplay { Link Here
199
     )
207
     )
200
     AND   DATE(timestamp) < DATE_ADD(CURDATE(), INTERVAL 1 DAY)
208
     AND   DATE(timestamp) < DATE_ADD(CURDATE(), INTERVAL 1 DAY)
201
     AND   (lang = '' OR lang = ?)
209
     AND   (lang = '' OR lang = ?)
202
     AND   (branchcode IS NULL OR branchcode = ?)
210
     AND   (opac_news.branchcode IS NULL OR opac_news.branchcode = ?)
203
     ORDER BY number
211
     ORDER BY number
204
    }; # expirationdate field is NOT in ISO format?
212
    }; # expirationdate field is NOT in ISO format?
205
       # timestamp has HH:mm:ss, CURRENT_DATE generates 00:00:00
213
       # timestamp has HH:mm:ss, CURRENT_DATE generates 00:00:00
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/koha-news.tt (+2 lines)
Lines 20-25 Link Here
20
	<li>News in the OPAC will appear above the OpacMainUserBlock</li>
20
	<li>News in the OPAC will appear above the OpacMainUserBlock</li>
21
	<li>News in the Staff Client will appear on the far left of the screen</li>
21
	<li>News in the Staff Client will appear on the far left of the screen</li>
22
	<li>News on the circulation receipts will appear below the items that are checked out</li>
22
	<li>News on the circulation receipts will appear below the items that are checked out</li>
23
	<li>The news item's author will be set to the currently logged in user.</li>
24
	<li>The system preference 'NewsAuthorDisplay' can be used to hide or show the author for news item.</li>
23
</ul>
25
</ul>
24
26
25
<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>
27
<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>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt (-1 / +3 lines)
Lines 1-3 Link Here
1
[% USE Koha %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha staff client</title>
3
<title>Koha staff client</title>
3
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/mainpage.css" />
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/mainpage.css" />
Lines 170-179 Link Here
170
    [% IF ( koha_news_count ) %]
171
    [% IF ( koha_news_count ) %]
171
        <div id="area-news">
172
        <div id="area-news">
172
            <h3><span="news_title">News</span></h3>
173
            <h3><span="news_title">News</span></h3>
174
            [% SET newsdisp = Koha.Preference('NewsAuthorDisplay') %]
173
            [% FOREACH koha_new IN koha_news %]
175
            [% FOREACH koha_new IN koha_news %]
174
                <div class="newsitem" id="news[% koha_new.idnew %]"><h4>[% koha_new.title %]</h4>
176
                <div class="newsitem" id="news[% koha_new.idnew %]"><h4>[% koha_new.title %]</h4>
175
                    <p>[% koha_new.new %]</p>
177
                    <p>[% koha_new.new %]</p>
176
                    <p class="newsfooter"> Posted on [% koha_new.newdate %]
178
                    <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 %]
177
                        [% IF ( CAN_user_tools ) %]
179
                        [% IF ( CAN_user_tools ) %]
178
                            <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;id=[% koha_new.idnew %]">Edit</a>
180
                            <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;id=[% koha_new.idnew %]">Edit</a>
179
                             | <a href="/cgi-bin/koha/tools/koha-news.pl?op=del&amp;ids=[% koha_new.idnew %]">Delete</a>
181
                             | <a href="/cgi-bin/koha/tools/koha-news.pl?op=del&amp;ids=[% koha_new.idnew %]">Delete</a>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt (+2 lines)
Lines 213-218 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
213
                        <th class="title-string">Publication date</th>
213
                        <th class="title-string">Publication date</th>
214
                        <th class="title-string">Expiration date</th>
214
                        <th class="title-string">Expiration date</th>
215
                        <th>Title</th>
215
                        <th>Title</th>
216
                        <th>Author</th>
216
                        <th>News</th>
217
                        <th>News</th>
217
                        <th>&nbsp;</th>
218
                        <th>&nbsp;</th>
218
                    </tr></thead>
219
                    </tr></thead>
Lines 244-249 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
244
                            <td><span title="[% opac_new.newdate %]">[% opac_new.newdate | $KohaDates %]</span></td>
245
                            <td><span title="[% opac_new.newdate %]">[% opac_new.newdate | $KohaDates %]</span></td>
245
                            <td><span title="[% opac_new.expirationdate %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.expired ) %](<span class="expired">expired</span>)[% END %]</span></td>
246
                            <td><span title="[% opac_new.expirationdate %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.expired ) %](<span class="expired">expired</span>)[% END %]</span></td>
246
                            <td>[% opac_new.title %]</td>
247
                            <td>[% opac_new.title %]</td>
248
                            <td>[% opac_new.author_title %] [% opac_new.author_firstname %] [% opac_new.author_surname %]</td>
247
                           <td>
249
                           <td>
248
                                [% opac_new.new %]
250
                                [% opac_new.new %]
249
                            </td>
251
                            </td>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt (-2 / +2 lines)
Lines 40-50 Link Here
40
40
41
        [% IF ( koha_news_count ) %]
41
        [% IF ( koha_news_count ) %]
42
            <div id="news" class="newscontainer">
42
            <div id="news" class="newscontainer">
43
                [% SET newsdisp = ( Koha.Preference('NewsAuthorDisplay') ) %]
43
                [% FOREACH koha_new IN koha_news %]
44
                [% FOREACH koha_new IN koha_news %]
44
                    <div class="newsitem">
45
                    <div class="newsitem">
45
                        <a name="newsitem[% koha_new.idnew %]"></a><h4 class="newsheader">[% koha_new.title %]</h4>
46
                        <a name="newsitem[% koha_new.idnew %]"></a><h4 class="newsheader">[% koha_new.title %]</h4>
46
                        <div class="newsbody">[% koha_new.new %]</div>
47
                        <div class="newsbody">[% koha_new.new %]</div>
47
                        <div class="newsfooter">(published on [% koha_new.newdate %])</div>
48
                        <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>
48
                    </div>
49
                    </div>
49
                [% END %]
50
                [% END %]
50
            </div>
51
            </div>
51
- 

Return to bug 14248