Commit 72f7d7a9 authored by Monish Deb's avatar Monish Deb

Merge pull request #7940 from seamuslee001/CRM-18181

CRM-18181 Get all mailings that use mailings that an acled user can see
parents 035a159a 0fb7d0a1
......@@ -2454,6 +2454,19 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id = m.id
while ($dao->fetch()) {
$mailingIDs[] = $dao->id;
}
//CRM-18181 Get all mailings that use the mailings found earlier as receipients
if (!empty($mailingIDs)) {
$mailings = implode(',', $mailingIDs);
$mailingQuery = "
SELECT DISTINCT ( m.id ) as id
FROM civicrm_mailing m
LEFT JOIN civicrm_mailing_group g ON g.mailing_id = m.id
WHERE g.entity_table like 'civicrm_mailing%' AND g.entity_id IN ($mailings)";
$mailingDao = CRM_Core_DAO::executeQuery($mailingQuery);
while ($mailingDao->fetch()) {
$mailingIDs[] = $mailingDao->id;
}
}
}
return $mailingIDs;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment