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

(-)a/Koha/News.pm (-2 / +7 lines)
Lines 55-61 type is one of this: Link Here
55
- slip - for ISSUESLIP notice
55
- slip - for ISSUESLIP notice
56
- koha - for intranet
56
- koha - for intranet
57
- opac - for online catalogue
57
- opac - for online catalogue
58
- OpanNavRight - Right column in the online catalogue
58
- OpacNavRight - Right column in the online catalogue
59
- OpacLoginInstructions
60
- OpacMainUserBlock
61
- OpacCustomSearch
62
- opacheader
63
- opaccredits
59
64
60
lang is language code - it is used only when type is opac or OpacNavRight
65
lang is language code - it is used only when type is opac or OpacNavRight
61
66
Lines 78-84 sub search_for_display { Link Here
78
    }
83
    }
79
84
80
    $search_params->{branchcode} = [ $params->{library_id}, undef ] if $params->{library_id};
85
    $search_params->{branchcode} = [ $params->{library_id}, undef ] if $params->{library_id};
81
    $search_params->{timestamp} = { '<=' => \'NOW()' };
86
    $search_params->{published_on} = { '<=' => \'NOW()' };
82
    $search_params->{-or} = [ expirationdate => { '>=' => \'NOW()' },
87
    $search_params->{-or} = [ expirationdate => { '>=' => \'NOW()' },
83
                              expirationdate => undef ];
88
                              expirationdate => undef ];
84
89
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt (-1 / +1 lines)
Lines 25-31 Link Here
25
                        [% FOREACH koha_new IN koha_news %]
25
                        [% FOREACH koha_new IN koha_news %]
26
                            <div class="newsitem" id="news[% koha_new.idnew | html %]"><h4>[% koha_new.title | html %]</h4>
26
                            <div class="newsitem" id="news[% koha_new.idnew | html %]"><h4>[% koha_new.title | html %]</h4>
27
                                <div class="newsbody">[% koha_new.content | $raw %]</div>
27
                                <div class="newsbody">[% koha_new.content | $raw %]</div>
28
                                <p class="newsfooter"> Posted on [% koha_new.timestamp | $KohaDates %][% IF( show_author && koha_new.borrowernumber ) %] by <span class="newsauthor_title">[% koha_new.author.title | html %] </span>[% koha_new.author.firstname | html %] [% koha_new.author.surname | html %]<br />[% END %]
28
                                <p class="newsfooter"> Posted on [% koha_new.published_on | $KohaDates %][% IF( show_author && koha_new.borrowernumber ) %] by <span class="newsauthor_title">[% koha_new.author.title | html %] </span>[% koha_new.author.firstname | html %] [% koha_new.author.surname | html %]<br />[% END %]
29
                                    [% IF ( CAN_user_tools ) %]
29
                                    [% IF ( CAN_user_tools ) %]
30
                                        <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;id=[% koha_new.idnew | uri %]">Edit</a>
30
                                        <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;id=[% koha_new.idnew | uri %]">Edit</a>
31
                                         | <a class="news_delete" href="/cgi-bin/koha/tools/koha-news.pl?op=del&amp;ids=[% koha_new.idnew | html %]">Delete</a>
31
                                         | <a class="news_delete" href="/cgi-bin/koha/tools/koha-news.pl?op=del&amp;ids=[% koha_new.idnew | html %]">Delete</a>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt (-1 / +1 lines)
Lines 149-155 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
149
                                [% ELSE %][% opac_new.library.branchname | html %]
149
                                [% ELSE %][% opac_new.library.branchname | html %]
150
                                [% END %]</td>
150
                                [% END %]</td>
151
                            <td>[% opac_new.number | html %]</td>
151
                            <td>[% opac_new.number | html %]</td>
152
                            <td><span title="[% opac_new.timestamp | html %]">[% opac_new.timestamp | $KohaDates %]</span></td>
152
                            <td><span title="[% opac_new.published_on | html %]">[% opac_new.published_on | $KohaDates %]</span></td>
153
                            <td><span title="[% opac_new.expirationdate | html %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.is_expired ) %](<span class="expired">expired</span>)[% END %]</span></td>
153
                            <td><span title="[% opac_new.expirationdate | html %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.is_expired ) %](<span class="expired">expired</span>)[% END %]</span></td>
154
                            <td>[% opac_new.title | html %]</td>
154
                            <td>[% opac_new.title | html %]</td>
