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

moved conditions and actions to managed entities

parent 0531b48a
No related branches found
No related tags found
No related merge requests found
...@@ -19,14 +19,6 @@ class CRM_Civirules_Upgrader extends CRM_Civirules_Upgrader_Base { ...@@ -19,14 +19,6 @@ class CRM_Civirules_Upgrader extends CRM_Civirules_Upgrader_Base {
$this->executeSqlFile('sql/createCiviruleRuleAction.sql'); $this->executeSqlFile('sql/createCiviruleRuleAction.sql');
$this->executeSqlFile('sql/createCiviruleRuleCondition.sql'); $this->executeSqlFile('sql/createCiviruleRuleCondition.sql');
$this->executeSqlFile('sql/createCiviruleRuleLog.sql'); $this->executeSqlFile('sql/createCiviruleRuleLog.sql');
$this->addCondition('CRM_CivirulesConditions_PrimaryEmailChanged', 'primary_email_changed', ts('Primary e-mail addres is changed'));
$this->addCondition('CRM_CivirulesConditions_AgeComparison', 'age_comparison', ts('Age comparison'));
$this->addCondition('CRM_CivirulesConditions_BirthdayChanged', 'birthday_changed', ts('Birthday changed'));
$this->addCondition('CRM_CivirulesConditions_FirstContribution', 'first_contribution_of_contact', ts('First Contribution of a Contact'));
$this->addCondition('CRM_CivirulesConditions_ContributionStatus', 'contribution_status', ts('Contribution status'));
$this->addCondition('CRM_CivirulesConditions_ContributionFinancialType', 'contribution_financial_type', ts('Contribution financial type'));
$this->addCondition('CRM_CivirulesConditions_ContributionAmount', 'contribution_total_amount', ts('Contribution total amount'));
} }
protected function addCondition($class_name, $name, $label) { protected function addCondition($class_name, $name, $label) {
......
<?php
return array (
0 =>
array (
'name' => 'Civirules:Condition.AgeComparison',
'entity' => 'CiviRuleCondition',
'params' =>
array (
'version' => 3,
'name' => 'age_comparison',
'label' => 'Age comparison',
'class_name' => 'CRM_CivirulesConditions_AgeComparison',
'is_active' => 1
),
),
);
\ No newline at end of file
<?php
return array (
0 =>
array (
'name' => 'Civirules:Condition.BirthdayChanged',
'entity' => 'CiviRuleCondition',
'params' =>
array (
'version' => 3,
'name' => 'birthday_changed',
'label' => 'Birthday changed',
'class_name' => 'CRM_CivirulesConditions_BirthdayChanged',
'is_active' => 1
),
),
);
\ No newline at end of file
<?php
return array (
0 =>
array (
'name' => 'Civirules:Condition.ContributionAmount',
'entity' => 'CiviRuleCondition',
'params' =>
array (
'version' => 3,
'name' => 'contribution_total_amount',
'label' => 'Contribution total amount',
'class_name' => 'CRM_CivirulesConditions_ContributionAmount',
'is_active' => 1
),
),
);
\ No newline at end of file
<?php
return array (
0 =>
array (
'name' => 'Civirules:Condition.ContributionFinancialType',
'entity' => 'CiviRuleCondition',
'params' =>
array (
'version' => 3,
'name' => 'contribution_financial_type',
'label' => 'Birthday changed',
'class_name' => 'Contribution financial type',
'is_active' => 1
),
),
);
\ No newline at end of file
<?php
return array (
0 =>
array (
'name' => 'Civirules:Condition.ContributionStatus',
'entity' => 'CiviRuleCondition',
'params' =>
array (
'version' => 3,
'name' => 'contribution_status',
'label' => 'Contribution status',
'class_name' => 'CRM_CivirulesConditions_ContributionStatus',
'is_active' => 1
),
),
);
\ No newline at end of file
<?php
return array (
0 =>
array (
'name' => 'Civirules:Condition.FirstContribution',
'entity' => 'CiviRuleCondition',
'params' =>
array (
'version' => 3,
'name' => 'first_contribution_of_contact',
'label' => 'First Contribution of a Contact',
'class_name' => 'CRM_CivirulesConditions_FirstContribution',
'is_active' => 1
),
),
);
\ No newline at end of file
<?php
return array (
0 =>
array (
'name' => 'Civirules:Condition.PrimaryEmailChanged',
'entity' => 'CiviRuleCondition',
'params' =>
array (
'version' => 3,
'name' => 'primary_email_changed',
'label' => 'Primary e-mail address is changed',
'class_name' => 'CRM_CivirulesConditions_PrimaryEmailChanged',
'is_active' => 1
),
),
);
\ No newline at end of file
<?php
/**
* CiviRuleAction.Create API specification (optional)
* This is used for documentation and validation.
*
* @param array $spec description of fields supported by this API call
* @return void
* @see http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/
function _civicrm_api3_civi_rule_action_delete_spec(&$spec) {
$spec['id']['api_required'] = 0;
}
/**
* CiviRuleAction.Create API
*
* @param array $params
* @return array API result descriptor
* @see civicrm_api3_create_success
* @see civicrm_api3_create_error
*/
function civicrm_api3_civi_rule_action_delete($params) {
CRM_Civirules_BAO_Action::deleteWithId($params['id']);
$returnValues[$params['id']] = array();
return civicrm_api3_create_success($returnValues, $params, 'CiviRuleAction', 'Create');
}
<?php
/**
* CiviRuleAction.Create API specification (optional)
* This is used for documentation and validation.
*
* @param array $spec description of fields supported by this API call
* @return void
* @see http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/
function _civicrm_api3_civi_rule_condition_delete_spec(&$spec) {
$spec['id']['api_required'] = 0;
}
/**
* CiviRuleAction.Create API
*
* @param array $params
* @return array API result descriptor
* @see civicrm_api3_create_success
* @see civicrm_api3_create_error
*/
function civicrm_api3_civi_rule_condition_delete($params) {
CRM_Civirules_BAO_Condition::deleteWithId($params['id']);
$returnValues[$params['id']] = array();
return civicrm_api3_create_success($returnValues, $params, 'CiviRuleAction', 'Create');
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment