Filters using float data type doesn't work with many-to-one and in_operator filters because it replaces all numerics with %d instead of checking to see if it's a float. Here's my workaround:

-    $placeholder = !empty($this->handler->definition['numeric']) ? '%d' : "'%s'";
+    $placeholder = !empty($this->handler->definition['numeric']) ? (($this->handler->content_field[type] == 'number_float') ? '%f' : '%d') : "'%s'";

Is there a better way to check if the field is a float type instead of numeric? If you can point me at that (or say this works ok) I'll be happy to roll and submit a patch against -dev.

Comments

fearlsgroove’s picture

Btw the code in the original post appears in includes/handler.inc.add_filter and handlers/views_handler_filter_many_to_one.add_where

dagmar’s picture

Version: 6.x-2.x-dev » 6.x-3.x-dev

I think we should add a new option in the definition of the handler to define if this is integer or not. And then, make this check. This may require review all numeric handlers...

esmerel’s picture

Category: bug » feature
Status: Active » Postponed
merlinofchaos’s picture

Category: feature » task
Status: Postponed » Active

Changing to active task. This would need someone to do the work.

mustanggb’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)