+ if ($this->changed['deathdate']) {
+ XDB::execute('UPDATE profiles
+ SET deathdate = {?}, deathdate_rec = NOW()
+ WHERE pid = {?} AND deathdate_rec IS NULL',
+ ProfileSettingDate::toSQLDate($this->values['deathdate']), $this->pid());
+ if (XDB::affectedRows() > 0) {
+ $this->profile->clear();
+ if ($this->owner) {
+ $this->owner->clear(true);
+ }
+ } else {
+ /* deathdate_rec was not NULL, this is just an update of the death date
+ */
+ XDB::execute('UPDATE profiles
+ SET deathdate = {?}
+ WHERE pid = {?}',
+ ProfileSettingDate::toSQLDate($this->values['deathdate']), $this->pid());
+ }
+ }