Skip to content

Instantly share code, notes, and snippets.

@chadhutchins
Last active August 29, 2015 14:10
Show Gist options
  • Save chadhutchins/10b62a30ec9e6614dde0 to your computer and use it in GitHub Desktop.
Save chadhutchins/10b62a30ec9e6614dde0 to your computer and use it in GitHub Desktop.
<?php
/**
* Put this immediately before line 92 in SugarModules/modules/off_Dynamic_Target_List/dynamic_AddJobsHere.php
**/
// check if sugarchimp table exists and the list has a synced mailchimp list id
if (!empty($obj_custom->mailchimp_list_name_c) && $db->getRowCount($db->query("SHOW TABLES LIKE 'sugarchimp'"))==1)
{
// insert 'remove mailchimp subscriber' jobs for each record that is getting removed from the prospect_lists_prospects table
$sql = "INSERT INTO sugarchimp
SELECT ".$db->getGuidSQL().", 'RemoveMailchimpSubscriber', ".$db->now().", ".$db->now().",1,1,'',0,'".$obj_custom->mailchimp_list_name_c."',related_type,related_id,NULL,NULL,NULL
FROM prospect_lists_prospects
WHERE
deleted=0 AND
query_name='".$query_name."' AND
related_type='".$target_module."'";
$db->query($sql, false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment