private function getUser() {
		$user = new Pap_Affiliates_User();
		$user->setId(Gpf_Session::getAuthUser()->getPapUserId());
		$user->load();

		return $user;
	}
 private function fillFromUser(Gpf_Rpc_Form $form, Pap_Affiliates_User $user) {
     $userData = new Gpf_Data_RecordSet();
     $userData->setHeader(array('userid', 'username','firstname', 'lastname'));
     $data = $userData->createRecord();
     $data->add('userid', $user->getId());
     $data->add('username', $user->getUserName());
     $data->add('firstname', $user->getFirstName());
     $data->add('lastname', $user->getLastName());
     $userData->add($data);
     $form->setField('userid', null, $userData->toObject());
 }
    /**
     * Load affiliate detail for affiliate manager
     *
     * @service affiliate read
     * @param $fields
     */
    public function affiliateDetails(Gpf_Rpc_Params $params) {
        $data = new Gpf_Rpc_Data($params);
        $search = $data->getFilters()->getFilter("id");
        if (sizeof($search) == 1) {
            $id = $search[0]->getValue();
        }
        

        $user = new Pap_Affiliates_User();
        $user->setId($id);
        try {
            $user->load();
        } catch (Gpf_DbEngine_NoRowException $e) {
            return $data;
        }
        $data->setValue("id", $user->getId());
        $data->setValue("name", $user->getFirstName()." ".$user->getLastName());
        $data->setValue("username", $user->getUserName());

        $formFields = $this->getUserFormFields();
        foreach($formFields as $record) {
            $code = $record->get('code');
            $data->setValue($code, $user->get($code));
        }

        return $data;
    }
 public static function getAffiliateLink() {
     $mainSiteUrl = Gpf_Settings::get(Pap_Settings::MAIN_SITE_URL);
     $user = new Pap_Affiliates_User();
     $user->setId(Gpf_Session::getAuthUser()->getPapUserId());
     $user->load();
     if (Pap_Tracking_ClickTracker::getInstance()->getLinkingMethod() == Pap_Tracking_ClickTracker::LINKMETHOD_REDIRECT) {
         $affiliateLink = "";
     } elseif(Pap_Tracking_ClickTracker::getInstance()->getLinkingMethod() == Pap_Tracking_ClickTracker::LINKMETHOD_ANCHOR
            && Gpf_Settings::get(Pap_Settings::SUPPORT_SHORT_ANCHOR_LINKING) == GPF::YES) {
         $affiliateLink = $mainSiteUrl . "#" . $user->getRefId();
     } else {
         $affiliateLink = Pap_Tracking_ClickTracker::getInstance()->getClickUrl(null, $user, $mainSiteUrl);
     }
     return $affiliateLink;
 }
Example #5
0
    public function firstTimeApproved(Pap_Affiliates_User $user){
        $userInCommision = new Pap_Db_UserInCommissionGroup();

        $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
        $selectBuilder->select->addAll(Pap_Db_Table_Campaigns::getInstance(), 'ca');
        
        $selectBuilder->from->add('qu_pap_commissiongroups', 'c');
        $selectBuilder->from->addInnerJoin('qu_pap_userincommissiongroup', 'u', 'u.commissiongroupid=c.commissiongroupid');
        $selectBuilder->from->addInnerJoin(Pap_Db_Table_Campaigns::getName(), 'ca', 'ca.'.Pap_Db_Table_Campaigns::ID.'=c.campaignid');
        $selectBuilder->where->add('u.userid','=',$user->getId());
        foreach ($selectBuilder->getAllRowsIterator() as $row){
            $campaign = new Pap_Common_Campaign();
            $campaign->fillFromRecord($row);
            $userInCommision->sendInviteMail($campaign,$user->getId());
        }
    }
 private function initAffiliate($affiliateId) {
 	$this->affiliate = new Pap_Affiliates_User();
 	$this->affiliate->setPrimaryKeyValue($affiliateId);
     $this->affiliate->load();
     if ($this->affiliate->getType() != Pap_Application::ROLETYPE_AFFILIATE) {
     	throw new Gpf_Exception($this->_('User is not affiliate'));
     }
 }
 public static function getSignupScriptUrl($useParent = true, Pap_Common_User $user = null) {  	
     $url = Gpf_Paths::getAffiliateSignupUrl();
     if ($useParent) {
         if ($user == null) {
         	$user = Pap_Affiliates_User::getUserById(Gpf_Session::getAuthUser()->getPapUserId());
         }
         $url .= '?' . Pap_Tracking_Request::getAffiliateClickParamName() . '=' . $user->getRefId();
     }
     return $url;   
 }
