- system alias no longer persists after system delete

- reset some character table columns on corp change or character sold
This commit is contained in:
Exodus4D
2017-05-28 15:00:00 +02:00
parent f126e07fdb
commit 398615cc5c
4 changed files with 31 additions and 6 deletions

View File

@@ -200,6 +200,22 @@ class CharacterModel extends BasicModel {
return $characterData;
}
/**
* set corporation for this character
* -> corp change resets admin actions (e.g. kick/ban)
* @param $corporationId
* @return mixed
*/
public function set_corporationId($corporationId){
$currentCorporationId = (int)$this->get('corporationId', true);
if($currentCorporationId !== $corporationId){
$this->resetAdminColumns();
}
return $corporationId;
}
/**
* set unique "ownerHash" for this character
* -> Hash will change when character is transferred (sold)
@@ -207,9 +223,12 @@ class CharacterModel extends BasicModel {
* @return string
*/
public function set_ownerHash($ownerHash){
if( $this->ownerHash !== $ownerHash ){
if( $this->hasUserCharacter() ){
// reset admin actions (e.g. kick/ban)
$this->resetAdminColumns();
// new ownerHash -> new user (reset)
$this->userCharacter->erase();
}
@@ -365,6 +384,13 @@ class CharacterModel extends BasicModel {
parent::clearCacheDataWithPrefix(self::DATA_CACHE_KEY_LOG);
}
/**
* resets some columns that could have changed by admins (e.g. kick/ban)
*/
private function resetAdminColumns(){
$this->kick();
}
/**
* check whether this character has already a user assigned to it
* @return bool