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 159-165 subtest '->search_for_display' => sub { Link Here
159
        class => 'Koha::News',
159
        class => 'Koha::News',
160
        value => {
160
        value => {
161
            expirationdate => $yesterday,
161
            expirationdate => $yesterday,
162
            timestamp => $today,
162
            published_on => $today,
163
            lang => '',
163
            lang => '',
164
            branchcode => undef,
164
            branchcode => undef,
165
            number => 1,
165
            number => 1,
Lines 169-175 subtest '->search_for_display' => sub { Link Here
169
        class => 'Koha::News',
169
        class => 'Koha::News',
170
        value => {
170
        value => {
171
            expirationdate => $tomorrow,
171
            expirationdate => $tomorrow,
172
            timestamp => $today,
172
            published_on => $today,
173
            lang => '',
173
            lang => '',
174
            branchcode => undef,
174
            branchcode => undef,
175
            number => 2,
175
            number => 2,
Lines 179-185 subtest '->search_for_display' => sub { Link Here
179
        class => 'Koha::News',
179
        class => 'Koha::News',
180
        value => {
180
        value => {
181
            expirationdate => $tomorrow,
181
            expirationdate => $tomorrow,
182
            timestamp => $tomorrow,
182
            published_on => $tomorrow,
183
            lang => '',
183
            lang => '',
184
            branchcode => undef,
184
            branchcode => undef,
185
            number => 3,
185
            number => 3,
Lines 189-195 subtest '->search_for_display' => sub { Link Here
189
        class => 'Koha::News',
189
        class => 'Koha::News',
190
        value => {
190
        value => {
191
            expirationdate => $tomorrow,
191
            expirationdate => $tomorrow,
192
            timestamp => $today,
192
            published_on => $today,
193
            lang => 'slip',
193
            lang => 'slip',
194
            branchcode => $library1->branchcode,
194
            branchcode => $library1->branchcode,
195
            number => 4,
195
            number => 4,
Lines 199-205 subtest '->search_for_display' => sub { Link Here
199
        class => 'Koha::News',
199
        class => 'Koha::News',
200
        value => {
200
        value => {
201
            expirationdate => $tomorrow,
201
            expirationdate => $tomorrow,
202
            timestamp => $today,
202
            published_on => $today,
203
            lang => 'koha',
203
            lang => 'koha',
204
            branchcode => $library2->branchcode,
204
            branchcode => $library2->branchcode,
205
            number => 5,
205
            number => 5,
Lines 209-215 subtest '->search_for_display' => sub { Link Here
209
        class => 'Koha::News',
209
        class => 'Koha::News',
210
        value => {
210
        value => {
211
            expirationdate => $tomorrow,
211
            expirationdate => $tomorrow,
212
            timestamp => $today,
212
            published_on => $today,
213
            lang => 'koha',
213
            lang => 'koha',
214
            branchcode => undef,
214
            branchcode => undef,
215
            number => 5,
215
            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