Hi all,
I don't know if this is the right place to report this bug, maybe Date or Entity API would be better - but please be patient with me, its the first bug report I've ever written, I'm new to drupal and I've got no PHP skills. But as the PHP warning is in in a file in sites/all/modules/rules I decided to post this issue here.
What I'm trying to do:
My users have a (required) field "year" of type "date" in their profile specifing the year they graduatet from school. I want to create a possibility to send a Mail to everyone who has graduated in the same year.
I've created an content-type "yearmail", and the following rule:
{ "rules_yearmail" : {
"LABEL" : "Yearmail",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules" ],
"ON" : [ "node_insert" ],
"IF" : [
{ "node_is_of_type" : {
"node" : [ "node" ],
"type" : { "value" : { "yearmail" : "yearmail" } }
}
}
],
"DO" : [
{ "entity_query" : {
"USING" : {
"type" : "user",
"property" : "field_year",
"value" : [ "node:author:field-year" ],
"limit" : "150"
},
"PROVIDE" : { "entity_fetched" : { "user_year_list" : "List of Users with same Year as Author" } }
}
},
{ "LOOP" : {
"USING" : { "list" : [ "user-year-list" ] },
"ITEM" : { "user_year" : "User with same year as author" },
"DO" : [
{ "mail" : {
"to" : [ "user-year:mail" ],
"subject" : [ "node:title" ],
"message" : [ "node:body:value" ],
"from" : [ "node:author:mail" ],
"language" : [ "" ]
}
}
]
}
}
]
}
}
The error
If a user creates a node of type yearmail the node is created correctly, but no email is sent to the other users with the same year, instead the following PHP Warning appears:
Warning: array_values() [function.array-values]: The argument should be an array in rules_action_entity_query() (line 56 of /home/www/web423/html/carlumni/portal/drupal7_test/sites/all/modules/rules/modules/entity.eval.inc).
The rules log states:
rules 04/17/2012 - 13:31 Unable to get the data value for the variable or parameter to. Error: Missing data values.
rules 04/17/2012 - 13:31 Unable to evaluate action mail.
What I've already tested
- Changing the Year-field to type text: everything works correctly
- The error is reproduceable: On a fresh Drupal 7.12 installation the dev versions of these three modules (Date: 7.x-2.x-dev; Entity API: 7.x-1.x-dev; Rules: 7.x-2.x-dev) as well as the recomended releases (Date: 7.x-2.3; Entity API: 7.x-1.0-rc1; Rules: 7.x-2.1) produce that error
If I can provide further information please let me know! Thanks for your great work on Drupal!
cid-baba
Comments
Comment #1
mitchell commentedI'm not sure, but my guess is that the data types aren't matching properly. Anyway, thank you for including all the relevant information (though you could make it a bit shorter). Hopefully someone will kindly come along with info soon.
Comment #2
mitchell commentedMoving this to Date because this error, generated by Rules calling
entity_property_query()on a date field, leads me to believe that this is a bug in Date's Entity API wrapper. #1530042: Get Entity Tokens working may have solved this issue.@cid-baba: Would you please re-test this with the latest code for each module? Thanks for getting involved. PS. what I meant in #1 was that exports can be uploaded in txt files to make the OP more readable. Thanks again for reporting.
Comment #3
alansaviolobo commentedI would like to report this issue. following are the details:
Users have a specific 'role' and a date field attached which specifies when that role should be withdrawn from that user.
If I try to create a rule to pull up all users whose 'date' is 'today', the rule doesnt work. However, if i add a simple text field and try the same rule with that text field, it seems to work.
Here is an export of both the rules:
(rule based on the date field)
(rule based on the text field)