Set filters: Error

Zoltan

Member
@twisted1919 Could you take a look at this?

Screen%20Recording%202016-05-26%20at%2010.35%20du..gif
 
@Zoltan - I think that has been fixed in the dev version.
You can open the file apps/customer/controllers/List_subscribersController.php
and from line 101 to 174 replace with:
PHP:
// since 1.3.6.2
if (!empty($getFilter['campaigns']['action'])) {
    $action      = $getFilter['campaigns']['action'];
    $campaignId  = !empty($getFilter['campaigns']['campaign']) ? (int)$getFilter['campaigns']['campaign'] : 0;
    $campaignIds = empty($campaignId) ? array_keys($listCampaigns) : array($campaignId);
    $campaignIds = array_map('intval', $campaignIds);
    $atu  = $subscriber->getFilterTimeUnitValueForDb(!empty($getFilter['campaigns']['atu']) ? (int)$getFilter['campaigns']['atu'] : 0);
    $atuc = !empty($getFilter['campaigns']['atuc']) ? (int)$getFilter['campaigns']['atuc'] : 0;
    $atuc = $atuc > 1024 ? 1024 : $atuc;
    $atuc = $atuc < 0 ? 0 : $atuc;
   
    if (in_array($action, array(ListSubscriber::CAMPAIGN_FILTER_ACTION_DID_OPEN, ListSubscriber::CAMPAIGN_FILTER_ACTION_DID_NOT_OPEN))) {
        $rel = array(
            'select'   => false,
            'together' => true,
        );
       
        if ($action == ListSubscriber::CAMPAIGN_FILTER_ACTION_DID_OPEN) {
            $rel['joinType']  = 'INNER JOIN';
            $rel['condition'] = 'trackOpens.campaign_id IN (' . implode(',', $campaignIds) . ')';
            if (!empty($atuc)) {
                $rel['condition'] .= sprintf(' AND trackOpens.date_added >= DATE_SUB(NOW(), INTERVAL %d %s)', $atuc, $atu);
            }
        } else {
            $rel['on']        = 'trackOpens.campaign_id IN (' . implode(',', $campaignIds) . ')';
            $rel['joinType']  = 'LEFT OUTER JOIN';
            $rel['condition'] = 'trackOpens.subscriber_id IS NULL';
            if (!empty($atuc)) {
                $rel['condition'] .= sprintf(' OR (trackOpens.subscriber_id IS NOT NULL AND (SELECT date_added FROM {{campaign_track_open}} WHERE subscriber_id = trackOpens.subscriber_id ORDER BY date_added DESC LIMIT 1) <= DATE_SUB(NOW(), INTERVAL %d %s))', $atuc, $atu);
            }
        }
       
        $criteria->with['trackOpens'] = $rel;
    }
   
    if (in_array($action, array(ListSubscriber::CAMPAIGN_FILTER_ACTION_DID_CLICK, ListSubscriber::CAMPAIGN_FILTER_ACTION_DID_NOT_CLICK))) {
       
        $ucriteria = new CDbCriteria();
        $ucriteria->select = 'url_id';
        $ucriteria->addInCondition('campaign_id', $campaignIds);
        $models = CampaignUrl::model()->findAll($ucriteria);
        $urlIds = array();
        foreach ($models as $model) {
            $urlIds[] = $model->url_id;
        }

        if (empty($urlIds)) {
            $urlIds = array(0);
        }
       
        $rel = array(
            'select'   => false,
            'together' => true,
        );

        if ($action == ListSubscriber::CAMPAIGN_FILTER_ACTION_DID_CLICK) {
            $rel['joinType']  = 'INNER JOIN';
            $rel['condition'] = 'trackUrls.url_id IN (' . implode(',', $urlIds) . ')';
            if (!empty($atuc)) {
                $rel['condition'] .= sprintf(' AND trackUrls.date_added >= DATE_SUB(NOW(), INTERVAL %d %s)', $atuc, $atu);
            }
        } else {
            $rel['on']        = 'trackUrls.url_id IN (' . implode(',', $urlIds) . ')';
            $rel['joinType']  = 'LEFT OUTER JOIN';
            $rel['condition'] = 'trackUrls.subscriber_id IS NULL';
            if (!empty($atuc)) {
                $rel['condition'] .= sprintf(' OR (trackUrls.subscriber_id IS NOT NULL AND (SELECT date_added FROM {{campaign_track_url}} WHERE subscriber_id = trackUrls.subscriber_id ORDER BY date_added DESC LIMIT 1) <= DATE_SUB(NOW(), INTERVAL %d %s))', $atuc, $atu);
            }
        }

        $criteria->with['trackUrls'] = $rel;
    }
}
//
 
Back
Top