From 002c7bdfac99f4f8fff1c7f67757c29a81455c6a Mon Sep 17 00:00:00 2001 From: Alex Lombry Date: Thu, 30 Nov 2017 10:57:42 +0100 Subject: [PATCH] Fix issue in SforceBaseClient.php with object fields --- .../SforceBaseClient.php | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/Davispeixoto/ForceDotComToolkitForPhp/SforceBaseClient.php b/src/Davispeixoto/ForceDotComToolkitForPhp/SforceBaseClient.php index 32806c2..f95013a 100644 --- a/src/Davispeixoto/ForceDotComToolkitForPhp/SforceBaseClient.php +++ b/src/Davispeixoto/ForceDotComToolkitForPhp/SforceBaseClient.php @@ -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.