#1562 - Group codes don't appear to be generated upon creation of group

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@44002 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2007-10-30 03:17:18 +00:00
parent 367cc65019
commit eefc4ffc06

View File

@ -159,6 +159,14 @@ class Group extends DataObject {
public function setCode($val){
$this->setField("Code",SiteTree::generateURLSegment($val));
}
function onBeforeWrite() {
parent::onBeforeWrite();
if(stripos($this->Code, 'new-') === 0) {
$this->setCode($this->Title);
}
}
}
class Group_Unsecure extends Group {
}