Created
December 12, 2014 00:22
-
-
Save SmellyFish/4e74971887114d8cc361 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected function createInfluenceObject($accountId, $opportunityId, $touchId, $prospectId, $campaignId, | |
$touchCreatedAt, $oppCreatedAt, $oppIsClosed, $oppClosedAt, $influence = null) | |
{ | |
if (empty($influence)) { | |
$influence = new \piOpportunityInfluence(); | |
} | |
$influence->account_id = $accountId; | |
$influence->opportunity_id = $opportunityId; | |
$influence->campaign_touch_id = $touchId; | |
$influence->prospect_id = $prospectId; | |
$influence->campaign_id = $campaignId; | |
$influence->opportunity_created_at = $oppCreatedAt; | |
$influence->opportunity_closed_at = $oppIsClosed ? $oppClosedAt : null; | |
$influence->opportunity_influence_to_creation = strtotime($oppCreatedAt) - strtotime($touchCreatedAt); | |
if ($oppIsClosed) { | |
$influence->opportunity_influence_to_closed = strtotime($oppClosedAt) - strtotime($touchCreatedAt); | |
} else { | |
$influence->opportunity_influence_to_closed = null; | |
} | |
return $influence; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment