Bugzilla – Attachment 155461 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]
Bug 34731: Use Koha::Notice::Message in EnqueueLetter
Bug-34731-Use-KohaNoticeMessage-in-EnqueueLetter.patch (text/plain), 3.05 KB, created by
David Nind
on 2023-09-08 19:48:34 UTC
(
hide
)
Description:
Bug 34731: Use Koha::Notice::Message in EnqueueLetter
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-09-08 19:48:34 UTC
Size:
3.05 KB
patch
obsolete
>From 29fac2da2639e3daab7a2615acd35147c7f8bd4e 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> >--- > C4/Letters.pm | 43 +++++++++++++++++++------------------------ > 1 file changed, 19 insertions(+), 24 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index f7efee76be..b2ad4c2d1d 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -925,30 +925,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