Bugzilla – Attachment 89193 Details for
Bug 5770
Email librarian when purchase suggestion made
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5770: (QA follow-up) Revert change to GetQueuedMessages
Bug-5770-QA-follow-up-Revert-change-to-GetQueuedMe.patch (text/plain), 6.08 KB, created by
Martin Renvoize (ashimema)
on 2019-05-01 18:04:05 UTC
(
hide
)
Description:
Bug 5770: (QA follow-up) Revert change to GetQueuedMessages
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-05-01 18:04:05 UTC
Size:
6.08 KB
patch
obsolete
>From 45be637586eb76a9bcbc33e5a3eafa8e481c7ec6 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 1 May 2019 12:56:05 +0100 >Subject: [PATCH] Bug 5770: (QA follow-up) Revert change to GetQueuedMessages > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Letters.pm | 11 +++-------- > t/db_dependent/Suggestions.t | 26 ++++++++++---------------- > 2 files changed, 13 insertions(+), 24 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 8b086a79ab..bdb213a49e 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -1058,10 +1058,10 @@ sub GetPrintMessages { > > my $messages = GetQueuedMessage( { borrowernumber => '123', limit => 20 } ); > >-fetches messages out of the message queue. >+Fetches a list of messages from the message queue optionally filtered by borrowernumber >+and limited to specified limit. > >-returns: >-list of hashes, each has represents a message in the message queue. >+Return is an arrayref of hashes, each has represents a message in the message queue. > > =cut > >@@ -1081,11 +1081,6 @@ ENDSQL > push @query_params, $params->{'borrowernumber'}; > } > >- if ( exists $params->{'letter_code'} ) { >- push @whereclauses, ' letter_code = ? '; >- push @query_params, $params->{'letter_code'}; >- } >- > if ( @whereclauses ) { > $statement .= ' WHERE ' . join( 'AND', @whereclauses ); > } >diff --git a/t/db_dependent/Suggestions.t b/t/db_dependent/Suggestions.t >index 816786a2f8..02d1d92bec 100644 >--- a/t/db_dependent/Suggestions.t >+++ b/t/db_dependent/Suggestions.t >@@ -42,6 +42,8 @@ $schema->storage->txn_begin; > my $dbh = C4::Context->dbh; > my $builder = t::lib::TestBuilder->new; > >+t::lib::Mocks::mock_preference( "EmailPurchaseSuggestions", "0"); >+ > # Reset item types to only the default ones > $dbh->do(q|DELETE FROM itemtypes;|); > my $sql = qq| >@@ -191,8 +193,7 @@ isnt( $suggestion->{accepteddate}, undef, 'ModSuggestion does not update a non g > is( $suggestion->{note}, 'my note', 'ModSuggestion should not erase data if not given' ); > > my $messages = C4::Letters::GetQueuedMessages({ >- borrowernumber => $borrowernumber, >- letter_code => 'CHECKED', >+ borrowernumber => $borrowernumber > }); > is( @$messages, 0, 'ModSuggestions does not send an email if the status is not updated' ); > >@@ -219,8 +220,7 @@ is( $status, 1, 'ModSuggestion modifies one entry' ); > $suggestion = GetSuggestion($my_suggestionid); > is( $suggestion->{STATUS}, $mod_suggestion3->{STATUS}, 'ModSuggestion modifies the status correctly' ); > $messages = C4::Letters::GetQueuedMessages({ >- borrowernumber => $borrowernumber, >- letter_code => 'CHECKED', >+ borrowernumber => $borrowernumber > }); > is( @$messages, 1, 'ModSuggestion sends an email if the status is updated' ); > is ($messages->[0]->{message_transport_type}, 'email', 'When FallbackToSMSIfNoEmail syspref is disabled the suggestion message_transport_type is always email'); >@@ -230,8 +230,7 @@ is( CountSuggestion('CHECKED'), 1, 'CountSuggestion returns the correct number o > t::lib::Mocks::mock_preference( 'FallbackToSMSIfNoEmail', 1 ); > ModSuggestion($mod_suggestion3); > $messages = C4::Letters::GetQueuedMessages({ >- borrowernumber => $borrowernumber, >- letter_code => 'CHECKED', >+ borrowernumber => $borrowernumber > }); > is ($messages->[1]->{message_transport_type}, 'sms', 'When FallbackToSMSIfNoEmail syspref is enabled the suggestion message_transport_type is sms if the borrower has no email'); > >@@ -246,8 +245,7 @@ my $mod_suggestion4 = { > }; > ModSuggestion($mod_suggestion4); > $messages = C4::Letters::GetQueuedMessages({ >- borrowernumber => $borrowernumber2, >- letter_code => 'CHECKED', >+ borrowernumber => $borrowernumber2 > }); > is ($messages->[0]->{message_transport_type}, 'email', 'When FallbackToSMSIfNoEmail syspref is enabled the suggestion message_transport_type is email if the borrower has an email'); > >@@ -489,8 +487,7 @@ subtest 'EmailPurchaseSuggestions' => sub { > t::lib::Mocks::mock_preference( "EmailPurchaseSuggestions", "KohaAdminEmailAddress"); > NewSuggestion($my_suggestion); > my $newsuggestions_messages = C4::Letters::GetQueuedMessages({ >- borrowernumber => $borrowernumber, >- letter_code => 'NEW_SUGGESTION', >+ borrowernumber => $borrowernumber > }); > > is( @$newsuggestions_messages, 1, 'NewSuggestions sends an email' ); >@@ -500,8 +497,7 @@ subtest 'EmailPurchaseSuggestions' => sub { > t::lib::Mocks::mock_preference( "EmailPurchaseSuggestions", "EmailAddressForSuggestions"); > NewSuggestion($my_suggestion); > $newsuggestions_messages = C4::Letters::GetQueuedMessages({ >- borrowernumber => $borrowernumber, >- letter_code => 'NEW_SUGGESTION', >+ borrowernumber => $borrowernumber > }); > my $message2 = C4::Letters::GetMessage( $newsuggestions_messages->[1]->{message_id}); > is ($message2->{to_address}, 'a@b.c', 'to_address is EmailAddressForSuggestions'); >@@ -509,8 +505,7 @@ subtest 'EmailPurchaseSuggestions' => sub { > t::lib::Mocks::mock_preference( "EmailPurchaseSuggestions", "BranchEmailAddress"); > NewSuggestion($my_suggestion); > $newsuggestions_messages = C4::Letters::GetQueuedMessages({ >- borrowernumber => $borrowernumber, >- letter_code => 'NEW_SUGGESTION', >+ borrowernumber => $borrowernumber > }); > my $message3 = C4::Letters::GetMessage( $newsuggestions_messages->[2]->{message_id}); > is ($message3->{to_address}, 'branchemail@b.c', 'to_address is BranchEmailAddress'); >@@ -518,8 +513,7 @@ subtest 'EmailPurchaseSuggestions' => sub { > Koha::Libraries->find('CPL')->update({ branchemail => undef }); > NewSuggestion($my_suggestion); > $newsuggestions_messages = C4::Letters::GetQueuedMessages({ >- borrowernumber => $borrowernumber, >- letter_code => 'NEW_SUGGESTION', >+ borrowernumber => $borrowernumber > }); > my $message4 = C4::Letters::GetMessage( $newsuggestions_messages->[3]->{message_id}); > isnt ($message4->{to_address}, 'branchemail@b.c', 'to_address is KohaAdminEmailAddress. Because branchemail is undef'); >-- >2.20.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 5770
:
83384
|
83385
|
83386
|
83387
|
83388
|
83390
|
83615
|
83616
|
83617
|
84463
|
84812
|
89139
|
89140
|
89141
|
89142
|
89144
|
89145
|
89146
|
89147
|
89188
|
89189
|
89190
|
89191
|
89192
| 89193 |
89194
|
89195