Skip to content

Commit

Permalink
Add missing check.
Browse files Browse the repository at this point in the history
  • Loading branch information
Santiagoebizmarts committed Feb 21, 2018
1 parent b42ba7c commit e2a5556
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions app/code/community/Ebizmarts/MailChimp/Model/Api/Batches.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}
Expand Down

0 comments on commit e2a5556

Please sign in to comment.