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

(-)a/C4/NewsChannels.pm (-9 / +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->{publicationdate} = output_pref({ dt => dt_from_string( $data->{publicationdate} ), 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
                         publicationdate 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 publicationdate DESC ';
166
    #if ($limit) {
166
    #if ($limit) {
167
    #    $query.= 'LIMIT 0, ' . $limit;
167
    #    $query.= 'LIMIT 0, ' . $limit;
168
    #}
168
    #}
Lines 191-199 sub get_opac_news { Link Here
191
sub GetNewsToDisplay {
191
sub GetNewsToDisplay {
192
    my ($lang,$branch) = @_;
192
    my ($lang,$branch) = @_;
193
    my $dbh = C4::Context->dbh;
193
    my $dbh = C4::Context->dbh;
194
    # SELECT *,DATE_FORMAT(timestamp, '%d/%m/%Y') AS newdate
195
    my $query = q{
194
    my $query = q{
196
     SELECT opac_news.*,timestamp AS newdate,
195
     SELECT opac_news.*,publicationdate AS newdate,
197
     borrowers.title AS author_title,
196
     borrowers.title AS author_title,
198
     borrowers.firstname AS author_firstname,
197
     borrowers.firstname AS author_firstname,
199
     borrowers.surname AS author_surname
198
     borrowers.surname AS author_surname
Lines 203-215 sub GetNewsToDisplay { Link Here
203
        expirationdate >= CURRENT_DATE()
202
        expirationdate >= CURRENT_DATE()
204
        OR    expirationdate IS NULL
203
        OR    expirationdate IS NULL
205
     )
204
     )
206
     AND   DATE(timestamp) < DATE_ADD(CURDATE(), INTERVAL 1 DAY)
205
     AND   publicationdate <= CURDATE()
207
     AND   (opac_news.lang = '' OR opac_news.lang = ?)
206
     AND   (opac_news.lang = '' OR opac_news.lang = ?)
208
     AND   (opac_news.branchcode IS NULL OR opac_news.branchcode = ?)
207
     AND   (opac_news.branchcode IS NULL OR opac_news.branchcode = ?)
209
     ORDER BY number
208
     ORDER BY number
210
    }; # expirationdate field is NOT in ISO format?
209
    };
211
       # timestamp has HH:mm:ss, CURRENT_DATE generates 00:00:00
212
       #           by adding 1, that captures today correctly.
213
    my $sth = $dbh->prepare($query);
210
    my $sth = $dbh->prepare($query);
214
    $lang = $lang // q{};
211
    $lang = $lang // q{};
215
    $sth->execute($lang,$branch);
212
    $sth->execute($lang,$branch);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt (-1 / +1 lines)
Lines 83-89 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
83
            </li>
83
            </li>
84
            <li>
84
            <li>
85
                <label for="from">Publication date: </label>
85
                <label for="from">Publication date: </label>
86
                <input id="from" type="text" name="timestamp" size="15" value="[% new_detail.timestamp | html %]" class="datepickerfrom" />
86
                <input id="from" type="text" name="publicationdate" size="15" value="[% new_detail.publicationdate | html %]" class="datepickerfrom" />
87
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
87
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
88
            </li>
88
            </li>
89
            <li>
89
            <li>
(-)a/tools/koha-news.pl (-4 / +3 lines)
Lines 42-48 my $expirationdate; Link Here
42
if ( $cgi->param('expirationdate') ) {
42
if ( $cgi->param('expirationdate') ) {
43
    $expirationdate = output_pref({ dt => dt_from_string( scalar $cgi->param('expirationdate') ), dateformat => 'iso', dateonly => 1 });
43
    $expirationdate = output_pref({ dt => dt_from_string( scalar $cgi->param('expirationdate') ), dateformat => 'iso', dateonly => 1 });
44
}
44
}
45
my $timestamp      = output_pref({ dt => dt_from_string( scalar $cgi->param('timestamp') ), dateformat => 'iso', dateonly => 1 });
45
my $publicationdate= output_pref({ dt => dt_from_string( scalar $cgi->param('publicationdate') ), dateformat => 'iso', dateonly => 1 });
46
my $number         = $cgi->param('number');
46
my $number         = $cgi->param('number');
47
my $lang           = $cgi->param('lang');
47
my $lang           = $cgi->param('lang');
48
my $branchcode     = $cgi->param('branch');
48
my $branchcode     = $cgi->param('branch');
Lines 109-115 elsif ( $op eq 'add' ) { Link Here
109
                content        => $content,
109
                content        => $content,
110
                lang           => $lang,
110
                lang           => $lang,
111
                expirationdate => $expirationdate,
111
                expirationdate => $expirationdate,
112
                timestamp      => $timestamp,
112
                publicationdate=> $publicationdate,
113
                number         => $number,
113
                number         => $number,
114
                branchcode     => $branchcode,
114
                branchcode     => $branchcode,
115
                borrowernumber => $borrowernumber,
115
                borrowernumber => $borrowernumber,
Lines 129-135 elsif ( $op eq 'edit' ) { Link Here
129
            content        => $content,
129
            content        => $content,
130
            lang           => $lang,
130
            lang           => $lang,
131
            expirationdate => $expirationdate,
131
            expirationdate => $expirationdate,
132
            timestamp      => $timestamp,
132
            publicationdate=> $publicationdate,
133
            number         => $number,
133
            number         => $number,
134
            branchcode     => $branchcode,
134
            branchcode     => $branchcode,
135
        }
135
        }
136
- 

Return to bug 21066