Merge branch 'feature/campaign'

This commit is contained in:
yuri
2015-03-06 18:11:02 +02:00
57 changed files with 1343 additions and 19 deletions
+1 -1
View File
@@ -87,7 +87,7 @@ return array (
'Lead',
'Opportunity',
),
"tabList" => array("Account", "Contact", "Lead", "Opportunity", "Calendar", "Meeting", "Call", "Task", "Case", "Email", "Document"),
"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,
@@ -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 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
{
}
@@ -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 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
{
}
@@ -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
{
}
@@ -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": {
@@ -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"
}
}
@@ -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"
]
@@ -1,6 +1,6 @@
[
{"name": "parent", "width": 30},
{"name": "action", "width": 30},
{"name": "actionDate"},
{"name": "application"}
{"name": "action", "notSortable": true, "width": 15},
{"name": "parent", "notSortable": true},
{"name": "data", "notSortable": true, "customLabel": ""},
{"name": "actionDate", "width": 18}
]
@@ -1,5 +1,6 @@
[
{"name": "action", "width": 40},
{"name": "actionDate"},
{"name": "campaign"}
{"name": "action", "notSortable": true, "width": 15},
{"name": "data", "notSortable": true, "customLabel": ""},
{"name": "campaign", "notSortable": true},
{"name": "actionDate", "width": 18}
]
@@ -1,6 +1,7 @@
[
"assignedUser",
"address",
"campaign",
"status",
"source",
"opportunityAmountConverted",
@@ -2,6 +2,7 @@
"account",
"amountConverted",
"assignedUser",
"campaign",
"closeDate",
"contacts",
"leadSource",
@@ -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"]
@@ -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"]
}
@@ -0,0 +1,4 @@
{
"controller": "Controllers.Record",
"boolFilters": ["onlyMy"]
}
@@ -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": {
@@ -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"]
}
}
}
@@ -0,0 +1,80 @@
{
"fields": {
"action": {
"type": "enum",
"required": true,
"maxLength": 50,
"options": ["Sent", "Opened", "Opted Out", "Bounced", "Clicked", "Lead Created"]
},
"actionDate": {
"type": "datetime",
"required": true
},
"data": {
"type": "jsonObject",
"view": "Crm:CampaignLogRecord.Fields.Data"
},
"stringData": {
"type": "varchar",
"maxLength": 100
},
"stringAdditionalData": {
"type": "varchar",
"maxLength": 100
},
"application": {
"type": "varchar",
"required": true,
"maxLength": 36,
"default": "EspoCRM"
},
"createdAt": {
"type": "datetime",
"readOnly": true
},
"createdBy": {
"type": "link",
"readOnly": true
},
"campaign": {
"type": "link"
},
"parent": {
"type": "linkParent"
},
"object": {
"type": "linkParent"
}
},
"links": {
"createdBy": {
"type": "belongsTo",
"entity": "User"
},
"campaign": {
"type": "belongsTo",
"entity": "Campaign",
"foreign": "campaignLogRecords"
},
"parent": {
"type": "belongsToParent",
"entityList": ["Account", "Contact", "Lead", "Opportunity", "User"]
},
"object": {
"type": "belongsToParent",
"entityList": ["Email"]
}
},
"collection": {
"sortBy": "actionDate",
"asc": false
},
"indexes": {
"actionDate": {
"columns": ["actionDate", "deleted"]
},
"action": {
"columns": ["action", "deleted"]
}
}
}
@@ -100,6 +100,10 @@
"notStorable": true,
"disabled": true
},
"campaign": {
"type": "link",
"layoutListDisabled": true
},
"createdAt": {
"type": "datetime",
"readOnly": true
@@ -192,6 +196,22 @@
"entity": "Task",
"foreign": "parent",
"layoutRelationshipsDisabled": true
},
"campaign": {
"type": "belongsTo",
"entity": "Campaign",
"foreign": "contacts",
"noJoin": true
},
"campaignLogRecords": {
"type": "hasChildren",
"entity": "CampaignLogRecord",
"foreign": "parent"
},
"targetLists": {
"type": "hasMany",
"entity": "TargetList",
"foreign": "contacts"
}
},
"collection": {
@@ -113,6 +113,10 @@
"teams": {
"type": "linkMultiple"
},
"campaign": {
"type": "link",
"layoutListDisabled": true
},
"createdAccount": {
"type": "link",
"layoutDetailDisabled": true,
@@ -191,6 +195,22 @@
"type": "belongsTo",
"entity": "Opportunity",
"noJoin": true
},
"campaign": {
"type": "belongsTo",
"entity": "Campaign",
"foreign": "leads",
"noJoin": true
},
"campaignLogRecords": {
"type": "hasChildren",
"entity": "CampaignLogRecord",
"foreign": "parent"
},
"targetLists": {
"type": "hasMany",
"entity": "TargetList",
"foreign": "leads"
}
},
"convertFields": {
@@ -64,6 +64,9 @@
"description": {
"type": "text"
},
"campaign": {
"type": "link"
},
"createdAt": {
"type": "datetime",
"readOnly": true
@@ -151,6 +154,12 @@
"type": "hasMany",
"entity": "Document",
"foreign": "opportunities"
},
"campaign": {
"type": "belongsTo",
"entity": "Campaign",
"foreign": "opportunities",
"noJoin": true
}
},
"collection": {
@@ -0,0 +1,96 @@
{
"fields": {
"name": {
"type": "varchar",
"required": true
},
"entryCount": {
"type": "int",
"readOnly": true,
"notStorable": true
},
"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"
},
"campaigns": {
"type": "link"
}
},
"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
},
"campaigns": {
"type": "hasMany",
"entity": "Campaign",
"foreign": "targetLists"
},
"accounts": {
"type": "hasMany",
"entity": "Account",
"foreign": "targetLists"
},
"contacts": {
"type": "hasMany",
"entity": "Contact",
"foreign": "targetLists"
},
"leads": {
"type": "hasMany",
"entity": "Lead",
"foreign": "targetLists"
},
"users": {
"type": "hasMany",
"entity": "User",
"foreign": "targetLists"
}
},
"collection": {
"sortBy": "createdAt",
"asc": false
},
"indexes": {
"createdAt": {
"columns": ["createdAt", "deleted"]
}
}
}
@@ -0,0 +1,9 @@
{
"links": {
"targetLists": {
"type": "hasMany",
"entity": "TargetList",
"foreign": "users"
}
}
}
@@ -0,0 +1,10 @@
{
"entity": true,
"layouts": true,
"tab": true,
"acl": true,
"module": "Crm",
"customizable": true,
"stream": false,
"importable": false
}
@@ -0,0 +1,10 @@
{
"entity": true,
"layouts": false,
"tab": false,
"acl": false,
"module": "Crm",
"customizable": false,
"stream": false,
"importable": false
}
@@ -0,0 +1,10 @@
{
"entity": true,
"layouts": false,
"tab": true,
"acl": true,
"module": "Crm",
"customizable": false,
"stream": false,
"importable": false
}
@@ -0,0 +1,100 @@
<?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\Services;
use \Espo\ORM\Entity;
class Campaign extends \Espo\Services\Record
{
protected function loadAdditionalFields($entity)
{
parent::loadAdditionalFields($entity);
$sentCount = $this->getEntityManager()->getRepository('CampaignLogRecord')->where(array(
'campaignId' => $entity->id,
'action' => 'Clicked'
))->count();
$entity->set('sentCount', $sentCount);
$openedCount = $this->getEntityManager()->getRepository('CampaignLogRecord')->where(array(
'campaignId' => $entity->id,
'action' => 'Opened'
))->count();
$entity->set('openedCount', $openedCount);
$clickedCount = $this->getEntityManager()->getRepository('CampaignLogRecord')->where(array(
'campaignId' => $entity->id,
'action' => 'Clicked'
))->count();
$entity->set('clickedCount', $clickedCount);
$optedOutCount = $this->getEntityManager()->getRepository('CampaignLogRecord')->where(array(
'campaignId' => $entity->id,
'action' => 'Opted Out'
))->count();
$entity->set('optedOutCount', $optedOutCount);
$bouncedCount = $this->getEntityManager()->getRepository('CampaignLogRecord')->where(array(
'campaignId' => $entity->id,
'action' => 'Bounced'
))->count();
$entity->set('bouncedCount', $bouncedCount);
$leadCreatedCount = $this->getEntityManager()->getRepository('CampaignLogRecord')->where(array(
'campaignId' => $entity->id,
'action' => 'Lead Created'
))->count();
$entity->set('leadCreatedCount', $leadCreatedCount);
$entity->set('revenueCurrency', $this->getConfig()->get('defaultCurrency'));
$params = array(
'select' => array('SUM:amountConverted'),
'whereClause' => array(
'status' => 'Closed Won',
'campaignId' => $entity->id
),
'groupBy' => array('opportunity.campaignId')
);
$this->getEntityManager()->getRepository('Opportunity')->handleSelectParams($params);
$sql = $this->getEntityManager()->getQuery()->createSelectQuery('Opportunity', $params);
$pdo = $this->getEntityManager()->getPDO();
$sth = $pdo->prepare($sql);
$sth->execute();
if ($row = $sth->fetch(\PDO::FETCH_ASSOC)) {
$revenue = floatval($row['SUM:amountConverted']);
if ($revenue > 0) {
$entity->set('revenue', $revenue);
}
}
}
}
@@ -0,0 +1,51 @@
<?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\Services;
use \Espo\ORM\Entity;
class TargetList extends \Espo\Services\Record
{
protected function loadAdditionalFields(Entity $entity)
{
parent::loadAdditionalFields($entity);
$this->loadEntryCountField($entity);
}
public function loadAdditionalFieldsForList(Entity $entity)
{
parent::loadAdditionalFields($entity);
$this->loadEntryCountField($entity);
}
protected function loadEntryCountField(Entity $entity)
{
$count = 0;
$count += $this->getEntityManager()->getRepository('TargetList')->countRelated($entity, 'contacts');
$count += $this->getEntityManager()->getRepository('TargetList')->countRelated($entity, 'leads');
$count += $this->getEntityManager()->getRepository('TargetList')->countRelated($entity, 'users');
$count += $this->getEntityManager()->getRepository('TargetList')->countRelated($entity, 'accounts');
$entity->set('entryCount', $count);
}
}
@@ -0,0 +1,8 @@
<div class="row">
<div class="col-sm-offset-9 col-sm-3 col-xs-offset-6 col-xs-6 filters-container">
<select name="filter" class="form-control">
{{{options filterList filterValue field="action" translatedOptions=filterTranslatedOptions scope='CampaignLogRecords'}}}
</select>
</div>
</div>
<div class="list-container">{{{list}}}</div>
@@ -0,0 +1,54 @@
/************************************************************************
* 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/.
************************************************************************/
Espo.define('Crm:Views.CampaignLogRecord.Fields.Data', 'Views.Fields.Base', function (Dep) {
return Dep.extend({
listTemplate: 'crm:campaign-log-record.fields.data.detail',
getValueForDisplay: function () {
var action = this.model.get('action');
switch (action) {
case 'Sent':
return this.model.get('stringData');
case 'Clicked':
return '<span class="text-success">' + this.model.get('stringData') + '</span>';
case 'Opted Out':
return '<span class="text-muted">' + this.model.get('stringData') + '</span>';
case 'Bounced':
var emailAddress = this.model.get('stringData');
var type = this.model.get('stringAdditionalData');
if (type == 'Hard') {
return '<s class="text-danger">' + emailAddress + '</s>';
} else {
return '<s class="text-muted">' + emailAddress + '</s>';
}
}
return '';
}
});
});
@@ -0,0 +1,31 @@
/************************************************************************
* 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/.
************************************************************************/
Espo.define('Crm:Views.Campaign.Record.DetailBottom', 'Views.Record.DetailBottom', function (Dep) {
return Dep.extend({
});
});
@@ -0,0 +1,49 @@
/************************************************************************
* 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/.
************************************************************************/
Espo.define('Crm:Views.Campaign.Record.Detail', 'Views.Record.Detail', function (Dep) {
return Dep.extend({
bottomView: 'Crm:Campaign.Record.DetailBottom',
handleStatisticsPanelAppearance: function() {
if (this.model.get('status') == 'Planning') {
this.hidePanel('statistics');
} else {
this.showPanel('statistics');
}
},
afterRender: function () {
Dep.prototype.afterRender.call(this);
this.handleStatisticsPanelAppearance();
this.listenTo(this.model, 'change:status', function () {
this.handleStatisticsPanelAppearance();
}, this);
},
});
});
@@ -0,0 +1,74 @@
/************************************************************************
* 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/.
************************************************************************/
Espo.define('Crm:Views.Campaign.Record.Panels.CampaignLogRecords', 'Views.Record.Panels.Relationship', function (Dep) {
return Dep.extend({
template: 'crm:campaign.record.panels.campaign-log-records',
filterList: ["All", "Sent", "Opened", "Opted Out", "Bounced", "Clicked", "Lead Created"],
data: function () {
return _.extend({
filterList: this.filterList,
filterValue: this.filterValue,
filterTranslatedOptions: this.getFilterTranslatedOptions()
}, Dep.prototype.data.call(this));
},
getFilterTranslatedOptions: function () {
var o = Espo.Utils.clone(this.getLanguage().get('CampaignLogRecord', 'options', 'action'));
o['All'] = this.translate('All', 'labels', 'CampaignLogRecord');
return o;
},
setup: function () {
Dep.prototype.setup.call(this);
this.events = Espo.Utils.clone(this.events || {});
this.events['change select[name="filter"]'] = function (e) {
var value = $(e.currentTarget).val();
this.setFilter(value);
};
},
setFilter: function (value) {
this.filterValue = value;
if (value && value != 'All') {
this.collection.where = [{
field: 'action',
type: 'equals',
value: value
}];
} else {
this.collection.where = [];
}
this.collection.fetch();
}
});
});
@@ -0,0 +1,69 @@
/************************************************************************
* 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/.
************************************************************************/
Espo.define('Crm:Views.Campaign.Record.Panels.Statistics', 'Views.Record.Panels.Side', function (Dep) {
return Dep.extend({
setupFieldList: function () {
var type = this.model.get('type');
switch (type) {
case 'Email':
case 'Newsletter':
this.fieldList = ['sentCount', 'openedCount', 'clickedCount', 'optedOutCount', 'bouncedCount', 'revenue'];
break;
case 'Web':
case 'Television':
case 'Radio':
this.fieldList = ['leadCreatedCount', 'revenue'];
break;
case 'Mail':
this.fieldList = ['sentCount', 'leadCreatedCount', 'revenue'];
break;
default:
this.fieldList = ['leadCreatedCount', 'revenue'];
}
},
setup: function () {
this.fieldList = ['sentCount', 'openedCount', 'clickedCount', 'optedOutCount', 'bouncedCount', 'leadCreatedCount', 'revenue'];
Dep.prototype.setup.call(this);
this.setupFieldList();
this.listenTo(this.model, 'change:type', function () {
this.setupFieldList();
if (this.isRendered()) {
this.render();
}
}, this);
},
actionRefresh: function () {
this.model.fetch();
},
});
});