Skip to content

Commit

Permalink
dont persist contact when updating lastname company
Browse files Browse the repository at this point in the history
  • Loading branch information
mqueme committed May 11, 2017
1 parent 981823c commit 1c555df
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1023,6 +1022,7 @@ public function pushLeads($params = [])
$limit = $originalLimit;
$mauticData = [];
$checkEmailsInSF = [];
$leadsToSync = [];
// Process
if (!$noMoreUpdates) {
// Fetch them separately so we can determine
Expand Down Expand Up @@ -1284,6 +1284,7 @@ public function pushLeads($params = [])

if (!empty($leadsToSync)) {
$leadModel->saveEntities($leadsToSync);
unset($leadsToSync);
$this->em->clear(Lead::class);
}

Expand All @@ -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) {
Expand All @@ -1305,6 +1307,10 @@ public function pushLeads($params = [])
$totalCreated += (int) $created;
}
}

if ($progress && $progress->getProgressPercent() >= 1) {
break;
}
}

if ($progress) {
Expand Down

0 comments on commit 1c555df

Please sign in to comment.