From e2a5556974e797eb17debd71a930576778e185f9 Mon Sep 17 00:00:00 2001 From: Santiago Date: Wed, 21 Feb 2018 17:25:03 -0300 Subject: [PATCH] Add missing check. --- .../Ebizmarts/MailChimp/Model/Api/Batches.php | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/app/code/community/Ebizmarts/MailChimp/Model/Api/Batches.php b/app/code/community/Ebizmarts/MailChimp/Model/Api/Batches.php index cf8649abc..2d640397e 100644 --- a/app/code/community/Ebizmarts/MailChimp/Model/Api/Batches.php +++ b/app/code/community/Ebizmarts/MailChimp/Model/Api/Batches.php @@ -707,25 +707,30 @@ protected function saveSyncData($itemId, $itemType, $mailchimpStoreId, $syncDelt protected function addSyncValueToArray($storeId, $syncedDateArray) { $helper = $this->getHelper(); - $mailchimpStoreId = $helper->getMCStoreId($storeId); - $syncedDate = $helper->getMCIsSyncing($storeId); - // Check if $syncedDate is in date format to support previous versions. - if (isset($syncedDateArray[$mailchimpStoreId]) && $syncedDateArray[$mailchimpStoreId]) { - if ($helper->validateDate($syncedDate)) { - if ($syncedDate > $syncedDateArray[$mailchimpStoreId]) { - $syncedDateArray[$mailchimpStoreId] = array($storeId => $syncedDate); + $ecomEnabled = $helper->isEcomSyncDataEnabled($storeId); + + if ($ecomEnabled) { + $mailchimpStoreId = $helper->getMCStoreId($storeId); + $syncedDate = $helper->getMCIsSyncing($storeId); + + // Check if $syncedDate is in date format to support previous versions. + if (isset($syncedDateArray[$mailchimpStoreId]) && $syncedDateArray[$mailchimpStoreId]) { + if ($helper->validateDate($syncedDate)) { + if ($syncedDate > $syncedDateArray[$mailchimpStoreId]) { + $syncedDateArray[$mailchimpStoreId] = array($storeId => $syncedDate); + } + } elseif ((int)$syncedDate === 1) { + $syncedDateArray[$mailchimpStoreId] = array($storeId => false); } - } elseif ((int)$syncedDate === 1) { - $syncedDateArray[$mailchimpStoreId] = array($storeId => false); - } - } else { - if ($helper->validateDate($syncedDate)) { - $syncedDateArray[$mailchimpStoreId] = array($storeId => $syncedDate); } else { - if ((int)$syncedDate === 1) { - $syncedDateArray[$mailchimpStoreId] = array($storeId => false); - } elseif (!isset($syncedDateArray[$mailchimpStoreId])) { - $syncedDateArray[$mailchimpStoreId] = array($storeId => true); + if ($helper->validateDate($syncedDate)) { + $syncedDateArray[$mailchimpStoreId] = array($storeId => $syncedDate); + } else { + if ((int)$syncedDate === 1) { + $syncedDateArray[$mailchimpStoreId] = array($storeId => false); + } elseif (!isset($syncedDateArray[$mailchimpStoreId])) { + $syncedDateArray[$mailchimpStoreId] = array($storeId => true); + } } } }