Created
February 7, 2017 17:48
-
-
Save joebordes/0ed9a65ae8d109f074d2dbce8a7986e6 to your computer and use it in GitHub Desktop.
coreBOS protect mailchimp update on empty email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 716e75e6f17be7792310c8b8d748e2484600167d | |
Author: Omar Llorens <omar@tsolucio.com> | |
Date: Tue Feb 7 08:48:42 2017 +0100 | |
fix(Mailchimp) protect account, contacts and leads when to not update them with empty names | |
diff --git a/modules/Mailchimp/webhooks.class.php b/modules/Mailchimp/webhooks.class.php | |
index 91d3370..c29c6c4 100644 | |
--- a/modules/Mailchimp/webhooks.class.php | |
+++ b/modules/Mailchimp/webhooks.class.php | |
@@ -204,14 +204,14 @@ class Webhooks { | |
$groups = $data['data']['merges']['GROUPINGS']; | |
// First update the names ... | |
- | |
- $sql = "UPDATE vtiger_contactdetails SET firstname = '$firstname', lastname = '$lastname' WHERE email = '$email'"; | |
- $result = $adb->query($sql); | |
- $sql = "UPDATE vtiger_leaddetails SET firstname = '$firstname', lastname = '$lastname' WHERE email = '$email'"; | |
- $result = $adb->query($sql); | |
- $sql = "UPDATE vtiger_account SET accountname = '$firstname' WHERE email1 = '$email'"; | |
- $result = $adb->query($sql); | |
- | |
+ if(!empty($lastname) && !empty($firstname)){ | |
+ $sql = "UPDATE vtiger_contactdetails SET firstname = '$firstname', lastname = '$lastname' WHERE email = '$email'"; | |
+ $result = $adb->query($sql); | |
+ $sql = "UPDATE vtiger_leaddetails SET firstname = '$firstname', lastname = '$lastname' WHERE email = '$email'"; | |
+ $result = $adb->query($sql); | |
+ $sql = "UPDATE vtiger_account SET accountname = '$firstname' WHERE email1 = '$email'"; | |
+ $result = $adb->query($sql); | |
+ } | |
$include_groupIds = $remove_groupIds = array(); | |
// get groups ids | |
@@ -289,4 +289,4 @@ class Webhooks { | |
} | |
-?> | |
\ No newline at end of file | |
+?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment