private function disableActionCommissionInCampaigns() { $campaign = new Pap_Db_Campaign(); $campaigns = $campaign->loadCollection(); foreach ($campaigns as $campaign) { $commissionType = new Pap_Db_CommissionType(); $commissionType->setCampaignId($campaign->getId()); $commissionType->setType(Pap_Common_Constants::TYPE_ACTION); $commTypeCollection = $commissionType->loadCollection(); foreach ($commTypeCollection as $commTypeRow) { $commTypeRow->setStatus(Pap_Db_CommissionType::STATUS_DISABLED); $commTypeRow->save(); } } }
private function addCpmCommissionToCampaigns() { $campaign = new Pap_Db_Campaign(); $campaigns = $campaign->loadCollection(); foreach ($campaigns as $campaign) { $commissionType = new Pap_Db_CommissionType(); $commissionType->setCampaignId($campaign->getId()); $commissionType->setType(Pap_Common_Constants::TYPE_CPM); try { $commissionType->loadFromData(); } catch (Gpf_DbEngine_NoRowException $e) { $commissionType->setStatus(Pap_Db_CommissionType::STATUS_DISABLED); $commissionType->setRecurrencePresetId(Pap_Db_CommissionType::RECURRENCE_NONE); $commissionType->setApproval(Pap_Db_CommissionType::APPROVAL_AUTOMATIC); $commissionType->setZeroOrdersCommission(Gpf::NO); $commissionType->setSaveZeroCommission(Gpf::NO); $commissionType->insert(); } } }
public function insertCommissionType($type) { $commissionType = new Pap_Db_CommissionType(); $commissionType->setCampaignId($this->getId()); $commissionType->setType($type); $commissionType->setStatus(Pap_Db_CommissionType::STATUS_ENABLED); $commissionType->setApproval(Pap_Db_CommissionType::APPROVAL_AUTOMATIC); $commissionType->setRecurrencePresetId(Pap_Db_CommissionType::RECURRENCE_NONE); $commissionType->setZeroOrdersCommission(Gpf::NO); $commissionType->setSaveZeroCommission(Gpf::NO); $commissionType->insert(); return $commissionType->getId(); }
protected function insertCommissionType($campaignId, $recurringCommission, $recurringDateType, $pap4CommType) { $obj = new Pap_Db_CommissionType(); $obj->setType($pap4CommType); $obj->setStatus(Pap_Common_Constants::ESTATUS_ENABLED); // set commission type approval $pap3ApprovalStatus = ''; if($pap4CommType == Pap_Common_Constants::TYPE_CLICK) { $pap3ApprovalStatus = $this->getPap3Setting($campaignId, 'Aff_camp_clickapproval'); } else { $pap3ApprovalStatus = $this->getPap3Setting($campaignId, 'Aff_camp_saleapproval'); } if($pap3ApprovalStatus == 2) { $obj->setApproval(Pap_Db_CommissionType::APPROVAL_AUTOMATIC); } else { $obj->setApproval(Pap_Db_CommissionType::APPROVAL_MANUAL); } // set recurring type if($recurringCommission == 0 || $recurringDateType == 0) { $obj->setRecurrencePresetId(Pap_Db_CommissionType::RECURRENCE_NONE); } else { switch($recurringDateType) { case Pap3Compatibility_Migration_Pap3Constants::RECURRINGTYPE_WEEKLY: $obj->setRecurrencePresetId(Pap_Db_CommissionType::RECURRENCE_WEEKLY); break; case Pap3Compatibility_Migration_Pap3Constants::RECURRINGTYPE_MONTHLY: $obj->setRecurrencePresetId(Pap_Db_CommissionType::RECURRENCE_MONTHLY); break; case Pap3Compatibility_Migration_Pap3Constants::RECURRINGTYPE_QUARTERLY: $obj->setRecurrencePresetId(Pap_Db_CommissionType::RECURRENCE_QUARTERLY); break; case Pap3Compatibility_Migration_Pap3Constants::RECURRINGTYPE_BIANNUALLY: $obj->setRecurrencePresetId(Pap_Db_CommissionType::RECURRENCE_SEMIANNUALLY); break; case Pap3Compatibility_Migration_Pap3Constants::RECURRINGTYPE_YEARLY: $obj->setRecurrencePresetId(Pap_Db_CommissionType::RECURRENCE_YEARLY); break; default: $obj->setRecurrencePresetId(Pap_Db_CommissionType::RECURRENCE_NONE); } } $obj->setZeroOrdersCommission(Gpf::YES); $obj->setSaveZeroCommission(Gpf::YES); $obj->setCampaignId($campaignId); $obj->save(); $this->countCommTypes++; return $obj; }
/** * Load commissionType from campaignId and type * * @throws Gpf_DbEngine_NoRowException * @throws Gpf_DbEngine_TooManyRowsException * * @return Pap_Db_CommissionType */ public function getCommissionType($campaignId, $type) { $commissionType = new Pap_Db_CommissionType(); $commissionType->setCampaignId($campaignId); $commissionType->setType($type); $commissionType->loadFromData(array(Pap_Db_Table_CommissionTypes::CAMPAIGNID, Pap_Db_Table_CommissionTypes::TYPE)); return $commissionType; }
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); }
/** * @return Pap_Db_CommissionType */ protected function getCommTypeFromCampaignAndRtype($campaignId, $rtype) { $commObj = new Pap_Db_CommissionType(); $commObj->setCampaignId($campaignId); $commObj->setType($rtype); $commObj->loadFromData(array(Pap_Db_Table_CommissionTypes::CAMPAIGNID, Pap_Db_Table_CommissionTypes::TYPE)); return $commObj; }