Active
Project:
Rules
Version:
7.x-2.0
Component:
Rules Engine
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Nov 2011 at 18:13 UTC
Updated:
27 Jun 2012 at 15:15 UTC
I'm using the field collections module which provides a 'host-entity' chain. When I use the data selector input method, the chained tokens work but not when in direct input mode. I assumed this would work since there's this message
Note that token replacements containing chained objects – such as [node:author:uid] – are not listed here, but are still available. The data selection input mode may help you find more complex replacement patterns.
example:
item:host-entity:mail works in data selection mode.
[item:host-entity:mail] does not work in direct input mode.
Is this supposed to work. Could it be a problem with field-collections? How would I find out?
Comments
Comment #0.0
ErnestoJaboneta commentedclarification
Comment #1
arbel commentedSame issue for me.
Comment #2
arbel commentedanyone?
Comment #3
willito commentedI have the same exact issue. Chained tokens do not work in direct input mode, but function as expected in data selection mode. I am also using field-collections.
Comment #4
ksouthworth commentedI also have this exact same issue
Comment #5
brandy.brown commentedi am not using field collections, but I have this same problem.
Comment #6
nmc commentedI'm not using field collections but have the same problem whereby tokens work when in Data Selection mode but not in direct input mode.
I think this is the same issue: #1475946: How to access tokens from fetched entity fields?
Comment #7
fagoIf you have problems with that please try updating to the entity api dev version. If this doesn't help please re-open and provide more details on the not working tokens.
Comment #8
nmc commentedI tested using the entity api dev version. Some of the tokens that were previously working stopped working and the tokens that were not working started to work.
Will test more thoroughly and provide more details later.
Comment #9
nmc commentedThe following are custom fields (textfields) in the user account (admin/config/people/accounts/fields):
[commerce-order:owner:field-user-business-name] <-- worked previously, STILL works
[commerce-order:owner:field-user-contact-name] <-- worked previously, STILL works
[commerce-order:owner:field-user-phone] <-- worked previously, STOPPED working
[commerce-order:owner:field-user-fax] <-- worked previously, STOPPED working
The following are from the addressfield fields in the user account (admin/config/people/accounts/fields). These were the fields that were NOT working previously but are now working.
[commerce-order:owner:field-user-billing-address:thoroughfare]
[commerce-order:owner:field-user-billing-address:premise]
[commerce-order:owner:field-user-billing-address:locality]
[commerce-order:owner:field-user-billing-address:administrative-area]
[commerce-order:owner:field-user-billing-address:postal-code]
[commerce-order:owner:field-user-billing-address:country]
There are fields in the commerce order entity and were working previously. They have since STOPPED working.
[commerce-order:field-order-po-number]
[commerce-order:field-order-notes]
I can't see any patterns above especially given that some textfields in the user account work and some dont. Happy to continue testing or provide more detailed feedback if it would help. Let me know.
Comment #10
nmc commentedFurther testing reveals that the fields that done work are fields that are empty. But instead of showing blank, the token gets printed. So where I would expect to see the PO Number or nothing at all if customer left the field blank, I see "[commerce-order:field-order-notes]"
My issue can be fixed by adding
$replacements += array_fill_keys($tokens, '');in the evaluate function, on after line 178 in rules/modules/system.eval.incOr if I'm following core's token_replace function then it should be:
But then you I would have to set
$options['clear']I'm happy to contribute a patch but I'm not certain this is the right solution for everyone.
Comment #11
mitchell commentedNice job investigating this, nmc. If its not too much trouble to roll a patch for others to test, that may help fago save time.
Comment #12
brandy.brown commentedI switched to the dev version of entity and still have no replacement patterns on direct input.
Comment #13
bobslee commentedDoes this somehow relate to issue?
See that thread... I experienced that Entity-RC2 broke some working token replacements with Entity-RC1.
Comment #14
star-szr@nmc - A patch would be great, although it sounds like the patch may not address the original reported issue. Can you confirm or deny?
Setting back to active since there is no patch yet.
Comment #14.0
star-szrclarification