/**
  * Delete this object
  *
  * @param void
  * @return boolean
  */
 function delete()
 {
     if ($this->getUserId() && logged_user() instanceof User && !can_manage_security(logged_user())) {
         return false;
     }
     // if
     $roles = $this->getRoles();
     if ($roles) {
         foreach ($roles as $role) {
             $role->delete();
         }
     }
     $this->deletePicture();
     return parent::delete();
 }
 /**
  * Delete this object
  *
  * @param void
  * @return boolean
  */
 function delete()
 {
     // dont delete owner company and account owner
     if ($this->isOwnerCompany() || $this->isAccountOwner()) {
         return false;
     }
     if ($this->isUser() && logged_user() instanceof Contact && !can_manage_security(logged_user())) {
         return false;
     }
     $this->deletePicture();
     ContactEmails::clearByContact($this);
     ContactAddresses::clearByContact($this);
     ContactTelephones::clearByContact($this);
     ContactWebpages::clearByContact($this);
     ContactImValues::clearByContact($this);
     return parent::delete();
 }
 /**
  * Delete this object
  *
  * @param void
  * @return boolean
  */
 function delete()
 {
     if ($this->isAccountOwner()) {
         return false;
     }
     // if
     if ($this->isTaggable()) {
         $this->clearTags();
     }
     // if
     // TODO check all things that need to be deleted
     // ticket subscriptions
     // message subscriptions
     // project-user association
     $this->deleteAvatar();
     $this->clearImValues();
     if ($this->hasUserAccount()) {
         ProjectUsers::clearByUser($this->getUserAccount());
         MessageSubscriptions::clearByUser($this->getUserAccount());
         $this->getUserAccount()->delete();
     }
     // if
     return parent::delete();
 }