SuiteCRM V8 and Mautic 5 Integration - Current Status

Here’s what I have from my notes. These are the only changes required:

Code Fixes for Version 5

There is an error with the DetachEntities function added in version 5. Switch back to the line from version 4 and it will work:

\plugins\MauticCrmBundle\Integration\SugarcrmIntegration.php

public function amendLeadDataBeforeMauticPopulate($data, $object): int
...............

/**********change********/
			   // $this->integrationEntityModel->getRepository()->detachEntities($integrationEntities);
			   $this->em->clear('Mautic\PluginBundle\Entity\IntegrationEntity');
/***************end change****/

There is also a counting problem with Companies and can be fixed:

public function getCompanies($params = [], $query = null, $executed = null)
    {
        $executed = null;

        $sugarObject           = 'Accounts';
        $params['max_results'] = 100;
        if (!isset($params['offset'])) {
            // First call
            $params['offset'] = 0;
			/*************added******/
		}else{
			$params['offset'] = $params['offset']+ 100;
			/*********end change*****/
        }

        $query = $params;

        try {
            if ($this->isAuthorized()) {
                $result           = $this->getApiHelper()->getLeads($query, $sugarObject);
                /***********change**********/
				//$params['offset'] = $result['next_offset'];
				$params['offset'] = isset($result['next_offset']) ? $result['next_offset'] : $params['offset'];
                $executed += $this->amendLeadDataBeforeMauticPopulate($result, $sugarObject);
                if (
                    (isset($result['total_count']) && $result['total_count'] > $params['offset'])   // Sugar 6
                    || (!isset($result['total_count']) && $params['offset'] > -1)) {            // Sugar 7
                    $result = null;
                    $executed += $this->getCompanies($params, null, $executed);
                }

                return $executed;
            }
        } catch (\Exception $e) {
            $this->logIntegrationError($e);
        }

        return $executed;
    }
1 Like

Is it correct for company sync?

/usr/local/bin/php /{path to Mautic}/bin/console mautic:integration:synccompany --integration="Sugarcrm" --time-interval="1 hour"

It depends on your hosting provider. They are all different in how they specify the cron jobs. That is incorrect for any hosting. There is no such job as “synccompany”

1 Like