mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
Add in missing update project function
This commit is contained in:
@@ -12,10 +12,12 @@ use App\Classes\Modules\PerfexCRM\Services\FetchesPerfexCRMTask;
|
|||||||
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMCustomer;
|
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMCustomer;
|
||||||
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMCustomerContact;
|
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMCustomerContact;
|
||||||
use App\Classes\Modules\PerfexCRM\Services\UpdatesPerfexCRMCustomer;
|
use App\Classes\Modules\PerfexCRM\Services\UpdatesPerfexCRMCustomer;
|
||||||
|
use App\Classes\Modules\PerfexCRM\Services\UpdatesPerfexCRMProject;
|
||||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\CustomerContactObject;
|
use App\Classes\Modules\PerfexCRM\DataTransferObjects\CustomerContactObject;
|
||||||
use App\Classes\Exceptions\MalformedRequestException;
|
use App\Classes\Exceptions\MalformedRequestException;
|
||||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMObject;
|
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMObject;
|
||||||
use App\Classes\ValueObjects\Constants\PerfexCRMTaskStatus;
|
use App\Classes\ValueObjects\Constants\PerfexCRMTaskStatus;
|
||||||
|
use App\Classes\ValueObjects\Constants\PerfexCRMProjectStatus;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -55,6 +57,9 @@ class UpdatePerfexCRMProcessor
|
|||||||
/** @var UpdatesPerfexCRMCustomer */
|
/** @var UpdatesPerfexCRMCustomer */
|
||||||
private $updatesPerfexCRMCustomer;
|
private $updatesPerfexCRMCustomer;
|
||||||
|
|
||||||
|
/** @var UpdatesPerfexCRMProject */
|
||||||
|
private $updatesPerfexCRMProject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ConvertsPerfexCRMLeadToCustomer $convertsPerfexCRMLeadToCustomer
|
* @param ConvertsPerfexCRMLeadToCustomer $convertsPerfexCRMLeadToCustomer
|
||||||
* @param CreatesPerfexCRMCustomerProject $createsPerfexCRMCustomerProject
|
* @param CreatesPerfexCRMCustomerProject $createsPerfexCRMCustomerProject
|
||||||
@@ -66,6 +71,7 @@ class UpdatePerfexCRMProcessor
|
|||||||
* @param CreatesPerfexCRMCustomer $createsPerfexCRMCustomer
|
* @param CreatesPerfexCRMCustomer $createsPerfexCRMCustomer
|
||||||
* @param CreatesPerfexCRMCustomerContact $createsPerfexCRMCustomerContact
|
* @param CreatesPerfexCRMCustomerContact $createsPerfexCRMCustomerContact
|
||||||
* @param UpdatesPerfexCRMCustomer $updatesPerfexCRMCustomer
|
* @param UpdatesPerfexCRMCustomer $updatesPerfexCRMCustomer
|
||||||
|
* @param UpdatesPerfexCRMProject $updatesPerfexCRMProject
|
||||||
*/
|
*/
|
||||||
public function __construct(ConvertsPerfexCRMLeadToCustomer $convertsPerfexCRMLeadToCustomer,
|
public function __construct(ConvertsPerfexCRMLeadToCustomer $convertsPerfexCRMLeadToCustomer,
|
||||||
CreatesPerfexCRMCustomerProject $createsPerfexCRMCustomerProject,
|
CreatesPerfexCRMCustomerProject $createsPerfexCRMCustomerProject,
|
||||||
@@ -76,7 +82,8 @@ class UpdatePerfexCRMProcessor
|
|||||||
FetchesPerfexCRMTask $fetchesPerfexCRMTask,
|
FetchesPerfexCRMTask $fetchesPerfexCRMTask,
|
||||||
CreatesPerfexCRMCustomer $createsPerfexCRMCustomer,
|
CreatesPerfexCRMCustomer $createsPerfexCRMCustomer,
|
||||||
CreatesPerfexCRMCustomerContact $createsPerfexCRMCustomerContact,
|
CreatesPerfexCRMCustomerContact $createsPerfexCRMCustomerContact,
|
||||||
UpdatesPerfexCRMCustomer $updatesPerfexCRMCustomer)
|
UpdatesPerfexCRMCustomer $updatesPerfexCRMCustomer,
|
||||||
|
UpdatesPerfexCRMProject $updatesPerfexCRMProject)
|
||||||
{
|
{
|
||||||
$this->convertsPerfexCRMLeadToCustomer = $convertsPerfexCRMLeadToCustomer;
|
$this->convertsPerfexCRMLeadToCustomer = $convertsPerfexCRMLeadToCustomer;
|
||||||
$this->createsPerfexCRMCustomerProject = $createsPerfexCRMCustomerProject;
|
$this->createsPerfexCRMCustomerProject = $createsPerfexCRMCustomerProject;
|
||||||
@@ -88,6 +95,7 @@ class UpdatePerfexCRMProcessor
|
|||||||
$this->createsPerfexCRMCustomer = $createsPerfexCRMCustomer;
|
$this->createsPerfexCRMCustomer = $createsPerfexCRMCustomer;
|
||||||
$this->createsPerfexCRMCustomerContact = $createsPerfexCRMCustomerContact;
|
$this->createsPerfexCRMCustomerContact = $createsPerfexCRMCustomerContact;
|
||||||
$this->updatesPerfexCRMCustomer = $updatesPerfexCRMCustomer;
|
$this->updatesPerfexCRMCustomer = $updatesPerfexCRMCustomer;
|
||||||
|
$this->updatesPerfexCRMProject = $updatesPerfexCRMProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -151,7 +159,13 @@ class UpdatePerfexCRMProcessor
|
|||||||
$projectId = $result->payload['project_id'];
|
$projectId = $result->payload['project_id'];
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$projectId = $this->fetchesPerfexCRMProject->execute($updatePerfexCRMObject->getProjectName(), $crmClientId)->id;
|
$project = $this->fetchesPerfexCRMProject->execute($updatePerfexCRMObject->getProjectName(), $crmClientId);
|
||||||
|
$projectId = $project->id;
|
||||||
|
//if the project status is anything but PerfexCRMProjectStatus::NOT_STARTED, update the project
|
||||||
|
if($updatePerfexCRMObject->getProjectStatus() != PerfexCRMProjectStatus::NOT_STARTED)
|
||||||
|
{
|
||||||
|
$this->updatesPerfexCRMProject->execute($project, $updatePerfexCRMObject->getProjectStatus());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tasks = $updatePerfexCRMObject->getTaskNames();
|
$tasks = $updatePerfexCRMObject->getTaskNames();
|
||||||
|
|||||||
Reference in New Issue
Block a user