🇬🇧United Kingdom @mchaplin

Account created on 24 May 2007, over 17 years ago
#

Recent comments

🇬🇧United Kingdom mchaplin

Drupal 10.2.5
webform_civicrm: 6.2.5
Sorry...this issue is for D7 I guess.
I'll try the same fix in my version though to see if it helps.

🇬🇧United Kingdom mchaplin

I'm afraid I tried the patch
https://git.drupalcode.org/issue/webform-3463864/-/commit/a527618b7181cb...
based on the changes and it failed.

The issue is that it is taking the input $value (a textual string eg 'location1 from my custom options') and then looking in a keyed array $options[$value] eg $options['location1 from my custom options'] which doesn't exist. It should be eg $options[1] etc.

So while it prevents the form from submitting if a bad value is entered, it also prevents the form from submitting if a valid option is chosen.

🇬🇧United Kingdom mchaplin

Has PR 839 made it into a released version?

🇬🇧United Kingdom mchaplin

This is possibly an issue with feeds_tamper - see the issue I raised there
https://www.drupal.org/project/feeds_tamper/issues/3437709#comment-15532308 🐛 $item->get($source) returns null Active

Maybe the hack I did there would tell you something useful?

🇬🇧United Kingdom mchaplin

Except that the required data exists in the item 2 lines above?
ksm($item);//has source data in it from XML

Drupal\feeds\Feeds\Item\DynamicItem {#2704 ▼
  #data: array:2 [▼
    "xpath_title_value" => "Senior Funding Development Lead"
    "xpath_field_flexible_working_options_value" => "Flexitime, Staggered hours"
  ]
}

So that would suggest the config is correct?
The value of $source = "flexible_work" (which is the desired xml tag) but I can't see that in the item?

🇬🇧United Kingdom mchaplin

I'm also hitting this issue with D10.
See https://www.drupal.org/project/feeds_ex/issues/3437598 🐛 Can't set the context Active

🇬🇧United Kingdom mchaplin

The Apache TimeOut directive is often 300 seconds. Hope this helps.

🇬🇧United Kingdom mchaplin

OK so it must go into some sort of loop.
The solution is to add a condition that excludes the outcome set in the action ie I want to set the title to '12345' so I add a condition which excludes nodes where the title == '12345'.

Here the same rule as above but with the extra condition:

uuid: 1773974c-4515-4efa-84ce-97ccbecfa198
langcode: en
status: true
dependencies: { }
id: test1
label: test1
events:
-
event_name: 'rules_entity_update:node--page'
description: ''
tags: { }
config_version: '3'
expression:
id: rules_rule
uuid: f87f1be1-87e4-4afa-a1bc-319c4d00ed9d
weight: 0
conditions:
id: rules_and
uuid: 2dad0d04-a038-4a52-aa8d-4a8748574ee1
weight: 0
conditions:
-
id: rules_condition
uuid: c6123b02-a589-4de1-93df-1036a743372f
weight: 0
condition_id: rules_entity_is_of_bundle
negate: false
context_values:
type: node
bundle: page
context_mapping:
entity: node
context_processors:
type:
rules_tokens: { }
bundle:
rules_tokens: { }
provides_mapping: { }
-
id: rules_condition
uuid: 210bcbc4-2452-4391-9bf1-63af6057c757
weight: 0
condition_id: rules_data_comparison
negate: true
context_values:
operation: '=='
value: '12345'
context_mapping:
data: node.title.value
context_processors:
operation:
rules_tokens: { }
value:
rules_tokens: { }
provides_mapping: { }
actions:
id: rules_action_set
uuid: 91e1cde3-aa98-4642-98bc-6374b0976006
weight: 0
actions:
-
id: rules_action
uuid: 55030240-7f1e-48f8-9389-faeea73ccc21
weight: 0
action_id: rules_data_set
context_values:
value: '12345'
context_mapping:
data: node.title.value
context_processors:
value:
rules_tokens: { }
provides_mapping: { }

🇬🇧United Kingdom mchaplin

Trial and error and using a site message reveals that you should surround the token with brackets
{{@rules.current_date_context:current_date}}
and that returns a Unix timestamp for now.

Rule still crashes if you try to set a date with that.

🇬🇧United Kingdom mchaplin

Here's an export of a test rule that just times out

uuid: 1773974c-4515-4efa-84ce-97ccbecfa198
langcode: en
status: true
dependencies: { }
id: test1
label: test1
events:
-
event_name: 'rules_entity_presave:node--job'
description: ''
tags: { }
config_version: '3'
expression:
id: rules_rule
uuid: f87f1be1-87e4-4afa-a1bc-319c4d00ed9d
weight: 0
conditions:
id: rules_and
uuid: 2dad0d04-a038-4a52-aa8d-4a8748574ee1
weight: 0
conditions:
-
id: rules_condition
uuid: c6123b02-a589-4de1-93df-1036a743372f
weight: 0
condition_id: rules_entity_is_of_bundle
negate: false
context_values:
type: node
bundle: job
context_mapping:
entity: node
context_processors:
type:
rules_tokens: { }
bundle:
rules_tokens: { }
provides_mapping: { }
actions:
id: rules_action_set
uuid: 91e1cde3-aa98-4642-98bc-6374b0976006
weight: 0
actions:
-
id: rules_action
uuid: ca2d3735-fffb-4bdc-8a11-9bcc7bb686ee
weight: 0
action_id: rules_system_message
context_values:
message: hi
type: status
repeat: false
context_mapping: { }
context_processors:
message:
rules_tokens: { }
type:
rules_tokens: { }
repeat:
rules_tokens: { }
provides_mapping: { }
-
id: rules_action
uuid: f9ffdc4a-b1e0-41a5-ab8a-77f023694d23
weight: 0
action_id: rules_data_set
context_values:
value: '2020-11-12 08:00:00'
context_mapping:
data: node.field_approval_date.value
context_processors:
value:
rules_tokens: { }
provides_mapping: { }

🇬🇧United Kingdom mchaplin

mchaplin created an issue.

🇬🇧United Kingdom mchaplin

Hi @KarinG

Its
Drupal Version 9.5.8
CiviCRM 5.58.1
PHP 8.0.28
webform_civicrm 6.2.4

🇬🇧United Kingdom mchaplin

@KarinG Do you mean PR 839 rather than 539?

The patch from https://github.com/colemanw/webform_civicrm/pull/839/files doesn't apply to webform_civicrm 6.2.4.
If manually applied to v 6.2.4, I still had an issue.

Along with the patch changes, I found I also had to add

if (gettype($val) == 'array'){
$element['#webform_multiple'] = true;
}

in function _fillCiviCRMData.
Hope this helps someone.

🇬🇧United Kingdom mchaplin

This module works when the Rules module is installed.

Production build 0.71.5 2024