Compare commits
273 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f979a8dd46 | |||
| ecf1645e05 | |||
| d015bec89c | |||
| 92e1d4b8e6 | |||
| a75df456e2 | |||
| 5393c2f314 | |||
| c49bcc29db | |||
| 3e74fb49ac | |||
| cf885cafb4 | |||
| 7a7c605687 | |||
| 5676d42801 | |||
| c893a4441d | |||
| c5e1d0847f | |||
| f0b4c2dc79 | |||
| 1584f25af5 | |||
| 761e7b2344 | |||
| 7099c92c39 | |||
| be26ec2651 | |||
| 7a2f49ad43 | |||
| 22477385f7 | |||
| e7ae0862ba | |||
| f501a7377d | |||
| 9ce9ccdb5c | |||
| f8a425b7d1 | |||
| 8ab92f8668 | |||
| e598665242 | |||
| 1bc984f8fa | |||
| 3a0b1a22f0 | |||
| 8fd41d5ea7 | |||
| 787adc72a5 | |||
| a99b043d95 | |||
| 2079c19dc0 | |||
| 9f9ba2c915 | |||
| 31db584658 | |||
| a09c7db717 | |||
| 19bd38bb85 | |||
| 7e678a8378 | |||
| 93c5d7eb91 | |||
| a9fcf5d510 | |||
| 6f1266dcea | |||
| 2395fb6986 | |||
| 48a0fa5e96 | |||
| 95a0f78fa7 | |||
| 85f18fe338 | |||
| cbfad8eb79 | |||
| 5cd4a92049 | |||
| e5b4de1683 | |||
| cdd07a9f44 | |||
| 121eaabe40 | |||
| f559c512fd | |||
| 9aa5ed63d0 | |||
| fa9c0e5b3b | |||
| 469c6f3b45 | |||
| e23e013432 | |||
| e051ef4935 | |||
| 2a4e816448 | |||
| 4095530491 | |||
| 5a40507b54 | |||
| f438b0898b | |||
| 58cfeeb1be | |||
| 6dbd521501 | |||
| 541cb13ec3 | |||
| e7fbcbbac6 | |||
| 7bc3d8a826 | |||
| a814a95c9a | |||
| e95a40f24d | |||
| b5972da08e | |||
| 9f488c5539 | |||
| aeea86155c | |||
| 843ca2a7c5 | |||
| bbb67856c0 | |||
| 1100e82364 | |||
| 7dfafaee22 | |||
| cd1aab0b1e | |||
| fa9c2806ca | |||
| 736a53c8d0 | |||
| 0b713be508 | |||
| 715b290174 | |||
| 54d241d247 | |||
| bf8f9023e2 | |||
| f57c81efe4 | |||
| 6d12cf44b4 | |||
| 4e76855a12 | |||
| 724b2adbbd | |||
| c95031912a | |||
| 4f7c6dacee | |||
| 716e434099 | |||
| f1f566d56f | |||
| 4cf1b8dbda | |||
| 87ce26f3cd | |||
| 94c157df7a | |||
| d13ccb8dc7 | |||
| b73d82ba00 | |||
| afdeeeffa7 | |||
| 16cd135cb7 | |||
| 0c6df91604 | |||
| 58a6ced886 | |||
| d0d3f39f5d | |||
| 82a96c743c | |||
| a18453c3af | |||
| a75dc61748 | |||
| 0a60663548 | |||
| 53cac1c299 | |||
| 4d624aa6d1 | |||
| ca807c7ec8 | |||
| f245b30d90 | |||
| 0cfb29ad6d | |||
| 27ed23cb51 | |||
| 1794042cea | |||
| 6657078a89 | |||
| a156e869fc | |||
| 06ffe9d373 | |||
| 817fc2fd40 | |||
| 2ec4464a52 | |||
| e79874c039 | |||
| 72b9d77e44 | |||
| c622b976de | |||
| 4e0d570f90 | |||
| ffce8cb0f7 | |||
| 6dd2e365ad | |||
| c324729cdf | |||
| 5b3eee299c | |||
| 2ff6946b91 | |||
| c3a44a413a | |||
| a4050b1476 | |||
| 2da6d68fe3 | |||
| ed19b9d328 | |||
| f41e4f2df4 | |||
| 410bd7f177 | |||
| caa659020e | |||
| 877820f5f5 | |||
| 18c6847481 | |||
| 274c043f44 | |||
| 529d8c1100 | |||
| c05c169948 | |||
| 99db3f5416 | |||
| 1fa976a43c | |||
| 32198144cc | |||
| 29420a5306 | |||
| 67f6f9b250 | |||
| c2bbc2e61e | |||
| 2d74cddf86 | |||
| 53049cf1f4 | |||
| 6aa012891d | |||
| 5a7f3ed101 | |||
| 131743e702 | |||
| b5cde9a157 | |||
| b150aad977 | |||
| 75d220e74d | |||
| 39a3d215d6 | |||
| 8fe87ccd04 | |||
| 621a2ffbbf | |||
| 0f582c59ab | |||
| ce18f41400 | |||
| d780847232 | |||
| c074423f0b | |||
| 31cb2fed88 | |||
| 225f407545 | |||
| f10dd19446 | |||
| 78d5547e08 | |||
| af08f23ca1 | |||
| 99d2f14008 | |||
| a90a2b859d | |||
| b0edae1eae | |||
| a5d923c4e3 | |||
| 86e118341e | |||
| ed152c9d4c | |||
| 8fa805f5eb | |||
| 16ce5385f4 | |||
| d1fe581706 | |||
| dc651b5d77 | |||
| be3dabe5a7 | |||
| 21326ec3b5 | |||
| 8b851463bc | |||
| d4a3eb1026 | |||
| 0980120184 | |||
| db275028d1 | |||
| f78004b9d3 | |||
| bac0227675 | |||
| 9f84faa776 | |||
| 639c52d1d6 | |||
| 811db09a1d | |||
| 9c61e03542 | |||
| 3e4e86bd5a | |||
| 5acf253a98 | |||
| 84cfcd4352 | |||
| 73f3673a11 | |||
| 2c18f75152 | |||
| 3601ee35bd | |||
| 76379f49be | |||
| 1f1fc9111f | |||
| 334bd55ad6 | |||
| 2f9f0964ed | |||
| b5b04f85d0 | |||
| 554f5de0af | |||
| 5f528c9f6f | |||
| 64b98a7a3c | |||
| 74c9d5a8e6 | |||
| ff2ca7f18c | |||
| a0203d3310 | |||
| bddd55213f | |||
| fa97c0ede4 | |||
| 1dbfe36d1e | |||
| ec898f297a | |||
| 67049d2f08 | |||
| a2c7f84907 | |||
| 338ba010a2 | |||
| a9737e8352 | |||
| fb8a4b90ca | |||
| 6876bd9a6d | |||
| 392f107de1 | |||
| 17ab2cc717 | |||
| abddb6c686 | |||
| 0a5ec4b81c | |||
| ddba654f00 | |||
| 27a5833b36 | |||
| c4cc29b452 | |||
| ac56846e1b | |||
| efb7592782 | |||
| 6c40c5a20c | |||
| 724c79d089 | |||
| 7148cb232b | |||
| 9943d1794b | |||
| 972615c8e6 | |||
| 213546b83f | |||
| e23345edc6 | |||
| 7af38e8d21 | |||
| b1e62ecb20 | |||
| f05e3924ff | |||
| 2ccb9c3a17 | |||
| c64d27f413 | |||
| 2a3711d0b4 | |||
| 2baace4ef9 | |||
| aa501a4429 | |||
| 3095f61011 | |||
| 001de70fe8 | |||
| 58733450d1 | |||
| 0605672c32 | |||
| 0c570b0d83 | |||
| 0833428b71 | |||
| 4c4714a846 | |||
| 155cd428f6 | |||
| 06bde4f1ce | |||
| 6112a9d02d | |||
| a3f4beac61 | |||
| b116821731 | |||
| 3439267926 | |||
| 1ac55737b4 | |||
| c66cfeb297 | |||
| 85f9fe6f3b | |||
| fe9154fde7 | |||
| bdc7bbada4 | |||
| 9f4a203abe | |||
| c38544e6ad | |||
| 6122edb091 | |||
| 684441040c | |||
| 55c733b13a | |||
| dc7571d30c | |||
| 699c1d1f23 | |||
| f67fbbd621 | |||
| dbcc7e61c1 | |||
| 859f1f0cd9 | |||
| 3f8ccb69fc | |||
| ba65ccffe4 | |||
| c87c657b02 | |||
| ec17306992 | |||
| 9b6bf4171b | |||
| 252b5ef729 | |||
| ced41021f0 | |||
| 36e3cc4688 | |||
| 0ab702726d | |||
| dec5ab6a16 | |||
| 68cbadda4c |
+4
-3
@@ -17,7 +17,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
************************************************************************/
|
||||
module.exports = function (grunt) {
|
||||
|
||||
var jsFilesToMinify = [
|
||||
@@ -65,10 +65,10 @@ module.exports = function (grunt) {
|
||||
'client/src/controllers/base.js',
|
||||
'client/src/view.js',
|
||||
];
|
||||
|
||||
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
|
||||
|
||||
mkdir: {
|
||||
tmp: {
|
||||
options: {
|
||||
@@ -154,6 +154,7 @@ module.exports = function (grunt) {
|
||||
'bootstrap.php',
|
||||
'cron.php',
|
||||
'rebuild.php',
|
||||
'upgrade.php',
|
||||
'index.php',
|
||||
'LICENSE.txt',
|
||||
'.htaccess',
|
||||
|
||||
@@ -72,7 +72,7 @@ class Admin extends \Espo\Core\Controllers\Base
|
||||
{
|
||||
$upgradeManager = new \Espo\Core\UpgradeManager($this->getContainer());
|
||||
|
||||
$upgradeManager->install($data['id']);
|
||||
$upgradeManager->install($data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -29,18 +29,18 @@ use \Espo\Core\Exceptions\Error;
|
||||
class Email extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
public function actionGetCopiedAttachments($params, $data, $request)
|
||||
{
|
||||
{
|
||||
$id = $request->get('id');
|
||||
|
||||
|
||||
return $this->getRecordService()->getCopiedAttachments($id);
|
||||
}
|
||||
|
||||
|
||||
public function actionSendTestEmail($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
|
||||
if (empty($data['password'])) {
|
||||
if ($data['type'] == 'preferences') {
|
||||
if (!$this->getUser()->isAdmin() && $data['id'] != $this->getUser()->id) {
|
||||
@@ -50,7 +50,7 @@ class Email extends \Espo\Core\Controllers\Record
|
||||
if (!$preferences) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
|
||||
$data['password'] = $this->getContainer()->get('crypt')->decrypt($preferences->get('smtpPassword'));
|
||||
} else {
|
||||
if (!$this->getUser()->isAdmin()) {
|
||||
@@ -59,8 +59,21 @@ class Email extends \Espo\Core\Controllers\Record
|
||||
$data['password'] = $this->getConfig()->get('smtpPassword');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $this->getRecordService()->sendTestEmail($data);
|
||||
}
|
||||
|
||||
public function actionMarkAsRead($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
if (empty($data['ids']) || !is_array($data['ids'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
$ids = $data['ids'];
|
||||
|
||||
return $this->getRecordService()->markAsReadByIds($ids);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -28,22 +28,22 @@ use \Espo\Core\Exceptions\BadRequest;
|
||||
use \Espo\Core\Exceptions\NotFound;
|
||||
|
||||
class Preferences extends \Espo\Core\Controllers\Base
|
||||
{
|
||||
{
|
||||
protected function getPreferences()
|
||||
{
|
||||
return $this->getContainer()->get('preferences');
|
||||
}
|
||||
|
||||
|
||||
protected function getEntityManager()
|
||||
{
|
||||
return $this->getContainer()->get('entityManager');
|
||||
}
|
||||
|
||||
|
||||
protected function getCrypt()
|
||||
{
|
||||
return $this->getContainer()->get('crypt');
|
||||
}
|
||||
|
||||
|
||||
protected function handleUserAccess($userId)
|
||||
{
|
||||
if (!$this->getUser()->isAdmin()) {
|
||||
@@ -52,7 +52,7 @@ class Preferences extends \Espo\Core\Controllers\Base
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function actionDelete($params, $data)
|
||||
{
|
||||
$userId = $params['id'];
|
||||
@@ -60,38 +60,38 @@ class Preferences extends \Espo\Core\Controllers\Base
|
||||
throw new BadRequest();
|
||||
}
|
||||
$this->handleUserAccess($userId);
|
||||
|
||||
return $this->getEntityManager()->getRepository('Preferences')->resetToDefaults($userId);
|
||||
|
||||
return $this->getEntityManager()->getRepository('Preferences')->resetToDefaults($userId);
|
||||
}
|
||||
|
||||
|
||||
public function actionPatch($params, $data)
|
||||
{
|
||||
return $this->actionUpdate($params, $data);
|
||||
}
|
||||
}
|
||||
|
||||
public function actionUpdate($params, $data)
|
||||
{
|
||||
$userId = $params['id'];
|
||||
$this->handleUserAccess($userId);
|
||||
|
||||
|
||||
if (array_key_exists('smtpPassword', $data)) {
|
||||
$data['smtpPassword'] = $this->getCrypt()->encrypt($data['smtpPassword']);
|
||||
}
|
||||
|
||||
$user = $this->getEntityManager()->getEntity('User', $userId);
|
||||
|
||||
$user = $this->getEntityManager()->getEntity('User', $userId);
|
||||
|
||||
$entity = $this->getEntityManager()->getEntity('Preferences', $userId);
|
||||
|
||||
if ($entity) {
|
||||
|
||||
if ($entity && $user) {
|
||||
$entity->set($data);
|
||||
$this->getEntityManager()->saveEntity($entity);
|
||||
|
||||
$entity->set('smtpEmailAddress', $user->get('emailAddress'));
|
||||
|
||||
$entity->set('smtpEmailAddress', $user->get('emailAddress'));
|
||||
$entity->set('name', $user->get('name'));
|
||||
|
||||
|
||||
$entity->clear('smtpPassword');
|
||||
|
||||
return $entity->toArray();
|
||||
|
||||
return $entity->toArray();
|
||||
}
|
||||
throw new Error();
|
||||
}
|
||||
@@ -101,18 +101,19 @@ class Preferences extends \Espo\Core\Controllers\Base
|
||||
$userId = $params['id'];
|
||||
$this->handleUserAccess($userId);
|
||||
|
||||
$entity = $this->getEntityManager()->getEntity('Preferences', $userId);
|
||||
$entity = $this->getEntityManager()->getEntity('Preferences', $userId);
|
||||
$user = $this->getEntityManager()->getEntity('User', $userId);
|
||||
|
||||
|
||||
if (!$entity || !$user) {
|
||||
throw new NotFound();
|
||||
}
|
||||
|
||||
$entity->set('smtpEmailAddress', $user->get('emailAddress'));
|
||||
$entity->set('name', $user->get('name'));
|
||||
|
||||
|
||||
$entity->clear('smtpPassword');
|
||||
|
||||
if ($entity) {
|
||||
return $entity->toArray();
|
||||
}
|
||||
throw new NotFound();
|
||||
|
||||
return $entity->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -35,30 +35,33 @@ class User extends \Espo\Core\Controllers\Record
|
||||
if (empty($userId)) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
|
||||
if (!$this->getUser()->isAdmin() && $this->getUser()->id != $userId) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
|
||||
$user = $this->getEntityManager()->getEntity('User', $userId);
|
||||
if (empty($user)) {
|
||||
throw new NotFound();
|
||||
}
|
||||
|
||||
|
||||
$acl = new \Espo\Core\Acl($user, $this->getConfig(), $this->getContainer()->get('fileManager'), $this->getMetadata());
|
||||
|
||||
|
||||
return $acl->toArray();
|
||||
}
|
||||
|
||||
public function actionChangeOwnPassword($params, $data)
|
||||
|
||||
public function actionChangeOwnPassword($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
return $this->getService('User')->changePassword($this->getUser()->id, $data['password']);
|
||||
}
|
||||
|
||||
public function actionChangePasswordByRequest($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new Forbidden();
|
||||
throw new BadRequest();
|
||||
}
|
||||
if (empty($data['requestId']) || empty($data['password'])) {
|
||||
throw new BadRequest();
|
||||
|
||||
@@ -28,7 +28,9 @@ use \Espo\ORM\Entity;
|
||||
|
||||
class Acl
|
||||
{
|
||||
private $data = array();
|
||||
private $data = array(
|
||||
'table' => array()
|
||||
);
|
||||
|
||||
private $cacheFile;
|
||||
|
||||
@@ -74,16 +76,16 @@ class Acl
|
||||
|
||||
public function checkScope($scope, $action = null, $isOwner = null, $inTeam = null, $entity = null)
|
||||
{
|
||||
if (array_key_exists($scope, $this->data)) {
|
||||
if ($this->data[$scope] === false) {
|
||||
if (array_key_exists($scope, $this->data['table'])) {
|
||||
if ($this->data['table'][$scope] === false) {
|
||||
return false;
|
||||
}
|
||||
if ($this->data[$scope] === true) {
|
||||
if ($this->data['table'][$scope] === true) {
|
||||
return true;
|
||||
}
|
||||
if (!is_null($action)) {
|
||||
if (array_key_exists($action, $this->data[$scope])) {
|
||||
$value = $this->data[$scope][$action];
|
||||
if (array_key_exists($action, $this->data['table'][$scope])) {
|
||||
$value = $this->data['table'][$scope][$action];
|
||||
|
||||
if ($value === 'all' || $value === true) {
|
||||
return true;
|
||||
@@ -125,14 +127,29 @@ class Acl
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function get($permission)
|
||||
{
|
||||
if ($this->user->isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
if ($permission == 'table') {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (array_key_exists($permission, $this->data)) {
|
||||
return $this->data[$permission];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getLevel($scope, $action)
|
||||
{
|
||||
if ($this->user->isAdmin()) {
|
||||
return 'all';
|
||||
}
|
||||
if (array_key_exists($scope, $this->data)) {
|
||||
if (array_key_exists($action, $this->data[$scope])) {
|
||||
return $this->data[$scope][$action];
|
||||
if (array_key_exists($scope, $this->data['table'])) {
|
||||
if (array_key_exists($action, $this->data['table'][$scope])) {
|
||||
return $this->data['table'][$scope][$action];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -156,8 +173,8 @@ class Acl
|
||||
|
||||
public function checkReadOnlyTeam($scope)
|
||||
{
|
||||
if (isset($this->data[$scope]) && isset($this->data[$scope]['read'])) {
|
||||
return $this->data[$scope]['read'] === 'team';
|
||||
if (isset($this->data['table'][$scope]) && isset($this->data['table'][$scope]['read'])) {
|
||||
return $this->data['table'][$scope]['read'] === 'team';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -167,8 +184,8 @@ class Acl
|
||||
if ($this->user->isAdmin()) {
|
||||
return false;
|
||||
}
|
||||
if (isset($this->data[$scope]) && isset($this->data[$scope]['read'])) {
|
||||
return $this->data[$scope]['read'] === 'own';
|
||||
if (isset($this->data['table'][$scope]) && isset($this->data['table'][$scope]['read'])) {
|
||||
return $this->data['table'][$scope]['read'] === 'own';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -213,12 +230,14 @@ class Acl
|
||||
|
||||
private function load()
|
||||
{
|
||||
$aclTables = array();
|
||||
$aclTables = [];
|
||||
$assignmentPermissionList = [];
|
||||
|
||||
$userRoles = $this->user->get('roles');
|
||||
|
||||
foreach ($userRoles as $role) {
|
||||
$aclTables[] = $role->get('data');
|
||||
$assignmentPermissionList[] = $role->get('assignmentPermission');
|
||||
}
|
||||
|
||||
$teams = $this->user->get('teams');
|
||||
@@ -226,21 +245,47 @@ class Acl
|
||||
$teamRoles = $team->get('roles');
|
||||
foreach ($teamRoles as $role) {
|
||||
$aclTables[] = $role->get('data');
|
||||
$assignmentPermissionList[] = $role->get('assignmentPermission');
|
||||
}
|
||||
}
|
||||
|
||||
$this->data = $this->merge($aclTables);
|
||||
$this->data['table'] = $this->merge($aclTables);
|
||||
$this->data['assignmentPermission'] = $this->mergeValues($assignmentPermissionList, 'all');
|
||||
}
|
||||
|
||||
private function initSolid()
|
||||
{
|
||||
if (!$this->metadata) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = $this->metadata->get('app.acl.solid', array());
|
||||
|
||||
foreach ($data as $entityName => $item) {
|
||||
$this->data[$entityName] = $item;
|
||||
$this->data['table'][$entityName] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
private function mergeValues(array $list, $defaultValue)
|
||||
{
|
||||
$result = null;
|
||||
foreach ($list as $level) {
|
||||
if ($level != 'not-set') {
|
||||
if (is_null($result)) {
|
||||
$result = $level;
|
||||
continue;
|
||||
}
|
||||
if (array_search($result, $this->levelList) > array_search($level, $this->levelList)) {
|
||||
$result = $level;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_null($result)) {
|
||||
$result = $defaultValue;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function merge($tables)
|
||||
{
|
||||
$data = array();
|
||||
|
||||
@@ -194,9 +194,17 @@ class Record extends Base
|
||||
|
||||
$ids = $request->get('ids');
|
||||
$where = $request->get('where');
|
||||
$byWhere = $request->get('byWhere');
|
||||
|
||||
$params = array();
|
||||
if ($byWhere) {
|
||||
$params['where'] = $where;
|
||||
} else {
|
||||
$params['ids'] = $ids;
|
||||
}
|
||||
|
||||
return array(
|
||||
'id' => $this->getRecordService()->export($ids, $where)
|
||||
'id' => $this->getRecordService()->export($params)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -205,12 +213,20 @@ class Record extends Base
|
||||
if (!$this->getAcl()->check($this->name, 'edit')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
if (empty($data['attributes'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$params = array();
|
||||
if (array_key_exists('where', $data) && !empty($data['byWhere'])) {
|
||||
$params['where'] = json_decode(json_encode($data['where']), true);
|
||||
} else if (array_key_exists('ids', $data)) {
|
||||
$params['ids'] = $data['ids'];
|
||||
}
|
||||
|
||||
$ids = $data['ids'];
|
||||
$where = $data['where'];
|
||||
$attributes = $data['attributes'];
|
||||
|
||||
$idsUpdated = $this->getRecordService()->massUpdate($attributes, $ids, $where);
|
||||
$idsUpdated = $this->getRecordService()->massUpdate($attributes, $params);
|
||||
|
||||
return $idsUpdated;
|
||||
}
|
||||
@@ -221,37 +237,56 @@ class Record extends Base
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
$ids = $data['ids'];
|
||||
$where = $data['where'];
|
||||
$params = array();
|
||||
if (array_key_exists('where', $data) && !empty($data['byWhere'])) {
|
||||
$where = json_decode(json_encode($data['where']), true);
|
||||
$params['where'] = $where;
|
||||
}
|
||||
if (array_key_exists('ids', $data)) {
|
||||
$where = json_decode(json_encode($data['where']), true);
|
||||
$params['ids'] = $data['ids'];
|
||||
}
|
||||
|
||||
$idsRemoved = $this->getRecordService()->massRemove($ids, $where);
|
||||
$idsRemoved = $this->getRecordService()->massRemove($params);
|
||||
|
||||
return $idsRemoved;
|
||||
}
|
||||
|
||||
public function actionCreateLink($params, $data)
|
||||
{
|
||||
if (empty($params['id']) || empty($params['link'])) {
|
||||
throw BadRequest();
|
||||
}
|
||||
|
||||
$id = $params['id'];
|
||||
$link = $params['link'];
|
||||
|
||||
$foreignIds = array();
|
||||
if (isset($data['id'])) {
|
||||
$foreignIds[] = $data['id'];
|
||||
}
|
||||
if (isset($data['ids']) && is_array($data['ids'])) {
|
||||
foreach ($data['ids'] as $foreignId) {
|
||||
$foreignIds[] = $foreignId;
|
||||
if (!empty($data['massRelate'])) {
|
||||
if (!is_array($data['where'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
$where = json_decode(json_encode($data['where']), true);
|
||||
return $this->getRecordService()->linkEntityMass($id, $link, $where);
|
||||
} else {
|
||||
$foreignIds = array();
|
||||
if (isset($data['id'])) {
|
||||
$foreignIds[] = $data['id'];
|
||||
}
|
||||
if (isset($data['ids']) && is_array($data['ids'])) {
|
||||
foreach ($data['ids'] as $foreignId) {
|
||||
$foreignIds[] = $foreignId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$result = false;
|
||||
foreach ($foreignIds as $foreignId) {
|
||||
if ($this->getRecordService()->linkEntity($id, $link, $foreignId)) {
|
||||
$result = $result || true;
|
||||
$result = false;
|
||||
foreach ($foreignIds as $foreignId) {
|
||||
if ($this->getRecordService()->linkEntity($id, $link, $foreignId)) {
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
if ($result) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if ($result) {
|
||||
return true;
|
||||
}
|
||||
|
||||
throw new Error();
|
||||
@@ -262,6 +297,10 @@ class Record extends Base
|
||||
$id = $params['id'];
|
||||
$link = $params['link'];
|
||||
|
||||
if (empty($params['id']) || empty($params['link'])) {
|
||||
throw BadRequest();
|
||||
}
|
||||
|
||||
$foreignIds = array();
|
||||
if (isset($data['id'])) {
|
||||
$foreignIds[] = $data['id'];
|
||||
|
||||
@@ -98,9 +98,11 @@ class CronManager
|
||||
|
||||
protected function getLastRunTime()
|
||||
{
|
||||
$lastRunTime = $this->getFileManager()->getPhpContents($this->lastRunTime);
|
||||
if (!is_int($lastRunTime)) {
|
||||
$lastRunTime = time() - (intval($this->getConfig()->get('cron.minExecutionTime')) + 60);
|
||||
$lastRunData = $this->getFileManager()->getPhpContents($this->lastRunTime);
|
||||
|
||||
$lastRunTime = time() - intval($this->getConfig()->get('cron.minExecutionTime')) - 1;
|
||||
if (is_array($lastRunData) && !empty($lastRunData['time'])) {
|
||||
$lastRunTime = $lastRunData['time'];
|
||||
}
|
||||
|
||||
return $lastRunTime;
|
||||
@@ -108,7 +110,10 @@ class CronManager
|
||||
|
||||
protected function setLastRunTime($time)
|
||||
{
|
||||
return $this->getFileManager()->putPhpContents($this->lastRunTime, $time);
|
||||
$data = array(
|
||||
'time' => $time,
|
||||
);
|
||||
return $this->getFileManager()->putPhpContents($this->lastRunTime, $data);
|
||||
}
|
||||
|
||||
protected function checkLastRunTime()
|
||||
@@ -183,7 +188,6 @@ class CronManager
|
||||
$cronScheduledJob->addLogRecord($job['scheduled_job_id'], $status);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -155,7 +155,7 @@ abstract class OAuth2Abstract implements IClient
|
||||
$code = $r['code'];
|
||||
}
|
||||
|
||||
if ($code == 200) {
|
||||
if ($code >= 200 && $code < 300) {
|
||||
return $r['result'];
|
||||
} else {
|
||||
$handledData = $this->handleErrorResponse($r);
|
||||
|
||||
@@ -233,7 +233,7 @@ class Client
|
||||
$params['grant_type'] = $grantType;
|
||||
|
||||
$httpHeaders = array();
|
||||
switch ($this->clientAuth) {
|
||||
switch ($this->tokenType) {
|
||||
case self::AUTH_TYPE_URI:
|
||||
case self::AUTH_TYPE_FORM:
|
||||
$params['client_id'] = $this->clientId;
|
||||
|
||||
@@ -62,7 +62,7 @@ class Importer
|
||||
|
||||
$subject = $message->subject;
|
||||
if ($subject !== '0' && empty($subject)) {
|
||||
$subject = '--empty--';
|
||||
$subject = '(No Subject)';
|
||||
}
|
||||
|
||||
$email->set('isHtml', false);
|
||||
@@ -91,7 +91,13 @@ class Importer
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->checkIsDuplicate($email)) {
|
||||
if ($duplicate = $this->findDuplicate($email)) {
|
||||
$this->getEntityManager()->getRepository('Email')->relate($duplicate, 'users', $userId);
|
||||
if (!empty($teamsIds)) {
|
||||
foreach ($teamsIds as $teamId) {
|
||||
$this->getEntityManager()->getRepository('Email')->relate($duplicate, 'teams', $teamId);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -192,14 +198,14 @@ class Importer
|
||||
}
|
||||
}
|
||||
|
||||
protected function checkIsDuplicate(Entity $email)
|
||||
protected function findDuplicate(Entity $email)
|
||||
{
|
||||
if ($email->get('messageId')) {
|
||||
$duplicate = $this->getEntityManager()->getRepository('Email')->where(array(
|
||||
'messageId' => $email->get('messageId')
|
||||
))->findOne();
|
||||
if ($duplicate) {
|
||||
return true;
|
||||
return $duplicate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Espo\Core\Mail\Mail;
|
||||
|
||||
use ArrayIterator;
|
||||
use Countable;
|
||||
use Iterator;
|
||||
use Traversable;
|
||||
use Zend\Loader\PluginClassLocator;
|
||||
|
||||
class Headers extends \Zend\Mail\Headers
|
||||
{
|
||||
public static function fromString($string, $EOL = self::EOL)
|
||||
{
|
||||
$headers = new static();
|
||||
$currentLine = '';
|
||||
|
||||
// iterate the header lines, some might be continuations
|
||||
foreach (explode($EOL, $string) as $line) {
|
||||
// check if a header name is present
|
||||
if (preg_match('/^(?P<name>[\x21-\x39\x3B-\x7E]+):.*$/', $line, $matches)) {
|
||||
if ($currentLine) {
|
||||
// a header name was present, then store the current complete line
|
||||
$headers->addHeaderLine($currentLine);
|
||||
}
|
||||
$currentLine = trim($line);
|
||||
} elseif (preg_match('/^\s+.*$/', $line, $matches)) {
|
||||
// continuation: append to current line
|
||||
$currentLine .= $line;
|
||||
} elseif (preg_match('/^\s*$/', $line)) {
|
||||
// empty line indicates end of headers
|
||||
break;
|
||||
} else {
|
||||
// Line does not match header format!
|
||||
throw new Exception\RuntimeException(sprintf(
|
||||
'Line "%s"does not match header format!',
|
||||
$line
|
||||
));
|
||||
}
|
||||
}
|
||||
if ($currentLine) {
|
||||
$headers->addHeaderLine($currentLine);
|
||||
}
|
||||
return $headers;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -20,11 +20,11 @@
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Mail\Storage;
|
||||
namespace Espo\Core\Mail\Mail\Storage;
|
||||
|
||||
class Imap extends \Zend\Mail\Storage\Imap
|
||||
{
|
||||
protected $messageClass = '\\Espo\\Core\\Mail\\Storage\\Message';
|
||||
protected $messageClass = '\\Espo\\Core\\Mail\\Mail\\Storage\\Message';
|
||||
|
||||
public function getIdsFromUID($uid)
|
||||
{
|
||||
@@ -0,0 +1,155 @@
|
||||
<?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/.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Mail\Mail\Storage;
|
||||
|
||||
use Espo\Core\Mail\Mail\Headers;
|
||||
use Zend\Mail\Header\HeaderInterface;
|
||||
use Zend\Mime;
|
||||
use Zend\Mail\Storage\Exception;
|
||||
use Zend\Mail\Storage\AbstractStorage;
|
||||
|
||||
class Message extends \Zend\Mail\Storage\Message
|
||||
{
|
||||
public function __construct(array $params)
|
||||
{
|
||||
if (isset($params['file'])) {
|
||||
if (!is_resource($params['file'])) {
|
||||
ErrorHandler::start();
|
||||
$params['raw'] = file_get_contents($params['file']);
|
||||
$error = ErrorHandler::stop();
|
||||
if ($params['raw'] === false) {
|
||||
throw new Exception\RuntimeException('could not open file', 0, $error);
|
||||
}
|
||||
} else {
|
||||
$params['raw'] = stream_get_contents($params['file']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($params['flags'])) {
|
||||
// set key and value to the same value for easy lookup
|
||||
$this->flags = array_combine($params['flags'], $params['flags']);
|
||||
}
|
||||
|
||||
if (isset($params['handler'])) {
|
||||
if (!$params['handler'] instanceof AbstractStorage) {
|
||||
throw new Exception\InvalidArgumentException('handler is not a valid mail handler');
|
||||
}
|
||||
if (!isset($params['id'])) {
|
||||
throw new Exception\InvalidArgumentException('need a message id with a handler');
|
||||
}
|
||||
|
||||
$this->mail = $params['handler'];
|
||||
$this->messageNum = $params['id'];
|
||||
}
|
||||
|
||||
$params['strict'] = isset($params['strict']) ? $params['strict'] : false;
|
||||
|
||||
if (isset($params['raw'])) {
|
||||
self::splitMessage($params['raw'], $this->headers, $this->content, Mime\Mime::LINEEND, $params['strict']);
|
||||
} elseif (isset($params['headers'])) {
|
||||
if (is_array($params['headers'])) {
|
||||
$this->headers = new Headers();
|
||||
$this->headers->addHeaders($params['headers']);
|
||||
} else {
|
||||
if ($params['headers'] instanceof \Zend\Mail\Headers) {
|
||||
$this->headers = $params['headers'];
|
||||
} else {
|
||||
if (empty($params['noToplines'])) {
|
||||
self::splitMessage($params['headers'], $this->headers, $this->topLines);
|
||||
} else {
|
||||
$this->headers = Headers::fromString($params['headers']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($params['content'])) {
|
||||
$this->content = $params['content'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function __isset($name)
|
||||
{
|
||||
$headers = $this->getHeaders();
|
||||
if (empty($headers) || !is_object($headers)) {
|
||||
return false;
|
||||
}
|
||||
return $this->getHeaders()->has($name);
|
||||
}
|
||||
|
||||
public function isMultipart()
|
||||
{
|
||||
if (!isset($this->contentType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
return stripos($this->contentType, 'multipart/') === 0;
|
||||
} catch (Exception\ExceptionInterface $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function splitMessage($message, &$headers, &$body, $EOL = Mime\Mime::LINEEND, $strict = false)
|
||||
{
|
||||
if ($message instanceof Headers) {
|
||||
$message = $message->toString();
|
||||
}
|
||||
// check for valid header at first line
|
||||
$firstline = strtok($message, "\n");
|
||||
if (!preg_match('%^[^\s]+[^:]*:%', $firstline)) {
|
||||
$headers = array();
|
||||
// TODO: we're ignoring \r for now - is this function fast enough and is it safe to assume noone needs \r?
|
||||
$body = str_replace(array("\r", "\n"), array('', $EOL), $message);
|
||||
return;
|
||||
}
|
||||
|
||||
// see @ZF2-372, pops the first line off a message if it doesn't contain a header
|
||||
if (!$strict) {
|
||||
$parts = explode(':', $firstline, 2);
|
||||
if (count($parts) != 2) {
|
||||
$message = substr($message, strpos($message, $EOL)+1);
|
||||
}
|
||||
}
|
||||
|
||||
// find an empty line between headers and body
|
||||
// default is set new line
|
||||
if (strpos($message, $EOL . $EOL)) {
|
||||
list($headers, $body) = explode($EOL . $EOL, $message, 2);
|
||||
// next is the standard new line
|
||||
} elseif ($EOL != "\r\n" && strpos($message, "\r\n\r\n")) {
|
||||
list($headers, $body) = explode("\r\n\r\n", $message, 2);
|
||||
// next is the other "standard" new line
|
||||
} elseif ($EOL != "\n" && strpos($message, "\n\n")) {
|
||||
list($headers, $body) = explode("\n\n", $message, 2);
|
||||
// at last resort find anything that looks like a new line
|
||||
} else {
|
||||
ErrorHandler::start(E_NOTICE|E_WARNING);
|
||||
list($headers, $body) = preg_split("%([\r\n]+)\\1%U", $message, 2);
|
||||
ErrorHandler::stop();
|
||||
}
|
||||
|
||||
$headers = Headers::fromString($headers, $EOL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ class Sender
|
||||
$this->params = $params;
|
||||
|
||||
$this->transport = new SmtpTransport();
|
||||
|
||||
|
||||
$opts = array(
|
||||
'name' => 'admin',
|
||||
'host' => $params['server'],
|
||||
@@ -83,14 +83,14 @@ class Sender
|
||||
if ($params['security']) {
|
||||
$opts['connection_config']['ssl'] = strtolower($params['security']);
|
||||
}
|
||||
|
||||
|
||||
if (in_array('fromName', $params)) {
|
||||
$this->params['fromName'] = $params['fromName'];
|
||||
}
|
||||
if (in_array('fromAddress', $params)) {
|
||||
$this->params['fromAddress'] = $params['fromAddress'];
|
||||
}
|
||||
|
||||
|
||||
$options = new SmtpOptions($opts);
|
||||
$this->transport->setOptions($options);
|
||||
|
||||
@@ -160,10 +160,10 @@ class Sender
|
||||
} else {
|
||||
$fromName = $config->get('outboundEmailFromName');
|
||||
}
|
||||
|
||||
|
||||
$message->addFrom($fromAddress, $fromName);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($params['replyToAddress'])) {
|
||||
$replyToName = null;
|
||||
if (!empty($params['replyToName'])) {
|
||||
@@ -203,7 +203,6 @@ class Sender
|
||||
}
|
||||
|
||||
$attachmentPartList = array();
|
||||
|
||||
$attachmentCollection = $email->get('attachments');
|
||||
$attachmentInlineCollection = $email->getInlineAttachments();
|
||||
|
||||
@@ -220,7 +219,7 @@ class Sender
|
||||
$attachmentPartList[] = $attachment;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!empty($attachmentInlineCollection)) {
|
||||
foreach ($attachmentInlineCollection as $a) {
|
||||
$fileName = 'data/upload/' . $a->id;
|
||||
@@ -239,12 +238,12 @@ class Sender
|
||||
$message->setSubject($email->get('name'));
|
||||
|
||||
$body = new MimeMessage();
|
||||
|
||||
|
||||
$textPart = new MimePart($email->getBodyPlainForSending());
|
||||
$textPart->type = 'text/plain';
|
||||
$textPart->encoding = Mime::ENCODING_QUOTEDPRINTABLE;
|
||||
$textPart->charset = 'utf-8';
|
||||
|
||||
|
||||
if ($email->get('isHtml')) {
|
||||
$htmlPart = new MimePart($email->getBodyForSending());
|
||||
$htmlPart->encoding = Mime::ENCODING_QUOTEDPRINTABLE;
|
||||
|
||||
@@ -81,6 +81,9 @@ class RDB extends \Espo\ORM\Repositories\RDB implements Injectable
|
||||
|
||||
foreach ($defs['fields'] as $field => $d) {
|
||||
if (isset($d['type']) && $d['type'] == 'currency') {
|
||||
if (!empty($d['notStorable'])) {
|
||||
continue;
|
||||
}
|
||||
if (empty($params['customJoin'])) {
|
||||
$params['customJoin'] = '';
|
||||
}
|
||||
@@ -320,10 +323,12 @@ class RDB extends \Espo\ORM\Repositories\RDB implements Injectable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($specifiedIds as $id) {
|
||||
if (!in_array($id, $existingIds)) {
|
||||
$data = null;
|
||||
if (!empty($columns)) {
|
||||
if (!empty($columns) && isset($columnData->$id)) {
|
||||
$data = $columnData->$id;
|
||||
}
|
||||
$this->relate($entity, $name, $id, $data);
|
||||
|
||||
@@ -301,10 +301,110 @@ class Base
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function convertDateTimeWhere($item)
|
||||
{
|
||||
$format = 'Y-m-d H:i:s';
|
||||
|
||||
$value = null;
|
||||
$timeZone = 'UTC';
|
||||
|
||||
if (empty($item['field'])) {
|
||||
return null;
|
||||
}
|
||||
if (empty($item['type'])) {
|
||||
return null;
|
||||
}
|
||||
if (!empty($item['value'])) {
|
||||
$value = $item['value'];
|
||||
}
|
||||
if (!empty($item['timeZone'])) {
|
||||
$timeZone = $item['timeZone'];
|
||||
}
|
||||
$type = $item['type'];
|
||||
$field = $item['field'];
|
||||
|
||||
if (empty($value) && in_array($type, array('on', 'before', 'after'))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$where = array();
|
||||
$where['field'] = $field;
|
||||
|
||||
$dt = new \DateTime('now', new \DateTimeZone($timeZone));
|
||||
|
||||
switch ($type) {
|
||||
case 'today':
|
||||
$where['type'] = 'between';
|
||||
$dt->setTime(0, 0, 0);
|
||||
$dt->setTimezone(new \DateTimeZone('UTC'));
|
||||
$from = $dt->format($format);
|
||||
$dt->modify('+1 day');
|
||||
$to = $dt->format($format);
|
||||
$where['value'] = [$from, $to];
|
||||
break;
|
||||
case 'past':
|
||||
$where['type'] = 'before';
|
||||
$dt->setTimezone(new \DateTimeZone('UTC'));
|
||||
$where['value'] = $dt->format($format);
|
||||
break;
|
||||
case 'future':
|
||||
$where['type'] = 'after';
|
||||
$dt->setTimezone(new \DateTimeZone('UTC'));
|
||||
$where['value'] = $dt->format($format);
|
||||
break;
|
||||
case 'on':
|
||||
$where['type'] = 'between';
|
||||
|
||||
$dt = new \DateTime($value, new \DateTimeZone($timeZone));
|
||||
$dt->setTimezone(new \DateTimeZone('UTC'));
|
||||
$from = $dt->format($format);
|
||||
|
||||
$dt->modify('+1 day');
|
||||
$to = $dt->format($format);
|
||||
$where['value'] = [$from, $to];
|
||||
break;
|
||||
case 'before':
|
||||
$where['type'] = 'before';
|
||||
$dt = new \DateTime($value, new \DateTimeZone($timeZone));
|
||||
$dt->setTimezone(new \DateTimeZone('UTC'));
|
||||
$where['value'] = $dt->format($format);
|
||||
break;
|
||||
case 'after':
|
||||
$where['type'] = 'after';
|
||||
$dt = new \DateTime($value, new \DateTimeZone($timeZone));
|
||||
$dt->setTimezone(new \DateTimeZone('UTC'));
|
||||
$where['value'] = $dt->format($format);
|
||||
break;
|
||||
case 'between':
|
||||
$where['type'] = 'between';
|
||||
if (is_array($value)) {
|
||||
$dt = new \DateTime($value[0], new \DateTimeZone($timeZone));
|
||||
$dt->setTimezone(new \DateTimeZone('UTC'));
|
||||
$from = $dt->format($format);
|
||||
|
||||
$dt = new \DateTime($value[1], new \DateTimeZone($timeZone));
|
||||
$dt->setTimezone(new \DateTimeZone('UTC'));
|
||||
$to = $dt->format($format);
|
||||
|
||||
$where['value'] = [$from, $to];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$where['type'] = $type;
|
||||
}
|
||||
$result = $this->getWherePart($where);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function getWherePart($item)
|
||||
{
|
||||
$part = array();
|
||||
|
||||
if (!empty($item['dateTime'])) {
|
||||
return $this->convertDateTimeWhere($item);
|
||||
}
|
||||
|
||||
if (!empty($item['type'])) {
|
||||
switch ($item['type']) {
|
||||
case 'or':
|
||||
@@ -366,7 +466,7 @@ class Base
|
||||
$part[$item['field'] . '<'] = date('Y-m-d');
|
||||
break;
|
||||
case 'future':
|
||||
$part[$item['field'] . '>'] = date('Y-m-d');
|
||||
$part[$item['field'] . '>='] = date('Y-m-d');
|
||||
break;
|
||||
case 'currentMonth':
|
||||
$dt = new \DateTime();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
},
|
||||
"salutationName": {
|
||||
"type": "enum",
|
||||
"options": ["", "Mr.", "Mrs.", "Dr."]
|
||||
"options": ["", "Mr.", "Mrs.", "Ms.", "Dr."]
|
||||
},
|
||||
"firstName": {
|
||||
"type": "varchar",
|
||||
|
||||
@@ -34,6 +34,8 @@ abstract class Base
|
||||
|
||||
private $entityManager;
|
||||
|
||||
private $helper;
|
||||
|
||||
protected $data;
|
||||
|
||||
protected $params = null;
|
||||
@@ -131,7 +133,7 @@ abstract class Base
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
protected function getEntityManager()
|
||||
public function getEntityManager()
|
||||
{
|
||||
if (!isset($this->entityManager)) {
|
||||
$this->entityManager = $this->getContainer()->get('entityManager');
|
||||
@@ -195,10 +197,15 @@ abstract class Base
|
||||
$res &= $this->checkVersions($manifest['acceptableVersions'], $this->getConfig()->get('version'), 'Your EspoCRM version doesn\'t match for this installation package.');
|
||||
}
|
||||
|
||||
//check dependencies
|
||||
if (!empty($manifest['dependencies'])) {
|
||||
$res &= $this->checkDependencies($manifest['dependencies']);
|
||||
}
|
||||
|
||||
return (bool) $res;
|
||||
}
|
||||
|
||||
protected function checkVersions($versionList, $currentVersion, $errorMessage = '')
|
||||
public function checkVersions($versionList, $currentVersion, $errorMessage = '')
|
||||
{
|
||||
if (empty($versionList)) {
|
||||
return true;
|
||||
@@ -212,7 +219,7 @@ abstract class Base
|
||||
$semver = new SemVer\version($currentVersion);
|
||||
} catch (\Exception $e) {
|
||||
$GLOBALS['log']->error('Cannot recognize currentVersion ['.$currentVersion.'], error: '.$e->getMessage().'.');
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($versionList as $version) {
|
||||
@@ -251,6 +258,11 @@ abstract class Base
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function checkDependencies($dependencyList)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run scripts by type
|
||||
* @param string $type Ex. "before", "after"
|
||||
@@ -550,4 +562,15 @@ abstract class Base
|
||||
$backupPath = $this->getPath('backupPath');
|
||||
return $this->copy('', array($backupPath, self::FILES), false, $fullFileList);
|
||||
}
|
||||
|
||||
protected function getHelper()
|
||||
{
|
||||
if (!isset($this->helper)) {
|
||||
$this->helper = new Helper();
|
||||
}
|
||||
|
||||
$this->helper->setActionObject($this);
|
||||
|
||||
return $this->helper;
|
||||
}
|
||||
}
|
||||
@@ -138,7 +138,7 @@ class Install extends \Espo\Core\Upgrades\Actions\Base\Install
|
||||
|
||||
$data = array(
|
||||
'id' => $this->getProcessId(),
|
||||
'name' => $manifest['name'],
|
||||
'name' => trim($manifest['name']),
|
||||
'isInstalled' => true,
|
||||
'version' => $manifest['version'],
|
||||
'fileList' => $fileList,
|
||||
@@ -171,8 +171,8 @@ class Install extends \Espo\Core\Upgrades\Actions\Base\Install
|
||||
* Throw an exception and remove package files.
|
||||
* Redeclared to prevent of deleting a package of installed extension.
|
||||
*
|
||||
* @param string $errorMessage [description]
|
||||
* @return [type] [description]
|
||||
* @param string $errorMessage
|
||||
* @return void
|
||||
*/
|
||||
protected function throwErrorAndRemovePackage($errorMessage = '')
|
||||
{
|
||||
@@ -211,7 +211,8 @@ class Install extends \Espo\Core\Upgrades\Actions\Base\Install
|
||||
$this->executeAction(ExtensionManager::DELETE, array('id' => $extensionEntity->get('id')));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected function checkDependencies($dependencyList)
|
||||
{
|
||||
return $this->getHelper()->checkDependencies($dependencyList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,5 +24,8 @@ namespace Espo\Core\Upgrades\Actions\Extension;
|
||||
|
||||
class Upload extends \Espo\Core\Upgrades\Actions\Base\Upload
|
||||
{
|
||||
|
||||
protected function checkDependencies($dependencyList)
|
||||
{
|
||||
return $this->getHelper()->checkDependencies($dependencyList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?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/.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Upgrades\Actions;
|
||||
|
||||
use Espo\Core\Exceptions\Error;
|
||||
|
||||
class Helper
|
||||
{
|
||||
private $actionObject;
|
||||
|
||||
public function __construct($actionObject = null)
|
||||
{
|
||||
if (isset($actionObject)) {
|
||||
$this->setActionObject($actionObject);
|
||||
}
|
||||
}
|
||||
|
||||
public function setActionObject(\Espo\Core\Upgrades\Actions\Base $actionObject)
|
||||
{
|
||||
$this->actionObject = $actionObject;
|
||||
}
|
||||
|
||||
protected function getActionObject()
|
||||
{
|
||||
return $this->actionObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check dependencies
|
||||
*
|
||||
* @param array | string $dependencyList
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function checkDependencies($dependencyList)
|
||||
{
|
||||
if (!is_array($dependencyList)) {
|
||||
$dependencyList = (array) $dependencyList;
|
||||
}
|
||||
|
||||
$actionObject = $this->getActionObject();
|
||||
|
||||
foreach ($dependencyList as $extensionName => $extensionVersion) {
|
||||
$dependencyExtensionEntity = $actionObject->getEntityManager()->getRepository('Extension')->where(array(
|
||||
'name' => trim($extensionName),
|
||||
'isInstalled' => true,
|
||||
))->findOne();
|
||||
|
||||
$errorMessage = 'Dependency Error: The extension "'.$extensionName.'" with version "'.$extensionVersion.'" is missing.';
|
||||
if (!isset($dependencyExtensionEntity) || !$actionObject->checkVersions($extensionVersion, $dependencyExtensionEntity->get('version'), $errorMessage)) {
|
||||
throw new Error($errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -64,8 +64,6 @@ class Auth
|
||||
|
||||
public function login($username, $password)
|
||||
{
|
||||
$GLOBALS['log']->debug('AUTH: Try to authenticate');
|
||||
|
||||
$entityManager = $this->entityManager;
|
||||
|
||||
$authToken = $entityManager->getRepository('AuthToken')->where(array('token' => $password))->findOne();
|
||||
@@ -79,7 +77,6 @@ class Auth
|
||||
}
|
||||
$entityManager->setUser($user);
|
||||
$this->container->setUser($user);
|
||||
$GLOBALS['log']->debug('AUTH: Result of authenticate is [true]');
|
||||
|
||||
if (!$authToken) {
|
||||
$authToken = $entityManager->getEntity('AuthToken');
|
||||
|
||||
@@ -58,6 +58,7 @@ class Job
|
||||
{
|
||||
/** Mark Failed old jobs and remove pending duplicates */
|
||||
$this->markFailedJobs();
|
||||
$this->markJobAttempts();
|
||||
$this->removePendingJobDuplicates();
|
||||
|
||||
$jobList = $this->getActiveJobs();
|
||||
@@ -87,12 +88,11 @@ class Job
|
||||
$jobConfigs = $this->getConfig()->get('cron');
|
||||
|
||||
$currentTime = time();
|
||||
$periodTime = $currentTime - intval($jobConfigs['jobPeriod']);
|
||||
$limit = empty($jobConfigs['maxJobNumber']) ? '' : 'LIMIT '.$jobConfigs['maxJobNumber'];
|
||||
|
||||
$query = "SELECT " . $displayColumns . " FROM job WHERE
|
||||
`status` = '" . $status . "'
|
||||
AND execute_time BETWEEN '".date('Y-m-d H:i:s', $periodTime)."' AND '".date('Y-m-d H:i:s', $currentTime)."'
|
||||
AND execute_time <= '".date('Y-m-d H:i:s', $currentTime)."'
|
||||
AND deleted = 0
|
||||
ORDER BY execute_time ASC ".$limit;
|
||||
|
||||
@@ -109,15 +109,18 @@ class Job
|
||||
* Get Jobs by ScheduledJobId and date
|
||||
*
|
||||
* @param string $scheduledJobId
|
||||
* @param string $date
|
||||
* @param string $time
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getJobByScheduledJob($scheduledJobId, $date)
|
||||
public function getJobByScheduledJob($scheduledJobId, $time)
|
||||
{
|
||||
$dateObj = new \DateTime($time);
|
||||
$timeWithoutSeconds = $dateObj->format('Y-m-d H:i:');
|
||||
|
||||
$query = "SELECT * FROM job WHERE
|
||||
scheduled_job_id = '".$scheduledJobId."'
|
||||
AND execute_time = '".$date."'
|
||||
AND execute_time LIKE '".$timeWithoutSeconds."%'
|
||||
AND deleted = 0
|
||||
LIMIT 1";
|
||||
|
||||
@@ -143,7 +146,7 @@ class Job
|
||||
$periodTime = $currentTime - intval($jobConfigs['jobPeriod']);
|
||||
|
||||
$update = "UPDATE job SET `status` = '" . CronManager::FAILED ."' WHERE
|
||||
(`status` = '" . CronManager::PENDING ."' OR `status` = '" . CronManager::RUNNING ."')
|
||||
(`status` = '" . CronManager::RUNNING ."')
|
||||
AND execute_time < '".date('Y-m-d H:i:s', $periodTime)."' ";
|
||||
|
||||
$pdo = $this->getEntityManager()->getPDO();
|
||||
@@ -158,10 +161,22 @@ class Job
|
||||
*/
|
||||
protected function removePendingJobDuplicates()
|
||||
{
|
||||
$duplicateJobs = $this->getActiveJobs('DISTINCT scheduled_job_id');
|
||||
|
||||
$pdo = $this->getEntityManager()->getPDO();
|
||||
|
||||
$query = "SELECT scheduled_job_id FROM job
|
||||
WHERE
|
||||
scheduled_job_id IS NOT NULL
|
||||
AND `status` = '".CronManager::PENDING."'
|
||||
AND execute_time <= '".date('Y-m-d H:i:s')."'
|
||||
AND deleted = 0
|
||||
GROUP BY scheduled_job_id
|
||||
HAVING count( * ) > 1
|
||||
ORDER BY execute_time ASC";
|
||||
$sth = $pdo->prepare($query);
|
||||
$sth->execute();
|
||||
|
||||
$duplicateJobs = $sth->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
foreach ($duplicateJobs as $row) {
|
||||
if (!empty($row['scheduled_job_id'])) {
|
||||
|
||||
@@ -182,4 +197,41 @@ class Job
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark job attempts
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function markJobAttempts()
|
||||
{
|
||||
$query = "SELECT * FROM job WHERE
|
||||
`status` = '" . CronManager::FAILED . "'
|
||||
AND deleted = 0
|
||||
AND execute_time <= '".date('Y-m-d H:i:s')."'
|
||||
AND attempts > 0";
|
||||
|
||||
$pdo = $this->getEntityManager()->getPDO();
|
||||
$sth = $pdo->prepare($query);
|
||||
$sth->execute();
|
||||
|
||||
$rows = $sth->fetchAll(PDO::FETCH_ASSOC);
|
||||
if ($rows) {
|
||||
foreach ($rows as $row) {
|
||||
$row['failed_attempts'] = isset($row['failed_attempts']) ? $row['failed_attempts'] : 0;
|
||||
|
||||
$attempts = $row['attempts'] - 1;
|
||||
$failedAttempts = $row['failed_attempts'] + 1;
|
||||
|
||||
$update = "UPDATE job SET
|
||||
`status` = '" . CronManager::PENDING ."',
|
||||
attempts = '".$attempts."',
|
||||
failed_attempts = '".$failedAttempts."'
|
||||
WHERE
|
||||
id = '".$row['id']."'
|
||||
";
|
||||
$pdo->prepare($update)->execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,30 +34,38 @@ class Currency extends Base
|
||||
|
||||
$alias = Util::toUnderScore($fieldName) . "_currency_alias";
|
||||
|
||||
return array(
|
||||
$d = array(
|
||||
$entityName => array(
|
||||
'fields' => array(
|
||||
$fieldName => array(
|
||||
"type" => "float",
|
||||
"orderBy" => $converedFieldName . " {direction}"
|
||||
),
|
||||
$fieldName . 'Converted' => array(
|
||||
'type' => 'float',
|
||||
'select' => Util::toUnderScore($entityName) . "." . $currencyColumnName . " * {$alias}.rate" ,
|
||||
'where' =>
|
||||
array (
|
||||
"=" => Util::toUnderScore($entityName) . "." . $currencyColumnName . " * {$alias}.rate = {value}",
|
||||
">" => Util::toUnderScore($entityName) . "." . $currencyColumnName . " * {$alias}.rate > {value}",
|
||||
"<" => Util::toUnderScore($entityName) . "." . $currencyColumnName . " * {$alias}.rate < {value}",
|
||||
">=" => Util::toUnderScore($entityName) . "." . $currencyColumnName . " * {$alias}.rate >= {value}",
|
||||
"<=" => Util::toUnderScore($entityName) . "." . $currencyColumnName . " * {$alias}.rate <= {value}",
|
||||
"<>" => Util::toUnderScore($entityName) . "." . $currencyColumnName . " * {$alias}.rate <> {value}"
|
||||
),
|
||||
'notStorable' => true,
|
||||
'orderBy' => $converedFieldName . " {direction}"
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$params = $this->getFieldParams($fieldName);
|
||||
if (!empty($params['notStorable'])) {
|
||||
$d[$entityName]['fields'][$fieldName]['notStorable'] = true;
|
||||
} else {
|
||||
$d[$entityName]['fields'][$fieldName . 'Converted'] = array(
|
||||
'type' => 'float',
|
||||
'select' => Util::toUnderScore($entityName) . "." . $currencyColumnName . " * {$alias}.rate" ,
|
||||
'where' =>
|
||||
array (
|
||||
"=" => Util::toUnderScore($entityName) . "." . $currencyColumnName . " * {$alias}.rate = {value}",
|
||||
">" => Util::toUnderScore($entityName) . "." . $currencyColumnName . " * {$alias}.rate > {value}",
|
||||
"<" => Util::toUnderScore($entityName) . "." . $currencyColumnName . " * {$alias}.rate < {value}",
|
||||
">=" => Util::toUnderScore($entityName) . "." . $currencyColumnName . " * {$alias}.rate >= {value}",
|
||||
"<=" => Util::toUnderScore($entityName) . "." . $currencyColumnName . " * {$alias}.rate <= {value}",
|
||||
"<>" => Util::toUnderScore($entityName) . "." . $currencyColumnName . " * {$alias}.rate <> {value}"
|
||||
),
|
||||
'notStorable' => true,
|
||||
'orderBy' => $converedFieldName . " {direction}"
|
||||
);
|
||||
}
|
||||
|
||||
return $d;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ class Base extends \Espo\Core\Utils\Database\Orm\Base
|
||||
'conditions',
|
||||
'additionalColumns',
|
||||
'midKeys',
|
||||
'noJoin'
|
||||
);
|
||||
|
||||
protected function getParams()
|
||||
|
||||
@@ -26,16 +26,29 @@ class BelongsTo extends Base
|
||||
{
|
||||
protected function load($linkName, $entityName)
|
||||
{
|
||||
$linkParams = $this->getLinkParams();
|
||||
|
||||
$foreignEntityName = $this->getForeignEntityName();
|
||||
|
||||
if (!empty($linkParams['noJoin'])) {
|
||||
$fieldNameDefs = array(
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
'relation' => $linkName,
|
||||
'foreign' => $this->getForeignField('name', $foreignEntityName),
|
||||
);
|
||||
} else {
|
||||
$fieldNameDefs = array(
|
||||
'type' => 'foreign',
|
||||
'relation' => $linkName,
|
||||
'foreign' => $this->getForeignField('name', $foreignEntityName),
|
||||
);
|
||||
}
|
||||
|
||||
return array (
|
||||
$entityName => array (
|
||||
'fields' => array(
|
||||
$linkName.'Name' => array(
|
||||
'type' => 'foreign',
|
||||
'relation' => $linkName,
|
||||
'foreign' => $this->getForeignField('name', $foreignEntityName),
|
||||
),
|
||||
$linkName.'Name' => $fieldNameDefs,
|
||||
$linkName.'Id' => array(
|
||||
'type' => 'foreignId',
|
||||
'index' => true,
|
||||
@@ -46,7 +59,7 @@ class BelongsTo extends Base
|
||||
'type' => 'belongsTo',
|
||||
'entity' => $foreignEntityName,
|
||||
'key' => $linkName.'Id',
|
||||
'foreignKey' => 'id', //????
|
||||
'foreignKey' => 'id',
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -241,16 +241,19 @@ class Converter
|
||||
$table->addColumn('id', 'int', array('length'=>$this->defaultLength['int'], 'autoincrement' => true, 'notnull' => true,)); //'unique' => true,
|
||||
|
||||
//add midKeys to a schema
|
||||
$uniqueIndex = array();
|
||||
foreach($relationParams['midKeys'] as $index => $midKey) {
|
||||
|
||||
$usMidKey = Util::toUnderScore($midKey);
|
||||
$table->addColumn($usMidKey, $this->idParams['dbType'], array('length'=>$this->idParams['len']));
|
||||
$table->addIndex(array($usMidKey));
|
||||
$columnName = Util::toUnderScore($midKey);
|
||||
$table->addColumn($columnName, $this->idParams['dbType'], array('length'=>$this->idParams['len']));
|
||||
$table->addIndex(array($columnName));
|
||||
|
||||
} //END: add midKeys to a schema
|
||||
$uniqueIndex[] = $columnName;
|
||||
}
|
||||
//END: add midKeys to a schema
|
||||
|
||||
//add additionalColumns
|
||||
if (isset($relationParams['additionalColumns'])) {
|
||||
if (!empty($relationParams['additionalColumns'])) {
|
||||
foreach($relationParams['additionalColumns'] as $fieldName => $fieldParams) {
|
||||
|
||||
if (!isset($fieldParams['type'])) {
|
||||
@@ -264,6 +267,17 @@ class Converter
|
||||
}
|
||||
} //END: add additionalColumns
|
||||
|
||||
//add unique indexes
|
||||
if (!empty($relationParams['conditions'])) {
|
||||
foreach ($relationParams['conditions'] as $fieldName => $fieldParams) {
|
||||
$uniqueIndex[] = Util::toUnderScore($fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($uniqueIndex)) {
|
||||
$table->addUniqueIndex($uniqueIndex);
|
||||
}
|
||||
//END: add unique indexes
|
||||
|
||||
$table->addColumn('deleted', 'bool', array('default' => 0));
|
||||
$table->setPrimaryKey(array("id"));
|
||||
@@ -271,7 +285,6 @@ class Converter
|
||||
return $table;
|
||||
}
|
||||
|
||||
|
||||
protected function getDbFieldParams($fieldParams)
|
||||
{
|
||||
$dbFieldParams = array();
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?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/.
|
||||
************************************************************************/
|
||||
|
||||
return array(
|
||||
|
||||
'Autofollow' => array(
|
||||
'fields' => array(
|
||||
'id' => array(
|
||||
'type' => 'id',
|
||||
'dbType' => 'int',
|
||||
'len' => '11',
|
||||
'autoincrement' => true,
|
||||
'unique' => true,
|
||||
),
|
||||
'entityType' => array(
|
||||
'type' => 'varchar',
|
||||
'len' => '100',
|
||||
'index' => 'entityType',
|
||||
),
|
||||
'userId' => array(
|
||||
'type' => 'varchar',
|
||||
'len' => '24',
|
||||
'index' => true,
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
@@ -25,42 +25,56 @@ namespace Espo\Core\Utils;
|
||||
class DateTime
|
||||
{
|
||||
protected $dataFormat;
|
||||
|
||||
|
||||
protected $timeFormat;
|
||||
|
||||
|
||||
protected $timezone;
|
||||
|
||||
|
||||
protected $internalDateTimeFormat = 'Y-m-d H:i:s';
|
||||
|
||||
protected $internalDateFormat = 'Y-m-d';
|
||||
|
||||
protected $dateFormats = array(
|
||||
'MM/DD/YYYY' => 'm/d/Y',
|
||||
'YYYY-MM-DD' => 'Y-m-d',
|
||||
'DD.MM.YYYY' => 'd.m.Y',
|
||||
);
|
||||
|
||||
|
||||
protected $timeFormats = array(
|
||||
'HH:mm' => 'H:i',
|
||||
'hh:mm A' => 'h:i A',
|
||||
'hh:mm a' => 'h:ia',
|
||||
'hh:mmA' => 'h:iA',
|
||||
);
|
||||
|
||||
|
||||
public function __construct($dateFormat = 'YYYY-MM-DD', $timeFormat = 'HH:mm', $timeZone = 'UTC')
|
||||
{
|
||||
$this->dateFormat = $dateFormat;
|
||||
$this->timeFormat = $timeFormat;
|
||||
|
||||
|
||||
$this->timezone = new \DateTimeZone($timeZone);
|
||||
}
|
||||
|
||||
|
||||
public function getInternalDateTimeFormat()
|
||||
{
|
||||
return $this->internalDateTimeFormat;
|
||||
}
|
||||
|
||||
public function getInternalDateFormat()
|
||||
{
|
||||
return $this->internalDateFormat;
|
||||
}
|
||||
|
||||
protected function getPhpDateFormat()
|
||||
{
|
||||
return $this->dateFormats[$this->dateFormat];
|
||||
}
|
||||
|
||||
|
||||
protected function getPhpDateTimeFormat()
|
||||
{
|
||||
return $this->dateFormats[$this->dateFormat] . ' ' . $this->timeFormats[$this->timeFormat];
|
||||
}
|
||||
|
||||
|
||||
public function convertSystemDateToGlobal($string)
|
||||
{
|
||||
$dateTime = \DateTime::createFromFormat('Y-m-d', $string);
|
||||
@@ -69,7 +83,7 @@ class DateTime
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public function convertSystemDateTimeToGlobal($string)
|
||||
{
|
||||
$dateTime = \DateTime::createFromFormat('Y-m-d H:i:s', $string);
|
||||
|
||||
@@ -81,6 +81,7 @@ class EntityManager
|
||||
"namespace Espo\Custom\Entities;\n".
|
||||
"class {$normalizedName} extends \Espo\Core\Templates\Entities\\{$type}\n".
|
||||
"{\n".
|
||||
" protected \$entityType = \"$name\";\n".
|
||||
"}\n";
|
||||
|
||||
$filePath = "custom/Espo/Custom/Entities/{$normalizedName}.php";
|
||||
|
||||
@@ -62,12 +62,14 @@ class Manager
|
||||
*/
|
||||
public function getFileList($path, $recursively = false, $filter = '', $onlyFileType = null, $isReturnSingleArray = false)
|
||||
{
|
||||
if (!file_exists($path)) {
|
||||
return false;
|
||||
}
|
||||
$path = $this->concatPaths($path);
|
||||
|
||||
$result = array();
|
||||
|
||||
if (!file_exists($path) || !is_dir($path)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
$cdir = scandir($path);
|
||||
foreach ($cdir as $key => $value)
|
||||
{
|
||||
@@ -373,9 +375,11 @@ class Manager
|
||||
*
|
||||
* @param string | array $path
|
||||
* @param int $permission - ex. 0755
|
||||
* @param bool $recursive
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function mkdir($path, $permission = null)
|
||||
public function mkdir($path, $permission = null, $recursive = false)
|
||||
{
|
||||
$fullPath = $this->concatPaths($path);
|
||||
|
||||
@@ -383,14 +387,23 @@ class Manager
|
||||
return true;
|
||||
}
|
||||
|
||||
$defaultPermissions = $this->getPermissionUtils()->getDefaultPermissions();
|
||||
|
||||
if (!isset($permission)) {
|
||||
$defaultPermissions = $this->getPermissionUtils()->getDefaultPermissions();
|
||||
$permission = (string) $defaultPermissions['dir'];
|
||||
$permission = base_convert($permission, 8, 10);
|
||||
}
|
||||
|
||||
try {
|
||||
$result = mkdir($fullPath, $permission, true);
|
||||
|
||||
if (!empty($defaultPermissions['user'])) {
|
||||
$this->getPermissionUtils()->chown($fullPath);
|
||||
}
|
||||
|
||||
if (!empty($defaultPermissions['group'])) {
|
||||
$this->getPermissionUtils()->chgrp($fullPath);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$GLOBALS['log']->critical('Permission denied: unable to create the folder on the server - '.$fullPath);
|
||||
}
|
||||
@@ -473,7 +486,7 @@ class Manager
|
||||
* @param string $filePath
|
||||
* @return string
|
||||
*/
|
||||
protected function checkCreateFile($filePath)
|
||||
public function checkCreateFile($filePath)
|
||||
{
|
||||
$defaultPermissions = $this->getPermissionUtils()->getDefaultPermissions();
|
||||
|
||||
@@ -490,8 +503,8 @@ class Manager
|
||||
$dirPermission = $defaultPermissions['dir'];
|
||||
$dirPermission = is_string($dirPermission) ? base_convert($dirPermission,8,10) : $dirPermission;
|
||||
|
||||
if (!mkdir($pathParts['dirname'], $dirPermission, true)) {
|
||||
throw new Error('Permission denied: unable to create a folder on the server - '.$pathParts['dirname']);
|
||||
if (!$this->mkdir($pathParts['dirname'], $dirPermission, true)) {
|
||||
throw new Error('Permission denied: unable to create a folder on the server - ' . $pathParts['dirname']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,6 @@ class Permission
|
||||
return $this->params;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get default settings
|
||||
*
|
||||
@@ -137,7 +136,6 @@ class Permission
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get current permissions
|
||||
*
|
||||
@@ -216,7 +214,6 @@ class Permission
|
||||
return $this->chmodRecurse($path, $permission['file'], $permission['dir']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Change permissions recursive
|
||||
*
|
||||
@@ -232,27 +229,20 @@ class Permission
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_file($path)) {
|
||||
if (!is_dir($path)) {
|
||||
return $this->chmodReal($path, $fileOctal);
|
||||
}
|
||||
|
||||
if (is_dir($path)) {
|
||||
$allFiles = $this->getFileManager()->getFileList($path);
|
||||
$result = $this->chmodReal($path, $dirOctal);
|
||||
|
||||
foreach ($items as $item) {
|
||||
$this->chmodRecurse($path. Utils\Util::getSeparator() .$item, $fileOctal, $dirOctal);
|
||||
}
|
||||
|
||||
return $this->chmodReal($path, $dirOctal);
|
||||
$allFiles = $this->getFileManager()->getFileList($path);
|
||||
foreach ($allFiles as $item) {
|
||||
$result &= $this->chmodRecurse($path . Utils\Util::getSeparator() . $item, $fileOctal, $dirOctal);
|
||||
}
|
||||
|
||||
return false;
|
||||
return (bool) $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Change owner permission
|
||||
*
|
||||
@@ -262,7 +252,7 @@ class Permission
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function chown($path, $user='', $recurse=false)
|
||||
public function chown($path, $user = '', $recurse = false)
|
||||
{
|
||||
if (!file_exists($path)) {
|
||||
return false;
|
||||
@@ -295,13 +285,18 @@ class Permission
|
||||
return false;
|
||||
}
|
||||
|
||||
$allFiles = $this->getFileManager()->getFileList($path);
|
||||
|
||||
foreach ($items as $item) {
|
||||
$this->chownRecurse($path. Utils\Util::getSeparator() .$item, $user);
|
||||
if (!is_dir($path)) {
|
||||
return $this->chownReal($path, $user);
|
||||
}
|
||||
|
||||
return $this->chownReal($path, $user);
|
||||
$result = $this->chownReal($path, $user);
|
||||
|
||||
$allFiles = $this->getFileManager()->getFileList($path);
|
||||
foreach ($allFiles as $item) {
|
||||
$result &= $this->chownRecurse($path . Utils\Util::getSeparator() . $item, $user);
|
||||
}
|
||||
|
||||
return (bool) $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -347,15 +342,19 @@ class Permission
|
||||
return false;
|
||||
}
|
||||
|
||||
$allFiles = $this->getFileManager()->getFileList($path);
|
||||
|
||||
foreach ($items as $item) {
|
||||
$this->chgrpRecurse($path. Utils\Util::getSeparator() .$item, $group);
|
||||
if (!is_dir($path)) {
|
||||
return $this->chgrpReal($path, $group);
|
||||
}
|
||||
|
||||
return $this->chgrpReal($path, $group);
|
||||
}
|
||||
$result = $this->chgrpReal($path, $group);
|
||||
|
||||
$allFiles = $this->getFileManager()->getFileList($path);
|
||||
foreach ($allFiles as $item) {
|
||||
$result &= $this->chgrpRecurse($path . Utils\Util::getSeparator() . $item, $group);
|
||||
}
|
||||
|
||||
return (bool) $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change permissions recursive
|
||||
|
||||
@@ -51,9 +51,15 @@ class StreamHandler extends \Monolog\Handler\StreamHandler
|
||||
|
||||
$this->errorMessage = null;
|
||||
|
||||
set_error_handler(array($this, 'customErrorHandler'));
|
||||
$this->getFileManager()->appendContents($this->url, $this->pruneMessage($record));
|
||||
restore_error_handler();
|
||||
if (!is_writable($this->url)) {
|
||||
$this->getFileManager()->checkCreateFile($this->url);
|
||||
}
|
||||
|
||||
if (is_writable($this->url)) {
|
||||
set_error_handler(array($this, 'customErrorHandler'));
|
||||
$this->getFileManager()->appendContents($this->url, $this->pruneMessage($record));
|
||||
restore_error_handler();
|
||||
}
|
||||
|
||||
if (isset($this->errorMessage)) {
|
||||
throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened: '.$this->errorMessage, $this->url));
|
||||
|
||||
@@ -87,7 +87,7 @@ return array (
|
||||
'Lead',
|
||||
'Opportunity',
|
||||
),
|
||||
"tabList" => array("Account", "Contact", "Lead", "Opportunity", "Calendar", "Meeting", "Call", "Task", "Case", "Email"),
|
||||
"tabList" => array("Account", "Contact", "Lead", "Opportunity", "Calendar", "Meeting", "Call", "Task", "Case", "Email", "Document", "Campaign"),
|
||||
"quickCreateList" => array("Account", "Contact", "Lead", "Opportunity", "Meeting", "Call", "Task", "Case"),
|
||||
'calendarDefaultEntity' => 'Meeting',
|
||||
'disableExport' => false,
|
||||
@@ -95,6 +95,8 @@ return array (
|
||||
'assignmentEmailNotificationsEntityList' => array('Lead', 'Opportunity', 'Task', 'Case'),
|
||||
'emailMessageMaxSize' => 10,
|
||||
'notificationsCheckInterval' => 10,
|
||||
'disabledCountQueryEntityList' => array('Email'),
|
||||
'maxEmailAccountCount' => 2,
|
||||
'isInstalled' => false,
|
||||
);
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ return array (
|
||||
'maxJobNumber' => 15, /** Max number of jobs per one execution */
|
||||
'jobPeriod' => 7800, /** Period for jobs, ex. if cron executed at 15:35, it will execute all pending jobs for times from 14:05 to 15:35 */
|
||||
'minExecutionTime' => 50, /** to avoid too frequency execution **/
|
||||
'attempts' => 3, /** attempts to run jobs **/
|
||||
),
|
||||
'crud' => array(
|
||||
'get' => 'read',
|
||||
@@ -115,6 +116,7 @@ return array (
|
||||
'ldapTryUsernameSplit',
|
||||
'ldapOptReferrals',
|
||||
'ldapCreateEspoUser',
|
||||
'maxEmailAccountCount'
|
||||
),
|
||||
'isInstalled' => false,
|
||||
);
|
||||
|
||||
@@ -37,6 +37,8 @@ class Download extends \Espo\Core\EntryPoints\Base
|
||||
'application/vnd.oasis.opendocument.text',
|
||||
'application/vnd.oasis.opendocument.spreadsheet',
|
||||
'text/plain',
|
||||
'application/msword',
|
||||
'application/msexcel'
|
||||
);
|
||||
|
||||
public function run()
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\EntryPoints;
|
||||
|
||||
@@ -30,23 +30,23 @@ use \Espo\Core\Exceptions\Error;
|
||||
class LogoImage extends Image
|
||||
{
|
||||
public static $authRequired = false;
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->imageSizes['small-logo'] = array(173, 38);
|
||||
|
||||
{
|
||||
$this->imageSizes['small-logo'] = array(181, 44);
|
||||
|
||||
$id = $this->getConfig()->get('companyLogoId');
|
||||
|
||||
|
||||
if (empty($id)) {
|
||||
throw new NotFound();
|
||||
}
|
||||
|
||||
$size = null;
|
||||
|
||||
$size = null;
|
||||
if (!empty($_GET['size'])) {
|
||||
$size = $_GET['size'];
|
||||
}
|
||||
|
||||
$this->show($id, $size);
|
||||
}
|
||||
|
||||
$this->show($id, $size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,23 +18,23 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Hooks\Common;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
class AssignmentEmailNotification extends \Espo\Core\Hooks\Base
|
||||
{
|
||||
|
||||
{
|
||||
|
||||
public function afterSave(Entity $entity)
|
||||
{
|
||||
if (
|
||||
$this->getConfig()->get('assignmentEmailNotifications')
|
||||
&&
|
||||
&&
|
||||
in_array($entity->getEntityName(), $this->getConfig()->get('assignmentEmailNotificationsEntityList', array()))
|
||||
) {
|
||||
|
||||
) {
|
||||
|
||||
$userId = $entity->get('assignedUserId');
|
||||
if (!empty($userId) && $userId != $this->getUser()->id && $entity->isFieldChanged('assignedUserId')) {
|
||||
$job = $this->getEntityManager()->getEntity('Job');
|
||||
@@ -50,7 +50,7 @@ class AssignmentEmailNotification extends \Espo\Core\Hooks\Base
|
||||
'executeTime' => date('Y-m-d H:i:s'),
|
||||
));
|
||||
$this->getEntityManager()->saveEntity($job);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -131,6 +131,29 @@ class Stream extends \Espo\Core\Hooks\Base
|
||||
}
|
||||
}
|
||||
|
||||
protected function getAutofollowUserIdList(Entity $entity, array $ignoreList = array())
|
||||
{
|
||||
$entityType = $entity->getEntityName();
|
||||
$pdo = $this->getEntityManager()->getPDO();
|
||||
$userIdList = [];
|
||||
|
||||
$sql = "
|
||||
SELECT user_id AS 'userId' FROM autofollow WHERE entity_type = ".$pdo->quote($entityType)."
|
||||
";
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute();
|
||||
$rows = $sth->fetchAll();
|
||||
foreach ($rows as $row) {
|
||||
$userId = $row['userId'];
|
||||
if (in_array($userId, $ignoreList)) {
|
||||
continue;
|
||||
}
|
||||
$userIdList[] = $userId;
|
||||
}
|
||||
|
||||
return $userIdList;
|
||||
}
|
||||
|
||||
public function afterSave(Entity $entity)
|
||||
{
|
||||
$entityName = $entity->getEntityName();
|
||||
@@ -141,15 +164,44 @@ class Stream extends \Espo\Core\Hooks\Base
|
||||
$assignedUserId = $entity->get('assignedUserId');
|
||||
$createdById = $entity->get('createdById');
|
||||
|
||||
$userIdList = [];
|
||||
if (!empty($createdById)) {
|
||||
$this->getStreamService()->followEntity($entity, $createdById);
|
||||
$userIdList[] = $createdById;
|
||||
}
|
||||
if (!empty($assignedUserId) && $createdById != $assignedUserId) {
|
||||
$userIdList[] = $assignedUserId;
|
||||
}
|
||||
|
||||
if (!empty($assignedUserId) && $createdById != $assignedUserId) {
|
||||
$this->getStreamService()->followEntity($entity, $assignedUserId);
|
||||
|
||||
if (!empty($userIdList)) {
|
||||
$this->getStreamService()->followEntityMass($entity, $userIdList);
|
||||
}
|
||||
|
||||
$this->getStreamService()->noteCreate($entity);
|
||||
|
||||
|
||||
$autofollowUserIdList = $this->getAutofollowUserIdList($entity, $userIdList);
|
||||
foreach ($autofollowUserIdList as $i => $userId) {
|
||||
if (in_array($userId, $userIdList)) {
|
||||
unset($autofollowUserIdList[$i]);
|
||||
}
|
||||
}
|
||||
$autofollowUserIdList = array_values($autofollowUserIdList);
|
||||
|
||||
if (!empty($autofollowUserIdList)) {
|
||||
$job = $this->getEntityManager()->getEntity('Job');
|
||||
$job->set(array(
|
||||
'serviceName' => 'Stream',
|
||||
'method' => 'afterRecordCreatedJob',
|
||||
'data' => array(
|
||||
'userIdList' => $autofollowUserIdList,
|
||||
'entityType' => $entity->getEntityName(),
|
||||
'entityId' => $entity->id
|
||||
)
|
||||
));
|
||||
$this->getEntityManager()->saveEntity($job);
|
||||
}
|
||||
|
||||
} else {
|
||||
if ($entity->isFieldChanged('assignedUserId')) {
|
||||
$assignedUserId = $entity->get('assignedUserId');
|
||||
|
||||
+2
-2
@@ -18,11 +18,11 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Controllers;
|
||||
|
||||
class Contract extends \Espo\Core\Controllers\Record
|
||||
class Campaign extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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/.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Controllers;
|
||||
|
||||
class TargetList extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
|
||||
}
|
||||
+2
-3
@@ -18,12 +18,11 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
class Contract extends \Espo\Core\Entities\Person
|
||||
class Campaign extends \Espo\Core\ORM\Entity
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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/.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
class CampaignLogRecord extends \Espo\Core\ORM\Entity
|
||||
{
|
||||
|
||||
}
|
||||
@@ -18,13 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
class CaseObj extends \Espo\Core\ORM\Entity
|
||||
{
|
||||
|
||||
protected $entityName = 'Case';
|
||||
protected $entityType = 'Case';
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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/.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
class TargetList extends \Espo\Core\ORM\Entity
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?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/.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Repositories;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
class Task extends \Espo\Core\ORM\Repositories\RDB
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
$this->dependencies[] = 'dateTime';
|
||||
$this->dependencies[] = 'config';
|
||||
}
|
||||
|
||||
protected function getConfig()
|
||||
{
|
||||
return $this->getInjection('config');
|
||||
}
|
||||
|
||||
protected function getDateTime()
|
||||
{
|
||||
return $this->getInjection('dateTime');
|
||||
}
|
||||
|
||||
protected function convertDateTimeToDefaultTimezone($string)
|
||||
{
|
||||
$dateTime = \DateTime::createFromFormat($this->getDateTime()->getInternalDateTimeFormat(), $string);
|
||||
$timeZone = $this->getConfig()->get('timeZone');
|
||||
if (empty($timeZone)) {
|
||||
$timeZone = 'UTC';
|
||||
}
|
||||
$tz = $timezone = new \DateTimeZone($timeZone);
|
||||
|
||||
if ($dateTime) {
|
||||
return $dateTime->setTimezone($tz)->format($this->getDateTime()->getInternalDateTimeFormat());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function beforeSave(Entity $entity)
|
||||
{
|
||||
parent::beforeSave($entity);
|
||||
|
||||
if ($entity->has('dateStartDate')) {
|
||||
$dateStartDate = $entity->get('dateStartDate');
|
||||
if (!empty($dateStartDate)) {
|
||||
$dateStart = $dateStartDate . ' 00:00:00';
|
||||
$dateStart = $this->convertDateTimeToDefaultTimezone($dateStart);
|
||||
|
||||
$entity->set('dateStart', $dateStart);
|
||||
} else {
|
||||
$entity->set('dateStartDate', null);
|
||||
}
|
||||
}
|
||||
|
||||
if ($entity->has('dateEndDate')) {
|
||||
$dateEndDate = $entity->get('dateEndDate');
|
||||
if (!empty($dateEndDate)) {
|
||||
$dateEnd = $dateEndDate . ' 00:00:00';
|
||||
$dateEnd = $this->convertDateTimeToDefaultTimezone($dateEnd);
|
||||
|
||||
$entity->set('dateEnd', $dateEnd);
|
||||
} else {
|
||||
$entity->set('dateEndDate', null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,10 @@
|
||||
"contacts": "Kontakte",
|
||||
"opportunities": "Verkaufschancen",
|
||||
"cases": "Fälle",
|
||||
"documents": "Dokumente"
|
||||
"documents": "Dokumente",
|
||||
"meetingsPrimary": "Meetings (intern)",
|
||||
"callsPrimary": "Anrufe (intern)",
|
||||
"tasksPrimary": "Aufgaben (intern)"
|
||||
},
|
||||
"options": {
|
||||
"type": {
|
||||
@@ -26,13 +29,32 @@
|
||||
"Reseller": "Wiederverkäufer"
|
||||
},
|
||||
"industry": {
|
||||
"Apparel": "Bekleidungsindustrie",
|
||||
"Agriculture": "Landwirtschaft",
|
||||
"Advertising": "Werbewirtschaft",
|
||||
"Apparel & Accessories": "Bekleidungsindustrie",
|
||||
"Automotive": "Automobilindustrie",
|
||||
"Banking": "Bankwesen",
|
||||
"Computer Software": "Computer Software",
|
||||
"Biotechnology": "Biotechnologie",
|
||||
"Chemical": "Chemieindustrie",
|
||||
"Computer": "Informationstechnologie",
|
||||
"Education": "Bildungswesen",
|
||||
"Electronics": "Elektronik",
|
||||
"Entertainment & Leisure": "Freizeit- und Unterhaltungsindustrie",
|
||||
"Finance": "Finanzsektor",
|
||||
"Insurance": "Versicherung"
|
||||
"Food & Beverage": "Speisen und Getränke",
|
||||
"Grocery": "Einzelhandel",
|
||||
"Insurance": "Versicherung",
|
||||
"Legal": "Rechtswesen",
|
||||
"Publishing": "Medien",
|
||||
"Real Estate": "Immobilien",
|
||||
"Service": "Dienstleistung",
|
||||
"Sports": "Sport",
|
||||
"Sofware": "Software",
|
||||
"Technology": "Technologie",
|
||||
"Telecommunications": "Telekommunikation",
|
||||
"Television": "Fernsehen",
|
||||
"Transportation": "Transportwesen",
|
||||
"Venture Capital": "Risikokapital"
|
||||
}
|
||||
},
|
||||
"labels": {
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
"users": "Benutzer",
|
||||
"contacts": "Kontakte",
|
||||
"leads": "Interessenten",
|
||||
"reminders": "Erinnerungen"
|
||||
},
|
||||
"links": {
|
||||
"reminders": "Erinnerungen",
|
||||
"account": "Firma"
|
||||
},
|
||||
"links": {},
|
||||
"options": {
|
||||
"status": {
|
||||
"Planned": "Geplant",
|
||||
@@ -28,7 +28,8 @@
|
||||
"acceptanceStatus": {
|
||||
"None": "Kein(e)",
|
||||
"Accepted": "Akzeptiert",
|
||||
"Declined": "Abgelehnt"
|
||||
"Declined": "Abgelehnt",
|
||||
"Tentative": "Mit Vorbehalt"
|
||||
}
|
||||
},
|
||||
"labels": {
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
"type": "Typ",
|
||||
"description": "Beschreibung"
|
||||
},
|
||||
"links": {
|
||||
},
|
||||
"links": {},
|
||||
"options": {
|
||||
"status": {
|
||||
"New": "Neu",
|
||||
@@ -20,7 +19,7 @@
|
||||
"Rejected": "Abgelehnt",
|
||||
"Duplicate": "Duplizieren"
|
||||
},
|
||||
"priority" : {
|
||||
"priority": {
|
||||
"Low": "Niedrig",
|
||||
"Normal": "Normal",
|
||||
"High": "Hoch",
|
||||
|
||||
@@ -58,17 +58,17 @@
|
||||
"billingAddressCity": "Ort",
|
||||
"billingAddressCountry": "Land",
|
||||
"billingAddressPostalCode": "PLZ",
|
||||
"billingAddressState": "Bundesland/Kanton",
|
||||
"billingAddressState": "Bundesland\/Kanton",
|
||||
"billingAddressStreet": "Straße",
|
||||
"addressCity": "Ort",
|
||||
"addressStreet": "Straße",
|
||||
"addressCountry": "Land",
|
||||
"addressState": "Bundesland/Kanton",
|
||||
"addressState": "Bundesland\/Kanton",
|
||||
"addressPostalCode": "PLZ",
|
||||
"shippingAddressCity": "Ort (Lieferadresse)",
|
||||
"shippingAddressStreet": "Straße (Lieferadresse)",
|
||||
"shippingAddressCountry": "Land (Lieferadresse)",
|
||||
"shippingAddressState": "Bundesland/Kanton (Lieferadresse)",
|
||||
"shippingAddressState": "Bundesland\/Kanton (Lieferadresse)",
|
||||
"shippingAddressPostalCode": "PLZ (Lieferadresse)"
|
||||
},
|
||||
"links": {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"trashFolder": "Papierkorb Ordner",
|
||||
"ssl": "SSL",
|
||||
"createCase": "Fall erstellen",
|
||||
"reply": "Antworten",
|
||||
"reply": "Autoantwort",
|
||||
"caseDistribution": "Fall Verteilung",
|
||||
"replyEmailTemplate": "Vorlage E-Mail Antwort",
|
||||
"replyFromAddress": "Von Adresse antworten",
|
||||
@@ -25,11 +25,11 @@
|
||||
"createCase": "Fall aus eingehender E-Mail automatisch erstellen.",
|
||||
"replyToAddress": "Geben Sie die E-Mail Adresse dieser Mailbox an um Antworten hier zu empfangen.",
|
||||
"caseDistribution": "Wie Fälle zugewiesen werden. Entweder direkt dem Benutzer oder im Team.",
|
||||
"assignToUser": "Benutzer E-Mails/Fälle werden zugewiesen an",
|
||||
"team": "Team E-Mails/Fälle werden verknüpft mit"
|
||||
},
|
||||
"links": {
|
||||
"assignToUser": "Benutzer E-Mails\/Fälle werden zugewiesen an",
|
||||
"team": "Team E-Mails\/Fälle werden verknüpft mit",
|
||||
"targetUserPosition": "Bestimmen Sie die Position der Benutzer die Fälle zugewiesen bekommen."
|
||||
},
|
||||
"links": {},
|
||||
"options": {
|
||||
"status": {
|
||||
"Active": "Aktiv",
|
||||
|
||||
@@ -22,8 +22,7 @@
|
||||
"createdContact": "Kontakt",
|
||||
"createdOpportunity": "Verkaufschance"
|
||||
},
|
||||
"links": {
|
||||
},
|
||||
"links": {},
|
||||
"options": {
|
||||
"status": {
|
||||
"New": "Neu",
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
"users": "Benutzer",
|
||||
"contacts": "Kontakte",
|
||||
"leads": "Interessenten",
|
||||
"reminders": "Erinnerungen"
|
||||
},
|
||||
"links": {
|
||||
"reminders": "Erinnerungen",
|
||||
"account": "Firma"
|
||||
},
|
||||
"links": {},
|
||||
"options": {
|
||||
"status": {
|
||||
"Planned": "Geplant",
|
||||
@@ -23,7 +23,8 @@
|
||||
"acceptanceStatus": {
|
||||
"None": "Kein(e)",
|
||||
"Accepted": "Akzeptiert",
|
||||
"Declined": "Abgelehnt"
|
||||
"Declined": "Abgelehnt",
|
||||
"Tentative": "Mit Vorbehalt"
|
||||
}
|
||||
},
|
||||
"labels": {
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
"Qualification": "Qualifikation",
|
||||
"Needs Analysis": "Bedarfserhebung",
|
||||
"Value Proposition": "Richtangebot",
|
||||
"Id. Decision Makers": "Id. Entscheider",
|
||||
"Id. Decision Makers": "Entscheider ident.",
|
||||
"Perception Analysis": "Analyse Sichtweise",
|
||||
"Proposal/Price Quote": "Preisangebot",
|
||||
"Negotiation/Review": "Verhandlung/Überarbeitung",
|
||||
"Negotiation/Review": "Verhandlung\/Überarbeitung",
|
||||
"Closed Won": "Gewonnen",
|
||||
"Closed Lost": "Verloren"
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
"options": {
|
||||
"job": {
|
||||
"CheckInboundEmails": "Eingehende E-Mail überprüfen",
|
||||
"CheckInboundEmails": "Eingehende E-Mail prüfen",
|
||||
"CheckEmailAccounts": "Persönliche E-Mail Konten prüfen",
|
||||
"SendEmailReminders": "E-Mail Erinnerungen senden"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
"address": "Adresse",
|
||||
"description": "Beschreibung"
|
||||
},
|
||||
"links": {
|
||||
},
|
||||
"links": {},
|
||||
"labels": {
|
||||
"Create Target": "Zielkontakt erstellen",
|
||||
"Convert to Lead": "Zu Interessent umwandeln"
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
"description": "Beschreibung",
|
||||
"isOverdue": "Ist überfällig"
|
||||
},
|
||||
"links": {
|
||||
},
|
||||
"links": {},
|
||||
"options": {
|
||||
"status": {
|
||||
"Not Started": "Nicht begonnen",
|
||||
@@ -18,7 +17,7 @@
|
||||
"Completed": "Abgeschlossen",
|
||||
"Canceled": "Storniert"
|
||||
},
|
||||
"priority" : {
|
||||
"priority": {
|
||||
"Low": "Niedrig",
|
||||
"Normal": "Normal",
|
||||
"High": "Hoch",
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"sicCode": "Sic Code",
|
||||
"industry": "Industry",
|
||||
"type": "Type",
|
||||
"contactRole": "Role"
|
||||
"contactRole": "Role",
|
||||
"campaign": "Campaign"
|
||||
},
|
||||
"links": {
|
||||
"contacts": "Contacts",
|
||||
@@ -19,7 +20,9 @@
|
||||
"documents": "Documents",
|
||||
"meetingsPrimary": "Meetings (Internal)",
|
||||
"callsPrimary": "Calls (Internal)",
|
||||
"tasksPrimary": "Tasks (Internal)"
|
||||
"tasksPrimary": "Tasks (Internal)",
|
||||
"targetLists": "Target Lists",
|
||||
"campaignLogRecords": "Campaign Log"
|
||||
},
|
||||
"options": {
|
||||
"type": {
|
||||
@@ -49,7 +52,7 @@
|
||||
"Real Estate": "Real Estate",
|
||||
"Service": "Service",
|
||||
"Sports": "Sports",
|
||||
"Sofware": "Sofware",
|
||||
"Software": "Software",
|
||||
"Technology": "Technology",
|
||||
"Telecommunications": "Telecommunications",
|
||||
"Television": "Television",
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"fields": {
|
||||
"name": "Name",
|
||||
"description": "Description",
|
||||
"status": "Status",
|
||||
"type": "Type",
|
||||
"startDate": "Start Date",
|
||||
"endDate": "End Date",
|
||||
"targetLists": "Target Lists",
|
||||
"sentCount": "Sent",
|
||||
"openedCount": "Opened",
|
||||
"clickedCount": "Clicked",
|
||||
"optedOutCount": "Opted Out",
|
||||
"bouncedCount": "Bounced",
|
||||
"hardBouncedCount": "Hard Bounced",
|
||||
"softBouncedCount": "Soft Bounced",
|
||||
"leadCreatedCount": "Leads Created",
|
||||
"revenue": "Revenue"
|
||||
},
|
||||
"links": {
|
||||
"targetLists": "Target Lists",
|
||||
"accounts": "Accounts",
|
||||
"contacts": "Contacts",
|
||||
"leads": "Leads",
|
||||
"opportunities": "Opportunities",
|
||||
"campaignLogRecords": "Log"
|
||||
},
|
||||
"options": {
|
||||
"type": {
|
||||
"Email": "Email",
|
||||
"Web": "Web",
|
||||
"Television": "Television",
|
||||
"Radio": "Radio",
|
||||
"Newsletter": "Newsletter",
|
||||
"Mail": "Mail"
|
||||
},
|
||||
"status": {
|
||||
"Planning": "Planning",
|
||||
"Active": "Active",
|
||||
"Inactive": "Inactive",
|
||||
"Complete": "Complete"
|
||||
}
|
||||
},
|
||||
"labels": {
|
||||
"Create Campaign": "Create Campaign",
|
||||
"Target Lists": "Target Lists",
|
||||
"Statistics": "Statistics",
|
||||
"hard": "hard",
|
||||
"soft": "soft"
|
||||
},
|
||||
"presetFilters": {
|
||||
"active": "Active"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"fields": {
|
||||
"action": "Action",
|
||||
"actionDate": "Date",
|
||||
"data": "Data",
|
||||
"campaign": "Campaign",
|
||||
"parent": "Target",
|
||||
"object": "Object",
|
||||
"application": "Application"
|
||||
},
|
||||
"options": {
|
||||
"action": {
|
||||
"Sent": "Sent",
|
||||
"Opened": "Opened",
|
||||
"Opted Out": "Opted Out",
|
||||
"Bounced": "Bounced",
|
||||
"Clicked": "Clicked",
|
||||
"Lead Created": "Lead Created"
|
||||
}
|
||||
},
|
||||
"labels": {
|
||||
"All": "All"
|
||||
}
|
||||
}
|
||||
@@ -11,11 +11,14 @@
|
||||
"address": "Address",
|
||||
"opportunityRole": "Opportunity Role",
|
||||
"accountRole": "Role",
|
||||
"description": "Description"
|
||||
"description": "Description",
|
||||
"campaign": "Campaign"
|
||||
},
|
||||
"links": {
|
||||
"opportunities": "Opportunities",
|
||||
"cases": "Cases"
|
||||
"cases": "Cases",
|
||||
"targetLists": "Target Lists",
|
||||
"campaignLogRecords": "Campaign Log"
|
||||
},
|
||||
"labels": {
|
||||
"Create Contact": "Create Contact"
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
"Task": "Task",
|
||||
"Case": "Case",
|
||||
"InboundEmail": "Inbound Email",
|
||||
"Document": "Document"
|
||||
"Document": "Document",
|
||||
"Campaign": "Campaign",
|
||||
"TargetList": "Target List"
|
||||
},
|
||||
"scopeNamesPlural": {
|
||||
"Account": "Accounts",
|
||||
@@ -25,7 +27,9 @@
|
||||
"Task": "Tasks",
|
||||
"Case": "Cases",
|
||||
"InboundEmail": "Inbound Emails",
|
||||
"Document": "Documents"
|
||||
"Document": "Documents",
|
||||
"Campaign": "Campaigns",
|
||||
"TargetList": "Target Lists"
|
||||
},
|
||||
"dashlets": {
|
||||
"Leads": "My Leads",
|
||||
|
||||
@@ -20,9 +20,12 @@
|
||||
"description": "Description",
|
||||
"createdAccount": "Account",
|
||||
"createdContact": "Contact",
|
||||
"createdOpportunity": "Opportunity"
|
||||
"createdOpportunity": "Opportunity",
|
||||
"campaign": "Campaign"
|
||||
},
|
||||
"links": {
|
||||
"targetLists": "Target Lists",
|
||||
"campaignLogRecords": "Campaign Log"
|
||||
},
|
||||
"options": {
|
||||
"status": {
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"contacts": "Contacts",
|
||||
"description": "Description",
|
||||
"amountConverted": "Amount (converted)",
|
||||
"amountWeightedConverted": "Amount Weighted"
|
||||
"amountWeightedConverted": "Amount Weighted",
|
||||
"campaign": "Campaign"
|
||||
},
|
||||
"links": {
|
||||
"contacts": "Contacts",
|
||||
@@ -28,7 +29,7 @@
|
||||
"Proposal/Price Quote": "Proposal/Price Quote",
|
||||
"Negotiation/Review": "Negotiation/Review",
|
||||
"Closed Won": "Closed Won",
|
||||
"Closed Lost": "Closed Lost"
|
||||
"Closed Lost": "Closed Lost"
|
||||
}
|
||||
},
|
||||
"labels": {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"fields": {
|
||||
"name": "Name",
|
||||
"description": "Description",
|
||||
"entryCount": "Entry Count",
|
||||
"campaigns": "Campaigns",
|
||||
"endDate": "End Date",
|
||||
"targetLists": "Target Lists"
|
||||
},
|
||||
"links": {
|
||||
"accounts": "Accounts",
|
||||
"contacts": "Contacts",
|
||||
"leads": "Leads",
|
||||
"campaigns": "Campaigns"
|
||||
},
|
||||
"options": {
|
||||
"type": {
|
||||
"Email": "Email",
|
||||
"Web": "Web",
|
||||
"Television": "Television",
|
||||
"Radio": "Radio",
|
||||
"Newsletter": "Newsletter"
|
||||
}
|
||||
},
|
||||
"labels": {
|
||||
"Create TargetList": "Create Target List"
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,8 @@
|
||||
"Not Started": "Not Started",
|
||||
"Started": "Started",
|
||||
"Completed": "Completed",
|
||||
"Canceled": "Canceled"
|
||||
"Canceled": "Canceled",
|
||||
"Deferred": "Deferred"
|
||||
},
|
||||
"priority" : {
|
||||
"Low": "Low",
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"links": {
|
||||
"targetLists": "Target Lists"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
[
|
||||
{
|
||||
"label":"Overview",
|
||||
"rows":[
|
||||
[{"name":"name"}, {"name":"status"}],
|
||||
[{"name":"type"}, {"name":"startDate"}],
|
||||
[{"name":"targetLists"}, {"name":"endDate"}],
|
||||
[{"name":"description", "fullWidth": true}]
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,11 @@
|
||||
[
|
||||
{
|
||||
"label": "",
|
||||
"rows": [
|
||||
[{"name":"name"}],
|
||||
[{"name":"type"}],
|
||||
[{"name":"status"}],
|
||||
[{"name":"endDate"}]
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,5 @@
|
||||
[
|
||||
"type",
|
||||
"status",
|
||||
"endDate"
|
||||
]
|
||||
@@ -0,0 +1,6 @@
|
||||
[
|
||||
{"name":"name","width":40,"link":true},
|
||||
{"name":"type","width":20},
|
||||
{"name":"status"},
|
||||
{"name":"endDate"}
|
||||
]
|
||||
@@ -0,0 +1,5 @@
|
||||
[
|
||||
{"name": "name", "width": 40,"link": true},
|
||||
{"name": "type", "width": 30},
|
||||
{"name": "status", "width": 30}
|
||||
]
|
||||
@@ -0,0 +1,5 @@
|
||||
[
|
||||
"campaignLogRecords",
|
||||
"opportunities",
|
||||
"leads"
|
||||
]
|
||||
@@ -0,0 +1,6 @@
|
||||
[
|
||||
{"name": "action", "notSortable": true, "width": 15},
|
||||
{"name": "parent", "notSortable": true},
|
||||
{"name": "data", "notSortable": true, "customLabel": ""},
|
||||
{"name": "actionDate", "width": 18}
|
||||
]
|
||||
@@ -0,0 +1,6 @@
|
||||
[
|
||||
{"name": "action", "notSortable": true, "width": 15},
|
||||
{"name": "data", "notSortable": true, "customLabel": ""},
|
||||
{"name": "campaign", "notSortable": true},
|
||||
{"name": "actionDate", "width": 18}
|
||||
]
|
||||
@@ -1,6 +1,6 @@
|
||||
[
|
||||
{"name":"name","width":30,"link":true},
|
||||
{"name":"account","width":20},
|
||||
{"name":"name","width":25,"link":true},
|
||||
{"name":"account","width":25},
|
||||
{"name":"emailAddress", "notSortable": true},
|
||||
{"name":"phoneNumber", "notSortable": true}
|
||||
]
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
[
|
||||
{"name":"name","width":32,"link":"true"},
|
||||
{"name":"accountRole", "notSortable": true},
|
||||
{"name":"emailAddress"},
|
||||
{"name":"phoneNumber"}
|
||||
{"name":"name", "width":35,"link":"true"},
|
||||
{"name":"accountRole", "width":35, "notSortable": true},
|
||||
{"name":"emailAddress"}
|
||||
]
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
[
|
||||
{"name":"name","width":32,"link":"true"},
|
||||
{"name":"account"},
|
||||
{"name":"emailAddress", "notSortable": true},
|
||||
{"name":"phoneNumber", "notSortable": true}
|
||||
{"name":"name", "width":35,"link":"true"},
|
||||
{"name":"account", "width":35},
|
||||
{"name":"emailAddress", "notSortable": true}
|
||||
]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[
|
||||
"assignedUser",
|
||||
"address",
|
||||
"campaign",
|
||||
"status",
|
||||
"source",
|
||||
"opportunityAmountConverted",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[
|
||||
{"name":"name", "width":32, "link":true},
|
||||
{"name":"status"},
|
||||
{"name":"name", "width":35, "link":true},
|
||||
{"name":"status", "width":35},
|
||||
{"name":"emailAddress", "notSortable": true}
|
||||
]
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"account",
|
||||
"amountConverted",
|
||||
"assignedUser",
|
||||
"campaign",
|
||||
"closeDate",
|
||||
"contacts",
|
||||
"leadSource",
|
||||
|
||||
@@ -1 +1 @@
|
||||
[]
|
||||
["documents"]
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
[
|
||||
{
|
||||
"label":"Overview",
|
||||
"rows":[
|
||||
[{"name":"name"}, {"name":"entryCount"}],
|
||||
[{"name":"description", "fullWidth": true}]
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,8 @@
|
||||
[
|
||||
{
|
||||
"label": "",
|
||||
"rows": [
|
||||
[{"name":"name"}]
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,2 @@
|
||||
[
|
||||
]
|
||||
@@ -0,0 +1,5 @@
|
||||
[
|
||||
{"name":"name","width":40,"link":true},
|
||||
{"name":"entryCount", "width":30},
|
||||
{"name":"createdAt"}
|
||||
]
|
||||
@@ -0,0 +1,5 @@
|
||||
[
|
||||
{"name":"name","width":40,"link":true},
|
||||
{"name":"entryCount", "width":30},
|
||||
{"name":"createdAt"}
|
||||
]
|
||||
@@ -0,0 +1,6 @@
|
||||
[
|
||||
"contacts",
|
||||
"leads",
|
||||
"users",
|
||||
"accounts"
|
||||
]
|
||||
@@ -28,6 +28,11 @@
|
||||
|
||||
],
|
||||
"layout":"listForAccount"
|
||||
},
|
||||
"campaignLogRecords": {
|
||||
"rowActionsView": "Record.RowActions.Empty",
|
||||
"select": false,
|
||||
"create": false
|
||||
}
|
||||
},
|
||||
"boolFilters": ["onlyMy"]
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
{
|
||||
"controller": "Controllers.Record",
|
||||
"views":{
|
||||
"detail":"Crm:Call.Detail",
|
||||
"list": "Crm:Call.List"
|
||||
"detail":"Crm:Call.Detail"
|
||||
},
|
||||
"recordViews":{
|
||||
"list":"Crm:Call.Record.List"
|
||||
},
|
||||
"menu": {
|
||||
"detail": {
|
||||
"dropdown": [
|
||||
"actions": [
|
||||
{
|
||||
"label": "Duplicate",
|
||||
"action": "duplicate",
|
||||
@@ -25,12 +24,25 @@
|
||||
"label":"Attendees",
|
||||
"view":"Record.Panels.Side",
|
||||
"options":{
|
||||
"fields":[
|
||||
"fieldList":[
|
||||
"users",
|
||||
"contacts",
|
||||
"leads"
|
||||
],
|
||||
"mode":"detail"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"detailSmall":[
|
||||
{
|
||||
"name":"attendees",
|
||||
"label":"Attendees",
|
||||
"view":"Record.Panels.Side",
|
||||
"options":{
|
||||
"fieldList":[
|
||||
"users",
|
||||
"contacts",
|
||||
"leads"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -40,12 +52,25 @@
|
||||
"label":"Attendees",
|
||||
"view":"Record.Panels.Side",
|
||||
"options":{
|
||||
"fields":[
|
||||
"fieldList":[
|
||||
"users",
|
||||
"contacts",
|
||||
"leads"
|
||||
],
|
||||
"mode":"edit"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"editSmall":[
|
||||
{
|
||||
"name":"attendees",
|
||||
"label":"Attendees",
|
||||
"view":"Record.Panels.Side",
|
||||
"options":{
|
||||
"fieldList":[
|
||||
"users",
|
||||
"contacts",
|
||||
"leads"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -73,6 +98,7 @@
|
||||
},
|
||||
{
|
||||
"name":"todays",
|
||||
"style": "info",
|
||||
"data": {
|
||||
"dateStart": {
|
||||
"type": "today",
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"controller": "Controllers.Record",
|
||||
"menu": {
|
||||
"list": {
|
||||
"buttons": [
|
||||
{
|
||||
"label": "Target Lists",
|
||||
"link": "#TargetList",
|
||||
"acl": "read",
|
||||
"style": "link",
|
||||
"aclScope": "TargetList"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"recordViews": {
|
||||
"detail": "Crm:Campaign.Record.Detail"
|
||||
},
|
||||
"sidePanels":{
|
||||
"detail":[
|
||||
{
|
||||
"name":"statistics",
|
||||
"label":"Statistics",
|
||||
"view":"Crm:Campaign.Record.Panels.Statistics"
|
||||
}
|
||||
]
|
||||
},
|
||||
"relationshipPanels": {
|
||||
"campaignLogRecords": {
|
||||
"view": "Crm:Campaign.Record.Panels.CampaignLogRecords",
|
||||
"layout": "listForCampaign",
|
||||
"rowActionsView": "Record.RowActions.Empty",
|
||||
"select": false,
|
||||
"create": false
|
||||
}
|
||||
},
|
||||
"presetFilters": [
|
||||
{
|
||||
"name":"active",
|
||||
"style": "primary",
|
||||
"data": {
|
||||
"status": {
|
||||
"type": "in",
|
||||
"value": ["Active"]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"boolFilters": ["onlyMy"]
|
||||
}
|
||||
@@ -22,5 +22,12 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"boolFilters": ["onlyMy"]
|
||||
"relationshipPanels": {
|
||||
"campaignLogRecords": {
|
||||
"rowActionsView": "Record.RowActions.Empty",
|
||||
"select": false,
|
||||
"create": false
|
||||
}
|
||||
},
|
||||
"boolFilters": ["onlyMy"]
|
||||
}
|
||||
|
||||
@@ -25,6 +25,13 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"relationshipPanels": {
|
||||
"campaignLogRecords": {
|
||||
"rowActionsView": "Record.RowActions.Empty",
|
||||
"select": false,
|
||||
"create": false
|
||||
}
|
||||
},
|
||||
"presetFilters": [
|
||||
{
|
||||
"name":"active",
|
||||
@@ -35,7 +42,7 @@
|
||||
"value": ["New", "Assigned", "In Process"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"boolFilters": ["onlyMy"]
|
||||
}
|
||||
|
||||
@@ -3,9 +3,12 @@
|
||||
"views":{
|
||||
"detail":"Crm:Meeting.Detail"
|
||||
},
|
||||
"recordViews":{
|
||||
"list":"Crm:Meeting.Record.List"
|
||||
},
|
||||
"menu": {
|
||||
"detail": {
|
||||
"dropdown": [
|
||||
"actions": [
|
||||
{
|
||||
"label": "Duplicate",
|
||||
"action": "duplicate",
|
||||
@@ -21,12 +24,25 @@
|
||||
"label":"Attendees",
|
||||
"view":"Record.Panels.Side",
|
||||
"options":{
|
||||
"fields":[
|
||||
"fieldList":[
|
||||
"users",
|
||||
"contacts",
|
||||
"leads"
|
||||
],
|
||||
"mode":"detail"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"detailSmall":[
|
||||
{
|
||||
"name":"attendees",
|
||||
"label":"Attendees",
|
||||
"view":"Record.Panels.Side",
|
||||
"options":{
|
||||
"fieldList":[
|
||||
"users",
|
||||
"contacts",
|
||||
"leads"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -36,12 +52,25 @@
|
||||
"label":"Attendees",
|
||||
"view":"Record.Panels.Side",
|
||||
"options":{
|
||||
"fields":[
|
||||
"fieldList":[
|
||||
"users",
|
||||
"contacts",
|
||||
"leads"
|
||||
],
|
||||
"mode":"edit"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"editSmall":[
|
||||
{
|
||||
"name":"attendees",
|
||||
"label":"Attendees",
|
||||
"view":"Record.Panels.Side",
|
||||
"options":{
|
||||
"fieldList":[
|
||||
"users",
|
||||
"contacts",
|
||||
"leads"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -69,6 +98,7 @@
|
||||
},
|
||||
{
|
||||
"name":"todays",
|
||||
"style": "info",
|
||||
"data": {
|
||||
"dateStart": {
|
||||
"type": "today",
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"controller": "Controllers.Record",
|
||||
"boolFilters": ["onlyMy"]
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
"data": {
|
||||
"status": {
|
||||
"type": "in",
|
||||
"value": ["Not Started", "Started"]
|
||||
"value": ["Not Started", "Started", "Deferred"]
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -30,6 +30,7 @@
|
||||
},
|
||||
{
|
||||
"name":"todays",
|
||||
"style": "info",
|
||||
"data": {
|
||||
"dateEnd": {
|
||||
"type": "today",
|
||||
|
||||
@@ -104,6 +104,10 @@
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"campaign": {
|
||||
"type": "link",
|
||||
"layoutListDisabled": true
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "datetime",
|
||||
"readOnly": true
|
||||
@@ -208,6 +212,22 @@
|
||||
"entity": "Email",
|
||||
"foreign": "parent",
|
||||
"layoutRelationshipsDisabled": true
|
||||
},
|
||||
"campaign": {
|
||||
"type": "belongsTo",
|
||||
"entity": "Campaign",
|
||||
"foreign": "accounts",
|
||||
"noJoin": true
|
||||
},
|
||||
"campaignLogRecords": {
|
||||
"type": "hasChildren",
|
||||
"entity": "CampaignLogRecord",
|
||||
"foreign": "parent"
|
||||
},
|
||||
"targetLists": {
|
||||
"type": "hasMany",
|
||||
"entity": "TargetList",
|
||||
"foreign": "accounts"
|
||||
}
|
||||
},
|
||||
"collection": {
|
||||
|
||||
@@ -140,8 +140,7 @@
|
||||
"len": "36",
|
||||
"default": "None"
|
||||
}
|
||||
},
|
||||
"layoutRelationshipsDisabled": true
|
||||
}
|
||||
},
|
||||
"contacts": {
|
||||
"type": "hasMany",
|
||||
@@ -153,8 +152,7 @@
|
||||
"len": "36",
|
||||
"default": "None"
|
||||
}
|
||||
},
|
||||
"layoutRelationshipsDisabled": true
|
||||
}
|
||||
},
|
||||
"leads": {
|
||||
"type": "hasMany",
|
||||
@@ -166,8 +164,7 @@
|
||||
"len": "36",
|
||||
"default": "None"
|
||||
}
|
||||
},
|
||||
"layoutRelationshipsDisabled": true
|
||||
}
|
||||
},
|
||||
"parent": {
|
||||
"type": "belongsToParent",
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
{
|
||||
"fields": {
|
||||
"name": {
|
||||
"type": "varchar",
|
||||
"required": true
|
||||
},
|
||||
"status": {
|
||||
"type": "enum",
|
||||
"options": ["Planning", "Active", "Inactive", "Complete"],
|
||||
"default": "Planning"
|
||||
},
|
||||
"type": {
|
||||
"type": "enum",
|
||||
"options": ["Email", "Newsletter", "Web", "Television", "Radio", "Mail"]
|
||||
},
|
||||
"startDate": {
|
||||
"type": "date"
|
||||
},
|
||||
"endDate": {
|
||||
"type": "date"
|
||||
},
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "datetime",
|
||||
"readOnly": true
|
||||
},
|
||||
"modifiedAt": {
|
||||
"type": "datetime",
|
||||
"readOnly": true
|
||||
},
|
||||
"createdBy": {
|
||||
"type": "link",
|
||||
"readOnly": true
|
||||
},
|
||||
"modifiedBy": {
|
||||
"type": "link",
|
||||
"readOnly": true
|
||||
},
|
||||
"assignedUser": {
|
||||
"type": "link",
|
||||
"required": true
|
||||
},
|
||||
"teams": {
|
||||
"type": "linkMultiple"
|
||||
},
|
||||
"targetLists": {
|
||||
"type": "linkMultiple"
|
||||
},
|
||||
"sentCount": {
|
||||
"type": "int",
|
||||
"notStorable": true,
|
||||
"readOnly": true,
|
||||
"layoutDetailDisabled": true,
|
||||
"layoutListDisabled": true,
|
||||
"layoutSearchDisabled": true
|
||||
},
|
||||
"openedCount": {
|
||||
"type": "int",
|
||||
"notStorable": true,
|
||||
"readOnly": true,
|
||||
"layoutDetailDisabled": true,
|
||||
"layoutListDisabled": true,
|
||||
"layoutSearchDisabled": true
|
||||
},
|
||||
"clickedCount": {
|
||||
"type": "int",
|
||||
"notStorable": true,
|
||||
"readOnly": true,
|
||||
"layoutDetailDisabled": true,
|
||||
"layoutListDisabled": true,
|
||||
"layoutSearchDisabled": true
|
||||
},
|
||||
"optedOutCount": {
|
||||
"type": "int",
|
||||
"notStorable": true,
|
||||
"readOnly": true,
|
||||
"layoutDetailDisabled": true,
|
||||
"layoutListDisabled": true,
|
||||
"layoutSearchDisabled": true
|
||||
},
|
||||
"bouncedCount": {
|
||||
"type": "int",
|
||||
"notStorable": true,
|
||||
"readOnly": true,
|
||||
"layoutDetailDisabled": true,
|
||||
"layoutListDisabled": true,
|
||||
"layoutSearchDisabled": true
|
||||
},
|
||||
"hardBouncedCount": {
|
||||
"type": "int",
|
||||
"notStorable": true,
|
||||
"readOnly": true,
|
||||
"layoutDetailDisabled": true,
|
||||
"layoutListDisabled": true,
|
||||
"layoutSearchDisabled": true
|
||||
},
|
||||
"softBouncedCount": {
|
||||
"type": "int",
|
||||
"notStorable": true,
|
||||
"readOnly": true,
|
||||
"layoutDetailDisabled": true,
|
||||
"layoutListDisabled": true,
|
||||
"layoutSearchDisabled": true
|
||||
},
|
||||
"leadCreatedCount": {
|
||||
"type": "int",
|
||||
"notStorable": true,
|
||||
"readOnly": true,
|
||||
"layoutDetailDisabled": true,
|
||||
"layoutListDisabled": true,
|
||||
"layoutSearchDisabled": true
|
||||
},
|
||||
"revenue": {
|
||||
"type": "currency",
|
||||
"notStorable": true,
|
||||
"readOnly": true,
|
||||
"layoutDetailDisabled": true,
|
||||
"layoutListDisabled": true,
|
||||
"layoutSearchDisabled": true
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"createdBy": {
|
||||
"type": "belongsTo",
|
||||
"entity": "User"
|
||||
},
|
||||
"modifiedBy": {
|
||||
"type": "belongsTo",
|
||||
"entity": "User"
|
||||
},
|
||||
"assignedUser": {
|
||||
"type": "belongsTo",
|
||||
"entity": "User"
|
||||
},
|
||||
"teams": {
|
||||
"type": "hasMany",
|
||||
"entity": "Team",
|
||||
"relationName": "EntityTeam",
|
||||
"layoutRelationshipsDisabled": true
|
||||
},
|
||||
"targetLists": {
|
||||
"type": "hasMany",
|
||||
"entity": "TargetList",
|
||||
"foreign": "campaigns"
|
||||
},
|
||||
"accounts": {
|
||||
"type": "hasMany",
|
||||
"entity": "Account",
|
||||
"foreign": "campaign"
|
||||
},
|
||||
"contacts": {
|
||||
"type": "hasMany",
|
||||
"entity": "Contact",
|
||||
"foreign": "campaign"
|
||||
},
|
||||
"leads": {
|
||||
"type": "hasMany",
|
||||
"entity": "Lead",
|
||||
"foreign": "campaign"
|
||||
},
|
||||
"opportunities": {
|
||||
"type": "hasMany",
|
||||
"entity": "Opportunity",
|
||||
"foreign": "campaign"
|
||||
},
|
||||
"campaignLogRecords": {
|
||||
"type": "hasMany",
|
||||
"entity": "CampaignLogRecord",
|
||||
"foreign": "campaign"
|
||||
}
|
||||
},
|
||||
"collection": {
|
||||
"sortBy": "createdAt",
|
||||
"asc": false
|
||||
},
|
||||
"indexes": {
|
||||
"createdAt": {
|
||||
"columns": ["createdAt", "deleted"]
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user