Skip to content

Commit

Permalink
Merge pull request #984 from bakaphp/hotfix-sponsor-link
Browse files Browse the repository at this point in the history
Merge pull request #960 from bakaphp/development
  • Loading branch information
kaioken authored Feb 26, 2024
2 parents 25c50c8 + cef7256 commit 71872a3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Domains/Connectors/Zoho/Workflows/ZohoAgentActivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,17 @@ protected function createAgent(AppInterface $app, ZohoService $zohoService, User
}

$sponsorsPage = $company->get('sponsors_page') ?? [];
$sponsorsPageLandingPages = $company->get('sponsors_page_landing') ?? [];
$agentPage = $user->get('agent_website');
$agentPageUserId = $sponsorsPage[$agentPage] ?? null;
$agentPageLandingPage = $sponsorsPageLandingPages[$agentPage] ?? null;

if ($agentPageLandingPage !== null) {
$user->set('landing_page', $agentPageLandingPage);
}

//@todo this is ugly , testing it out
if ($agentPageUserId) {
if ($agentPageUserId !== null) {
try {
$agentOwner = Agent::fromCompany($company)->where('users_id', $agentPageUserId)->firstOrFail();
$ownerMemberNumber = $agentOwner->member_id;
Expand All @@ -129,7 +136,7 @@ protected function createAgent(AppInterface $app, ZohoService $zohoService, User
}
}

if ($companyDefaultUseRotation && $ownerMemberNumber === null) {
if ($companyDefaultUseRotation !== false && $ownerMemberNumber === null) {
try {
$rotation = LeadRotation::getByIdFromCompany($companyDefaultUseRotation, $company);
$agentUser = $rotation->getAgent();
Expand Down

0 comments on commit 71872a3

Please sign in to comment.