One of my argument types is "string", and the other is "number". Neither of them show up under token replacement when creating an action.

How am I suppose to get their values?

Comments

fago’s picture

Component: Rules Core » Rules Engine
Status: Active » Fixed

String token support has been recently added. I'm not sure whether numbers work though. If that's missing, reopen as feature request.

fizk’s picture

Title: "string" and "number" types don't show up under token replacement » "number" types don't show up under token replacement
Status: Fixed » Active

Renamed the subject, and leaving as active.

fizk’s picture

Category: bug » feature
colin49’s picture

StatusFileSize
new1.24 KB

I ran into this issue as well. I've attached a patch which adds token replacement for the number rules data type.

colin49’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, number_token_replacement.patch, failed testing.

colin49’s picture

Version: 6.x-1.1 » 6.x-1.2
Status: Needs work » Needs review
StatusFileSize
new1.25 KB

Resubmitting patch this time created from the module's root folder (oops).

fago’s picture

Status: Needs review » Fixed

thanks, I improved the labels a bit and committed it.

colin49’s picture

np - thanks for accepting the patch.

fizk’s picture

Nice :) I have one question, why is the number cast to a float without checking if it is a float?

colin49’s picture

Hey fizk, good point. In fact it probably makes sense to leave out the cast completely. What do you think?

fizk’s picture

I agree, let's take it out. Thanks for the patch!

colin49’s picture

Status: Fixed » Needs review
StatusFileSize
new360 bytes

I've attached a second patch with the float cast removed. Sorry about that fizk / fago!

Status: Needs review » Needs work

The last submitted patch, number_token_replacement_2.patch, failed testing.

fago’s picture

Status: Needs work » Fixed

I do think the cast is fine - it just makes sure it is a number in case it isn't. Let's keep it.

fizk’s picture

But why float? Why not use http://php.net/manual/en/function.intval.php or sprintf("%d"), or something else. A straight cast to float with no checks pretty random.

Status: Fixed » Closed (fixed)

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