/** * Return tag names for this object * * @access public * @param void * @return array */ function getTagNames() { if (user_config_option('show_emails_as_conversations', true, logged_user()->getId())) { return Tags::getTagNamesByObjectIds(implode(',', $this->getConversationMailIds(true)), 'MailContents'); } else { return parent::getTagNames(); } }
/** * Override defaults. * Also adds mail to sharing table if is not categorized. * Only permissions for the account owner. * * @see ContentDataObject::addToSharingTable() */ function addToSharingTable() { parent::addToSharingTable(); $id = $this->getId(); if(!$this->getAccount() instanceof MailAccount) return; $macs = MailAccountContacts::instance()->getByAccount($this->getAccount()); foreach ($macs as $mac) { $contactId = $mac->getContactId(); $contact = Contacts::instance()->findById($contactId); if (!$contact instanceof Contact) continue; $group_id = $contact->getPermissionGroupId(); if ($group_id) { $sql = "INSERT INTO ".TABLE_PREFIX."sharing_table ( object_id, group_id ) VALUES ('$id','$group_id') ON DUPLICATE KEY UPDATE group_id = group_id "; DB::execute($sql); } } }
/** * Override defaults. * Also adds mail to sharing table if is not categorized. * Only permissions for the account owner. * * @see ContentDataObject::addToSharingTable() */ function addToSharingTable() { parent::addToSharingTable(); $id = $this->getId(); if (!$this->getAccount() instanceof MailAccount) { return; } $contactId = $this->getAccount()->getContactId(); $contact = Contacts::instance()->findById($contactId); if (!$contact instanceof Contact) { return; } $group_id = $contact->getPermissionGroupId(); if ($group_id) { $sql = "INSERT INTO " . TABLE_PREFIX . "sharing_table ( object_id, group_id ) VALUES ({$id},{$group_id}) ON DUPLICATE KEY UPDATE group_id = group_id "; DB::execute($sql); } }