Skip to content

Commit

Permalink
Merge pull request #4 from AlexLombry/hotfix/convert_lead_php7
Browse files Browse the repository at this point in the history
Fix issue in SforceBaseClient.php with object fields
  • Loading branch information
davispeixoto authored Dec 1, 2017
2 parents 7364b8e + 002c7bd commit 28e149b
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/Davispeixoto/ForceDotComToolkitForPhp/SforceBaseClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -635,12 +635,29 @@ protected function _sendEmail($arg)
*/
public function convertLead($leadConverts)
{
$this->setHeaders("convertLead");
$this->setHeaders("convertLead");
$arg = new stdClass();
$arg->leadConverts = $leadConverts;

foreach ($leadConverts as $k => $lc) {
if (isset($lc->contactRecord) && !$lc->contactRecord instanceof SoapVar) {
$lc->contactRecord = new SoapVar($lc->contactRecord, SOAP_ENC_OBJECT, 'Contact', $this->namespace);
}

return $this->sforce->convertLead($arg);
}
if (isset($lc->opportunityRecord) && !$lc->opportunityRecord instanceof SoapVar) {
$lc->opportunityRecord = new SoapVar($lc->opportunityRecord, SOAP_ENC_OBJECT, 'Opportunity', $this->namespace);
}

if (isset($lc->accountRecord) && !$lc->accountRecord instanceof SoapVar) {
$lc->accountRecord = new SoapVar($lc->accountRecord, SOAP_ENC_OBJECT, 'Account', $this->namespace);
}

$leadConverts[$k] = $lc;
}

$arg->leadConverts = $leadConverts;

return $this->sforce->convertLead($arg);
}

/**
* Deletes one or more new individual objects to your organization's data.
Expand Down

0 comments on commit 28e149b

Please sign in to comment.