ENHANCEMENT: Member::getTitle() return more flexible title in case of Surname or/and FirstName missing.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@74665 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Normann Lou 2009-04-17 06:00:32 +00:00
parent eb0b76840c
commit 9a5928438a

View File

@ -589,7 +589,17 @@ class Member extends DataObject {
public function getTitle() {
if($this->getField('ID') === 0)
return $this->getField('Surname');
return $this->getField('Surname') . ', ' . $this->getField('FirstName');
else{
if($this->getField('Surname') && $this->getField('FirstName')){
return $this->getField('Surname') . ', ' . $this->getField('FirstName');
}elseif($this->getField('Surname')){
return $this->getField('Surname');
}elseif($this->getField('FirstName')){
return $this->getField('FirstName');
}else{
return null;
}
}
}