From b79847de0851b66fe2997d6e969e6935b22acff7 Mon Sep 17 00:00:00 2001 From: Petrenko Yuri Date: Thu, 30 Nov 2017 11:36:09 +0200 Subject: [PATCH] fix `convertLead` for object fields Fix issue in `SforceBaseClient.php` with object fields `contactRecord`, `opportunityRecord`, `accountRecord` (tested in PHP7) --- soapclient/SforceBaseClient.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/soapclient/SforceBaseClient.php b/soapclient/SforceBaseClient.php index 4a59196..ed2ced6 100644 --- a/soapclient/SforceBaseClient.php +++ b/soapclient/SforceBaseClient.php @@ -566,6 +566,22 @@ protected function _sendEmail($arg) { public function convertLead($leadConverts) { $this->setHeaders("convertLead"); $arg = new stdClass(); + 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); + } + + 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); }