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

(-)a/C4/Members.pm (-1 / +1 lines)
Lines 2345-2351 sub IssueSlip { Link Here
2345
            'news' => [ map {
2345
            'news' => [ map {
2346
                $_->{'timestamp'} = $_->{'newdate'};
2346
                $_->{'timestamp'} = $_->{'newdate'};
2347
                { opac_news => $_ }
2347
                { opac_news => $_ }
2348
            } @{ GetNewsToDisplay("slip") } ],
2348
            } @{ GetNewsToDisplay("slip",$branch) } ],
2349
        );
2349
        );
2350
    }
2350
    }
2351
2351
(-)a/C4/NewsChannels.pm (-8 / +25 lines)
Lines 125-131 sub del_opac_new { Link Here
125
sub get_opac_new {
125
sub get_opac_new {
126
    my ($idnew) = @_;
126
    my ($idnew) = @_;
127
    my $dbh = C4::Context->dbh;
127
    my $dbh = C4::Context->dbh;
128
    my $query = q{ SELECT * FROM opac_news WHERE idnew = ? };
128
    my $query = q{
129
                  SELECT opac_news.*,branches.branchname
130
                  FROM opac_news LEFT JOIN branches
131
                      ON opac_news.branchcode=branches.branchcode
132
                  WHERE opac_news.idnew = ?;
133
                };
129
    my $sth = $dbh->prepare($query);
134
    my $sth = $dbh->prepare($query);
130
    $sth->execute($idnew);
135
    $sth->execute($idnew);
131
    my $data = $sth->fetchrow_hashref;
136
    my $data = $sth->fetchrow_hashref;
Lines 136-149 sub get_opac_new { Link Here
136
}
141
}
137
142
138
sub get_opac_news {
143
sub get_opac_news {
139
    my ($limit, $lang) = @_;
144
    my ($limit, $lang, $branchcode) = @_;
140
    my @values;
145
    my @values;
141
    my $dbh = C4::Context->dbh;
146
    my $dbh = C4::Context->dbh;
142
    my $query = q{ SELECT *, timestamp AS newdate FROM opac_news };
147
    my $query = q{
148
                  SELECT opac_news.*, branches.branchname,
149
                         timestamp AS newdate
150
                  FROM opac_news LEFT JOIN branches
151
                      ON opac_news.branchcode=branches.branchcode
152
                };
153
    $query = ' WHERE 1';
143
    if ($lang) {
154
    if ($lang) {
144
        $query.= " WHERE (lang='' OR lang=?)";
155
        $query .= " AND (opac_news.lang='' OR opac_news.lang=?)";
145
        push @values,$lang;
156
        push @values,$lang;
146
    }
157
    }
158
    if ($branchcode) {
159
        $query .= ' AND (opac_news.branchcode IS NULL OR opac_news.branchcode=?)';
160
        push @values,$branchcode;
161
    }
147
    $query.= ' ORDER BY timestamp DESC ';
162
    $query.= ' ORDER BY timestamp DESC ';
148
    #if ($limit) {
163
    #if ($limit) {
149
    #    $query.= 'LIMIT 0, ' . $limit;
164
    #    $query.= 'LIMIT 0, ' . $limit;
Lines 163-176 sub get_opac_news { Link Here
163
178
164
=head2 GetNewsToDisplay
179
=head2 GetNewsToDisplay
165
180
166
    $news = &GetNewsToDisplay($lang);
181
    $news = &GetNewsToDisplay($lang,$branch);
167
    C<$news> is a ref to an array which containts
182
    C<$news> is a ref to an array which containts
168
    all news with expirationdate > today or expirationdate is null.
183
    all news with expirationdate > today or expirationdate is null
184
    that is applicable for a given branch.
169
185
170
=cut
186
=cut
171
187
172
sub GetNewsToDisplay {
188
sub GetNewsToDisplay {
173
    my ($lang) = @_;
189
    my ($lang,$branch) = @_;
174
    my $dbh = C4::Context->dbh;
190
    my $dbh = C4::Context->dbh;
175
    # SELECT *,DATE_FORMAT(timestamp, '%d/%m/%Y') AS newdate
191
    # SELECT *,DATE_FORMAT(timestamp, '%d/%m/%Y') AS newdate
176
    my $query = q{
192
    my $query = q{
Lines 183-195 sub GetNewsToDisplay { Link Here
183
     )
199
     )
184
     AND   `timestamp` < CURRENT_DATE()+1
200
     AND   `timestamp` < CURRENT_DATE()+1
185
     AND   (lang = '' OR lang = ?)
201
     AND   (lang = '' OR lang = ?)
202
     AND   (branchcode IS NULL OR branchcode = ?)
186
     ORDER BY number
203
     ORDER BY number
187
    }; # expirationdate field is NOT in ISO format?
204
    }; # expirationdate field is NOT in ISO format?
188
       # timestamp has HH:mm:ss, CURRENT_DATE generates 00:00:00
205
       # timestamp has HH:mm:ss, CURRENT_DATE generates 00:00:00
189
       #           by adding 1, that captures today correctly.
206
       #           by adding 1, that captures today correctly.
190
    my $sth = $dbh->prepare($query);
207
    my $sth = $dbh->prepare($query);
191
    $lang = $lang // q{};
208
    $lang = $lang // q{};
192
    $sth->execute($lang);
209
    $sth->execute($lang,$branch);
193
    my @results;
210
    my @results;
194
    while ( my $row = $sth->fetchrow_hashref ){
211
    while ( my $row = $sth->fetchrow_hashref ){
195
        $row->{newdate} = format_date($row->{newdate});
212
        $row->{newdate} = format_date($row->{newdate});
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt (-3 / +43 lines)
Lines 76-82 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
76
			<fieldset class="rows">
76
			<fieldset class="rows">
77
            <legend>OPAC and Koha news</legend>
77
            <legend>OPAC and Koha news</legend>
78
           <ol> <li>
78
           <ol> <li>
79
            <label for="lang">([% new_detail.lang %])([% lang %])Display location</label>
79
            <label for="lang">Display location</label>
80
            <select id="lang" name="lang">
80
            <select id="lang" name="lang">
81
                [% IF ( default_lang == "" ) %]
81
                [% IF ( default_lang == "" ) %]
82
                <option value=""     selected>All</option>
82
                <option value=""     selected>All</option>
Lines 103-108 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
103
            </select>
103
            </select>
104
            </li>
104
            </li>
105
            <li>
105
            <li>
106
                <label for="branch">Library: </label>
107
                <select id="branch" name="branch">
108
                [% IF ( new_detail.branchcode == '' ) %]
109
                    <option value="" selected>All Libraries</option>
110
                [% ELSE %]
111
                    <option value=""         >All Libraries</option>
112
                [% END %]
113
                [% FOREACH branch_item IN branch_list %]
114
                [% IF ( branch_item.value.branchcode == new_detail.branchcode ) %]
115
                    <option value="[% branch_item.value.branchcode %]" selected>[% branch_item.value.branchname %]</option>
116
                [% ELSE %]
117
                    <option value="[% branch_item.value.branchcode %]">[% branch_item.value.branchname %]</option>
118
                [% END %]
119
                [% END %]
120
                </select>
121
            </li>
122
            <li>
106
                <label for="title">Title: </label>
123
                <label for="title">Title: </label>
107
                <input id="title" size="30" type="text" name="title" value="[% new_detail.title %]" />
124
                <input id="title" size="30" type="text" name="title" value="[% new_detail.title %]" />
108
            </li>
125
            </li>
Lines 155-161 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
155
                [% IF ( lang_lis.language == lang ) %]
172
                [% IF ( lang_lis.language == lang ) %]
156
                    <option value="[% lang_lis.language %]" selected>OPAC ([% lang_lis.language %])</option>
173
                    <option value="[% lang_lis.language %]" selected>OPAC ([% lang_lis.language %])</option>
157
                [% ELSE %]
174
                [% ELSE %]
158
                    <option value="[% lang_lis.language %]">OPAC ([% lang_lis.language %])</option>
175
                    <option value="[% lang_lis.language %]"         >OPAC ([% lang_lis.language %])</option>
176
                [% END %]
177
                [% END %]
178
            </select>
179
            <label for="branch">Library: </label>
180
            <select id="branch" name="branch">
181
                [% IF ( branchcode == "" ) %]
182
                <option value="" selected>All Libraries</option>
183
                [% ELSE %]
184
                <option value=""         >All Libraries</option>
185
                [% END %]
186
                [% FOREACH branch_item IN branch_list %]
187
                [% IF ( branch_item.value.branchcode == branchcode ) %]
188
                    <option value="[% branch_item.value.branchcode %]"
189
                            selected>[% branch_item.value.branchname %]
190
                    </option>
191
                [% ELSE %]
192
                    <option value="[% branch_item.value.branchcode %]"
193
                                    >[% branch_item.value.branchname %]
194
                    </option>
159
                [% END %]
195
                [% END %]
160
                [% END %]
196
                [% END %]
161
            </select>
197
            </select>
Lines 168-173 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
168
                   <thead> <tr>
204
                   <thead> <tr>
169
                        <th>&nbsp;</th>
205
                        <th>&nbsp;</th>
170
                        <th>Location</th>
206
                        <th>Location</th>
207
                        <th>Library</th>
171
                        <th>Number</th>
208
                        <th>Number</th>
172
                        <th>Creation date</th>
209
                        <th>Creation date</th>
173
                        <th>Expiration date</th>
210
                        <th>Expiration date</th>
Lines 195-201 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
195
                                    OPAC ([% opac_new.lang %])
232
                                    OPAC ([% opac_new.lang %])
196
                                [% END %]
233
                                [% END %]
197
                             </td>
234
                             </td>
198
235
                            <td>[% IF ( opac_new.branchcode == "" ) -%]
236
                                All Libraries
237
                                [% ELSE %][% opac_new.branchname %]
238
                                [% END %]</td>
199
                            <td>[% opac_new.number %]</td>
239
                            <td>[% opac_new.number %]</td>
200
                            <td><span title="[% opac_new.newdate %]">[% opac_new.newdate | $KohaDates %]</span></td>
240
                            <td><span title="[% opac_new.newdate %]">[% opac_new.newdate | $KohaDates %]</span></td>
201
                            <td><span title="[% opac_new.expirationdate %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.expired ) %](<span class="expired">expired</span>)[% END %]</span></td>
241
                            <td><span title="[% opac_new.expirationdate %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.expired ) %](<span class="expired">expired</span>)[% END %]</span></td>
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt (-2 / +2 lines)
Lines 21-28 Link Here
21
        <div id="notloggedin" class="yui-ge">
21
        <div id="notloggedin" class="yui-ge">
22
    [% END %]
22
    [% END %]
23
        <div class="yui-u first">
23
        <div class="yui-u first">
24
	[% IF ( koha_news_count ) %]
25
<div id="news" class="container">
24
<div id="news" class="container">
25
        [% IF ( koha_news_count ) %]
26
    <table>
26
    <table>
27
    [% FOREACH koha_new IN koha_news %]
27
    [% FOREACH koha_new IN koha_news %]
28
    <tr><th>[% koha_new.title %]</th></tr>
28
    <tr><th>[% koha_new.title %]</th></tr>
Lines 30-37 Link Here
30
                <p class="newsfooter"><i>(published on [% koha_new.newdate %])</i></p></td></tr>
30
                <p class="newsfooter"><i>(published on [% koha_new.newdate %])</i></p></td></tr>
31
    [% END %]
31
    [% END %]
32
    </table>
32
    </table>
33
</div>
34
[% END %]
33
[% END %]
34
</div>
35
35
36
      [% IF ( display_daily_quote && daily_quote ) %]
36
      [% IF ( display_daily_quote && daily_quote ) %]
37
    <div id="daily-quote" class="container"><h1>Quote of the Day</h1><div><span id="daily-quote-text">[% daily_quote.text %]</span><span id="daily-quote-sep"> ~ </span><span id="daily-quote-source">[% daily_quote.source %]</span></div></div>
37
    <div id="daily-quote" class="container"><h1>Quote of the Day</h1><div><span id="daily-quote-text">[% daily_quote.text %]</span><span id="daily-quote-sep"> ~ </span><span id="daily-quote-source">[% daily_quote.source %]</span></div></div>
(-)a/mainpage.pl (-16 / +20 lines)
Lines 1-30 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
# This file is part of Koha.
4
#
3
# Copyright Paul Poulain 2002
5
# Copyright Paul Poulain 2002
4
# Parts Copyright Liblime 2007
6
# Parts Copyright Liblime 2007
7
# Copyright (C) 2013  Mark Tompsett
5
#
8
#
6
# This file is part of Koha.
9
# Koha is free software; you can redistribute it and/or modify it
10
# under the terms of the GNU General Public License as published by
11
# the Free Software Foundation; either version 3 of the License, or
12
# (at your option) any later version.
7
#
13
#
8
# Koha is free software; you can redistribute it and/or modify it under the
14
# Koha is distributed in the hope that it will be useful, but
9
# terms of the GNU General Public License as published by the Free Software
15
# WITHOUT ANY WARRANTY; without even the implied warranty of
10
# Foundation; either version 2 of the License, or (at your option) any later
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# version.
17
# GNU General Public License for more details.
12
#
18
#
13
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
19
# You should have received a copy of the GNU General Public License
14
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
20
# along with Koha; if not, see <http://www.gnu.org/licenses>.
15
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License along
18
# with Koha; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
21
21
use strict;
22
use Modern::Perl;
22
use warnings;
23
use CGI;
23
use CGI;
24
use C4::Output;
24
use C4::Output;
25
use C4::Auth;
25
use C4::Auth;
26
use C4::Koha;
26
use C4::Koha;
27
use C4::NewsChannels;
27
use C4::NewsChannels; # GetNewsToDisplay
28
use C4::Review qw/numberofreviews/;
28
use C4::Review qw/numberofreviews/;
29
use C4::Suggestions qw/CountSuggestion/;
29
use C4::Suggestions qw/CountSuggestion/;
30
use C4::Tags qw/get_count_by_tag_status/;
30
use C4::Tags qw/get_count_by_tag_status/;
Lines 42-48 my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( Link Here
42
    }
42
    }
43
);
43
);
44
44
45
my $all_koha_news   = &GetNewsToDisplay("koha");
45
my $homebranch;
46
if (C4::Context->userenv) {
47
    $homebranch = C4::Context->userenv->{'branch'};
48
}
49
my $all_koha_news   = &GetNewsToDisplay("koha",$homebranch);
46
my $koha_news_count = scalar @$all_koha_news;
50
my $koha_news_count = scalar @$all_koha_news;
47
51
48
$template->param(
52
$template->param(
(-)a/opac/opac-main.pl (-14 / +19 lines)
Lines 2-27 Link Here
2
2
3
# This file is part of Koha.
3
# This file is part of Koha.
4
#
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
5
# Parts Copyright (C) 2013  Mark Tompsett
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 2 of the License, or (at your option) any later
8
# version.
9
#
6
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
7
# Koha is free software; you can redistribute it and/or modify it
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
8
# under the terms of the GNU General Public License as published by
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
13
#
11
#
14
# You should have received a copy of the GNU General Public License along
12
# Koha is distributed in the hope that it will be useful, but
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
19
18
20
19
use strict;
21
use Modern::Perl;
20
use warnings;
21
use CGI;
22
use CGI;
22
use C4::Auth;    # get_template_and_user
23
use C4::Auth;    # get_template_and_user
23
use C4::Output;
24
use C4::Output;
24
use C4::NewsChannels;    # get_opac_news
25
use C4::NewsChannels;    # GetNewsToDisplay
25
use C4::Languages qw(getTranslatedLanguages accept_language);
26
use C4::Languages qw(getTranslatedLanguages accept_language);
26
use C4::Koha qw( GetDailyQuote );
27
use C4::Koha qw( GetDailyQuote );
27
28
Lines 48-54 $template->param( Link Here
48
# use cookie setting for language, bug default to syspref if it's not set
49
# use cookie setting for language, bug default to syspref if it's not set
49
my ($theme, $news_lang, $availablethemes) = C4::Templates::themelanguage(C4::Context->config('opachtdocs'),'opac-main.tt','opac',$input);
50
my ($theme, $news_lang, $availablethemes) = C4::Templates::themelanguage(C4::Context->config('opachtdocs'),'opac-main.tt','opac',$input);
50
51
51
my $all_koha_news   = &GetNewsToDisplay($news_lang);
52
my $homebranch;
53
if (C4::Context->userenv) {
54
    $homebranch = C4::Context->userenv->{'branch'};
55
}
56
my $all_koha_news   = &GetNewsToDisplay($news_lang,$homebranch);
52
my $koha_news_count = scalar @$all_koha_news;
57
my $koha_news_count = scalar @$all_koha_news;
53
58
54
my $quote = GetDailyQuote();   # other options are to pass in an exact quote id or select a random quote each pass... see perldoc C4::Koha
59
my $quote = GetDailyQuote();   # other options are to pass in an exact quote id or select a random quote each pass... see perldoc C4::Koha
(-)a/t/db_dependent/NewsChannels.t (-4 / +15 lines)
Lines 23-28 my $dbh = C4::Context->dbh; Link Here
23
$dbh->{AutoCommit} = 0;
23
$dbh->{AutoCommit} = 0;
24
$dbh->{RaiseError} = 1;
24
$dbh->{RaiseError} = 1;
25
25
26
# Add LIB1, if it doesn't exist.
27
my $addbra = 'LIB1';
28
if ( !GetBranchName($addbra) ) {
29
    $dbh->do( q{ INSERT INTO branches (branchcode,branchname) VALUES (?,?) },
30
        undef, ( $addbra, "$addbra branch" ) );
31
}
32
26
# Test add_opac_new
33
# Test add_opac_new
27
my $rv = add_opac_new();    # intentionally bad
34
my $rv = add_opac_new();    # intentionally bad
28
ok( $rv == 0, 'Correctly failed on no parameter!' );
35
ok( $rv == 0, 'Correctly failed on no parameter!' );
Lines 38-43 my $href_entry1 = { Link Here
38
    expirationdate => $expirationdate1,
45
    expirationdate => $expirationdate1,
39
    timestamp      => $timestamp1,
46
    timestamp      => $timestamp1,
40
    number         => $number1,
47
    number         => $number1,
48
    branchcode     => 'LIB1',
41
};
49
};
42
50
43
$rv = add_opac_new($href_entry1);
51
$rv = add_opac_new($href_entry1);
Lines 52-57 my $href_entry2 = { Link Here
52
    expirationdate => $expirationdate2,
60
    expirationdate => $expirationdate2,
53
    timestamp      => $timestamp2,
61
    timestamp      => $timestamp2,
54
    number         => $number2,
62
    number         => $number2,
63
    branchcode     => 'LIB1',
55
};
64
};
56
$rv = add_opac_new($href_entry2);
65
$rv = add_opac_new($href_entry2);
57
ok( $rv == 1, 'Successfully added the second dummy news item!' );
66
ok( $rv == 1, 'Successfully added the second dummy news item!' );
Lines 107-117 if ( $hashref_check->{number} ne $number2 ) { $failure = $F6; } Link Here
107
ok( $failure == 0, "Successfully tested get_opac_new id2 ($failure)!" );
116
ok( $failure == 0, "Successfully tested get_opac_new id2 ($failure)!" );
108
117
109
# Test get_opac_news (multiple news items)
118
# Test get_opac_news (multiple news items)
110
my ( $opac_news_count, $arrayref_opac_news ) = get_opac_news( 0, q{} );
119
my ( $opac_news_count, $arrayref_opac_news ) = get_opac_news( 0, q{}, 'LIB1' );
111
ok( $opac_news_count >= 2, 'Successfully tested get_opac_news!' );
120
121
# using >= 2, because someone may have LIB1 news already.
122
ok( $opac_news_count >= 2, 'Successfully tested get_opac_news for LIB1!' );
112
123
113
# Test GetNewsToDisplay
124
# Test GetNewsToDisplay
114
( $opac_news_count, $arrayref_opac_news ) = GetNewsToDisplay(q{});
125
( $opac_news_count, $arrayref_opac_news ) = GetNewsToDisplay( q{}, 'LIB1' );
115
ok( $opac_news_count >= 2, 'Successfully tested GetNewsToDisplay!' );
126
ok( $opac_news_count >= 2, 'Successfully tested GetNewsToDisplay for LIB1!' );
116
127
117
$dbh->rollback;
128
$dbh->rollback;
(-)a/tools/koha-news.pl (-4 / +14 lines)
Lines 33-38 use C4::Output; Link Here
33
use C4::NewsChannels;
33
use C4::NewsChannels;
34
use C4::Languages qw(getTranslatedLanguages);
34
use C4::Languages qw(getTranslatedLanguages);
35
use Date::Calc qw/Date_to_Days Today/;
35
use Date::Calc qw/Date_to_Days Today/;
36
use C4::Branch qw/GetBranches/;
36
37
37
my $cgi = new CGI;
38
my $cgi = new CGI;
38
39
Lines 43-48 my $expirationdate = format_date_in_iso($cgi->param('expirationdate')); Link Here
43
my $timestamp      = format_date_in_iso($cgi->param('timestamp'));
44
my $timestamp      = format_date_in_iso($cgi->param('timestamp'));
44
my $number         = $cgi->param('number');
45
my $number         = $cgi->param('number');
45
my $lang           = $cgi->param('lang');
46
my $lang           = $cgi->param('lang');
47
my $branchcode     = $cgi->param('branch');
48
# Foreign Key constraints work with NULL, not ''
49
# NULL = All branches.
50
$branchcode = undef if (defined($branchcode) && $branchcode eq '');
46
51
47
my $new_detail = get_opac_new($id);
52
my $new_detail = get_opac_new($id);
48
53
Lines 68-76 foreach my $language ( @$tlangs ) { Link Here
68
      };
73
      };
69
}
74
}
70
75
71
$template->param( lang_list => \@lang_list );
76
my $branches = GetBranches;
72
77
73
my $op = $cgi->param('op');
78
$template->param( lang_list   => \@lang_list,
79
                  branch_list => $branches,
80
                  branchcode  => $branchcode );
81
82
my $op = $cgi->param('op') // '';
74
83
75
if ( $op eq 'add_form' ) {
84
if ( $op eq 'add_form' ) {
76
    $template->param( add_form => 1 );
85
    $template->param( add_form => 1 );
Lines 94-99 elsif ( $op eq 'add' ) { Link Here
94
                      expirationdate => $expirationdate,
103
                      expirationdate => $expirationdate,
95
                      timestamp      => $timestamp,
104
                      timestamp      => $timestamp,
96
                      number         => $number,
105
                      number         => $number,
106
                      branchcode     => $branchcode,
97
                  };
107
                  };
98
    add_opac_new( $parameters );
108
    add_opac_new( $parameters );
99
    print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
109
    print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
Lines 107-112 elsif ( $op eq 'edit' ) { Link Here
107
                      expirationdate => $expirationdate,
117
                      expirationdate => $expirationdate,
108
                      timestamp      => $timestamp,
118
                      timestamp      => $timestamp,
109
                      number         => $number,
119
                      number         => $number,
120
                      branchcode     => $branchcode,
110
                  };
121
                  };
111
    upd_opac_new( $parameters );
122
    upd_opac_new( $parameters );
112
    print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
123
    print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
Lines 119-125 elsif ( $op eq 'del' ) { Link Here
119
130
120
else {
131
else {
121
132
122
    my ( $opac_news_count, $opac_news ) = &get_opac_news( undef, $lang );
133
    my ( $opac_news_count, $opac_news ) = &get_opac_news( undef, $lang, $branchcode );
123
    
134
    
124
    foreach my $new ( @$opac_news ) {
135
    foreach my $new ( @$opac_news ) {
125
        next unless $new->{'expirationdate'};
136
        next unless $new->{'expirationdate'};
126
- 

Return to bug 7567