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

(-)a/C4/NewsChannels.pm (-6 / +6 lines)
Lines 135-141 sub get_opac_new { Link Here
135
    my $data = $sth->fetchrow_hashref;
135
    my $data = $sth->fetchrow_hashref;
136
    $data->{$data->{'lang'}} = 1 if defined $data->{lang};
136
    $data->{$data->{'lang'}} = 1 if defined $data->{lang};
137
    $data->{expirationdate} = output_pref({ dt => dt_from_string( $data->{expirationdate} ), dateonly => 1 }) if ( $data->{expirationdate} );
137
    $data->{expirationdate} = output_pref({ dt => dt_from_string( $data->{expirationdate} ), dateonly => 1 }) if ( $data->{expirationdate} );
138
    $data->{timestamp}      = output_pref({ dt => dt_from_string( $data->{timestamp} ), dateonly => 1 }) ;
138
    $data->{publisheddate} = output_pref({ dt => dt_from_string( $data->{publisheddate} ), dateonly => 1 }) ;
139
    return $data;
139
    return $data;
140
}
140
}
141
141
Lines 145-151 sub get_opac_news { Link Here
145
    my $dbh = C4::Context->dbh;
145
    my $dbh = C4::Context->dbh;
146
    my $query = q{
146
    my $query = q{
147
                  SELECT opac_news.*, branches.branchname,
147
                  SELECT opac_news.*, branches.branchname,
148
                         timestamp AS newdate,
148
                         publisheddate AS newdate,
149
                         borrowers.title AS author_title,
149
                         borrowers.title AS author_title,
150
                         borrowers.firstname AS author_firstname,
150
                         borrowers.firstname AS author_firstname,
151
                         borrowers.surname AS author_surname
151
                         borrowers.surname AS author_surname
Lines 162-168 sub get_opac_news { Link Here
162
        $query .= ' AND (opac_news.branchcode IS NULL OR opac_news.branchcode=?)';
162
        $query .= ' AND (opac_news.branchcode IS NULL OR opac_news.branchcode=?)';
163
        push @values,$branchcode;
163
        push @values,$branchcode;
164
    }
164
    }
165
    $query.= ' ORDER BY timestamp DESC ';
165
    $query.= ' ORDER BY publisheddate DESC ';
166
    #if ($limit) {
166
    #if ($limit) {
167
    #    $query.= 'LIMIT 0, ' . $limit;
167
    #    $query.= 'LIMIT 0, ' . $limit;
168
    #}
168
    #}
Lines 193-199 sub GetNewsToDisplay { Link Here
193
    my $dbh = C4::Context->dbh;
193
    my $dbh = C4::Context->dbh;
194
    # SELECT *,DATE_FORMAT(timestamp, '%d/%m/%Y') AS newdate
194
    # SELECT *,DATE_FORMAT(timestamp, '%d/%m/%Y') AS newdate
195
    my $query = q{
195
    my $query = q{
196
     SELECT opac_news.*,timestamp AS newdate,
196
     SELECT opac_news.*,publisheddate AS newdate,
197
     borrowers.title AS author_title,
197
     borrowers.title AS author_title,
198
     borrowers.firstname AS author_firstname,
198
     borrowers.firstname AS author_firstname,
199
     borrowers.surname AS author_surname
199
     borrowers.surname AS author_surname
Lines 204-210 sub GetNewsToDisplay { Link Here
204
        OR    expirationdate IS NULL
204
        OR    expirationdate IS NULL
205
        OR    expirationdate = '00-00-0000'
205
        OR    expirationdate = '00-00-0000'
206
     )
206
     )
207
     AND   DATE(timestamp) < DATE_ADD(CURDATE(), INTERVAL 1 DAY)
207
     AND   publisheddate < DATE_ADD(CURDATE(), INTERVAL 1 DAY)
208
     AND   (lang = '' OR lang = ?)
208
     AND   (lang = '' OR lang = ?)
209
     AND   (opac_news.branchcode IS NULL OR opac_news.branchcode = ?)
209
     AND   (opac_news.branchcode IS NULL OR opac_news.branchcode = ?)
210
     ORDER BY number
210
     ORDER BY number
Lines 216-222 sub GetNewsToDisplay { Link Here
216
    $sth->execute($lang,$branch);
216
    $sth->execute($lang,$branch);
217
    my @results;
217
    my @results;
218
    while ( my $row = $sth->fetchrow_hashref ){
218
    while ( my $row = $sth->fetchrow_hashref ){
219
        $row->{newdate} = output_pref({ dt => dt_from_string( $row->{newdate} ), dateonly => 1 });
219
        $row->{newdate} = output_pref({ dt => dt_from_string( $row->{newdate} ) });
220
        push @results, $row;
220
        push @results, $row;
221
    }
221
    }
222
    return \@results;
222
    return \@results;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt (-1 / +1 lines)
Lines 145-151 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
145
            </li>
145
            </li>
146
            <li>
146
            <li>
147
                <label for="from">Publication date: </label>
147
                <label for="from">Publication date: </label>
148
                <input id="from" type="text" name="timestamp" size="15" value="[% new_detail.timestamp %]" class="datepickerfrom" />
148
                <input id="from" type="text" name="publisheddate" size="15" value="[% new_detail.publisheddate %]" class="datepickerfrom" />
149
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
149
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
150
            </li>
150
            </li>
151
            <li>
151
            <li>
(-)a/tools/koha-news.pl (-4 / +3 lines)
Lines 43-49 my $expirationdate; Link Here
43
if ( $cgi->param('expirationdate') ) {
43
if ( $cgi->param('expirationdate') ) {
44
    $expirationdate = output_pref({ dt => dt_from_string( scalar $cgi->param('expirationdate') ), dateformat => 'iso', dateonly => 1 });
44
    $expirationdate = output_pref({ dt => dt_from_string( scalar $cgi->param('expirationdate') ), dateformat => 'iso', dateonly => 1 });
45
}
45
}
46
my $timestamp      = output_pref({ dt => dt_from_string( scalar $cgi->param('timestamp') ), dateformat => 'iso', dateonly => 1 });
46
my $publisheddate      = output_pref({ dt => dt_from_string( scalar $cgi->param('publisheddate') ), dateformat => 'iso', dateonly => 1 });
47
my $number         = $cgi->param('number');
47
my $number         = $cgi->param('number');
48
my $lang           = $cgi->param('lang');
48
my $lang           = $cgi->param('lang');
49
my $branchcode     = $cgi->param('branch');
49
my $branchcode     = $cgi->param('branch');
Lines 110-116 elsif ( $op eq 'add' ) { Link Here
110
                new            => $new,
110
                new            => $new,
111
                lang           => $lang,
111
                lang           => $lang,
112
                expirationdate => $expirationdate,
112
                expirationdate => $expirationdate,
113
                timestamp      => $timestamp,
113
                publisheddate  => $publisheddate,
114
                number         => $number,
114
                number         => $number,
115
                branchcode     => $branchcode,
115
                branchcode     => $branchcode,
116
                borrowernumber => $borrowernumber,
116
                borrowernumber => $borrowernumber,
Lines 130-136 elsif ( $op eq 'edit' ) { Link Here
130
            new            => $new,
130
            new            => $new,
131
            lang           => $lang,
131
            lang           => $lang,
132
            expirationdate => $expirationdate,
132
            expirationdate => $expirationdate,
133
            timestamp      => $timestamp,
133
            publisheddate  => $publisheddate,
134
            number         => $number,
134
            number         => $number,
135
            branchcode     => $branchcode,
135
            branchcode     => $branchcode,
136
        }
136
        }
137
- 

Return to bug 21066