The location_handler_filter_eq function in locaiton_views.module does not handle the values and operators from the province select filter form correctly. These values are not processed, so the resulting query uses "location.province_select" in the WHERE clause instead of "location" and does not pass the form value through location_form2api, therefore using the 'us-DC' format used in the select element instead of the 'DC' format used in the db. The non functioning queries look like:

SELECT ... WHERE ... AND ... location.province_select = 'us-DC' ...

I think they should be something more like:

SELECT ... WHERE ... AND ... location.province = 'DC'

Using a flow-through in the switch statement and setting the "field" value of the filterinfo var to 'province' when it is equal to 'province_select' seems to fix this. Patch attached.

CommentFileSizeAuthor
location_views.module.patch449 bytesethanw

Comments

darkodev’s picture

Thanks so much for posting this. Still didn't work for me, as it was still passing 'en-WA' for example.

These modifications to your patch worked for me:

case ('province_select'):
  $filterinfo['field'] = 'province';
  $filter['value'] = location_form2api(array('province' => $filter['value']));
  // strip unwanted 'us-' and pass only 'WA' for example
  $filter['value'] = substr($filter['value']['province'],strpos($filter['value']['province'],'-'),strlen($filter['value']['province']));
  break;
bdragon’s picture

Component: Code » Fixed in L3
bdragon’s picture

Status: Active » Closed (won't fix)

Wontfix for 2.x.