155
                            <td>[% IF ( opac_new.author) %][% INCLUDE 'patron-title.inc' patron=opac_new.author hide_patron_infos_if_needed=1 %][% END %]</td>
155
                            <td>[% IF ( opac_new.author) %][% INCLUDE 'patron-title.inc' patron=opac_new.author hide_patron_infos_if_needed=1 %][% END %]</td>
(-)a/t/db_dependent/Koha/News.t (-6 / +6 lines)
Lines 174-180 subtest '->search_for_display' => sub { Link Here
174
        class => 'Koha::News',
174
        class => 'Koha::News',
175
        value => {
175
        value => {
176
            expirationdate => $yesterday,
176
            expirationdate => $yesterday,
177
            timestamp => $today,
177
            published_on => $today,
178
            lang => '',
178
            lang => '',
179
            branchcode => undef,
179
            branchcode => undef,
180
            number => 1,
180
            number => 1,
Lines 184-190 subtest '->search_for_display' => sub { Link Here
184
        class => 'Koha::News',
184
        class => 'Koha::News',
185
        value => {
185
        value => {
186
            expirationdate => $tomorrow,
186
            expirationdate => $tomorrow,
187
            timestamp => $today,
187
            published_on => $today,
188
            lang => '',
188
            lang => '',
189
            branchcode => undef,
189
            branchcode => undef,
190
            number => 2,
190
            number => 2,
Lines 194-200 subtest '->search_for_display' => sub { Link Here
194
        class => 'Koha::News',
194
        class => 'Koha::News',
195
        value => {
195
        value => {
196
            expirationdate => $tomorrow,
196
            expirationdate => $tomorrow,
197
            timestamp => $tomorrow,
197
            published_on => $tomorrow,
198
            lang => '',
198
            lang => '',
199
            branchcode => undef,
199
            branchcode => undef,
200
            number => 3,
200
            number => 3,
Lines 204-210 subtest '->search_for_display' => sub { Link Here
204
        class => 'Koha::News',
204
        class => 'Koha::News',
205
        value => {
205
        value => {
206
            expirationdate => $tomorrow,
206
            expirationdate => $tomorrow,
207
            timestamp => $today,
207
            published_on => $today,
208
            lang => 'slip',
208
            lang => 'slip',
209
            branchcode => $library1->branchcode,
209
            branchcode => $library1->branchcode,
210
            number => 4,
210
            number => 4,
Lines 214-220 subtest '->search_for_display' => sub { Link Here
214
        class => 'Koha::News',
214
        class => 'Koha::News',
215
        value => {
215
        value => {
216
            expirationdate => $tomorrow,
216
            expirationdate => $tomorrow,
217
            timestamp => $today,
217
            published_on => $today,
218
            lang => 'koha',
218
            lang => 'koha',
219
            branchcode => $library2->branchcode,
219
            branchcode => $library2->branchcode,
220
            number => 5,
220
            number => 5,
Lines 224-230 subtest '->search_for_display' => sub { Link Here
224
        class => 'Koha::News',
224
        class => 'Koha::News',
225
        value => {
225
        value => {
226
            expirationdate => $tomorrow,
226
            expirationdate => $tomorrow,
227
            timestamp => $today,
227
            published_on => $today,
228
            lang => 'koha',
228
            lang => 'koha',
229
            branchcode => undef,
229
            branchcode => undef,
230
            number => 5,
230
            number => 5,
(-)a/tools/koha-news.pl (-3 / +2 lines)
Lines 113-119 elsif ( $op eq 'add' ) { Link Here
113
            content        => $content,
113
            content        => $content,
114
            lang           => $lang,
114
            lang           => $lang,
115
            expirationdate => $expirationdate,
115
            expirationdate => $expirationdate,
116
            timestamp      => $timestamp,
116
            published_on   => $published_on,
117
            number         => $number,
117
            number         => $number,
118
            branchcode     => $branchcode,
118
            branchcode     => $branchcode,
119
            borrowernumber => $borrowernumber,
119
            borrowernumber => $borrowernumber,
Lines 151-157 else { Link Here
151
    my $opac_news = Koha::News->search(
151
    my $opac_news = Koha::News->search(
152
        $params,
152
        $params,
153
        {
153
        {
154
            order_by => { -desc =>  'timestamp' },
154
            order_by => { -desc =>  'published_on' },
155
        }
155
        }
156
    );
156
    );
157
    $template->param( opac_news => $opac_news );
157
    $template->param( opac_news => $opac_news );
158
- 

Return to bug 22544