protected function setTimeVariableValues($timeOffset = 0) { parent::setTimeVariableValues($timeOffset); $firstClickTime = Gpf_Common_DateUtils::getTimestamp($this->transaction->get(Pap_Db_Table_Transactions::FIRST_CLICK_TIME)); $lastClickTime = Gpf_Common_DateUtils::getTimestamp($this->transaction->get(Pap_Db_Table_Transactions::LAST_CLICK_TIME)); $this->setVariable('firstclicktime', Gpf_Common_DateUtils::getDateTime($firstClickTime + $timeOffset)); $this->setVariable('lastclicktime', Gpf_Common_DateUtils::getDateTime($lastClickTime + $timeOffset)); }
private function updateNullDateVisits() { $update = new Gpf_SqlBuilder_UpdateBuilder(); $update->from->add(Pap_Db_Table_VisitorAffiliates::getName()); $update->set->add(Pap_Db_Table_VisitorAffiliates::DATEVISIT, Gpf_Common_DateUtils::now()); $update->where->add(Pap_Db_Table_VisitorAffiliates::DATEVISIT, 'is', 'NULL', 'AND', false); $update->update(); }
protected function setDefaultDbRowObjectValues(Gpf_DbEngine_RowBase $dbRow) { $dbRow->setAccountId(Gpf_Session::getAuthUser()->getAccountId()); $actualDate = Gpf_Common_DateUtils::getDateTime(time()); $dbRow->setDateInserted($actualDate); $dbRow->setDateApproved($actualDate); $dbRow->setStatus(Gpf_Db_User::APPROVED); }
public function process(Pap_Common_TransactionCompoundContext $context) { $transaction = $context->getTransaction(); $context->getContext()->debug("SubaffiliateFirstSaleBonus started"); if($transaction->getTier() != 2) { $context->getContext()->debug("SubaffiliateFirstSaleBonus ended - Not 2. tier"); return; } $row = $this->getChildAffiliateInfo($transaction); $date = new Gpf_DateTime(time()); $date->addDay(-Gpf_Settings::get(SubaffiliateFirstSaleBonus_Config::VALIDITY_DAYS)); if(Gpf_Common_DateUtils::getDateTime($date->toTimeStamp()) > $row->get(Pap_Db_Table_Users::DATEINSERTED)) { $context->getContext()->debug("SubaffiliateFirstSaleBonus ended - Date Inserted is older than defined days."); return; } if($this->getChildAffiliateTransactionsCount($row->get(Pap_Db_Table_Transactions::USER_ID)) > 1) { $context->getContext()->debug("SubaffiliateFirstSaleBonus ended - Not user's first transaction."); return; } if(Gpf_Settings::get(SubaffiliateFirstSaleBonus_Config::BONUS_TYPE) == '%') { $transaction->setCommission($transaction->getCommission()+(Gpf_Settings::get(SubaffiliateFirstSaleBonus_Config::BONUS_AMOUNT)/100)*$transaction->getTotalCost()); } else{ $transaction->setCommission(Gpf_Settings::get(SubaffiliateFirstSaleBonus_Config::BONUS_AMOUNT)+$transaction->getCommission()); } $context->getContext()->debug("SubaffiliateFirstSaleBonus ended - Success."); return; }
protected function setTimeVariableValues($timeOffset = 0) { $this->timeOffset = $timeOffset; parent::setTimeVariableValues($this->timeOffset); $this->initDate($this->statsParams, $this->timeOffset); $this->setVariable('dateFrom', Gpf_Common_DateUtils::getDateInLocaleFormat(strtotime($this->dateFrom) + $this->timeOffset)); $this->setVariable('dateTo', Gpf_Common_DateUtils::getDateInLocaleFormat(strtotime($this->dateTo) + $this->timeOffset)); }
private function addUserInCommissionGroup($commissionGroupId, $userId, $status) { $userInCommissionGroup = new Pap_Db_UserInCommissionGroup(); $userInCommissionGroup->setCommissionGroupId($commissionGroupId); $userInCommissionGroup->setUserId($userId); $userInCommissionGroup->setStatus($status); $userInCommissionGroup->setDateAdded(Gpf_Common_DateUtils::getDateTime(time())); $userInCommissionGroup->save(); }
function __construct(){ parent::__construct(); $this->setAccountId(Gpf_Db_Account::DEFAULT_ACCOUNT_ID); $this->setDateInserted(Gpf_Common_DateUtils::now()); $this->setChannel(''); $this->setSplit(1); $this->setTier(1); }
public function initSettings($context) { $context->addDbSetting(BusinessCatalyst_Config::LOGIN, ''); $context->addDbSetting(BusinessCatalyst_Config::PASSWORD, ''); $context->addDbSetting(BusinessCatalyst_Config::SITE_ID, ''); $context->addDbSetting(BusinessCatalyst_Config::PAP_CUSTOM_FIELD_NAME, ''); $context->addDbSetting(BusinessCatalyst_Config::BC_DOMAIN_NAME, ''); $context->addDbSetting(BusinessCatalyst_Config::BC_LAST_CHECK, Gpf_Common_DateUtils::getDateTime(1)); $context->addDbSetting(BusinessCatalyst_Config::BC_LAST_ENTITY_ID, '0'); }
private function deleteVisitorAffiliates() { $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add(Pap_Db_Table_VisitorAffiliates::getName()); $delete->where->add(Pap_Db_Table_VisitorAffiliates::VALIDTO,'<',Gpf_Common_DateUtils::now()); $delete->where->add(Pap_Db_Table_VisitorAffiliates::VALIDTO,'!=',null); $delete->limit->set('',$this->deleteLimit); $statement = $delete->delete(); return $statement->affectedRows()>0; }
/** * @param $value * @return boolean */ public function validate($value) { if ($this->isEmpty($value)) { return true; } if (preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $value) && $value == Gpf_Common_DateUtils::getDate(strtotime($value))) { return true; } return false; }
protected function addFillBonus(Pap_Common_User $user, $fillCount, $commission) { $transaction = new Pap_Common_Transaction(); $transaction->setCommission($commission); $transaction->setType(Pap_Db_Transaction::TYPE_EXTRA_BONUS); $transaction->setDateInserted(Gpf_Common_DateUtils::now()); $transaction->setStatus(Pap_Common_Constants::STATUS_APPROVED); $transaction->setPayoutStatus(Pap_Common_Constants::PSTATUS_UNPAID); $transaction->setUserId($user->getId()); $transaction->setSystemNote($this->_('Matrix %sx fill bonus', $fillCount)); $transaction->insert(); }
public function addForcedAffiliateToVisitorAffiliates(Pap_Common_VisitorAffiliateCacheCompoundContext $visitorAffiliatesCacheCompoundContext) { $context = $visitorAffiliatesCacheCompoundContext->getContext(); if ($context->getTrackingMethod() != Pap_Common_Transaction::TRACKING_METHOD_FORCED_PARAMETER && $context->getTrackingMethod() != Pap_Common_Transaction::TRACKING_METHOD_COUPON) { $context->debug('SplitCommissions - not forced affiliate'); return; } $context->debug('SplitCommissions - forced affiliate'); $context->setDateCreated(Gpf_Common_DateUtils::now()); $this->splitCommissionsSaveVisitorAffiliate($visitorAffiliatesCacheCompoundContext); }
/** * @return boolean */ private function isRecurrenceMonth() { if ($this->plannedTask->isPrimaryKeyEmpty()) { return false; } $lastSendDate = $this->plannedTask->getParams(); if (is_null($lastSendDate) || $lastSendDate == '') { return true; } $dateTime = new Gpf_DateTime(); if (Gpf_Common_DateUtils::getDifference($lastSendDate, $dateTime->toDateTime(), Gpf_Common_DateUtils::MONTH) > $this->accountSettings->get(Pap_Settings::NOTIFICATION_PAY_DAY_REMINDER_RECURRENCE_MONTH)) { return true; } return false; }
protected function insertBonusTransaction($commissionValue) { $transaction = new Pap_Common_Transaction(); $transaction->setCommission($commissionValue); $transaction->setType(Pap_Db_Transaction::TYPE_EXTRA_BONUS); $transaction->setDateInserted(Gpf_Common_DateUtils::now()); $transaction->setStatus('A'); $transaction->setPayoutStatus('U'); $transaction->setUserId($this->getCurrentUserId()); $transaction->setCampaignId($this->transaction->getCampaignId()); $transaction->setSystemNote('Commission of rule: ' . $this->rule->getString()); $transaction->setData1($this->rule->getId()); $transaction->setData2($this->getToDateRange()); $transaction->insert(); }
public function createCommissions() { $comissionEntry = new Pap_Db_RecurringCommissionEntry(); $comissionEntry->setRecurringCommissionId($this->getId()); try { $parentTransaction = $this->getTransaction(); } catch (Gpf_Exception $e) { $parentTransaction = null; } foreach ($comissionEntry->loadCollection() as $comissionEntry) { if (!$this->isExistsUser($comissionEntry->getUserId())) { Gpf_log::error('Recurring commissions - createCommissions: user does not exist: ' . $comissionEntry->getUserId()); if ($comissionEntry->getTier() == '1') { return; } else { continue; } } $transaction = new Pap_Common_Transaction(); $transaction->setDateInserted(Gpf_Common_DateUtils::now()); $transaction->setType(Pap_Common_Constants::TYPE_RECURRING); $transaction->setTier($comissionEntry->getTier()); $transaction->setUserId($comissionEntry->getUserId()); $transaction->setCommissionTypeId($this->getCommissionTypeId()); $transaction->setParentTransactionId($this->getTransactionId()); $transaction->setCommission($comissionEntry->getCommission()); $transaction->setPayoutStatus(Pap_Common_Transaction::PAYOUT_UNPAID); $transaction->setStatus(Pap_Common_Constants::STATUS_APPROVED); $transaction->setOrderId($this->getOrderId()); if ($parentTransaction != null) { if ($transaction->getOrderId() == '') { $transaction->setOrderId($parentTransaction->getOrderId()); } $transaction->setProductId($parentTransaction->getProductId()); $transaction->setTotalCost($parentTransaction->getTotalCost()); $transaction->setCampaignId($parentTransaction->getCampaignId()); $transaction->setBannerId($parentTransaction->getBannerId()); $transaction->setParentBannerId($parentTransaction->getParentBannerId()); $transaction->setCountryCode($parentTransaction->getCountryCode()); $transaction->setData1($parentTransaction->getData1()); $transaction->setData2($parentTransaction->getData2()); $transaction->setData3($parentTransaction->getData3()); $transaction->setData4($parentTransaction->getData4()); $transaction->setData5($parentTransaction->getData5()); } $transaction->save(); } }
/** * Load Location of last 20 IP addresses of logins of selected affiliate * * @service online_user read * @return Gpf_Data_RecordSet */ public function getAffiliateLogins(Gpf_Rpc_Params $params) { $sql = new Gpf_SqlBuilder_SelectBuilder(); $sql->select->add('l.'.Gpf_Db_Table_LoginsHistory::IP); $sql->select->add('MAX(l.'.Gpf_Db_Table_LoginsHistory::LOGIN . ')', 'login'); $sql->from->add(Gpf_Db_Table_LoginsHistory::getName(), 'l'); $sql->from->addInnerJoin(Gpf_Db_Table_Users::getName(), 'u', 'l.accountuserid=u.accountuserid'); $sql->from->addInnerJoin(Gpf_Db_Table_AuthUsers::getName(), 'au', 'u.authid=au.authid'); $sql->where->add(Gpf_Db_Table_AuthUsers::USERNAME, '=', $params->get('username')); $sql->where->add('l.'.Gpf_Db_Table_LoginsHistory::IP, '<>', '127.0.0.1'); $sql->orderBy->add(Gpf_Db_Table_LoginsHistory::LOGIN, false); $sql->groupBy->add('l.'.Gpf_Db_Table_LoginsHistory::IP); $sql->limit->set(0, 20); $recordset = $sql->getAllRows(); $recordset->addColumn('countryCode', ''); $recordset->addColumn('countryName', ''); $recordset->addColumn('city', ''); $recordset->addColumn('latitude', ''); $recordset->addColumn('longitude', ''); $recordset->addColumn('postalCode', ''); $recordset->addColumn('region', ''); foreach ($recordset as $record) { $location = new GeoIp_Location(); $location->setIpString($record->get('ip')); $location->load(); $record->set('countryCode', $location->getCountryCode()); $record->set('countryName', $location->getCountryName()); $record->set('city', $location->getCity()); $record->set('latitude', $location->getLatitude()); $record->set('longitude', $location->getLongitude()); $record->set('postalCode', $location->getPostalCode()); $record->set('region', $location->getRegion()); $record->set('login', Gpf_Common_DateUtils::getHumanRelativeTime(Gpf_Common_DateUtils::getClientTime( Gpf_Common_DateUtils::mysqlDateTime2Timestamp($record->get('login'))))); } return $recordset; }
private function saveReportsSendTask() { $task = new Gpf_Db_PlannedTask(); $task->setClassName(Pap_Merchants_Config_EmailNotificationsFormBase::REPORTS_SEND_CLASS); $task->setRecurrencePresetId('A'); $task->setParams(serialize(array('lastdate' => Gpf_Common_DateUtils::now()))); $task->setAccountId(Gpf_Application::getInstance()->getAccountId()); try { $task->loadFromData(array( Gpf_Db_Table_PlannedTasks::CLASSNAME, Gpf_Db_Table_PlannedTasks::RECURRENCEPRESETID, Gpf_Db_Table_PlannedTasks::ACCOUNTID)); } catch (Gpf_DbEngine_NoRowException $e) { $task->insert(); } catch (Gpf_DbEngine_TooManyRowsException $e) { } }
protected function execute() { try { $fromtime = $this->getFromTime(); if ($fromtime) { $select = $this->createSellNotificationSelect(Gpf_Common_DateUtils::getDateTime($fromtime)); foreach ($select->getAllRows() as $saleRow) { $this->createNotificationsForSale($saleRow); } if (!empty($this->androidNotifications)) $this->sendGoogleNotifications(); } $fromtime = (string) Gpf_Common_DateUtils::getTimestamp(Gpf_Common_DateUtils::now()); $this->saveFromTime($fromtime); $this->cleanupOldRegistrations(); } catch (Exception $e) { throw new Gpf_Exception('Pap_Mobile_NotificationTask failed ' . $e->getMessage()); } $this->interrupt(10 * 60); }
/** * @param Pap_Contexts_Tracking $context * @return boolean */ private function isInCookieLifetimeLimit(Pap_Contexts_Tracking $context) { $select = new Gpf_SqlBuilder_SelectBuilder(); $select->select->add(Pap_Db_Table_Transactions::DATE_INSERTED); $select->from->add(Pap_Db_Table_Transactions::getName()); $select->where->add(Pap_Db_Table_Transactions::DATA1, '=', $this->getIdentifier($context)); $select->where->add(Pap_Db_Table_Transactions::R_TYPE, '=', Pap_Db_Transaction::TYPE_SALE); $select->orderBy->add(Pap_Db_Table_Transactions::DATE_INSERTED); $select->limit->set(0, 1); try { $firstSale = $select->getOneRow()->get(Pap_Db_Table_Transactions::DATE_INSERTED); $cookieLifeTime = Pap_Tracking_Cookie::getCookieLifeTimeInDays($context); if (Gpf_Common_DateUtils::getDifference($firstSale, Gpf_Common_DateUtils::getDateTime(time()), 'day') > $cookieLifeTime) { $context->debug(' Transaction is not in cookie limit. Date of first transaction: ' . $firstSale . ' is not in cookie limit: ' . $cookieLifeTime . ' days.'); return false; } } catch (Gpf_DbEngine_NoRowException $e) { } return true; }
/** * * @service click delete * @param ids, status * @return Gpf_Rpc_Action */ public function deleteClicks(Gpf_Rpc_Params $params) { $action = new Gpf_Rpc_Action($params); $date = array(); switch ($action->getParam("status")) { case self::DATE_ONE_WEEK: $filter = new Gpf_SqlBuilder_Filter(array("", "DP", "L7D")); $date = $filter->addDateValueToArray($date); $olderThan = "one week"; break; case self::DATE_TWO_WEEKS: $dateFrom = Gpf_DbEngine_Database::getDateString( Gpf_Common_DateUtils::getServerTime( mktime(0,0,0,date("m"), date("d") - 14, date("Y")))); $date = array("dateFrom" => $dateFrom); $olderThan = "two weeks"; break; case self::DATE_ONE_MONTH: $filter = new Gpf_SqlBuilder_Filter(array("", "DP", "L30D")); $date = $filter->addDateValueToArray($date); $olderThan = "one month"; break; } $action->setInfoMessage($this->_("Raw clicks older than %s are deleted", $olderThan)); $action->setErrorMessage($this->_("Failed to delete raw clicks")); $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add(Pap_Db_Table_RawClicks::getName()); $delete->where->add(Pap_Db_Table_RawClicks::DATETIME, "<", $date["dateFrom"]); try { $delete->delete(); $action->addOk(); } catch(Gpf_DbEngine_NoRowException $e) { $action->addError(); } return $action; }
/** * * @service mail_outbox write * @param $ids * @return Gpf_Rpc_Action */ public function restartSendingMail(Gpf_Rpc_Params $params) { $action = new Gpf_Rpc_Action($params); $action->setErrorMessage($this->_('Failed to restart %s row(s)')); $action->setInfoMessage($this->_('%s row(s) successfully restarted')); foreach ($action->getIds() as $id) { try { $update = new Gpf_SqlBuilder_UpdateBuilder(); $update->from->add(Gpf_Db_Table_MailOutbox::getName()); $update->set->add(Gpf_Db_Table_MailOutbox::ERROR_MSG, self::RESTART_ERROR_MSG); $update->set->add(Gpf_Db_Table_MailOutbox::RETRY_NR, self::RESTART_RETRY_NR); $update->set->add(Gpf_Db_Table_MailOutbox::SCHNEDULET_AT, Gpf_Common_DateUtils::now()); $update->where->add(Gpf_Db_Table_MailOutbox::ID, '=', $id, 'AND'); $update->where->add(Gpf_Db_Table_MailOutbox::STATUS, '=', self::STATUS_PENDING); $update->executeOne(); $action->addOk(); } catch (Exception $e) { $action->addError(); } } return $action; }
protected function getHeader() { return "/**\n". " * @copyright Copyright (c) 2008-2009 Quality Unit s.r.o.\n". " * @author Quality Unit\n". " * @package PapApi\n". " * @since Version 1.0.0\n". " * \n". " * Licensed under the Quality Unit, s.r.o. Dual License Agreement,\n". " * Version 1.0 (the \"License\"); you may not use this file except in compliance\n". " * with the License. You may obtain a copy of the License at\n". " * http://www.qualityunit.com/licenses/gpf\n". " * Generated on: " . Gpf_Common_DateUtils::getDateTime(time()) . "\n" . " * PAP version: " . Pap_Application::getInstance()->getVersion() . ", GPF version: " . Gpf::GPF_VERSION . "\n" . " * \n". " */\n\n". "@ini_set('session.gc_maxlifetime', 28800);\n". "@ini_set('session.cookie_path', '/');\n". "@ini_set('session.use_cookies', true);\n". "@ini_set('magic_quotes_runtime', false);\n". "@ini_set('session.use_trans_sid', false);\n". "@ini_set('zend.ze1_compatibility_mode', false);\n"; }
protected function execute() { $select = new Gpf_SqlBuilder_SelectBuilder(); $select->select->addAll(Pap_Db_Table_RecurringCommissions::getInstance()); $select->from->add(Pap_Db_Table_RecurringCommissions::getName()); foreach ($select->getAllRowsIterator() as $row) { $recurringCommission = new Pap_Features_RecurringCommissions_RecurringCommission(); $recurringCommission->fillFromRecord($row); $recurringCommission->setPersistent(true); if ($this->isDone($recurringCommission->getId())) { continue; } $recurrencePreset = $recurringCommission->getRecurrencePreset(); $lastCommissionDate = $recurringCommission->getLastCommissionDate(); if ($lastCommissionDate == null) { $lastCommissionDate = $recurringCommission->getTransaction()->getDateInserted(); } $nextTimestamp = $recurrencePreset->getNextDate(Gpf_Common_DateUtils::mysqlDateTime2Timestamp($lastCommissionDate)); if ($nextTimestamp == null || $nextTimestamp > time()) { continue; } $recurringCommission->setLastCommissionDate(Gpf_Common_DateUtils::getDateTime($nextTimestamp)); if ($recurringCommission->getStatus() == Pap_Common_Constants::STATUS_APPROVED) { try { $recurringCommission->createCommissions(); } catch (Gpf_Exception $e) { Gpf_Log::critical('Recurring commissions - error create commissions: ' . $e->getMessage()); $this->setDone(); } } $recurringCommission->save(); $this->setDone(); } }
/** * @param timestamp $lastTimestamp * @return next date timestamp or null if there is no other date */ public function getNextDate($lastTimestamp) { if ($this->getStartDate() != null && $this->getStartDate() > Gpf_Common_DateUtils::getDateTime(time())) { return null; } if ($this->getEndDate() != null && $this->getEndDate() < Gpf_Common_DateUtils::getDateTime(time())) { return null; } $recurrenceSetting = new Gpf_Db_RecurrenceSetting(); $recurrenceSetting->setRecurrencePresetId($this->getId()); $nextDate = 0; foreach ($recurrenceSetting->loadCollection() as $recurrenceSetting) { $setting = Gpf_Recurrence_Setting_Factory::getRecurrenceSetting($recurrenceSetting); $settingNextDate = $setting->getNextDate($lastTimestamp); if ($nextDate < $settingNextDate) { $nextDate = $settingNextDate; } } if ($nextDate == 0) { return null; } return $nextDate; }
/** * * @service user_comm_group add * @param $fields */ public function add(Gpf_Rpc_Params $params) { $form = new Gpf_Rpc_Form($params); $dbRow = $this->createDbRowObject(); $this->setDefaultDbRowObjectValues($dbRow); $form->fill($dbRow); $dbRow->set(Pap_Db_Table_UserInCommissionGroup::STATUS, self::DEFAULT_STATUS); $dbRow->set(Pap_Db_Table_UserInCommissionGroup::NOTE, self::DEFAULT_NOTE); $dbRow->set(Pap_Db_Table_UserInCommissionGroup::DATE_ADDED, Gpf_Common_DateUtils::now()); try { $dbRow->save(); } catch (Exception $e) { $form->setErrorMessage($e->getMessage()); return $form; } $form->load($dbRow); $form->setField("Id", $dbRow->getPrimaryKeyValue()); $form->setInfoMessage($this->getDbRowObjectName().$this->_(" added")); return $form; }
public function scheduleTasks($inclusion_type, $inclusion_tasks) { $select = new Gpf_SqlBuilder_SelectBuilder(); $select->select->addAll(Gpf_Db_Table_PlannedTasks::getInstance()); $select->from->add(Gpf_Db_Table_PlannedTasks::getName()); $condition = new Gpf_SqlBuilder_CompoundWhereCondition(); $condition->add(Gpf_Db_Table_PlannedTasks::LASTPLANDATE, '<', Gpf_Common_DateUtils::now(), 'OR'); $condition->add(Gpf_Db_Table_PlannedTasks::LASTPLANDATE, 'is', 'NULL', 'OR', false); $select->where->addCondition($condition); if ($inclusion_type == Gpf_Tasks_Runner::INCLUDE_TASKS) { $select->where->add(Gpf_Db_Table_PlannedTasks::CLASSNAME, 'IN', $inclusion_tasks); } else { if ($inclusion_type == Gpf_Tasks_Runner::EXCLUDE_TASKS) { $select->where->add(Gpf_Db_Table_PlannedTasks::CLASSNAME, 'NOT IN', $inclusion_tasks); } } foreach ($select->getAllRows() as $plannedTaskRow) { $plannedTask = new Gpf_Db_PlannedTask(); $plannedTask->fillFromRecord($plannedTaskRow); if ($plannedTask->getLastPlanDate() == null) { $plannedTask->setLastPlanDate(Gpf_Common_DateUtils::now()); } $task = new Gpf_Db_Task(); $task->setClassName($plannedTask->getClassName()); $task->setParams($plannedTask->getParams()); $task->setAccountId($plannedTask->getAccountId()); $task->save(); $preset = new Gpf_Recurrence_Preset(); $preset->setId($plannedTask->getRecurrencePresetId()); $preset->load(); $nextDate = $preset->getNextDate(Gpf_Common_DateUtils::mysqlDateTime2Timestamp($plannedTask->getLastPlanDate())); if ($nextDate != null && $nextDate > 0) { $plannedTask->setLastPlanDate(Gpf_Common_DateUtils::getDateTime($nextDate)); $plannedTask->update(); } } }
/** * * @service user_in_commission_group add * @param $fields * @return Gpf_Rpc_Form */ public function add(Gpf_Rpc_Params $params) { $form = new Gpf_Rpc_Form($params); $dbRow = $this->createDbRowObject(); $this->setDefaultDbRowObjectValues($dbRow); $form->fill($dbRow); $dbRow->setDateAdded(Gpf_Common_DateUtils::getDateTime(time())); $dbRow->removeUserFromCampaignGroups($form->getFieldValue('campaignid')); try { $dbRow->save(); } catch (Exception $e) { $form->setErrorMessage($e->getMessage()); return $form; } $form->load($dbRow); $form->setField("Id", $dbRow->getPrimaryKeyValue()); $form->setInfoMessage($this->_("%s was successfully added", $this->getDbRowObjectName())); return $form; }
private function addLabel($date, $timeGroupBy) { $this->labels[] = Gpf_Common_DateUtils::formatByUnit($date, $timeGroupBy); }
/** * @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; }
protected function convertTimeColumn($dateTime) { return Gpf_Common_DateUtils::formatByUnit(new Gpf_DateTime($dateTime), $this->timeGroupBy); }