Merge pull request #496 from muskie9/bugfix/#492

BUGFIX no Sort value applie to EditableOption on write
This commit is contained in:
Damian Mooyman 2016-07-25 18:17:01 +12:00 committed by GitHub
commit ca2a6a3e99
1 changed files with 11 additions and 0 deletions

View File

@ -114,4 +114,15 @@ class EditableOption extends DataObject {
public function canUnpublish($member = null) {
return $this->canDelete($member);
}
/**
*
*/
protected function onBeforeWrite() {
if (!$this->Sort) {
$this->Sort = EditableOption::get()->max('Sort') + 1;
}
parent::onBeforeWrite();
}
}