From 1c555dfdaaa9c0950856d01a048066ed1ec1cc5a Mon Sep 17 00:00:00 2001 From: Marianela Queme Date: Thu, 11 May 2017 10:00:14 -0400 Subject: [PATCH] dont persist contact when updating lastname company --- .../MauticCrmBundle/Integration/SalesforceIntegration.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/MauticCrmBundle/Integration/SalesforceIntegration.php b/plugins/MauticCrmBundle/Integration/SalesforceIntegration.php index c5f59dacbb5..7fc4f94956a 100644 --- a/plugins/MauticCrmBundle/Integration/SalesforceIntegration.php +++ b/plugins/MauticCrmBundle/Integration/SalesforceIntegration.php @@ -968,7 +968,6 @@ public function pushLeads($params = []) $integrationEntityRepo = $this->em->getRepository('MauticPluginBundle:IntegrationEntity'); $fieldsToUpdateInSf = isset($config['update_mautic']) ? array_keys($config['update_mautic'], 1) : []; $leadFields = array_unique(array_values($config['leadFields'])); - $leadsToSync = []; $totalUpdated = $totalCreated = $totalErrors = 0; $leadModel = $this->leadModel; $companyModel = $this->companyModel; @@ -1023,6 +1022,7 @@ public function pushLeads($params = []) $limit = $originalLimit; $mauticData = []; $checkEmailsInSF = []; + $leadsToSync = []; // Process if (!$noMoreUpdates) { // Fetch them separately so we can determine @@ -1284,6 +1284,7 @@ public function pushLeads($params = []) if (!empty($leadsToSync)) { $leadModel->saveEntities($leadsToSync); + unset($leadsToSync); $this->em->clear(Lead::class); } @@ -1294,6 +1295,7 @@ public function pushLeads($params = []) $request = []; $request['allOrNone'] = 'false'; $chunked = array_chunk($mauticData, 25); + foreach ($chunked as $chunk) { // We can only submit 25 at a time if ($chunk) { @@ -1305,6 +1307,10 @@ public function pushLeads($params = []) $totalCreated += (int) $created; } } + + if ($progress && $progress->getProgressPercent() >= 1) { + break; + } } if ($progress) {