private function isOverWriteEnabled(Pap_Contexts_Click $context) {
     $key = '';
     if ($context->getCampaignObject() != null) {
         $key .= $context->getCampaignObject()->getId();
     }
     $key .= '_';
     if ($context->getUserObject() != null) {
         $key .= $context->getUserObject()->getId();
     }
      
     if (!isset($this->overwriteSettings[$key])) {
         $this->overwriteSettings[$key] =
         $this->cookieObject->isOverwriteEnabled($context->getCampaignObject(), $context->getUserObject());
     }
     return $this->overwriteSettings[$key];
 }
	private function getClickParamsArray(Pap_Db_ClickImpression $click, Pap_Contexts_Click $context, Pap_Common_Banner $banner=null) {
	    $columns = array();
	    $columns[Pap_Db_Table_ClicksImpressions::ACCOUNTID] = $context->getAccountId();
        $columns[Pap_Db_Table_ClicksImpressions::USERID] = $context->getUserObject()->getId();
        $columns[Pap_Db_Table_ClicksImpressions::BANNERID] = $banner == null ? '' : $banner->getId();
        $columns[Pap_Db_Table_ClicksImpressions::PARENTBANNERID] = $banner == null ? '' : $banner->getParentBannerId();
        $columns[Pap_Db_Table_ClicksImpressions::CAMPAIGNID] = $context->getCampaignObject() == null ? '' : $context->getCampaignObject()->getId();
        $columns[Pap_Db_Table_ClicksImpressions::COUNTRYCODE] = $context->getCountryCode();
        $columns[Pap_Db_Table_ClicksImpressions::CDATA1] = $context->getExtraDataFromRequest(1);
        $columns[Pap_Db_Table_ClicksImpressions::CDATA2] = $context->getExtraDataFromRequest(2);
        $columns[Pap_Db_Table_ClicksImpressions::CHANNEL] = $this->getChannel($context);
        $timeNow = new Gpf_DateTime($context->getVisitDateTime());
        $columns[Pap_Db_Table_ClicksImpressions::DATEINSERTED] = $timeNow->format("Y-m-d H:00:00");
        return $columns;
	}
    public function setSaleCookie(Pap_Contexts_Click $context) {
        $userObject = $context->getUserObject();
        $campaignObject = $context->getCampaignObject();
        $channelValue = null;
        if($context->getChannelObject() != null) {
            $channelValue = $context->getChannelObject()->getId();
        }
    	
    	$campaignId = 0;
        $lifetime = 0;
        if($campaignObject != null) {
            $campaignId = $campaignObject->getId();
        } else {
            $this->debug("No campaign recognized");
        }
         
        $lifetime = time() + self::getCookieLifetime($context);
         
        $cookie = new Pap_Tracking_Cookie_Sale();
        $cookie->setAffiliateId($userObject->getId());
        $cookie->setCampaignId($campaignId);
        $cookie->setChannelId($channelValue);

        $this->setCookie(self::SALE_COOKIE_NAME,
                         $cookie,
                         $lifetime,
                         $this->isOverwriteEnabled($campaignObject, $userObject));
    }
    protected function getCampaignClickCommissions(Pap_Contexts_Click $context) {
        try {
            $context->debug('        Checking that click commission is in campaign');

            if($context->getCampaignObject() == null) {
                $context->debug("    STOPPING, no campaign was recognized! ");
                return null;
            }
            
            return $context->getCampaignObject()->getCommissionTypeObject(Pap_Common_Constants::TYPE_CLICK, '', $context->getVisit()->getCountryCode()); 
        } catch (Pap_Tracking_Exception $e) {
            $context->debug("    STOPPING, This commission type is not supported by current campaign or is NOT enabled! ");
            return null;
        }
    }