I found that I had a problem that was specific to Oracle (and my submitted func_concat_ws for Oracle) and one that I think folks using any database might see.
The problem all might see involves values that contain spaces with m2o AF_LARGE and descriptors with multiple fields (in my case an employee's fullname and employee ID were in the descriptor). In class.atkmanytoonerelation.inc, in function getConcatFilter (near the end, around line 2307) you'll find the following:
Code:
// to search independent of characters between tags, like spaces and comma's,
// we remove all these separators so we can search for just the concatenated tags in concat_ws [Jeroen]
foreach ($concatSeparators as $separator)
{
$value = str_replace($separator, "", $value);
}
$value = str_replace(" ", "", $value); //add this line, to compensate for func_concat_ws stripping spaces
$db = $this->getDb();
$searchcondition = "UPPER(".$db->func_concat_ws($concatTags, "", true).") LIKE UPPER('%".$value."%')";
I added the line after the foreach loop because func_concat_ws (2 lines later) strips spaces
within fields as well as
between them. Without the added line, I was ending up with comparisons like this:
"JOEASMITH45632" LIKE "%JOE A SMITH45632%"
which, of course, was never true. This change errs on the side of finding extra matches if you have values that differ only in internal spaces.
For consistency's sake, and to make sure that this fix doesn't cause problem if the descriptor contains only one field, func_concat_ws in class.atkdb.inc should be changed from this:
Code:
function func_concat_ws($fields, $separator, $remove_all_spaces = false)
{
if(count($fields)==0 or !is_array($fields)) return '';
elseif(count($fields)==1) return $fields[0];
if ($remove_all_spaces)
{
return "REPLACE ( CONCAT_WS('$separator', ".implode(',',$fields)."), ' ', '') ";
}
else
{
return "CONCAT_WS('$separator', ".implode(',',$fields).")";
}
}
to something like this:
Code:
function func_concat_ws($fields, $separator, $remove_all_spaces = false)
{
if(count($fields)==0 or !is_array($fields)) return '';
elseif(count($fields)==1) $rtnval=$fields[0];
else $rtnval="CONCAT_WS('$separator', ".implode(',',$fields).")";
if ($remove_all_spaces) $rtnval= "REPLACE ( ".$rtnval.", ' ', '') ";
return $rtnval;
}
For changes/issues specific to Oracle, see this topic:
http://atk-framework.com/forum/forum/viewtopic.php?t=18891
I hope this helps others struggling with this.
-Vince