Example #8
0
    private function getNewRefid() {
        $codeGenerator = new Gpf_Common_CodeUtils_CodeGenerator(Gpf_Settings::get(CustomRefid_Config::CUSTOM_REFID_FORMAT));
        for ($i = 1; $i <= 5; $i++) {
            $refid = $codeGenerator->generate();
            try {
                Pap_Affiliates_User::loadFromId($refid);
            } catch (Gpf_Exception $e) {
                return $refid;
            }
        }
	}
Example #9
0
 private function getNewNumberRefid() {
     $codeGenerator = new Gpf_Common_CodeUtils_CodeGenerator('{99999999}');
     for ($i = 1; $i <= 5; $i++) {
         $refid = $codeGenerator->generate();
         try {
             Pap_Affiliates_User::loadFromId($refid);
         } catch (Gpf_Exception $e) {
             return $refid;
         }
     }
 }
	/**
	 * gets user by user id
	 * @param $userId
	 * @return Pap_Affiliates_User
	 */
	protected function getUserById($context, $id) {
		if($id == '') {
			return null;
		}
		
		try {
		    return Pap_Affiliates_User::loadFromId($id);
		} catch (Gpf_Exception $e) {
		    $this->debug($context, "User with RefId/UserId: $id doesn't exist");
		    return null;
		}
	}
Example #11
0
	public function processFillBonus(Pap_Common_User $child) {
		try {
			$originalParent = Pap_Affiliates_User::loadFromId($child->getOriginalParentUserId());
		} catch (Gpf_Exception $e) {
		    Gpf_Log::debug('Forced Matrix: Cannot load parent: ' . $e->getMessage());
			return;
		}
		$matrix = $this->createMatrix();
		if ($matrix->isFilled($originalParent)) {
			$matrixFillBonus = new Pap_Features_ForcedMatrix_MatrixFillBonus();
			$matrixFillBonus->process($originalParent);
		}
	}
 /**
  *
  * @service affiliate_invoice read
  * @param $fields
  */
 public function previewInvoice(Gpf_Rpc_Params $params) {
     $form = new Gpf_Rpc_Form($params);
     
     $user = new Pap_Affiliates_User();
     
     $applyVat = $form->getFieldValue('applyVat');
     $payoutInvoice = $form->getFieldValue('payoutInvoice');
     
     
     $user->setId($form->getFieldValue('userid'));
     try {
         $user->load();
     } catch (Gpf_Exception $e) {
         $this->invoiceHtml = $this->_("You have to select user");
         return $this;
     }
     
     $currency = Pap_Common_Utils_CurrencyUtils::getDefaultCurrency();
     $payout = new Pap_Common_Payout($user, $currency, 1, 123456);
     $payout->setApplyVat($applyVat);
     $payout->generateInvoice($payoutInvoice);
     $this->invoiceHtml = $payout->getInvoice(); 
     return $this;
 }
 private function addUserToRecordSet(Gpf_Data_RecordSet $result, $userId) {
     $user = new Pap_Affiliates_User();
     $user->setId($userId);
     try {
         $user->load();
         $record = $result->createRecord();
         $record->loadFromObject(array_values($user->toArray()));
         $record->set("subaffiliates", 1);
         $result->add($record);
         if (strlen($user->getParentUserId())) {
             $this->addUserToRecordSet($result, $user->getParentUserId());
         }
     } catch (Exception $e) {
     }
 }
 private function getClickTrackingCode() {
     $code  = '<script id="pap_x2s6df8d" src="'.Gpf_Paths::getInstance()->getFullScriptsUrl().'clickjs.php" type="text/javascript">'."\n";
     $code .= '</script>'."\n";
     $code .= '<script type="text/javascript">'."\n";
     $code .= '<!--'."\n";
     $code .= "var AffiliateID='".$this->user->getRefId()."'\n";
     $code .= "var BannerID='".$this->site->getId()."'\n";
     if($this->request->getRequestParameter('channel') != '') {
         $code .= "var Channel='".$this->request->getRequestParameter('channel')."'\n";
     }
     if($this->request->getRequestParameter('data1') != '') {
         $code .= "var Data1='".$this->request->getRequestParameter('data1')."'\n";
     }
     if($this->request->getRequestParameter('data2') != '') {
         $code .= "var Data2='".$this->request->getRequestParameter('data2')."'\n";
     }
     $code .= 'papTrack();'."\n";
     $code .= '//-->'."\n";
     $code .= '</script>'."\n";
     return $code;
 }
 protected function loadUserFromId($id) {
     return Pap_Affiliates_User::loadFromId($id);
 }
