Ejemplo n.º 1
0
    protected function insertCampaignObject($id, $accountId, $name, $description, $dateIns, $status, $productid, $campaignId) {
        $obj = new Pap_Common_Campaign();
        $obj->setId($id);
        $obj->setAccountId($accountId);
        $obj->setName($name);
        $obj->set('description', $description);
        $obj->set('dateinserted', $dateIns);
        $obj->setCampaignStatus($status);

        $publicStatus = $this->getPap3Setting($campaignId, 'Aff_camp_status');

        $obj->setCampaignType(($publicStatus == 1 ? Pap_Db_Campaign::CAMPAIGN_TYPE_PUBLIC : Pap_Db_Campaign::CAMPAIGN_TYPE_ON_INVITATION));
        $obj->set('productid', $productid);
        $obj->resetOverwriteCookieToDefault();
        $obj->save();

        $commGrp = new Pap_Db_CommissionGroup();
        $commGrp->setId($obj->getDefaultCommissionGroup());
        $commGrp->load();
        $commGrp->delete();
    }
Ejemplo n.º 2
0
    /**
     * @return Pap_Common_Campaign
     */
    public static function createDefaultCampaign($accountId, $campaignName, $campaignId = null, $type = Pap_Common_Campaign::CAMPAIGN_TYPE_PUBLIC) {
        $campaign = new Pap_Common_Campaign();
        if ($campaignId != null) {
            $campaign->setId($campaignId);
        }
        $campaign->setName($campaignName);
        $campaign->setDateInserted(Gpf_Common_DateUtils::now());
        $campaign->setCampaignStatus(Pap_Common_Campaign::CAMPAIGN_STATUS_ACTIVE);
        $campaign->setCampaignType($type);
        $campaign->setCookieLifetime(0);
        $campaign->resetOverwriteCookieToDefault();
        $campaign->setAccountId($accountId);
        $campaign->setIsDefault();
        $campaign->save();

        self::createDefaultCommissionSettings($campaign);

        return $campaign;
    }
    /**
     * @return Pap_Common_Campaign
     */
    private function createFirstCampaign() {
        $campaign = new Pap_Common_Campaign();
        $campaign->setId('11111111');
        $campaign->setName('First campaign');
        $campaign->setCampaignStatus(Pap_Common_Campaign::CAMPAIGN_STATUS_ACTIVE);
        $campaign->setCampaignType(Pap_Common_Campaign::CAMPAIGN_TYPE_PUBLIC);
        $campaign->setCookieLifetime(0);
        $campaign->resetOverwriteCookieToDefault();
        $campaign->setAccountId($this->account->getId());
        $campaign->save();

        return $campaign;
    }