Bugzilla – Attachment 96643 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: (follow-up) Change time_status_changed to updated_on
Bug-23673-follow-up-Change-timestatuschanged-to-up.patch (text/plain), 5.44 KB, created by
Agustín Moyano
on 2019-12-26 18:52:33 UTC
(
hide
)
Description:
Bug 23673: (follow-up) Change time_status_changed to updated_on
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2019-12-26 18:52:33 UTC
Size:
5.44 KB
patch
obsolete
>From 58730a47d6f78f1714b4a66d95fa7958a92f59c1 Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Thu, 26 Dec 2019 15:51:44 -0300 >Subject: [PATCH] Bug 23673: (follow-up) Change time_status_changed to > updated_on > >--- > C4/Letters.pm | 8 ++++---- > installer/data/mysql/atomicupdate/bug-23673.perl | 6 +++--- > installer/data/mysql/kohastructure.sql | 2 +- > t/db_dependent/Letters.t | 4 ++-- > 4 files changed, 10 insertions(+), 10 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index fd917a641e..6cf113171e 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, time_status_changed >+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, time_status_changed, 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_status_changed 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} ); >@@ -1419,7 +1419,7 @@ sub _set_message_status { > } > > my $dbh = C4::Context->dbh(); >- my $statement = 'UPDATE message_queue SET status= ?, time_status_changed = NOW() WHERE message_id = ?'; >+ my $statement = 'UPDATE message_queue SET status= ?, updated_on = NOW() WHERE message_id = ?'; > my $sth = $dbh->prepare( $statement ); > my $result = $sth->execute( $params->{'status'}, > $params->{'message_id'} ); >diff --git a/installer/data/mysql/atomicupdate/bug-23673.perl b/installer/data/mysql/atomicupdate/bug-23673.perl >index defa94d0a1..4a336e6618 100644 >--- a/installer/data/mysql/atomicupdate/bug-23673.perl >+++ b/installer/data/mysql/atomicupdate/bug-23673.perl >@@ -3,10 +3,10 @@ if( CheckVersion( $DBversion ) ) { > > $dbh->do("ALTER TABLE message_queue MODIFY time_queued timestamp NOT NULL default CURRENT_TIMESTAMP"); > >- if( !column_exists( 'message_queue', 'time_status_changed' ) ) { >- $dbh->do("ALTER TABLE message_queue ADD COLUMN time_status_changed timestamp NULL AFTER time_queued"); >+ if( !column_exists( 'message_queue', 'updated_on' ) ) { >+ $dbh->do("ALTER TABLE message_queue ADD COLUMN updated_on timestamp NULL AFTER time_queued"); > } > > SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 23673 - modify time_queued and add time_status_changed to message_queue)\n"; >+ print "Upgrade to $DBversion done (Bug 23673 - modify time_queued and add updated_on to message_queue)\n"; > } >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 7a40411223..26fd915bb2 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2427,7 +2427,7 @@ CREATE TABLE `message_queue` ( > `message_transport_type` varchar(20) NOT NULL, > `status` enum('sent','pending','failed','deleted') NOT NULL default 'pending', > `time_queued` timestamp NOT NULL default CURRENT_TIMESTAMP, >- `time_status_changed` timestamp NULL, >+ `updated_on` timestamp NULL, > `to_address` LONGTEXT, > `from_address` LONGTEXT, > `content_type` MEDIUMTEXT, >diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t >index 669b771e62..c2c716c1c0 100644 >--- a/t/db_dependent/Letters.t >+++ b/t/db_dependent/Letters.t >@@ -133,7 +133,7 @@ is( $messages->[0]->{content}, $my_message->{letter}->{content}, 'EnqueueLetter > 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]->{time_status_changed}, undef, 'Time status changed undefined by default in message_queue table' ); >+is( $messages->[0]->{updated_on}, undef, 'Time status changed undefined by default in message_queue table' ); > > my $message_time_queued = $messages->[0]->{time_queued}; > >@@ -148,7 +148,7 @@ is( > 'failed', > 'message marked failed if tried to send SMS message for borrower with no smsalertnumber set (bug 11208)' > ); >-isnt($messages->[0]->{time_status_changed}, undef, 'Time status changed set on status change' ); >+isnt($messages->[0]->{updated_on}, undef, 'Time status changed set on status change' ); > is($messages->[0]->{time_queued}, $message_time_queued, 'Time queued remaines inmutable' ); > > # ResendMessage >-- >2.17.1
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