mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
CRM add department custom field to tasks
This commit is contained in:
@@ -55,3 +55,7 @@ EXCHANGE_URL=https://dev.exchange.cief-malaysia.com/
|
|||||||
MIX_EXCHANGE_URL="${EXCHANGE_URL}"
|
MIX_EXCHANGE_URL="${EXCHANGE_URL}"
|
||||||
|
|
||||||
YD_API_CODE=''
|
YD_API_CODE=''
|
||||||
|
|
||||||
|
PERFEXCRM_BASE_URL=""
|
||||||
|
PERFEXCRM_API_KEY=""
|
||||||
|
PERFEXCRM_IS_ENABLED="false"
|
||||||
|
|||||||
@@ -33,8 +33,10 @@ class CreateTaskPerfexCRMObject implements DataTransferObject
|
|||||||
/** @var string */
|
/** @var string */
|
||||||
private $status;
|
private $status;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
private $department;
|
||||||
|
|
||||||
public function __construct(string $email, string $name, string $description, string $leadId, string $projectId, string $milestoneId, string $reference, string $onTaskCompletion, string $status)
|
public function __construct(string $email, string $name, string $description, string $leadId, string $projectId, string $milestoneId, string $reference, string $onTaskCompletion, string $status, string $department)
|
||||||
{
|
{
|
||||||
$this->email = $email;
|
$this->email = $email;
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
@@ -45,6 +47,7 @@ class CreateTaskPerfexCRMObject implements DataTransferObject
|
|||||||
$this->reference = $reference;
|
$this->reference = $reference;
|
||||||
$this->onTaskCompletion = $onTaskCompletion;
|
$this->onTaskCompletion = $onTaskCompletion;
|
||||||
$this->status = $status;
|
$this->status = $status;
|
||||||
|
$this->department = $department;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,4 +127,11 @@ class CreateTaskPerfexCRMObject implements DataTransferObject
|
|||||||
return $this->status;
|
return $this->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDepartment(): string
|
||||||
|
{
|
||||||
|
return $this->department;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class CreatePerfexCRMTaskProcessor
|
|||||||
$createTaskPerfexCRMObject->getProjectId(),
|
$createTaskPerfexCRMObject->getProjectId(),
|
||||||
$createTaskPerfexCRMObject->getReference(),
|
$createTaskPerfexCRMObject->getReference(),
|
||||||
$createTaskPerfexCRMObject->getOnTaskCompletion(),
|
$createTaskPerfexCRMObject->getOnTaskCompletion(),
|
||||||
|
$createTaskPerfexCRMObject->getDepartment(),
|
||||||
$createTaskPerfexCRMObject->getStatus(),
|
$createTaskPerfexCRMObject->getStatus(),
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ class InitializePerfexCRMProcessor
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get existing or create task
|
// Get existing or create task
|
||||||
$result = $this->createsPerfexCRMTask->execute($tasks[$count]['name'], $tasks[$count]['description'], '', $milestoneId, $projectId, $tasks[$count]['reference'], $tasks[$count]['on_task_completion'], $taskStatus);
|
$result = $this->createsPerfexCRMTask->execute($tasks[$count]['name'], $tasks[$count]['description'], '', $milestoneId, $projectId, $tasks[$count]['reference'], $tasks[$count]['on_task_completion'],$tasks[$count]['department'], $taskStatus);
|
||||||
if(is_null($result)){
|
if(is_null($result)){
|
||||||
break; //Breaking the rest of the tasks in array assuming that they are all created as a batch previously
|
break; //Breaking the rest of the tasks in array assuming that they are all created as a batch previously
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ class NewLeadTaskToPerfexCRMProcessor
|
|||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
PerfexCRMTasks::TASK_IDENTIFICATION_1['status']
|
PerfexCRMTasks::TASK_IDENTIFICATION_1['status'],
|
||||||
|
PerfexCRMTasks::TASK_IDENTIFICATION_1['department']
|
||||||
);
|
);
|
||||||
|
|
||||||
CreatePerfexCRMSingleTask::dispatch($createTaskPerfexCRMObject);
|
CreatePerfexCRMSingleTask::dispatch($createTaskPerfexCRMObject);
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ class UpdatePerfexCRMProcessor
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get existing or create task
|
// Get existing or create task
|
||||||
$result = $this->createsPerfexCRMTask->execute($tasks[$count]['name'], $tasks[$count]['description'], '', $milestoneId, $projectId, $tasks[$count]['reference'], $tasks[$count]['on_task_completion'], $taskStatus);
|
$result = $this->createsPerfexCRMTask->execute($tasks[$count]['name'], $tasks[$count]['description'], '', $milestoneId, $projectId, $tasks[$count]['reference'], $tasks[$count]['on_task_completion'], $tasks[$count]['department'], $taskStatus);
|
||||||
if(is_null($result)){
|
if(is_null($result)){
|
||||||
break; //Breaking the rest of the tasks in array assuming that they are all created as a batch previously
|
break; //Breaking the rest of the tasks in array assuming that they are all created as a batch previously
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\PerfexCRM\Services;
|
|||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use App\Classes\Exceptions\MalformedRequestException;
|
use App\Classes\Exceptions\MalformedRequestException;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use App\Classes\ValueObjects\Constants\PerfexCRMCustomFields;
|
||||||
|
|
||||||
class CreatesPerfexCRMTask
|
class CreatesPerfexCRMTask
|
||||||
{
|
{
|
||||||
@@ -20,8 +21,17 @@ class CreatesPerfexCRMTask
|
|||||||
* @return null|object
|
* @return null|object
|
||||||
* @throws MalformedRequestException
|
* @throws MalformedRequestException
|
||||||
*/
|
*/
|
||||||
public function execute(string $taskName, string $taskDescription, string $leadId, string $milestoneId, string $projectId, string $reference = '', string $on_task_completion = '', string $status = "1") {
|
public function execute(string $taskName, string $taskDescription, string $leadId, string $milestoneId, string $projectId, string $reference = '', string $on_task_completion = '', string $department = '', string $status = "1") {
|
||||||
try{
|
try{
|
||||||
|
$custom_fields = [];
|
||||||
|
if($department != ""){
|
||||||
|
$custom_fields = [
|
||||||
|
"tasks" => [
|
||||||
|
PerfexCRMCustomFields::TASKS_DEPARTMENT => $department
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'name' => $taskName,
|
'name' => $taskName,
|
||||||
'description' => $taskDescription,
|
'description' => $taskDescription,
|
||||||
@@ -32,7 +42,8 @@ class CreatesPerfexCRMTask
|
|||||||
'status' => $status,
|
'status' => $status,
|
||||||
'is_system_created' => 1,
|
'is_system_created' => 1,
|
||||||
'reference' => $reference,
|
'reference' => $reference,
|
||||||
'on_task_completion' => $on_task_completion
|
'on_task_completion' => $on_task_completion,
|
||||||
|
'custom_fields' => $custom_fields
|
||||||
];
|
];
|
||||||
|
|
||||||
if($leadId != '') {
|
if($leadId != '') {
|
||||||
@@ -46,7 +57,8 @@ class CreatesPerfexCRMTask
|
|||||||
'status' => $status,
|
'status' => $status,
|
||||||
'is_system_created' => 1,
|
'is_system_created' => 1,
|
||||||
'reference' => $reference,
|
'reference' => $reference,
|
||||||
'on_task_completion' => $on_task_completion
|
'on_task_completion' => $on_task_completion,
|
||||||
|
'custom_fields' => $custom_fields
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\PerfexCRM\Services;
|
|||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use App\Classes\Exceptions\MalformedRequestException;
|
use App\Classes\Exceptions\MalformedRequestException;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use App\Classes\ValueObjects\Constants\PerfexCRMCustomFields;
|
||||||
|
|
||||||
class UpdatesPerfexCRMCustomer
|
class UpdatesPerfexCRMCustomer
|
||||||
{
|
{
|
||||||
@@ -19,7 +20,7 @@ class UpdatesPerfexCRMCustomer
|
|||||||
try{
|
try{
|
||||||
$custom_fields = [
|
$custom_fields = [
|
||||||
"customers" => [
|
"customers" => [
|
||||||
2 => $companyReference
|
PerfexCRMCustomFields::CUSTOMERS_SHIPPING_PORTAL_REFERENCE => $companyReference
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\PerfexCRM\Services;
|
|||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use App\Classes\Exceptions\MalformedRequestException;
|
use App\Classes\Exceptions\MalformedRequestException;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use App\Classes\ValueObjects\Constants\PerfexCRMCustomFields;
|
||||||
|
|
||||||
class UpdatesPerfexCRMLead
|
class UpdatesPerfexCRMLead
|
||||||
{
|
{
|
||||||
@@ -18,7 +19,7 @@ class UpdatesPerfexCRMLead
|
|||||||
try{
|
try{
|
||||||
$custom_fields = [
|
$custom_fields = [
|
||||||
"leads" => [
|
"leads" => [
|
||||||
4 => $companyReference
|
PerfexCRMCustomFields::LEADS_SHIPPING_PORTAL_REFERENCE => $companyReference
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Classes\ValueObjects\Constants;
|
||||||
|
|
||||||
|
final class PerfexCRMCustomFields {
|
||||||
|
|
||||||
|
public const CUSTOMERS_EXCHANGE_REFERENCE = 1;
|
||||||
|
|
||||||
|
public const CUSTOMERS_SHIPPING_PORTAL_REFERENCE = 2;
|
||||||
|
|
||||||
|
public const LEADS_EXCHANGE_REFERENCE = 3;
|
||||||
|
|
||||||
|
public const LEADS_SHIPPING_PORTAL_REFERENCE = 4;
|
||||||
|
|
||||||
|
public const TICKETS_CUSTOM_TAGS = 5;
|
||||||
|
|
||||||
|
public const TASKS_DEPARTMENT = 6;
|
||||||
|
}
|
||||||
@@ -13,6 +13,7 @@ class PerfexCRMTasks
|
|||||||
'milestone' => 'MILESTONE 1 - Customer Paid',
|
'milestone' => 'MILESTONE 1 - Customer Paid',
|
||||||
'reference' => '',
|
'reference' => '',
|
||||||
'on_task_completion' => '',
|
'on_task_completion' => '',
|
||||||
|
'department' => '',
|
||||||
'status' => PerfexCRMTaskStatus::COMPLETED
|
'status' => PerfexCRMTaskStatus::COMPLETED
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@ class PerfexCRMTasks
|
|||||||
'milestone' => '',
|
'milestone' => '',
|
||||||
'reference' => 'TASK_POST_PAYMENT_1',
|
'reference' => 'TASK_POST_PAYMENT_1',
|
||||||
'on_task_completion' => 'TASK_POST_PAYMENT_2',
|
'on_task_completion' => 'TASK_POST_PAYMENT_2',
|
||||||
|
'department' => 'Accounts',
|
||||||
'status' => PerfexCRMTaskStatus::IN_PROGRESS
|
'status' => PerfexCRMTaskStatus::IN_PROGRESS
|
||||||
];
|
];
|
||||||
public const TASK_POST_PAYMENT_2 = [
|
public const TASK_POST_PAYMENT_2 = [
|
||||||
@@ -44,6 +46,7 @@ class PerfexCRMTasks
|
|||||||
'milestone' => '',
|
'milestone' => '',
|
||||||
'reference' => 'TASK_POST_PAYMENT_2',
|
'reference' => 'TASK_POST_PAYMENT_2',
|
||||||
'on_task_completion' => 'TASK_POST_PAYMENT_3',
|
'on_task_completion' => 'TASK_POST_PAYMENT_3',
|
||||||
|
'department' => 'Accounts',
|
||||||
'status' => ''
|
'status' => ''
|
||||||
];
|
];
|
||||||
public const TASK_POST_PAYMENT_3 = [
|
public const TASK_POST_PAYMENT_3 = [
|
||||||
@@ -59,6 +62,7 @@ class PerfexCRMTasks
|
|||||||
'milestone' => '',
|
'milestone' => '',
|
||||||
'reference' => 'TASK_POST_PAYMENT_3',
|
'reference' => 'TASK_POST_PAYMENT_3',
|
||||||
'on_task_completion' => 'TASK_POST_PAYMENT_4',
|
'on_task_completion' => 'TASK_POST_PAYMENT_4',
|
||||||
|
'department' => 'Accounts',
|
||||||
'status' => ''
|
'status' => ''
|
||||||
];
|
];
|
||||||
public const TASK_POST_PAYMENT_4 = [
|
public const TASK_POST_PAYMENT_4 = [
|
||||||
@@ -74,6 +78,7 @@ class PerfexCRMTasks
|
|||||||
'milestone' => '',
|
'milestone' => '',
|
||||||
'reference' => 'TASK_POST_PAYMENT_4',
|
'reference' => 'TASK_POST_PAYMENT_4',
|
||||||
'on_task_completion' => '',
|
'on_task_completion' => '',
|
||||||
|
'department' => 'Accounts',
|
||||||
'status' => ''
|
'status' => ''
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -88,6 +93,7 @@ class PerfexCRMTasks
|
|||||||
'milestone' => '',
|
'milestone' => '',
|
||||||
'reference' => 'TASK_LOADED_CONTAINER_1',
|
'reference' => 'TASK_LOADED_CONTAINER_1',
|
||||||
'on_task_completion' => 'TASK_LOADED_CONTAINER_2',
|
'on_task_completion' => 'TASK_LOADED_CONTAINER_2',
|
||||||
|
'department' => 'Operations',
|
||||||
'status' => PerfexCRMTaskStatus::IN_PROGRESS
|
'status' => PerfexCRMTaskStatus::IN_PROGRESS
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -101,6 +107,7 @@ class PerfexCRMTasks
|
|||||||
'milestone' => '',
|
'milestone' => '',
|
||||||
'reference' => 'TASK_LOADED_CONTAINER_2',
|
'reference' => 'TASK_LOADED_CONTAINER_2',
|
||||||
'on_task_completion' => '',
|
'on_task_completion' => '',
|
||||||
|
'department' => 'Customer Services',
|
||||||
'status' => ''
|
'status' => ''
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -118,6 +125,7 @@ class PerfexCRMTasks
|
|||||||
'milestone' => '',
|
'milestone' => '',
|
||||||
'reference' => 'TASK_IDENTIFICATION_1',
|
'reference' => 'TASK_IDENTIFICATION_1',
|
||||||
'on_task_completion' => '',
|
'on_task_completion' => '',
|
||||||
|
'department' => 'Operations',
|
||||||
'status' => PerfexCRMTaskStatus::IN_PROGRESS
|
'status' => PerfexCRMTaskStatus::IN_PROGRESS
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user