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]"
        }
      }
    ]
  }
}
CommentFileSizeAuthor
#5 1274986-5.patch566 bytesamateescu
#3 1274986.patch720 bytesamateescu

Comments

rszrama’s picture

Status: Active » Closed (cannot reproduce)

I'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.

jweowu’s picture

Version: 7.x-1.x-dev » 7.x-1.1
Status: Closed (cannot reproduce) » Active

commerce_payment_rules_event_info() registers an event commerce_payment_order_paid_in_full with '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:

Warning: call_user_func() expects parameter 1 to be a valid callback, function 'commerce_payment_rules_access' not found or invalid function name in RulesPluginUI::getOptions() (line 767 of [...] rules/ui/ui.core.inc).

amateescu’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new720 bytes

Easy patch then? Or we should use commerce_order_rules_access instead of commerce_payment_rules_access?

rszrama’s picture

Status: Needs review » Needs work

To 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.

amateescu’s picture

Status: Needs work » Needs review
StatusFileSize
new566 bytes

That was my initial thought as well :)

rszrama’s picture

Status: Needs review » Fixed

Alrighty, confirmed the purpose of the access callback and committed the patch in #5.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.