Merged revisions 43365 via svnmerge from

svn://svn.silverstripe.com/silverstripe/modules/cms/branches/2.1.0-rc3oriwave2

........
  r43365 | hsmith | 2007-10-12 15:33:57 +1300 (Fri, 12 Oct 2007) | 1 line
  
  Changed call to ViewableData::castingHelperPair to fix sort not being set by getNewItem
........


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@49766 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-02-19 00:15:44 +00:00
parent a5b8e4f9c4
commit 8cee1ab4de

View File

@ -441,7 +441,9 @@ JS;
$newItem->ClassName = $className;
$newItem->ParentID = $parentID;
if($newItem->fieldExists('Sort')) {
// DataObject::fieldExists only checks the current class, not the hierarchy
// This allows the CMS to set the correct sort value
if($newItem->castingHelperPair('Sort')) {
$newItem->Sort = DB::query("SELECT MAX(Sort) FROM SiteTree WHERE ParentID = '" . Convert::raw2sql($parentID) . "'")->value() + 1;
}