From 0c0fbc42485eadc7d982bf56cc2072453f901d39 Mon Sep 17 00:00:00 2001 From: Kevin Shenk Date: Mon, 30 Oct 2023 09:17:14 -0400 Subject: [PATCH] fix: skip invalid numbers on SMS `receiver_list` (#22879) This PR switches the loop in the `validate_receiver_nos` function in the SMS Settings Doctype from `break` to `continue`. The prior functionality would throw an error if any recipients on the receiver_list were invalid, which created an issue with SMS notifications that send to a user role, since any user without a valid mobile phone number would prevent the notification sending to any users (even those with valid mobile numbers). By switching the loop from `break` to `continue`, the function still eliminates invalid entries and enforces the existence of at least one valid phone number, but doesn't break sending based on a single absent or invalid recipient entry. [skip ci] --- frappe/core/doctype/sms_settings/sms_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/core/doctype/sms_settings/sms_settings.py b/frappe/core/doctype/sms_settings/sms_settings.py index 0047de1daa..1a68368ba0 100644 --- a/frappe/core/doctype/sms_settings/sms_settings.py +++ b/frappe/core/doctype/sms_settings/sms_settings.py @@ -30,7 +30,7 @@ def validate_receiver_nos(receiver_list): validated_receiver_list = [] for d in receiver_list: if not d: - break + continue # remove invalid character for x in [" ", "-", "(", ")"]: