Beispiel #1
0
 private function initDatabaseLogger()
 {
     $logger = Gpf_Log_Logger::getInstance();
     if (!$logger->checkLoggerTypeExists(Gpf_Log_LoggerDatabase::TYPE)) {
         $logger->setGroup(Gpf_Common_String::generateId(10));
         $logLevel = Gpf_Settings::get(Gpf_Settings_Gpf::LOG_LEVEL_SETTING_NAME);
         $logger->add(Gpf_Log_LoggerDatabase::TYPE, $logLevel);
     }
 }
 public function insert()
 {
     $password = $this->get(Gpf_Db_Table_AuthUsers::PASSWORD);
     if (strlen(trim($password)) == 0) {
         $this->set(Gpf_Db_Table_AuthUsers::PASSWORD, Gpf_Common_String::generatePassword(8));
     }
     $this->generateAuthToken();
     $this->setIp(Gpf_Http::getRemoteIp());
     parent::insert();
 }
    /**
     * @param Gpf_DbEngine_Row $dbRow
     */
    protected function setDefaultDbRowObjectValues($dbRow) {
        $dbRow->set("accountid", Gpf_Session::getAuthUser()->getAccountId());
        $dbRow->set("numberuserid", 1);
        $dbRow->set("rtype", Pap_Application::ROLETYPE_AFFILIATE);

        $approvalType = Gpf_Settings::get(Pap_Settings::AFFILIATE_APPROVAL);
        if($approvalType == 'A') {
            $dbRow->set("rstatus", Gpf_Db_User::APPROVED);
        } else {
            $dbRow->set("rstatus", Gpf_Db_User::PENDING);
        }
        $dbRow->set("deleted", Gpf::NO);
        $dbRow->set("dateinserted", Gpf_Common_DateUtils::Now());
        $dbRow->set("refid", uniqid());
        $dbRow->set("rpassword", Gpf_Common_String::generatePassword(8));
        Gpf_Plugins_Engine::extensionPoint('PostAffiliate.AffiliateForm.setDefaultDbRowObjectValues', $dbRow);
    }
Beispiel #4
0
    /**
     * @param $type
     * @return Gpf_Log_Logger
     */
    public static function create($type = self::SYSTEM_DEBUG_TYPE) {
        $logLevel = self::getLogLevel($type);
        
        $request = new Pap_Tracking_Request();
        if($request->getDebug() == Gpf::YES) {
            $logLevel = Gpf_Log::DEBUG;
        }
        
        $logger = Gpf_Log_Logger::getInstance($type);
        $logger->setGroup(substr($type, 0, 4) . '-' . Gpf_Common_String::generateId(10));
        $logger->setType($type);
        $logger->add(Gpf_Log_LoggerDatabase::TYPE, $logLevel);

        if($request->getDebug() == Gpf::YES) {
            $logger->add(Gpf_Log_LoggerDisplay::TYPE, $logLevel);
        }
         
        return $logger;
    }
 public function setGroup($group = null)
 {
     $this->group = $group;
     if ($group === null) {
         $this->group = Gpf_Common_String::generateId(10);
     }
 }
Beispiel #6
0
 /**
  * Generates new primary key value
  * Keys with already set values, don't change
  */
 protected function generatePrimaryKey()
 {
     foreach ($this->table->getPrimaryColumns() as $column) {
         if ($column->isAutogenerated() && $column->type == "String" && !strlen($this->get($column->name))) {
             $this->set($column->name, Gpf_Common_String::generateId($column->length));
         }
     }
 }
 protected function generatePrimaryKey() {
     for ($i = 1; $i <= 10; $i++) {
         $transactionId = Gpf_Common_String::generateId(8);
         try {
             $this->getTransaction($transactionId);
         } catch (Gpf_Exception $e) {
             $this->setId($transactionId);
             return;
         }
     }
 }
    public function saveCommissions(Pap_Common_ActionProcessorCompoundContext $actionProcessorCompoundContext) {
        $context = $actionProcessorCompoundContext->getContext();
        $cache = $actionProcessorCompoundContext->getActionProcessor()->getVisitorAffiliatesCache();

        $context->debug('SplitCommissions save started');

        $commType = $this->getCommissionType($context);

        if ($context->getTrackingMethod() == Pap_Common_Transaction::TRACKING_METHOD_DEFAULT_AFFILIATE) {
            $context->debug('SplitCommissions - default affiliate. STOPPED');
            return;
        }

        if ($context->getTrackingMethod() == Pap_Common_Transaction::TRACKING_METHOD_FORCED_PARAMETER) {
            $context->debug('SplitCommissions - forced parameter. STOPPED');
            return;
        }

        if ($context->getTrackingMethod() == Pap_Common_Transaction::TRACKING_METHOD_COUPON) {
            $context->debug('SplitCommissions - coupon. STOPPED');
            return;
        }

        $this->saleId = Gpf_Common_String::generateId();

        $firstAffBonus = $this->loadCommissionTypeAttributeValue($commType->getId(), Pap_Features_SplitCommissions_SplitCommissionsForm::FIRST_AFF_BONUS);
        $lastAffBonus = $this->loadCommissionTypeAttributeValue($commType->getId(), Pap_Features_SplitCommissions_SplitCommissionsForm::LAST_AFF_BONUS);
        $this->minCommission = $this->loadCommissionTypeAttributeValue($commType->getId(), Pap_Features_SplitCommissions_SplitCommissionsForm::MIN_COMMISSION);

        Pap_Features_SplitCommissions_VisitorAffiliateCheckCompatibility::getHandlerInstance()->checkCompatibility($context->getVisitorId(), $cache);

        $visitorAffiliates = $cache->getVisitorAffiliateAllRows($context->getVisitorId());

        Pap_Tracking_Visit_VisitorAffiliateCache::sortVisitorAffiliatesByDateVisit($visitorAffiliates);

        $this->setSplitCommissions($this->getSplitCommissions($firstAffBonus, $lastAffBonus, $visitorAffiliates));

        $this->visitorAffiliateCollection = $visitorAffiliates;

        $this->processVisitorAffiliates($visitorAffiliates, $actionProcessorCompoundContext);

        $context->debug('SplitCommissions save finished');
        $actionProcessorCompoundContext->setCommissionsAlreadySaved(true);
    }
 /**
  * @param Gpf_DbEngine_Row $dbRow
  */
 protected function setDefaultDbRowObjectValues($dbRow) {
     parent::setDefaultDbRowObjectValues($dbRow);
     $dbRow->setPassword(Gpf_Common_String::generatePassword(8));
 }
 protected function addRefundChargeback(Pap_Db_Transaction $refundChargeback, $type, $note = '', $orderId = '', $fee = 0) {
     foreach ($this as $name => $value) {
         $refundChargeback->set($name, $value);
     }
     $refundChargeback->setId(Gpf_Common_String::generateId());
     $refundChargeback->setCommission(($this->getCommission() * -1) - $fee);
     $refundChargeback->setType($type);
     if ($orderId != '') {
         $refundChargeback->setOrderId($orderId);
     }
     $refundChargeback->setParentTransactionId($this->getId());
     $refundChargeback->setDateInserted(Gpf_Common_DateUtils::now());
     $refundChargeback->setPayoutStatus(Pap_Common_Constants::PSTATUS_UNPAID);
     $refundChargeback->setMerchantNote($note);
     if ($refundChargeback->getStatus() == Pap_Common_Constants::STATUS_APPROVED) {
         $refundChargeback->setDateApproved($refundChargeback->getDateInserted());
     } else {
         $refundChargeback->setDateApproved('');
     }
     $refundChargeback->insert();
 }