Exemplo n.º 1
0
 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();
         }
     }
 }
Exemplo n.º 2
0
    private function getAllUsedCountryListForType(Pap_Db_CommissionType $beforeSaveType) {
        $existingcountries = array();

        $type = new Pap_Db_CommissionType();
        $type->setParentCommissionTypeId($beforeSaveType->getParentCommissionTypeId());
        $types = $type->loadCollection(array(Pap_Db_Table_CommissionTypes::PARENT_COMMISSIONTYPE_ID));

        foreach ($types as $type) {
            if ($type->getId() == $beforeSaveType->getId()) continue;
            $countryList = preg_split('/,/', $type->getCountryCodes());
            $existingcountries = array_merge($existingcountries, $countryList);
        }
        return $existingcountries;
    }