Skip to content
Snippets Groups Projects
Commit 36f45230 authored by jaapjansma's avatar jaapjansma
Browse files

added block for adding dynamic content to civirules

parent 72627ae7
Branches
Tags
No related merge requests found
......@@ -118,7 +118,7 @@ abstract class CRM_Civirules_Action {
$context['action_label'] = CRM_Civirules_BAO_Action::getActionLabelWithId($this->ruleAction['action_id']);
$context['action_parameters'] = $this->userFriendlyConditionParams();
$context['contact_id'] = $eventData ? $eventData->getContactId() : - 1;
$msg = "{action_label} ({rule_action_id}\r\n\r\n{message}\r\n\r\nRule: '{rule_title}' with id {rule_id}";
$msg = "{action_label} (ID: {rule_action_id})\r\n\r\n{message}\r\n\r\nRule: '{rule_title}' with id {rule_id}";
if ($context['contact_id'] > 0) {
$msg .= "\r\nFor contact: {contact_id}";
}
......
......@@ -87,7 +87,7 @@ abstract class CRM_Civirules_Condition {
$context['condition_label'] = CRM_Civirules_BAO_Condition::getConditionLabelWithId($this->ruleCondition['condition_id']);
$context['condition_parameters'] = $this->userFriendlyConditionParams();
$context['contact_id'] = $eventData ? $eventData->getContactId() : - 1;
$msg = "{condition_label} ({rule_condition_id}\r\n\r\n{message}\r\n\r\nRule: '{rule_title}' with id {rule_id}";
$msg = "{condition_label} (ID: {rule_condition_id})\r\n\r\n{message}\r\n\r\nRule: '{rule_title}' with id {rule_id}";
if ($context['contact_id'] > 0) {
$msg .= "\r\nFor contact: {contact_id}";
}
......
......@@ -17,6 +17,8 @@ class CRM_Civirules_Form_Rule extends CRM_Core_Form {
protected $event;
protected $postRuleBlock = '';
/**
* @var CRM_Civirules_Event
*/
......@@ -30,9 +32,31 @@ class CRM_Civirules_Form_Rule extends CRM_Core_Form {
function buildQuickForm() {
$this->setFormTitle();
$this->createFormElements();
$this->assign('postRuleBlock', $this->postRuleBlock);
parent::buildQuickForm();
}
/**
* Post rule details are shown on the form just between the rule name and the
* linked trigger
*
* @return string
*/
public function getPostRuleBlock() {
return $this->postRuleBlock;
}
/**
* Post rule details are shown on the form just between the rule name and the
* linked trigger
*
* @param $postRuleDetails
*/
public function setPostRuleBlock($postRuleBlock) {
$this->postRuleBlock = $postRuleBlock;
$this->assign('postRuleBlock', $this->postRuleBlock);
}
/**
* Function to perform processing before displaying form (overrides parent function)
*
......
......@@ -14,7 +14,7 @@ class CRM_CivirulesConditions_FieldValueComparison extends CRM_CivirulesConditio
protected function getFieldValue(CRM_Civirules_EventData_EventData $eventData) {
$entity = $this->conditionParams['entity'];
$field = $this->conditionParams['field'];
$data = $eventData->getEntityData($entity);
if (isset($data[$field])) {
return $this->normalizeValue($data[$field]);
......
......@@ -20,5 +20,6 @@
<div class="label">{$form.rule_created_contact.label}</div>
<div class="content">{$form.rule_created_contact.value}</div>
<div class="clear"></div>
</div>
</div>
{$postRuleBlock}
</div>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment