Skip to content
Snippets Groups Projects
Commit 1d11255c authored by Jaap Jansma's avatar Jaap Jansma
Browse files

Merge pull request #82 from systopia/dev_fix_relationship_trigger

Fix relationship trigger
parents fa73975d f140ac72
No related branches found
No related tags found
No related merge requests found
......@@ -278,7 +278,11 @@ class CRM_Civirules_Engine {
$sql = "INSERT INTO `civirule_rule_log` (`rule_id`, `contact_id`, `log_date`) VALUES (%1, %2, NOW())";
$params[1] = array($triggerData->getTrigger()->getRuleId(), 'Integer');
$params[2] = array($triggerData->getContactId(), 'Integer');
CRM_Core_DAO::executeQuery($sql, $params);
if (empty($params[2])) {
CRM_Civirules_Utils_LoggerFactory::logError("Failed log rule", "contact_id not set", $triggerData);
} else {
CRM_Core_DAO::executeQuery($sql, $params);
}
}
}
\ No newline at end of file
......@@ -12,6 +12,8 @@ class CRM_Civirules_TriggerData_Post extends CRM_Civirules_TriggerData_TriggerDa
$this->setEntityData($entity, $data);
if ($entity == 'contact') {
$this->contact_id = $objectId;
} elseif (strtolower($entity) == 'relationship' && isset($data['contact_id_a'])) {
$this->contact_id = $data['contact_id_a'];
} elseif (isset($data['contact_id'])) {
$this->contact_id = $data['contact_id'];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment