Merged revisions 50805 via svnmerge from

svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.2.2

........
  r50805 | ischommer | 2008-03-11 10:23:53 +1300 (Tue, 11 Mar 2008) | 2 lines
  
  added $searchable_fields in preparation for a more generic search implementation, currently limited to Member.php and MemberTableField.php (mainly to fix bugs caused by r49774 and r47856)
  fixed weird indentation formatting in Member.php
........


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@50801 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-03-10 21:28:15 +00:00
parent b50ca5ca0b
commit ee12df16a4

View File

@ -96,8 +96,6 @@ class MemberTableField extends ComplexTableField {
$fieldList["SetPassword"] = "Password";
}
// $detailFormFields = singleton(Object::getCustomClass($this->stat("data_class")))->getCMSFields();
if(isset($_REQUEST['ctf']['childID']) && $memberID = $_REQUEST['ctf']['childID']) {
$SNG_member = DataObject::get_by_id($this->stat("data_class"),$_REQUEST['ctf']['childID']);
} else {
@ -125,13 +123,13 @@ class MemberTableField extends ComplexTableField {
}
// search
$search = isset($_REQUEST['MemberSearch']) ? Convert::raw2sql($_REQUEST['MemberSearch']) : null;
$SQL_search = isset($_REQUEST['MemberSearch']) ? Convert::raw2sql($_REQUEST['MemberSearch']) : null;
if(!empty($_REQUEST['MemberSearch'])) {
//$this->sourceFilter[] = "( `Email` LIKE '%$search%' OR `FirstName` LIKE '%$search%' OR `Surname` LIKE '%$search%' )";
$sourceF = '( ';
foreach( $fieldList as $k => $v )
$sourceF .= '`$k` LIKE '%$search%' OR ';
$this->sourceFilter[] = substr( $sourceF, 0, -3 ) . ')';
$searchFilters = array();
foreach($SNG_member->stat('searchable_fields') as $fieldName => $fieldSpec) {
$searchFilters[] = "`$fieldName` LIKE '%{$SQL_search}%'";
}
$this->sourceFilter[] = '(' . implode(' OR ', $searchFilters) . ')';
}
// filter by groups