/** * Function to perform post save processing (extends parent function) * * @access public */ function postProcess() { $session = CRM_Core_Session::singleton(); $saveParams = array('rule_id' => $this->_submitValues['rule_id'], 'condition_id' => $this->_submitValues['rule_condition_select']); if (isset($this->_submitValues['rule_condition_link_select'])) { $saveParams['condition_link'] = $this->_submitValues['rule_condition_link_select']; } $ruleCondition = CRM_Civirules_BAO_RuleCondition::add($saveParams); $condition = CRM_Civirules_BAO_Condition::getConditionObjectById($ruleCondition['condition_id'], true); $redirectUrl = $condition->getExtraDataInputUrl($ruleCondition['id']); if (empty($redirectUrl)) { $redirectUrl = CRM_Utils_System::url('civicrm/civirule/form/rule', 'action=update&id=' . $this->_submitValues['rule_id'], TRUE); } else { $redirectUrl .= '&action=add'; } $session->setStatus('Condition added to CiviRule ' . CRM_Civirules_BAO_Rule::getRuleLabelWithId($this->_submitValues['rule_id']), 'Condition added', 'success'); CRM_Utils_System::redirect($redirectUrl); }
public static function emptyConditionLinkForFirstCondition($rule_id) { $conditionParams = array('is_active' => 1, 'rule_id' => $rule_id); $ruleConditions = CRM_Civirules_BAO_RuleCondition::getValues($conditionParams); if (count($ruleConditions)) { $ruleCondition = reset($ruleConditions); $ruleCondition['condition_link'] = 'null'; CRM_Civirules_BAO_RuleCondition::add($ruleCondition); } }