I am getting the following error when saving the rule below:
Warning: call_user_func(commerce_payment_rules_access) [function.call-user-func]: First argument is expected to be a valid callback in RulesReactionRule->access() (line 386 of /home1/computi6/public_html/profiles/commerce_downloads/modules/rules/includes/rules.plugins.inc).
Access violation!
all I am trying to do is get the order status to update to completed when full payment is made (e.g. paypal)
{ "rules_when_paid_in_full_complete_order" : {
"LABEL" : "When Paid in full, Complete order.",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "commerce_order", "rules", "commerce_payment" ],
"ON" : [ "commerce_payment_order_paid_in_full" ],
"DO" : [
{ "commerce_order_update_status" : { "commerce_order" : [ "commerce_order" ], "order_status" : "completed" } },
{ "drupal_message" : { "message" : "YES!!! your order was completed." } },
{ "mail" : {
"to" : "[commerce-order:mail]",
"subject" : "Order [commerce-order:order-number] is complete",
"message" : "[site:name][commerce-order:order-number]"
}
}
]
}
}
Comments
Comment #1
rszrama commentedI'm not getting this error, so I'm going to assumed this has been fixed since then. I'm pretty sure we just had a bug in our payment access function that got ironed out after this report was made.
Comment #2
jweowu commentedcommerce_payment_rules_event_info()registers an eventcommerce_payment_order_paid_in_fullwith'access callback' => 'commerce_payment_rules_access'No
commerce_payment_rules_access()function exists in the code base, and I'm getting a similar error to the above:Comment #3
amateescu commentedEasy patch then? Or we should use
commerce_order_rules_accessinstead ofcommerce_payment_rules_access?Comment #4
rszrama commentedTo be honest, I have no clue what these access callbacks exist for. Most payment transaction operations come in the context of an order; if you can view an order, you can view its payment transactions. When we're dealing with Rules events, I suppose the access callback just determines your ability to add Rules to the event. Is this right? If this is the case, I don't know why we'd restrict access to this event at all, but I guess it would be more appropriate to use an order check if possible.
Comment #5
amateescu commentedThat was my initial thought as well :)
Comment #6
rszrama commentedAlrighty, confirmed the purpose of the access callback and committed the patch in #5.