Bugzilla – Attachment 98433 Details for
Bug 23673
Separate time sent from time created in message_queue table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23673: Add "Updated on" column to patron's notices
Bug-23673-Add-Updated-on-column-to-patrons-notices.patch (text/plain), 6.18 KB, created by
Jonathan Druart
on 2020-02-05 08:50:28 UTC
(
hide
)
Description:
Bug 23673: Add "Updated on" column to patron's notices
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-02-05 08:50:28 UTC
Size:
6.18 KB
patch
obsolete
>From 17128ea0c9d9d2e0d65a55a3615059d118687756 Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Mon, 21 Oct 2019 19:18:55 -0300 >Subject: [PATCH] Bug 23673: Add "Updated on" column to patron's notices > >This patch adds "Updated on" column to patron's notices tab. It also adds logic to C4::Letters to retrieve updated_on column. > >To test: > >1. Apply patches. > >2. Restart plack. > >3. Choose a patron and add a purchase suggestion. > >4. Change suggestion status. > >5. Open patron's notifications. >CHECK => Messages table has now "Updated on" and "Time created" columns, and "Time" column is gone. >SUCCESS => There is a message with status pending, with a "time created" that equals "updated on" > >6. Execute in the shell in Koha directory > > $ ./misc/cronjobs/process_message_queue.pl > >7. Open patron's notifications one more time. >SUCCESS => The message changed status. Time created remained the same, and now "updated on" has the current timestamp. > >8. Resend the message and repeat sep 6. >SUCCESS => Every time you change the status, time created remains the same and updated on updates. > >9. prove t/db_dependant/Letters.t > >10. Sign off > >Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com> > >Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com> > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > C4/Letters.pm | 6 +++--- > koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt | 6 ++++-- > t/db_dependent/Letters.t | 8 +++++++- > 3 files changed, 14 insertions(+), 6 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 097096a501..0233ef52f4 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -1070,7 +1070,7 @@ sub GetQueuedMessages { > > my $dbh = C4::Context->dbh(); > my $statement = << 'ENDSQL'; >-SELECT message_id, borrowernumber, subject, content, message_transport_type, status, time_queued >+SELECT message_id, borrowernumber, subject, content, message_transport_type, status, time_queued, updated_on > FROM message_queue > ENDSQL > >@@ -1124,7 +1124,7 @@ sub GetMessage { > return unless $message_id; > my $dbh = C4::Context->dbh; > return $dbh->selectrow_hashref(q| >- SELECT message_id, borrowernumber, subject, content, metadata, letter_code, message_transport_type, status, time_queued, to_address, from_address, content_type >+ SELECT message_id, borrowernumber, subject, content, metadata, letter_code, message_transport_type, status, time_queued, updated_on, to_address, from_address, content_type > FROM message_queue > WHERE message_id = ? > |, {}, $message_id ); >@@ -1368,7 +1368,7 @@ sub _is_duplicate { > WHERE message_transport_type = ? > AND borrowernumber = ? > AND letter_code = ? >- AND CAST(time_queued AS date) = CAST(NOW() AS date) >+ AND CAST(updated_on AS date) = CAST(NOW() AS date) > AND status="sent" > AND content = ? > |, {}, $message->{message_transport_type}, $message->{borrowernumber}, $message->{letter_code}, $message->{content} ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt >index b5e2bebe7b..bf81f012e2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt >@@ -35,7 +35,8 @@ > <th>Notice</th> > <th>Type</th> > <th>Status</th> >- <th>Time</th> >+ <th>Updated on</th> >+ <th>Time created</th> > </tr> > </thead> > <tbody> >@@ -73,6 +74,7 @@ > </div> > [% END %] > </td> >+ <td><span title="[% QUEUED_MESSAGE.time_status_changed | html %]">[% QUEUED_MESSAGE.updated_on | $KohaDates with_hours => 1 %]</span></td> > <td><span title="[% QUEUED_MESSAGE.time_queued | html %]">[% QUEUED_MESSAGE.time_queued | $KohaDates with_hours => 1 %]</span></td> > </tr> > [% END %] >@@ -98,7 +100,7 @@ > $(document).ready(function() { > $("#noticestable").dataTable($.extend(true, {}, dataTablesDefaults, { > "aaSorting": [[ 3, "desc" ]], >- "aoColumns": [ null,null,null,{ "sType": "title-string" } ], >+ "aoColumns": [ null,null,null, { "sType": "title-string" } ,{ "sType": "title-string" } ], > "sPaginationType": "full" > })); > >diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t >index 41f2a05fb8..6353f9c07d 100644 >--- a/t/db_dependent/Letters.t >+++ b/t/db_dependent/Letters.t >@@ -18,7 +18,7 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 69; >+use Test::More tests => 73; > use Test::MockModule; > use Test::Warn; > >@@ -132,8 +132,12 @@ is( $messages->[0]->{subject}, $my_message->{letter}->{title}, 'EnqueueLetter st > is( $messages->[0]->{content}, $my_message->{letter}->{content}, 'EnqueueLetter stores the content correctly' ); > is( $messages->[0]->{message_transport_type}, $my_message->{message_transport_type}, 'EnqueueLetter stores the message type correctly' ); > is( $messages->[0]->{status}, 'pending', 'EnqueueLetter stores the status pending correctly' ); >+isnt( $messages->[0]->{time_queued}, undef, 'Time queued inserted by default in message_queue table' ); >+is( $messages->[0]->{updated_on}, $messages->[0]->{time_queued}, 'Time status changed equals time queued when created in message_queue table' ); > >+my $message_time_queued = $messages->[0]->{time_queued}; > >+sleep 1; > # SendQueuedMessages > my $messages_processed = C4::Letters::SendQueuedMessages( { type => 'email' }); > is($messages_processed, 0, 'No queued messages processed if type limit passed with unused type'); >@@ -145,6 +149,8 @@ is( > 'failed', > 'message marked failed if tried to send SMS message for borrower with no smsalertnumber set (bug 11208)' > ); >+isnt($messages->[0]->{updated_on}, $messages->[0]->{time_queued}, 'Time status changed differs from time queued when status changes' ); >+is($messages->[0]->{time_queued}, $message_time_queued, 'Time queued remaines inmutable' ); > > # ResendMessage > my $resent = C4::Letters::ResendMessage($messages->[0]->{message_id}); >-- >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 23673
:
94503
|
94504
|
94954
|
96232
|
96346
|
96347
|
96391
|
96392
|
96451
|
96452
|
96643
|
98090
|
98091
|
98419
|
98420
|
98431
|
98432
| 98433 |
98434
|
98435