From e1a505955edfd5afe9f0bc2d8987b759333b975b Mon Sep 17 00:00:00 2001 From: yuri Date: Mon, 23 Nov 2015 17:49:20 +0200 Subject: [PATCH] calendar metadata --- .../Crm/Resources/metadata/clientDefs/Calendar.json | 11 +++++++++++ application/Espo/Modules/Crm/Services/Activities.php | 6 +++--- .../client/modules/crm/src/views/calendar/calendar.js | 10 +++++++++- 3 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 application/Espo/Modules/Crm/Resources/metadata/clientDefs/Calendar.json diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Calendar.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Calendar.json new file mode 100644 index 0000000000..7bd71ae4c2 --- /dev/null +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Calendar.json @@ -0,0 +1,11 @@ +{ + "colors": { + "Meeting": "#558BBD", + "Call": "#CF605D", + "Task": "#76BA4E" + }, + "scopeList": ["Meeting", "Call", "Task"], + "allDayScopeList": ["Task"], + "modeList": ["month", "agendaWeek", "agendaDay"], + "completedStatusList": ["Held", "Completed"] +} \ No newline at end of file diff --git a/application/Espo/Modules/Crm/Services/Activities.php b/application/Espo/Modules/Crm/Services/Activities.php index dad07a50f0..87f15707cb 100644 --- a/application/Espo/Modules/Crm/Services/Activities.php +++ b/application/Espo/Modules/Crm/Services/Activities.php @@ -45,7 +45,7 @@ class Activities extends \Espo\Core\Services\Base 'selectManagerFactory' ); - protected $calendarEntityTypeList = ['Meeting', 'Call', 'Task']; + protected $calendarScopeList = ['Meeting', 'Call', 'Task']; protected function getPDO() { @@ -726,13 +726,13 @@ class Activities extends \Espo\Core\Services\Base $pdo = $this->getPDO(); if (is_null($scopeList)) { - $scopeList = $this->calendarEntityTypeList; + $scopeList = $this->calendarScopeList; } $sqlPartList = []; foreach ($scopeList as $scope) { - if (!in_array($scope, $this->calendarEntityTypeList)) { + if (!in_array($scope, $this->calendarScopeList)) { continue; } if ($this->getAcl()->checkScope($scopeList)) { diff --git a/frontend/client/modules/crm/src/views/calendar/calendar.js b/frontend/client/modules/crm/src/views/calendar/calendar.js index b57c2f0e9d..70466bcf54 100644 --- a/frontend/client/modules/crm/src/views/calendar/calendar.js +++ b/frontend/client/modules/crm/src/views/calendar/calendar.js @@ -42,6 +42,8 @@ Espo.define('crm:views/calendar/calendar', ['view', 'lib!full-calendar'], functi allDayScopeList: ['Task'], + scopeList: ['Meeting', 'Call', 'Task'], + canceledStatusList: ['Not Held', 'Canceled'], completedStatusList: ['Held', 'Completed'], @@ -128,8 +130,14 @@ Espo.define('crm:views/calendar/calendar', ['view', 'lib!full-calendar'], functi this.header = ('header' in this.options) ? this.options.header : this.header; this.slotDuration = this.options.slotDuration || this.slotDuration; + this.colors = this.getMetadata().get('clientDefs.Calendar.colors') || this.colors; + this.modeList = this.getMetadata().get('clientDefs.Calendar.modeList') || this.modeList; + this.completedStatusList = this.getMetadata().get('clientDefs.Calendar.completedStatusList') || this.completedStatusList; + this.scopeList = this.getMetadata().get('clientDefs.Calendar.scopeList') || Espo.Utils.clone(this.scopeList); + this.allDayScopeList = this.getMetadata().get('clientDefs.Calendar.allDaySopeList') || this.allDayScopeList; + this.scopeFilter = false; - this.scopeList = ['Meeting', 'Call', 'Task']; + var scopeList = []; this.scopeList.forEach(function (scope) { if (this.getAcl().check(scope)) {