email folder entity
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
class EmailFolder extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class EmailFilterManager
|
||||
return $this->filtersMatcher;
|
||||
}
|
||||
|
||||
public function getAction(Email $email, $userId)
|
||||
public function getMatchingFilter(Email $email, $userId)
|
||||
{
|
||||
if (!array_key_exists($userId, $this->data)) {
|
||||
$emailFilterList = $this->getEntityManager()->getRepository('EmailFilter')->where(array(
|
||||
@@ -69,7 +69,7 @@ class EmailFilterManager
|
||||
}
|
||||
foreach ($this->data[$userId] as $emailFilter) {
|
||||
if ($this->getFiltersMatcher()->match($email, $emailFilter)) {
|
||||
return $emailFilter->get('action');
|
||||
return $emailFilter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Entities;
|
||||
|
||||
class EmailFolder extends \Espo\Core\ORM\Entity
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -209,9 +209,17 @@ class Email extends \Espo\Core\ORM\Repositories\RDB
|
||||
|
||||
if ($entity->get('isBeingImported')) {
|
||||
foreach ($entity->getLinkMultipleIdList('users') as $userId) {
|
||||
$action = $this->getEmailFilterManager()->getAction($entity, $userId);
|
||||
if ($action === 'Skip') {
|
||||
$entity->setLinkMultipleColumn('users', 'inTrash', $userId, true);
|
||||
$filter = $this->getEmailFilterManager()->getMatchingFilter($entity, $userId);
|
||||
if ($filter) {
|
||||
$action = $filter->get('action');
|
||||
if ($action === 'Skip') {
|
||||
$entity->setLinkMultipleColumn('users', 'inTrash', $userId, true);
|
||||
} else if ($action === 'Move to Folder') {
|
||||
$folderId = $filter->get('folderId');
|
||||
if ($folderId) {
|
||||
$entity->setLinkMultipleColumn('users', 'folderId', $userId, $folderId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
"isNotReplied": "Is Not Replied",
|
||||
"isUsers": "Is User's",
|
||||
"inTrash": "In Trash",
|
||||
"sentBy": "Sent by (User)"
|
||||
"sentBy": "Sent by (User)",
|
||||
"folder": "Folder"
|
||||
},
|
||||
"links": {
|
||||
"replied": "Replied",
|
||||
@@ -70,7 +71,8 @@
|
||||
"Unmark Importance": "Unmark Importance",
|
||||
"Move to Trash": "Move to Trash",
|
||||
"Retrieve from Trash": "Retrieve from Trash",
|
||||
"Filters": "Filters"
|
||||
"Filters": "Filters",
|
||||
"Folders": "Folders"
|
||||
},
|
||||
"messages": {
|
||||
"noSmtpSetup": "No SMTP setup. {link}.",
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"fields": {
|
||||
"skipNotifications": "Skip Notifications"
|
||||
},
|
||||
"labels": {
|
||||
"Create EmailFolder": "Create Folder"
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,8 @@
|
||||
"EmailFilter": "Email Filter",
|
||||
"Portal": "Portal",
|
||||
"PortalRole": "Portal Role",
|
||||
"Attachment": "Attachment"
|
||||
"Attachment": "Attachment",
|
||||
"EmailFolder": "Email Folder"
|
||||
},
|
||||
"scopeNamesPlural": {
|
||||
"Email": "Emails",
|
||||
@@ -43,7 +44,8 @@
|
||||
"EmailFilter": "Email Filters",
|
||||
"Portal": "Portals",
|
||||
"PortalRole": "Portal Roles",
|
||||
"Attachment": "Attachments"
|
||||
"Attachment": "Attachments",
|
||||
"EmailFolder": "Email Folders"
|
||||
},
|
||||
"labels": {
|
||||
"Misc": "Misc",
|
||||
|
||||
@@ -44,6 +44,12 @@
|
||||
"delete": "own",
|
||||
"create": "yes"
|
||||
},
|
||||
"EmailFolder": {
|
||||
"read": "own",
|
||||
"edit": "own",
|
||||
"delete": "own",
|
||||
"create": "yes"
|
||||
},
|
||||
"Preferences": {
|
||||
"read": "own",
|
||||
"edit": "own",
|
||||
@@ -67,6 +73,9 @@
|
||||
},
|
||||
"User": {
|
||||
"gender": false
|
||||
},
|
||||
"EmailFolder": {
|
||||
"assignedUser": false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
"Role": false,
|
||||
"PortalRole": false,
|
||||
"EmailFilter": false,
|
||||
"EmailFolder": false,
|
||||
"EmailAccount": false,
|
||||
"EmailTemplate": false,
|
||||
"Preferences": {
|
||||
|
||||
@@ -41,6 +41,10 @@
|
||||
"acl": "read",
|
||||
"aclScope": "EmailTemplate"
|
||||
},
|
||||
{
|
||||
"label": "Folders",
|
||||
"link": "#EmailFolder"
|
||||
},
|
||||
{
|
||||
"label": "Filters",
|
||||
"link": "#EmailFilter"
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"controller": "controllers/record",
|
||||
"recordViews": {
|
||||
},
|
||||
"searchPanelDisabled": true
|
||||
}
|
||||
@@ -95,6 +95,11 @@
|
||||
"notStorable": true,
|
||||
"default": false
|
||||
},
|
||||
"folder": {
|
||||
"type": "link",
|
||||
"notStorable": true,
|
||||
"readOnly": true
|
||||
},
|
||||
"nameHash": {
|
||||
"type": "text",
|
||||
"notStorable": true,
|
||||
@@ -241,7 +246,8 @@
|
||||
"layoutMassUpdateDisabled": true,
|
||||
"readOnly": true,
|
||||
"columns": {
|
||||
"inTrash": "usersInTrash"
|
||||
"inTrash": "inTrash",
|
||||
"folderId": "folderId"
|
||||
}
|
||||
},
|
||||
"assignedUsers": {
|
||||
@@ -290,6 +296,11 @@
|
||||
"inTrash": {
|
||||
"type": "bool",
|
||||
"default": false
|
||||
},
|
||||
"folderId": {
|
||||
"type": "varchar",
|
||||
"default": null,
|
||||
"maxLength": 24
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"fields": {
|
||||
"name": {
|
||||
"type": "varchar",
|
||||
"required": true,
|
||||
"maxLength": 64,
|
||||
"trim": true
|
||||
},
|
||||
"order": {
|
||||
"type": "int"
|
||||
},
|
||||
"assignedUser": {
|
||||
"type": "link"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "datetime",
|
||||
"readOnly": true
|
||||
},
|
||||
"modifiedAt": {
|
||||
"type": "datetime",
|
||||
"readOnly": true
|
||||
},
|
||||
"createdBy": {
|
||||
"type": "link",
|
||||
"readOnly": true
|
||||
},
|
||||
"modifiedBy": {
|
||||
"type": "link",
|
||||
"readOnly": true
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"createdBy": {
|
||||
"type": "belongsTo",
|
||||
"entity": "User"
|
||||
},
|
||||
"modifiedBy": {
|
||||
"type": "belongsTo",
|
||||
"entity": "User"
|
||||
},
|
||||
"assignedUser": {
|
||||
"type": "belongsTo",
|
||||
"entity": "User"
|
||||
}
|
||||
},
|
||||
"collection": {
|
||||
"sortBy": "order",
|
||||
"asc": true
|
||||
}
|
||||
}
|
||||
@@ -63,6 +63,7 @@ class Email extends \Espo\Core\SelectManagers\Base
|
||||
$result['additionalSelectColumns']['usersMiddle.is_read'] = 'isRead';
|
||||
$result['additionalSelectColumns']['usersMiddle.is_important'] = 'isImportant';
|
||||
$result['additionalSelectColumns']['usersMiddle.in_trash'] = 'inTrash';
|
||||
$result['additionalSelectColumns']['usersMiddle.folder_id'] = 'folderId';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +75,8 @@ class Email extends \Espo\Core\SelectManagers\Base
|
||||
$idList[] = $ea->id;
|
||||
}
|
||||
$d = array(
|
||||
'usersMiddle.inTrash=' => false
|
||||
'usersMiddle.inTrash=' => false,
|
||||
'usersMiddle.folderId' => null
|
||||
);
|
||||
if (!empty($idList)) {
|
||||
$d['fromEmailAddressId!='] = $idList;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\SelectManagers;
|
||||
|
||||
class EmailFilter extends \Espo\Core\SelectManagers\Base
|
||||
{
|
||||
protected function access(&$result)
|
||||
{
|
||||
$this->accessOnlyOwn($result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Services;
|
||||
|
||||
use \Espo\ORM\Entity;
|
||||
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
|
||||
class EmailFolder extends Record
|
||||
{
|
||||
|
||||
protected function beforeCreate(Entity $entity, array $data = array())
|
||||
{
|
||||
parent::beforeCreate($entity, $data);
|
||||
if (!$this->getAcl()->check($entity, 'edit')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user