Example #16
0
 /**
  * @param $refid
  * @return Pap_Affiliates_User
  * @throws Gpf_Exception
  */
 private static function loadFromRefid($refid)
 {
     $user = new Pap_Affiliates_User();
     $user->setRefId($refid);
     $user->loadFromData(array(Pap_Db_Table_Users::REFID));
     return $user;
 }
    public function sendInviteMail(Pap_Common_Campaign $campaign, $userID) {
        if(Gpf::NO == Gpf_Settings::get(Pap_Settings::AFF_NOTIFICATION_CAMPAIGN_INVITATION)){
            return;
        }

        $affiliate = new Pap_Affiliates_User();
        $affiliate->setId($userID);
        try {
            $affiliate->load();

            $mail = new Pap_Mail_InviteToCampaign();
            $mail->setCampaign($campaign);
            $mail->setUser($affiliate);
            $mail->addRecipient($affiliate->getEmail());
            $mail->send();
        } catch (Gpf_Exception $e) {
        }
    }
    private function createTestAffiliateUser() {
        $affiliateUser = new Pap_Affiliates_User();
        $affiliateUser->setId('11111111');
        $affiliateUser->setDateInserted(Gpf_Common_DateUtils::now());
        $affiliateUser->setRefId("testaff");
        $affiliateUser->setPassword($this->account->getPassword());
        $affiliateUser->setUserName(Pap_Branding::DEMO_AFFILIATE_USERNAME);
        $affiliateUser->setFirstName("Test");
        $affiliateUser->setLastName("Affiliate");
        $affiliateUser->setAccountId($this->account->getId());
        $affiliateUser->setStatus(Gpf_Db_User::APPROVED);
        $affiliateUser->set('dateapproved', Gpf_Common_DateUtils::Now());
        $affiliateUser->save();

        $this->setQuickLaunchSettings($affiliateUser->getAccountUserId(), 'showDesktop');
        Gpf_Settings::set(Pap_Settings::DEFAULT_AFFILIATE_PANEL_THEME, Pap_Branding::DEFAULT_AFFILIATE_PANEL_THEME);
    }
    /**
     * processes match and sets userid, campaign, banner, channel
     */
    protected function fillParametersFromMatch(Pap_Contexts_Click $context, $match) {
        if($match == null || $match == false || !is_array($match) || count($match) != 5) {
            $context->debug("    Matching data are in incorrect format");
        }

        $userId = $match['userid'];
        $url = $match['url'];
        $channelid = $match['channelid'];
        $campaignid = $match['campaignid'];
        $bannerid = $match['bannerid'];

        $context->debug("    Referrer matched '$url' pattern");

        // user
        if ($userId == '') {
            $context->debug("    DirectLink affiliate Id is empty stopping");
            $context->setDoTrackerSave(false);
            return;
        }

        try {
            $user = Pap_Affiliates_User::loadFromId($userId);
        } catch (Gpf_Exception $e) {
            $context->debug(" DirectLink affiliate with id '$userId' doesn't exist");
            $context->setDoTrackerSave(false);
            return;
        }

        $context->debug("    Setting affiliate from referrer URL. Affiliate Id: ".$userId."");
        $context->setUserObject($user);


        // banner
        $banner = null;
        try {
            $bannerFactory = new Pap_Common_Banner_Factory();
            $banner = $bannerFactory->getBanner($bannerid);
            $context->debug("Setting banner from referrer URL. Banner Id: ".$bannerid."");
            $context->setBannerObject($banner);
        } catch (Gpf_Exception $e) {
            $context->debug("Banner parameter in DirectLink is empty");
        }

        // campaign
        $campaign = $this->getCampaignById($context, $campaignid);
        if($campaignid != '' && $campaign != null) {
            $context->debug("    Setting campaign from DirectLink. Campaign Id: ".$campaignid."");
            $context->setCampaignObject($campaign);
        } else {
            $context->debug("    Campaign parameter in DirectLink is empty");
        }
        	
        if($banner != null) {
            $context->debug("    Trying to get campaign from banner");
            $campaign = $this->getCampaignFromBanner($context, $banner);
        }

        if($campaign == null) {
            $campaign = $this->getDefaultCampaign($context);
        }

        if($campaign != null) {
            $context->setCampaignObject($campaign);
        } else {
            $context->setDoTrackerSave(false);
            $context->debug("        No default campaign defined");
        }
        
        // channel
        $channel = $this->getChannelById($context, $channelid);
        if($channelid != '' && $channel != null) {
            $context->debug("    Setting channel from referrer URL. Channel Id: ".$channelid."");
            $context->setChannelObject($channel);
        } else {
            $context->debug("    Channel parameter in DirectLink is empty");
        }
        
        // account
        if ($campaign != null) {
            $context->setAccountId($campaign->getAccountId(), Pap_Contexts_Tracking::ACCOUNT_RECOGNIZED_FROM_CAMPAIGN);
        }
    }
Example #20
0
 public function beforeSave(Pap_Common_TransactionCompoundContext $transactionCompoundContext){
     $user =  Pap_Affiliates_User::loadFromId($transactionCompoundContext->getTransaction()->getUserId());
     if ($user->getParentUserId() != '') {
         $transactionCompoundContext->setSaveTransaction(false);
     }
 }
Example #21
0
 /**
  * @throws Gpf_Exception
  * @return Pap_Affiliates_User
  */
 protected function getAffiliate($userID) {
     return Pap_Affiliates_User::loadFromId($userID);
 }
	/**
	 * @return Pap_Affiliates_User
	 * @throws Gpf_Exception
	 */
	protected function getUser($affiliateId) {
		if (!isset($this->affiliateCache[$affiliateId])) {
			$this->affiliateCache[$affiliateId] = Pap_Affiliates_User::loadFromId($affiliateId);
		}

		return $this->affiliateCache[$affiliateId];
	}
 public static function fillCachedBanner(Pap_Common_Banner $banner, Pap_Db_CachedBanner $cachedBanner){
     if ($cachedBanner->getParentBannerId() != '') {
         $banner->setParentBannerId($cachedBanner->getParentBannerId());
     }
     
     $banner->fillCachedBanner($cachedBanner, Pap_Affiliates_User::loadFromId($cachedBanner->getUserId()));
     if($cachedBanner->getWrapper() == self::URL_VALUE_INNERPAGE){
         $cachedBanner->setCode(self::INNERPAGE_BEGIN . $cachedBanner->getCode() . self::INNERPAGE_END);
     }
 }
 protected function createNewAffiliate(array $headerArray, array $row) {
     $affiliate = new Pap_Affiliates_User();
     $affiliate->setSendNotification(false);
      
     $this->setDbRowData($affiliate, $row, $headerArray, $this->getPapUserColumnsWithoutParentUserId());
     $this->setDbRowData($affiliate, $row, $headerArray, $this->getGpfUserColumns());
     $this->setDbRowData($affiliate, $row, $headerArray, $this->getAuthUserColumns());
     
     if($affiliate->getDeleted() == "") {
         $affiliate->setDeleted(false); 
     }
     
     try {
         $affiliate->save();
         $this->logger->debug('New affiliate was created');
     } catch (Gpf_Exception $e) {
     	$this->logError('Affiliate3', $row, $e);
     	throw new Gpf_Exception($e->getMessage());
     }
 }
    private function insertUser($record) {
    	$user = new Pap_Affiliates_User();
    	$user->setId($record->get('userid'));
    	$user->setRefId(($record->get('refid') != '' ? $record->get('refid') : $record->get('userid')));
    	$user->setPassword($record->get('rpassword'));
    	$user->setUserName($record->get('username'));
    	$user->setFirstName($record->get('name'));
    	$user->setLastName($record->get('surname'));
    	$user->setAccountId(Pap3Compatibility_Migration_Pap3Constants::DEFAULT_ACCOUNT_ID);
    	$user->setDateInserted($record->get('dateinserted'));
    	if ($record->get('minimumpayout') != NULL) {
    		$user->setMinimumPayout($record->get('minimumpayout'));
    	} else {
    		$user->setMinimumPayout(Gpf_Settings::get(Pap_Settings::PAYOUTS_MINIMUM_PAYOUT_SETTING_NAME));
    	}
    	if($record->get('dateapproved') != null && $record->get('dateapproved') != '') {
    		$user->setDateApproved($record->get('dateapproved'));
    	}
    	if (Pap3Compatibility_Migration_Pap3Constants::translateStatus($record->get('rstatus')) == Pap_Common_Constants::STATUS_APPROVED && 
    	$user->getDateApproved() == null) {
    		$actualDate = new Gpf_DateTime();
    		$user->setDateApproved($actualDate->toDateTime());
    	}
    	$user->setStatus(Pap3Compatibility_Migration_Pap3Constants::translateStatus($record->get('rstatus')));
    	$user->setType('A');
        $user->set('numberuserid',1);
        
    	$this->setAffiliateField($user, $record, 'street');
    	$this->setAffiliateField($user, $record, 'city');
    	$this->setAffiliateField($user, $record, 'company_name');
    	$this->setAffiliateField($user, $record, 'state');
    	$this->setAffiliateField($user, $record, 'zipcode');
    	$this->setAffiliateField($user, $record, 'weburl');
    	$this->setAffiliateField($user, $record, 'phone');
    	$this->setAffiliateField($user, $record, 'fax');
    	$this->setAffiliateField($user, $record, 'tax_ssn');
    	$this->setAffiliateField($user, $record, 'country');
    	$this->setAffiliateField($user, $record, 'data1');
    	$this->setAffiliateField($user, $record, 'data2');
    	$this->setAffiliateField($user, $record, 'data3');
    	$this->setAffiliateField($user, $record, 'data4');
    	$this->setAffiliateField($user, $record, 'data5');

    	$user->setSendNotification(false);
    	$user->setPayoutOptionId($this->savePayoutData($record->get('userid')));
    	$user->save();
    	
    	// handle parent id
        $parentUserId = $record->get('parentuserid');
        if($parentUserId != '') {
            $updateBuilder = new Gpf_SqlBuilder_UpdateBuilder();
            $updateBuilder->from->add(Pap_Db_Table_Users::getName());
            $updateBuilder->set->add(Pap_Db_Table_Users::PARENTUSERID, $parentUserId);
            $updateBuilder->where->add(Pap_Db_Table_Users::ID, '=', $record->get('userid'));
            try {
                $updateBuilder->executeOne();
            } catch (Gpf_Exception $e) {
                Pap3Compatibility_Migration_OutputWriter::log("<br/>Error setting parentuserid: ".$e->getMessage());
            }
        }
        
    	
    	$this->countUsers++;
    }
    protected function addReferralCommissions(Pap_Affiliates_User $affiliate) {
        try {
            $commissionType = Pap_Db_Table_CommissionTypes::getReferralCommissionType();
        } catch (Gpf_Exception $e) {
            return;
        }
        $referralCommissions = Pap_Db_Table_Commissions::getReferralCommissions();
        if ($commissionType->getStatus() == 'D' || $referralCommissions->getSize() < 1) {
            return;
        }
        if ($commissionType->getApproval() == Pap_Db_CommissionType::APPROVAL_MANUAL) {
            $status = 'P';
        } else {
            $status = $affiliate->getStatus();
        }

        $saveZeroCommissions = $commissionType->getSaveZeroCommissions();

        $iterator = $referralCommissions->getIterator();

        while (($affiliate = $affiliate->getParentUser()) !== null) {
            if ($iterator->valid()) {
                $commission = $iterator->current();
                $this->addTransaction($affiliate->getId(), Pap_Db_Transaction::TYPE_REFERRAL, $commission->get(Pap_Db_Table_Commissions::VALUE), $status, $commission,$saveZeroCommissions);
                $iterator->next();
            } else {
                break;
            }
        }
    }
Example #27
0
    /**
     * returns user object from user ID stored in default affiliate
     *
     * @return string
     */
    private function getDefaultAffiliate(Pap_Contexts_Tracking $context) {
        $context->debug("    Trying to get default affiliate");
        if (Gpf_Settings::get(Pap_Settings::SAVE_UNREFERED_SALE_LEAD_SETTING_NAME) != Gpf::YES) {
            $context->debug("      Save unreferred sale is not enabled");
            return null;
        }
        $userId = Gpf_Settings::get(Pap_Settings::DEFAULT_AFFILIATE_SETTING_NAME);
        if($userId == '') {
            $context->debug("      No default affiliate defined");
            return null;
        }

        $userObj = Pap_Affiliates_User::loadFromId($userId);
        if($userObj == null) {
            return null;
        }

        return $userObj;
    }
Example #28
0
 /**
  * @return Pap_Common_User
  */
 public function getUser()
 {
     try {
         return Pap_Affiliates_User::loadFromId($this->getRequestParameter($this->getAffiliateClickParamName()));
     } catch (Gpf_Exception $e) {
         return null;
     }
 }
Example #29
0
    /**
     * @param $email
     * @param $context
     * @return Pap_Affiliates_User
     */
    private function createUserFromEmail($email, $context) {
        $context->debug('Loading affiliate by email');
        $emailValidator = new Gpf_Rpc_Form_Validator_EmailValidator();
        if (!$emailValidator->validate($email)) {
            if (!$emailValidator->validate(urldecode($email))) {
                $context->debug('    AutoRegisteringAffiliates - Creating affiliate stopped, not valid email address: ' . $email);
                return null;
            }
            $email = urldecode($email);
        }
        try {
            return Pap_Affiliates_User::loadFromUsername($email);
        } catch (Gpf_Exception $e) {
            if (!Pap_Common_User::isUsernameUnique($email)) {
                $context->debug('    AutoRegisteringAffiliates - Creating affiliate stopped, email address is used for another user: '******'');
            $user->setLastName(substr($email, 0, strpos($email, '@')));
            //$user->setSendNotification(false);
            $user->save();
            $signupForm->setDefaultEmailNotificationsSettings($user);

            $signupContext = Pap_Contexts_Signup::getContextInstance();
            $signupContext->setUserObject($user);
            $merchantNotificationEmails = new Pap_Signup_SendNotificationEmails();
            $merchantNotificationEmails->process($signupContext);

            $context->debug('    AutoRegisteringAffiliates - New Affiliate created successfully, email: ' . $email);

            Gpf_Db_Table_UserAttributes::setSetting(self::AUTO_REGISTERED_AFFILIATE, Gpf::YES, $user->getAccountUserId());
        }

        return Pap_Affiliates_User::loadFromUsername($email);
    }
    private function processAffiliatesReports($dateFrom) {
        foreach ($this->getAccountAffiliatesID()->getAllRowsIterator() as $row) {
            $this->interruptIfMemoryFull();
            try {
                $affiliate = Pap_Affiliates_User::getUserById($row->get(Pap_Db_Table_Users::ID));
                Gpf_Db_Table_UserAttributes::getInstance()->loadAttributes($affiliate->getAccountUserId());
            } catch (Gpf_DbEngine_NoRowException $e) {
                $this->setDone();
                continue;
            }

            if ($this->isAffDailyReportEnabled() && $this->isNotificationPending('affDailyReport', 'Send affiliates daily report', $affiliate) &&
            $this->hasNotifyEnabled('aff_notification_daily_report', Pap_Settings::AFF_NOTIFICATION_DAILY_REPORT_ENABLED, Pap_Settings::AFF_NOTIFICATION_DAILY_REPORT_DEFAULT)) {
                $this->sendAffReport(new Pap_Mail_Reports_AffDailyReport(new Pap_Stats_Params(new Gpf_DateTime($this->time))), $affiliate);
            }
            $this->setDone();
            $this->interruptIfMemoryFull();

            if ($this->isAffWeeklyReportEnabled() && $this->isNotificationPending('affWeeklyReport', 'Send affiliates weekly report', $affiliate) &&
            $this->hasNotifyEnabled('aff_notification_weekly_report', Pap_Settings::AFF_NOTIFICATION_WEEKLY_REPORT_ENABLED, Pap_Settings::AFF_NOTIFICATION_WEEKLY_REPORT_DEFAULT)) {
                $this->sendAffWeeklyReport($affiliate, $dateFrom);
            }
            $this->setDone();
            $this->interruptIfMemoryFull();

            if ($this->isAffMonthlyReportEnabled() && $this->isNotificationPending('affMonthlyReport', 'Send affiliates monthly report', $affiliate) &&
            $this->hasNotifyEnabled('aff_notification_monthly_report', Pap_Settings::AFF_NOTIFICATION_MONTHLY_REPORT_ENABLED, Pap_Settings::AFF_NOTIFICATION_MONTHLY_REPORT_DEFAULT)) {
                $this->sendAffMonthlyReport($affiliate, $dateFrom);
            }
            $this->setDone();
        }
    }