Esempio n. 1
0
 public function testGetByType()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $jobLog = new JobLog();
     $jobLog->type = 'Monitor';
     $jobLog->startDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
     $jobLog->endDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
     $jobLog->status = JobLog::STATUS_COMPLETE_WITHOUT_ERROR;
     $jobLog->isProcessed = false;
     $this->assertTrue($jobLog->save());
     $jobLog = new JobLog();
     $jobLog->type = 'Monitor';
     $jobLog->startDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
     $jobLog->endDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
     $jobLog->status = JobLog::STATUS_COMPLETE_WITHOUT_ERROR;
     $jobLog->isProcessed = false;
     $this->assertTrue($jobLog->save());
     $jobLog = new JobLog();
     $jobLog->type = 'SomethingElse';
     $jobLog->startDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
     $jobLog->endDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
     $jobLog->status = JobLog::STATUS_COMPLETE_WITHOUT_ERROR;
     $jobLog->isProcessed = false;
     $this->assertTrue($jobLog->save());
     $jobLogs = JobLog::getByType('Monitor');
     $this->assertCount(2, $jobLogs);
     $jobLogs = JobLog::getByType('Monitor', 1);
     $this->assertCount(1, $jobLogs);
     $jobLogs = JobLog::getByType('SomethingElse');
     $this->assertCount(1, $jobLogs);
     $jobLogs = JobLog::getByType('SomethingElse', 1);
     $this->assertCount(1, $jobLogs);
 }
 /**
  * Attempts to detect if outbound email settings are setup correctly.
  */
 protected function outboundEmailSettingsAreNotCorrect()
 {
     $testOutboundEmailJobLogs = JobLog::getByType('TestOutboundEmail', 1, 'startdatetime desc');
     if (count($testOutboundEmailJobLogs) == 0) {
         return false;
     }
     if ($testOutboundEmailJobLogs[0]->status == JobLog::STATUS_COMPLETE_WITH_ERROR) {
         return true;
     }
     return false;
 }
 protected function preFilter($filterChain)
 {
     if (isset($_POST['ajax'])) {
         return true;
     }
     $queueJobLogs = JobLog::getByType('AutoresponderQueueMessagesInOutbox', 1);
     $processJobLogs = JobLog::getByType('ProcessOutboundEmail', 1);
     if (count($queueJobLogs) == 0 || count($processJobLogs) == 0) {
         Yii::app()->user->setFlash('notification', Zurmo::t('AutorespondersModule', 'Autoresponders will not run properly until scheduled jobs are set up. Contact your administrator.'));
     }
     return true;
 }
 protected function preFilter($filterChain)
 {
     if (isset($_POST['ajax'])) {
         return true;
     }
     $generateJobLogs = JobLog::getByType('CampaignGenerateDueCampaignItems', 1);
     $markJobLogs = JobLog::getByType('CampaignMarkCompleted', 1);
     $queueJobLogs = JobLog::getByType('CampaignQueueMessagesInOutbox', 1);
     $processJobLogs = JobLog::getByType('ProcessOutboundEmail', 1);
     if (count($generateJobLogs) == 0 || count($markJobLogs) == 0 || count($queueJobLogs) == 0 || count($processJobLogs) == 0) {
         Yii::app()->user->setFlash('notification', Zurmo::t('CampaignsModule', 'Campaigns will not run properly until scheduled jobs are set up. Contact your administrator.'));
     }
     return true;
 }