Report cannot search on associative field with integer keys
Brought to you by:
jberanek
We have a custom field with select options that must have integer keys as they are defined by a custom table that has an autoincrement index field. This only seems to be a problem in report. When called with no parameters, report correctly loads the select options as a datalist. On the subsequent call, the URI is properly formed with match_fieldname=textvalue. However, because of the following code, $match_fieldname gets the value zero from get_form_var because $var_type takes on the value 'integer' from the MYSQL field properties.
// Get the custom form inputs
foreach ($custom_fields as $key => $value)
{
$var = "match_$key";
if (($field_natures[$key] == 'integer') && ($field_lengths[$key] > 2))
{
$var_type = 'int';
}
else
{
$var_type = 'string';
}
$$var = get_form_var($var, $var_type);
}
I'm wondering if a configuration setting such as
$force_assoc['fieldname']=TRUE;
would be a viable solution to this and ticket 387
// Get the custom form inputs
foreach ($custom_fields as $key => $value)
{
$var = "match_$key";
if (($field_natures[$key] == 'integer')
&& ($field_lengths[$key] > 2)
&& (!$force_assoc[$key])
{
$var_type = 'int';
}
else
{
$var_type = 'string';
}
$$var = get_form_var($var, $var_type);
}