Skip to content

Commit

Permalink
Merge pull request #1 from australiangreens/upgrade_1_23
Browse files Browse the repository at this point in the history
Upgrade to version 1.23
  • Loading branch information
seamuslee001 authored Jun 27, 2019
2 parents 89337cd + dd4abcf commit c2f7d56
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CRM/CivirulesConditions/FieldValueComparison.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected function getFieldValue(CRM_Civirules_TriggerData_TriggerData $triggerD
* @return mixed
*/
protected function convertMultiselectCustomfieldToArray($custom_field_id, $value) {
if (CRM_Civirules_Utils_CustomField::isCustomFieldMultiselect($custom_field_id)) {
if (CRM_Civirules_Utils_CustomField::isCustomFieldMultiselect($custom_field_id) && !is_array($value)) {
$value = trim($value, CRM_Core_DAO::VALUE_SEPARATOR);
$value = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
}
Expand Down Expand Up @@ -114,4 +114,4 @@ public function userFriendlyConditionParams() {
return htmlentities($this->conditionParams['entity'].'.'.$this->conditionParams['field'].' '.($this->getOperator())).' '.htmlentities($value);
}

}
}
15 changes: 15 additions & 0 deletions CRM/CivirulesConditions/Generic/ValueComparison.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,26 @@ protected function compare($leftValue, $rightValue, $operator) {
if (empty($leftValue)) {
return true;
}
else if (is_array($leftValue)){
foreach ($leftValue as $item){
if (!empty($item)){
return false;
}
}
return true;
}
return false;
case 'is not empty':
if (empty($leftValue)) {
return false;
}
else if(is_array($leftValue)){
foreach ($leftValue as $item){
if (empty($item)){
return false;
}
}
}
return true;
default:
return false;
Expand Down
8 changes: 4 additions & 4 deletions docs/basic-example-immediate-processing.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ If you install the extension a new menu item will be added right of the Support

<a href='../img/CiviRules_cookbook_print02.png'><img src='../img/CiviRules_cookbook_print02.png'/></a>

The Find Rules sub menu item you will help you to search for a existing CiviRules. If you click on the New Rule submenu you will see a form with the basic data of your CiviRule:
The Find Rules submenu item you will help you to search for a existing CiviRules. If you click on the New Rule submenu you will see a form with the basic data of your CiviRule:

<a href='../img/CiviRules_cookbook_print03.png'><img src='../img/CiviRules_cookbook_print03.png'/></a>

In this form you can add a title for your CiviRule. Spend some time thinking of a good title that all your users will understand and recognize. In this example we will use Send Welcoming Mail to New Regular Donors.

Next we have to select the trigger for the CiviRule. Each CiviRule can only have one trigger. Trigger are when the conditions are checked and the action(s) of the CiviRule are executed. In this example it is when a contact is added so the trigger is 'Contact of any type is added'. When I have entered this I click on the Next button. I will then go to the form where I can add conditions and actions to my CiviRule:
Next we have to select the trigger for the CiviRule. Each CiviRule can only have one trigger. The trigger is when the condition(s) are checked and the action(s) of the CiviRule are executed. In this example it is when a contact is added so the trigger is 'Contact of any type is added'. When I have entered this I click on the Next button. I will then go to the form where I can add conditions and actions to my CiviRule:

<a href='../img/CiviRules_cookbook_print04.png'><img src='../img/CiviRules_cookbook_print04.png'/></a>

Expand All @@ -30,7 +30,7 @@ When I click on Add Condition I get a form where I can select a condition, like

<a href='../img/CiviRules_cookbook_print05.png'><img src='../img/CiviRules_cookbook_print05.png'/></a>

In the list I will get a list of all conditions that are in the extension. Some conditions will be shipped with the initial extension, but you as a developer you can add you own conditions.
In the list I will get a list of all conditions that are in the extension. Some conditions will be shipped with the initial extension, but as a developer you can add your own conditions.

In this example I want to check if the new contact is member of the group Regular Donors so I select the condition Contact (not) in group. When I click save I can select the group I want and if the contact should be a member of the group or not be a member of the group(s):

Expand All @@ -48,7 +48,7 @@ Finally I have to add the action that has to be executed if the condition(s) of

<a href='../img/CiviRules_cookbook_print08.png'><img src='../img/CiviRules_cookbook_print08.png'/></a>

In the list I will get a list of all actions that are in the extension. Some actions will be shipped with the initial extension, but you as a developer you can add you own actions.
In the list I will get a list of all actions that are in the extension. Some actions will be shipped with the initial extension, but as a developer you can add your own actions.

You also get the option to add a delay, which means a certain time (number of minutes, days, weeks) to wait with the execution of the CiviRule. For example you can set a delay of 10 mins so typing errors are corrected before the CiviRule is executed.

Expand Down
12 changes: 10 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ __Triggers__ that gets CiviRules into action. This will be things like:
__Conditions__ that determine the conditions to be compared when the trigger occurs. The conditions determine if the action will be executed and can be combined with AND or OR. This could be stuff like:

- when it is the first contribution of a donor
- when the contribution is of a certain financial type AND the total amount is more than
- when the contribution is of a certain financial type AND the total amount is more than xxx
- when the contact is member of group xxx.

__Actions__ that specify what is to happen if the trigger occurs and the conditions are met. Each CiviRule can have one or more actions. This could be:

- send an emai, SMS or PDF
- send an email, SMS or PDF
- add a contact to a group
- add an activity to a contact
- remove a tag from a contact
Expand All @@ -37,6 +37,14 @@ This guide has two parts each aimed at a different audience.

CiviRules has been developed for CiviCRM 4.4 and has been tested with CiviCRM 4.6 (release 1.2), as this is the version our sponsors are on. If you want CiviRules updated to a newer version you can do so (check CiviRules on GitHub: https://github.com/CiviCooP/org.civicoop.civirules. Alternatively, if you want us to do it and have some funding, contact Jaap Jansma ([email protected]) or Erik Hommel ([email protected])

## Other useful extensions and modules

If you want to be able to send SMS, emails or create PDFs when a CiviRule is triggered, you will need to install the [SMS API extension](https://civicrm.org/extensions/sms-api), the [Email API extension](https://civicrm.org/extensions/e-mail-api) and the [PDF creation API extension](https://civicrm.org/extensions/pdf-creation-api) from https://civicrm.org/extensions.

To use webform submission as a trigger, you will need to download the [CiviRules webform Drupal module](https://lab.civicrm.org/partners/civicoop/webform_civirules).

These are not available through the user interface. For instructions on how to install them manually, please see the [System Administrator Guide](https://docs.civicrm.org/sysadmin/en/latest/customize/extensions/).

## History

There are a couple of blog post about the development of the extension (in descending publication date):
Expand Down

0 comments on commit c2f7d56

Please sign in to comment.