Skip to content
Snippets Groups Projects
Commit 0ca3a1cb authored by Erik Hommel's avatar Erik Hommel
Browse files

fix #63 merge conflicts

parents 05e6e810 be3a2df6
Branches
Tags
No related merge requests found
......@@ -5,20 +5,24 @@ class CRM_Civirules_Utils_CustomDataFromPre {
private static $customValues = array();
public static function pre($op, $objectName, $objectId, $params) {
if (is_array($params)) {
if (isset($params['custom']) && is_array($params['custom'])) {
foreach ($params['custom'] as $fid => $custom_values) {
foreach ($custom_values as $id => $field) {
$value = $field['value'];
self::setCustomData($objectName, $fid, $value, $id);
}
if (!is_array($params)) {
return;
}
if (isset($params['custom']) && is_array($params['custom'])) {
foreach($params['custom'] as $fid => $custom_values) {
foreach($custom_values as $id => $field) {
$value = $field['value'];
self::setCustomData($objectName, $fid, $value, $id);
}
}
}
foreach($params as $key => $value) {
if (stripos($key, 'custom_')===0) {
list($custom_, $fid, $id) = explode("_", $key, 3);
self::setCustomData($objectName, $fid, $value, $id);
if (is_numeric($fid)) {
// The variable $fid should contain a valid ID which should be a numeric value.
self::setCustomData($objectName, $fid, $value, $id);
}
}
}
}
......@@ -26,6 +30,10 @@ class CRM_Civirules_Utils_CustomDataFromPre {
private static function setCustomData($objectName, $field_id, $value, $id) {
$v = $value;
if (!is_numeric($field_id)) {
return; // The parameter $field_id should contain a valid ID which is a numeric value.
}
/**
* Convert value array from
* value_a => 1
......
......@@ -21,7 +21,9 @@ class CRM_Civirules_Utils_CustomField {
* @throws CiviCRM_API3_Exception
*/
public static function isCustomFieldMultiselect($customfield_id) {
//var_dump($customfield_id); exit();
$multi_select_types = self::getMultiselectTypes();
$custom_field = civicrm_api3('CustomField', 'getsingle', array('id' => $customfield_id));
if (in_array($custom_field['html_type'], $multi_select_types)) {
return true;
......
......@@ -24,7 +24,21 @@ class CRM_CivirulesActions_Activity_Add extends CRM_CivirulesActions_Generic_Api
$params['status_id'] = $action_params['status_id'];
$params['subject'] = $action_params['subject'];
if (!empty($action_params['assignee_contact_id'])) {
$params['assignee_contact_id'] = $action_params['assignee_contact_id'];
$assignee = array();
if (is_array($action_params['assignee_contact_id'])) {
foreach($action_params['assignee_contact_id'] as $contact_id) {
if($contact_id) {
$assignee[] = $contact_id;
}
}
} else {
$assignee[] = $action_params['assignee_contact_id'];
}
if (count($assignee)) {
$params['assignee_contact_id'] = $action_params['assignee_contact_id'];
} else {
$params['assignee_contact_id'] = '';
}
}
return $params;
}
......@@ -107,4 +121,4 @@ class CRM_CivirulesActions_Activity_Add extends CRM_CivirulesActions_Generic_Api
return 'create';
}
}
\ No newline at end of file
}
......@@ -180,7 +180,7 @@
cj('#original_multi_value_options').html(multi_select_options);
cj('#original_multi_value_options').removeClass('hiddenElement');
cj('#original_multi_value_options input[type="checkbox"]').change(function() {
var currentOptions = cj('#multi_value').val().match(/[^\r\n]+/g);
var currentOptions = cj('#original_multi_value').val().match(/[^\r\n]+/g);
if (!currentOptions) {
currentOptions = new Array();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment