Skip to content

Commit

Permalink
Merge pull request #1708 from bakaphp/feat-zoho-lead-reciever-job
Browse files Browse the repository at this point in the history
refact: zoho lead reciever job
  • Loading branch information
kaioken committed Jul 19, 2024
2 parents 4759d33 + 249290e commit eb9d6dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/Domains/Connectors/Zoho/Actions/SyncZohoLeadAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,18 @@ public function execute(): ?Lead
if ($user) {
$localLead->leads_owner_id = $user->getId();
}

if ($user) {
$localLead->leads_owner_id = $user->getId();
$localLead->users_id = $user->getId();
}

$localLead->people->firstname = $zohoLead->First_Name;
$localLead->people->lastname = $zohoLead->Last_Name;
$localLead->firstname = $zohoLead->First_Name;
$localLead->lastname = $zohoLead->Last_Name;
$localLead->title = $zohoLead->Full_Name;
$localLead->description = $zohoLead->Description;
$localLead->leads_status_id = $leadStatus->getId();
$localLead->disableWorkflows();
$localLead->saveOrFail();
Expand Down
6 changes: 4 additions & 2 deletions src/Domains/Connectors/Zoho/Workflows/ZohoLeadActivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ protected function assignAgent(

$defaultLeadSource = $company->get(CustomFieldEnum::ZOHO_DEFAULT_LEAD_SOURCE->value);
if (! empty($defaultLeadSource)) {
$zohoData['Lead_Source'] = $lead->receiver ? $lead->receiver->name : $defaultLeadSource;
$zohoData['Lead_Source'] = $defaultLeadSource; //$lead->receiver ? $lead->receiver->name : $defaultLeadSource;
}

if (is_object($agent)) {
Expand All @@ -144,7 +144,9 @@ protected function assignAgent(
if ($agentInfo && $agentInfo->get('over_write_owner')) {
$zohoData['Owner'] = (int) $agentInfo->get('over_write_owner');
}
$zohoData['Lead_Source'] = $agent->name ?? $agent->Name;
if (empty($defaultLeadSource)) {
$zohoData['Lead_Source'] = $agent->name ?? $agent->Name;
}
} elseif ($agentInfo instanceof Agent) {
$zohoData['Owner'] = (int) $agentInfo->owner_linked_source_id;
if (empty($defaultLeadSource)) {
Expand Down

0 comments on commit eb9d6dd

Please sign in to comment.