Bugzilla – Attachment 109150 Details for
Bug 21066
Replace opac_news.timestamp by published_on and add updated_on as timestamp
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21066: Code changes needed for replacing opac_news.timestamp
Bug-21066-Code-changes-needed-for-replacing-opacne.patch (text/plain), 5.61 KB, created by
Owen Leonard
on 2020-08-26 12:08:29 UTC
(
hide
)
Description:
Bug 21066: Code changes needed for replacing opac_news.timestamp
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2020-08-26 12:08:29 UTC
Size:
5.61 KB
patch
obsolete
>From 0cffecacaf89abe263e4d3cef557ed0da29effdf Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 17 Jul 2018 16:11:01 +0200 >Subject: [PATCH] Bug 21066: Code changes needed for replacing > opac_news.timestamp > >Test plan: >Perform some CRUD operations on the news page in staff. >Verify that news on opac and staff respect publicationdate. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > C4/NewsChannels.pm | 15 ++++++--------- > .../intranet-tmpl/prog/en/modules/tools/koha-news.tt | 2 +- > tools/koha-news.pl | 6 +++--- > 3 files changed, 10 insertions(+), 13 deletions(-) > >diff --git a/C4/NewsChannels.pm b/C4/NewsChannels.pm >index 7ab168e171..bfcbfc6afe 100644 >--- a/C4/NewsChannels.pm >+++ b/C4/NewsChannels.pm >@@ -135,7 +135,7 @@ sub get_opac_new { > my $data = $sth->fetchrow_hashref; > $data->{$data->{'lang'}} = 1 if defined $data->{lang}; > $data->{expirationdate} = output_pref({ dt => dt_from_string( $data->{expirationdate} ), dateonly => 1 }) if ( $data->{expirationdate} ); >- $data->{timestamp} = output_pref({ dt => dt_from_string( $data->{timestamp} ), dateonly => 1 }) ; >+ $data->{publicationdate} = output_pref({ dt => dt_from_string( $data->{publicationdate} ), dateonly => 1 }); > return $data; > } > >@@ -145,7 +145,7 @@ sub get_opac_news { > my $dbh = C4::Context->dbh; > my $query = q{ > SELECT opac_news.*, branches.branchname, >- timestamp AS newdate, >+ publicationdate AS newdate, > borrowers.title AS author_title, > borrowers.firstname AS author_firstname, > borrowers.surname AS author_surname >@@ -162,7 +162,7 @@ sub get_opac_news { > $query .= ' AND (opac_news.branchcode IS NULL OR opac_news.branchcode=?)'; > push @values,$branchcode; > } >- $query.= ' ORDER BY timestamp DESC '; >+ $query.= ' ORDER BY publicationdate DESC '; > #if ($limit) { > # $query.= 'LIMIT 0, ' . $limit; > #} >@@ -191,9 +191,8 @@ sub get_opac_news { > sub GetNewsToDisplay { > my ($lang,$branch) = @_; > my $dbh = C4::Context->dbh; >- # SELECT *,DATE_FORMAT(timestamp, '%d/%m/%Y') AS newdate > my $query = q{ >- SELECT opac_news.*,timestamp AS newdate, >+ SELECT opac_news.*,publicationdate AS newdate, > borrowers.title AS author_title, > borrowers.firstname AS author_firstname, > borrowers.surname AS author_surname >@@ -203,13 +202,11 @@ sub GetNewsToDisplay { > expirationdate >= CURRENT_DATE() > OR expirationdate IS NULL > ) >- AND DATE(timestamp) < DATE_ADD(CURDATE(), INTERVAL 1 DAY) >+ AND publicationdate <= CURDATE() > AND (opac_news.lang = '' OR opac_news.lang = ?) > AND (opac_news.branchcode IS NULL OR opac_news.branchcode = ?) > ORDER BY number >- }; # expirationdate field is NOT in ISO format? >- # timestamp has HH:mm:ss, CURRENT_DATE generates 00:00:00 >- # by adding 1, that captures today correctly. >+ }; > my $sth = $dbh->prepare($query); > $lang = $lang // q{}; > $sth->execute($lang,$branch); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >index 12758c01bb..205b1b1933 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >@@ -83,7 +83,7 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > </li> > <li> > <label for="from">Publication date: </label> >- <input id="from" type="text" name="timestamp" size="15" value="[% new_detail.timestamp | html %]" class="datepickerfrom" /> >+ <input id="from" type="text" name="publicationdate" size="15" value="[% new_detail.publicationdate | html %]" class="datepickerfrom" /> > <div class="hint">[% INCLUDE 'date-format.inc' %]</div> > </li> > <li> >diff --git a/tools/koha-news.pl b/tools/koha-news.pl >index b90a8c4521..687259beaa 100755 >--- a/tools/koha-news.pl >+++ b/tools/koha-news.pl >@@ -42,7 +42,7 @@ my $expirationdate; > if ( $cgi->param('expirationdate') ) { > $expirationdate = output_pref({ dt => dt_from_string( scalar $cgi->param('expirationdate') ), dateformat => 'iso', dateonly => 1 }); > } >-my $timestamp = output_pref({ dt => dt_from_string( scalar $cgi->param('timestamp') ), dateformat => 'iso', dateonly => 1 }); >+my $publicationdate= output_pref({ dt => dt_from_string( scalar $cgi->param('publicationdate') ), dateformat => 'iso', dateonly => 1 }); > my $number = $cgi->param('number'); > my $lang = $cgi->param('lang'); > my $branchcode = $cgi->param('branch'); >@@ -109,7 +109,7 @@ elsif ( $op eq 'add' ) { > content => $content, > lang => $lang, > expirationdate => $expirationdate, >- timestamp => $timestamp, >+ publicationdate=> $publicationdate, > number => $number, > branchcode => $branchcode, > borrowernumber => $borrowernumber, >@@ -129,7 +129,7 @@ elsif ( $op eq 'edit' ) { > content => $content, > lang => $lang, > expirationdate => $expirationdate, >- timestamp => $timestamp, >+ publicationdate=> $publicationdate, > number => $number, > branchcode => $branchcode, > } >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21066
:
77037
|
77038
|
77039
|
107769
|
107770
|
107771
|
107772
|
107773
|
107774
|
107775
|
107776
|
109148
|
109149
|
109150
|
109151
|
109152
|
109153
|
109154
|
109192
|
109193
|
109194
|
109195
|
109196
|
109197
|
109198
|
109199
|
109354
|
109514
|
109515