module_invoke_all doesn't pass arguments by reference.

Patch fixes the problem.

CommentFileSizeAuthor
rules_import.patch712 bytesxen

Comments

fago’s picture

Component: Rules Core » Rules Engine
Category: bug » feature

That was never intended to be possible, what's your use case for that?

xen’s picture

ECommerce uses rules for transaction workflow and in my payment gateway I need to add another state for authorized but not yet captured payments. Apart from defining some additional rules in my module, I need to add a condition to one of the rules defined by ECommerce.

Alternatively, I would have to disable the ECommerce rule and redefine it in my module, but I don't think there's a straitforward way to do that. Correct me if I'm wrong, it's been a while since I looked at the code.

ECommerce is complex enough as it is, I'd rather avoid having to instruct users on how to alter the relevant rules when installing my payment gateway.

Views has a views_default_views_alter hook that allows for something along the same lines, so I think it makes sense if rules has too.

fago’s picture

Title: Implementations of hook_rules_import cannot change the rule » Add hook_default_rules_alter
Version: 6.x-1.1 » 6.x-1.x-dev
Status: Needs review » Needs work

I see, thanks for explaining. However the import is for something different: it allows modules to react on added certain rules being there and is currently used by the rules_forms module to activate used events. This hook is invoked also when you import using the UI.

So I see your use-case and it makes sense, but we just need a separate _alter() hook for default rules. But be aware that user might have the rules of ec already overridden, in that case your changes won't appear in the overridden rule.

xen’s picture

An alter hook doesn't quite solve my problem, but I realize I've been barking up the wrong tree. If the user has modified the eC rule manually, I still need to ensure that my alteration gets applied, as without it, orders that haven't been captured would be marked as completed.

I'll be better off trying to get the condition in eC instead of trying to modify the existing installation.

Doesn't mean that an default_rules_alter wouldn't be generally useful though.

xen’s picture

Status: Needs work » Fixed

Original patch in now.

Status: Fixed » Closed (fixed)

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