Hi,
in my project I need rules action for reset a flag

CommentFileSizeAuthor
#1 flag-reset-flag-2166975.patch1.38 KBzestagio
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

zestagio’s picture

shabana.navas’s picture

Status: Active » Needs review

Thanks @zestagio. Looks good, but I am not sure how many people will really use this rules action. Would hate to bloat the module with lots of actions that only a random few will use.

I think if we have enough people who want this feature to go into the module, then, we can go ahead and think about adding it.

torgosPizza’s picture

This is a feature I would like, because "trim a flag" does not have enough flexibility for us. Our use case:

- We have commerce products referenced by their display nodes.
- Sometimes there are more than one product attached to these display nodes, but not always.
- I just wrote #2659736: Add a "product is flagged" condition (patch inside) to allow flag-based Commerce Discounts
- To create a new discount that does not exclude previously flagged products, I can't set "trim" to 1 or 2 because this could lead to inconsistent results. The only real option os to reset the flag, and then apply the flag to the new products.

Therefore adding a "reset" action to the scheduled "Flag a product" action component will take the guesswork out of trimming previously flagged discount products.

Thanks!

EDIT: One thing I think could be an issue is that the Action appears to require an entity_id, whereas the reset function itself only has this as an optional parameter. (By default it removes all flags from those entities, but when an entity_id is specified, it removes that entity's flags.) Unless there's a way to specify NULL in the Rules UI's parameter field for that action this patch may Need Work.