Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core/#273 Fix issue where sending an SMS with the To Field in the… #12634

Merged
merged 1 commit into from
Aug 14, 2018

Conversation

seamuslee001
Copy link
Contributor

… provider params set did not work and fix handling of do_not_sms

Overview

Picking up the work done in these 2 PRs https://github.com/civicrm/civicrm-core/pull/12614/files https://github.com/civicrm/civicrm-core/pull/12554/files it was obvious that when the phone number was set in the To param for the sms provider params that SMSes were failing. This was shown to be happening when you selected outbound sms from the list of actions on a contact screen.

When investigating this i found that in that case where the phone number was set in the SMS provider Params, the do_not_sms flag was potentially not properly being respected and would have been worsened under PR 12614. This now has tests that a) prove the original bug and b) lock in the handling on do not SMS

Before

SMS sending fails when phone number included in the To param of smsProviderParams

After

SMSes fail to send and potential mis handling in terms of do_not_sms

Technical Details

SMSes send correctly have better handling of do_not_sms and more tests

ping @mattwire @eileenmcnaughton @vinuvarshith @jyothi-shree21

@civibot
Copy link

civibot bot commented Aug 8, 2018

(Standard links)

@seamuslee001 seamuslee001 force-pushed the dev_core_273 branch 2 times, most recently from b587006 to 5dab823 Compare August 8, 2018 05:21
// Collect all of the PEAR_Error objects
$errMsgs[] = $sendResult;
if ($doNotSms) {
$errMsgs[] = PEAR::raiseError('Contact Does not accept SMS', NULL, PEAR_ERROR_RETURN);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ug - but I guess

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeps it consistent with all the other errors

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it's not worse than before - I'll give you that

@JoeMurray
Copy link
Contributor

Thanks, @seamuslee001

@seamuslee001 seamuslee001 mentioned this pull request Aug 8, 2018
@mlutfy
Copy link
Member

mlutfy commented Aug 8, 2018

Nice work!

@eileenmcnaughton
Copy link
Contributor

@mlutfy is this something you can review? Or @jmcclelland

@mattwire
Copy link
Contributor

mattwire commented Aug 9, 2018

Worth noting that prior to #10946 there were NO unit tests on this part of the code so breakage was highly likely. Nice to see that in #12634 we can extend those unit tests to lock in the expected functionality.

@mattwire
Copy link
Contributor

mattwire commented Aug 9, 2018

Changes look sane and I'm really happy to see the unit tests. Ping @JKingsnorth @michaelmcandrew in case they have time to run/review.

@@ -231,6 +231,7 @@ public static function getRecipients($mailingID) {
$criteria = array(
'is_opt_out' => CRM_Utils_SQL_Select::fragment()->where("$contact.is_opt_out = 0"),
'is_deceased' => CRM_Utils_SQL_Select::fragment()->where("$contact.is_deceased <> 1"),
'do_not_sms' => CRM_Utils_SQL_Select::fragment()->where("$contact.do_not_sms = 0"),
'location_filter' => CRM_Utils_SQL_Select::fragment()->where("$entityTable.phone_type_id = " . CRM_Core_PseudoConstant::getKey('CRM_Core_DAO_Phone', 'phone_type_id', 'Mobile')),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! I don't want to hold this PR back (and this could be a separate issue) but since it's related to this change I'll mention it: If someone opts out of email (is_opt_out), should they really opt out of SMS too? The UI very clearly says no bulk emails, so I would be in favor of removing that query item for sending mass SMS so people do get an SMS message even if they have opted out of bulk email.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than slow down this PR, I just opened a separate issue:

https://lab.civicrm.org/dev/core/issues/318

Let's merge this PR :).

@seamuslee001
Copy link
Contributor Author

@jmcclelland have you r-run this PR?

@jmcclelland
Copy link
Contributor

Yes, I have done an r-run (I fully tested send via activity, which works. I made a modified version of the bulk SMS patch because our code has not been upgraded to the new query api but the logic should be the same and it also worked as expected).

@eileenmcnaughton
Copy link
Contributor

@seamuslee001 seems good to merge but against the rc

… in the provider params set did not work and fix handling of do_not_sms

Add test of error message
@seamuslee001 seamuslee001 changed the base branch from master to 5.5 August 13, 2018 21:34
@seamuslee001
Copy link
Contributor Author

@eileenmcnaughton this is against the RC now should we put it as merge on pass?

@seamuslee001
Copy link
Contributor Author

Merging per the tag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants