Bugzilla – Attachment 158179 Details for
Bug 34731
C4::Letters::SendQueuedMessages can be triggered with an undef message_id
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[22.11.x] Bug 34731: Use Koha::Notice::Message in EnqueueLetter
Bug-34731-Use-KohaNoticeMessage-in-EnqueueLetter.patch (text/plain), 3.12 KB, created by
Kyle M Hall (khall)
on 2023-11-01 15:26:12 UTC
(
hide
)
Description:
[22.11.x] Bug 34731: Use Koha::Notice::Message in EnqueueLetter
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2023-11-01 15:26:12 UTC
Size:
3.12 KB
patch
obsolete
>From a7012fed5b973ecf629d9fa637b89b1a9bbaa47f Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 7 Sep 2023 11:40:59 -0400 >Subject: [PATCH] Bug 34731: Use Koha::Notice::Message in EnqueueLetter > >Test Plan: >1) Apply this patch >2) prove t/db_dependent/Letters.t > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Letters.pm | 43 +++++++++++++++++++------------------------ > 1 file changed, 19 insertions(+), 24 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index ee6af309a0c..ab16f729c58 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -922,30 +922,25 @@ sub EnqueueLetter { > ); > } > >- my $dbh = C4::Context->dbh(); >- my $statement = << 'ENDSQL'; >-INSERT INTO message_queue >-( letter_id, borrowernumber, subject, content, metadata, letter_code, message_transport_type, status, time_queued, to_address, from_address, reply_address, content_type, failure_code ) >-VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, CAST(NOW() AS DATETIME), ?, ?, ?, ?, ? ) >-ENDSQL >- >- my $sth = $dbh->prepare($statement); >- my $result = $sth->execute( >- $params->{letter}->{id} || undef, # letter.id >- $params->{'borrowernumber'}, # borrowernumber >- $params->{'letter'}->{'title'}, # subject >- $params->{'letter'}->{'content'}, # content >- $params->{'letter'}->{'metadata'} || '', # metadata >- $params->{'letter'}->{'code'} || '', # letter_code >- $params->{'message_transport_type'}, # message_transport_type >- 'pending', # status >- $params->{'to_address'}, # to_address >- $params->{'from_address'}, # from_address >- $params->{'reply_address'}, # reply_address >- $params->{'letter'}->{'content-type'}, # content_type >- $params->{'failure_code'} || '', # failure_code >- ); >- return $dbh->last_insert_id(undef,undef,'message_queue', undef); >+ my $message = Koha::Notice::Message->new( >+ { >+ letter_id => $params->{letter}->{id} || undef, >+ borrowernumber => $params->{borrowernumber}, >+ subject => $params->{letter}->{title}, >+ content => $params->{letter}->{content}, >+ metadata => $params->{letter}->{metadata} || q{}, >+ letter_code => $params->{letter}->{code} || q{}, >+ message_transport_type => $params->{message_transport_type}, >+ status => 'pending', >+ time_queued => dt_from_string(), >+ to_address => $params->{to_address}, >+ from_address => $params->{from_address}, >+ reply_address => $params->{reply_address}, >+ content_type => $params->{letter}->{'content-type'}, >+ failure_code => $params->{failure_code} || q{}, >+ } >+ )->store(); >+ return $message->id; > } > > =head2 SendQueuedMessages ([$hashref]) >-- >2.30.2
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 34731
:
155325
|
155326
|
155327
|
155459
|
155460
|
155461
|
155478
|
155479
|
155480
|
155481
|
158178
| 158179 |
158180