Exemplo n.º 1
0
    private function setSplitCommissionsBonus(Pap_Db_Campaign $campaign) {
        $commissionType = new Pap_Db_CommissionType();
        $commissionType->setCampaignId($campaign->getId());
        $commissionType->setType(Pap_Common_Constants::TYPE_SALE);
        $commissionType->loadFromData(array(Pap_Db_Table_CommissionTypes::CAMPAIGNID, Pap_Db_Table_CommissionTypes::TYPE));

        $overwriteCookie = $campaign->getOverwriteCookie();
        if ($overwriteCookie != Gpf::YES && $overwriteCookie != Gpf::NO) {
            $overwriteCookie = $this->isGeneralOverwriteAllowed();
        }

        if ($overwriteCookie == Gpf::YES) {
            $firstClickBonus = 0;
            $lastClickBonus = 100;
        } else {
            $firstClickBonus = 100;
            $lastClickBonus = 0;
        }

        Pap_Db_Table_CommissionTypeAttributes::getInstance()->setCommissionTypeAttributeValue($commissionType->getId(), Pap_Features_SplitCommissions_SplitCommissionsForm::FIRST_AFF_BONUS, $firstClickBonus);
        Pap_Db_Table_CommissionTypeAttributes::getInstance()->setCommissionTypeAttributeValue($commissionType->getId(), Pap_Features_SplitCommissions_SplitCommissionsForm::LAST_AFF_BONUS, $lastClickBonus);
    }