mlanthaler: Bugfix: Make sure *Priority* is set, otherwise an invalid SQL statement will be generated when the page is published (Priority = ).

(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@41818 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-14 23:33:51 +00:00
parent e452de966c
commit f9c5f25254
1 changed files with 7 additions and 0 deletions

View File

@ -1,4 +1,5 @@
<?php
/**
* @package sapphire
* @subpackage core
@ -490,6 +491,12 @@ class SiteTree extends DataObject {
}
}
// If priority is empty or invalid, set it to the default value
if(!is_numeric($this->Priority) ||
(($this->Priority < 0) || ($this->Priority > 1)))
$this->Priority = self::$defaults['Priority'];
parent::onBeforeWrite();
}