/**
  * @param DataObject $rec           This would normally just be a singleton but we don't want to have to create it over and over
  * @param string     $filterField
  * @param mixed      $filterVal
  * @return array - returns the new filter added
  */
 public function processFilterField($rec, $filterField, $filterVal)
 {
     // First check for VFI fields
     if ($rec->hasExtension('VirtualFieldIndex') && ($spec = $rec->getVFISpec($filterField))) {
         if ($spec['Type'] == VirtualFieldIndex::TYPE_LIST) {
             // Lists have to be handled a little differently
             $f = $rec->getVFIFieldName($filterField) . ':PartialMatch';
             if (is_array($filterVal)) {
                 foreach ($filterVal as &$val) {
                     $val = '|' . $val . '|';
                 }
                 return array($f => $filterVal);
             } else {
                 return array($f => '|' . $filterVal . '|');
             }
         } else {
             // Simples are simple
             $filterField = $rec->getVFIFieldName($filterField);
         }
     }
     // Next check for regular db fields
     if ($rec->dbObject($filterField)) {
         // Is it a range value?
         if (preg_match('/^RANGE\\~(.+)\\~(.+)$/', $filterVal, $m)) {
             $filterField .= ':Between';
             $filterVal = array_slice($m, 1, 2);
         }
         return array($filterField => $filterVal);
     }
     return array();
 }