private function loadPlannedTask() { $this->plannedTask = new Gpf_Db_PlannedTask(); $this->plannedTask->setClassName(get_class($this)); $this->plannedTask->setRecurrencePresetId('A'); $this->plannedTask->setAccountId($this->task->getAccountId()); try { $this->plannedTask->loadFromData(array(Gpf_Db_Table_PlannedTasks::CLASSNAME, Gpf_Db_Table_PlannedTasks::RECURRENCEPRESETID, Gpf_Db_Table_PlannedTasks::ACCOUNTID)); } catch (Gpf_Exception $e) { } }
private function updatePlannedTaskParams() { $plannedTask = new Gpf_Db_PlannedTask(); $plannedTask->setClassName(Pap_Merchants_Config_EmailNotificationsFormBase::REPORTS_SEND_CLASS); $plannedTask->setAccountId($this->task->getAccountId()); try { $plannedTask->loadFromData(array(Gpf_Db_Table_PlannedTasks::CLASSNAME, Gpf_Db_Table_PlannedTasks::ACCOUNTID)); $plannedTask->setParams($this->getSerializedDateParams(Gpf_Common_DateUtils::getDate($this->time))); $plannedTask->setLastPlanDate(Gpf_Common_DateUtils::addDateUnit(Gpf_Common_DateUtils::getDate($this->time), 1, Gpf_Common_DateUtils::DAY)); $plannedTask->save(); } catch (Gpf_Exception $e) { Gpf_Log::error('Error during updating planned ReportsSendTask: ' . $e->getMessage()); } }
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) { } }
/** * This method will be removed when all accounts will be able own affiliates */ protected function initAccountId(Gpf_Db_PlannedTask $task) { $task->setAccountId(Gpf_Application::getInstance()->getAccountId()); }
protected function initAccountId(Gpf_Db_PlannedTask $task) { $task->setAccountId(Gpf_Session::getInstance()->getAuthUser()->getAccountId()); }