BUGFIX: Fixed DataList operations to respect the fact that they're idempotent.

This commit is contained in:
Sam Minnee 2012-06-15 15:30:08 +12:00
parent c051b80b73
commit 792c9058fa
4 changed files with 9 additions and 9 deletions

View File

@ -102,7 +102,7 @@ JS
// Re-add previously removed "Name" filter as combined filter
// TODO Replace with composite SearchFilter once that API exists
if(isset($params['Name'])) {
$list->where(sprintf(
$list = $list->where(sprintf(
'"Name" LIKE \'%%%s%%\' OR "Title" LIKE \'%%%s%%\'',
Convert::raw2sql($params['Name']),
Convert::raw2sql($params['Name'])
@ -110,12 +110,12 @@ JS
}
// Always show folders at the top
$list->sort('(CASE WHEN "File"."ClassName" = \'Folder\' THEN 0 ELSE 1 END), "Name"');
$list = $list->sort('(CASE WHEN "File"."ClassName" = \'Folder\' THEN 0 ELSE 1 END), "Name"');
// If a search is conducted, check for the "current folder" limitation.
// Otherwise limit by the current folder as denoted by the URL.
if(!$params || @$params['CurrentFolderOnly']) {
$list->filter('ParentID', $folder->ID);
$list = $list->filter('ParentID', $folder->ID);
}
// Category filter
@ -124,7 +124,7 @@ JS
$categorySQLs = array();
foreach($exts as $ext) $categorySQLs[] = '"File"."Name" LIKE \'%.' . $ext . '\'';
// TODO Use DataList->filterAny() once OR connectives are implemented properly
$list->where('(' . implode(' OR ', $categorySQLs) . ')');
$list = $list->where('(' . implode(' OR ', $categorySQLs) . ')');
}
return $list;

View File

@ -477,7 +477,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
)));
}
$result->sort('AddAction');
$result = $result->sort('AddAction');
return $result;
}
@ -658,9 +658,9 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
foreach($pages=$filter->pagesIncluded() as $pageMap){
$ids[] = $pageMap['ID'];
}
if(count($ids)) $list->where('"'.$this->stat('tree_class').'"."ID" IN ('.implode(",", $ids).')');
if(count($ids)) $list = $list->where('"'.$this->stat('tree_class').'"."ID" IN ('.implode(",", $ids).')');
} else {
$list->filter("ParentID", is_numeric($parentID) ? $parentID : 0);
$list = $list->filter("ParentID", is_numeric($parentID) ? $parentID : 0);
}
return $list;

View File

@ -69,7 +69,7 @@ class BrokenLinksReport extends SS_Report {
}
}
if($sortBrokenReason) $returnSet->sort('BrokenReason', $direction);
if($sortBrokenReason) $returnSet = $returnSet->sort('BrokenReason', $direction);
return $returnSet;
}

View File

@ -206,7 +206,7 @@ class SS_Report extends ViewableData {
$list = ArrayList::create($reportsArray);
//sort
$list->sort('sort');
$list = $list->sort('sort');
return $list;
}