/**
  * @covers DateTimeUtil::getHis
  */
 public function testGetHis()
 {
     $obj = new DateTimeUtil();
     $val = 1448400000;
     $actual = $obj->getHis($val);
     $expected = '06:20:00';
     $this->assertEquals($expected, $actual, __CLASS__ . "::" . __METHOD__ . ": line " . __LINE__);
 }
Esempio n. 2
0
 public function testRunAndProcessStuckJobs()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $emailAddress = new Email();
     $emailAddress->emailAddress = '*****@*****.**';
     Yii::app()->user->userModel->primaryEmail = $emailAddress;
     $saved = Yii::app()->user->userModel->save();
     $this->assertTrue($saved);
     $this->assertEquals(0, Yii::app()->emailHelper->getQueuedCount());
     $this->assertEquals(0, Yii::app()->emailHelper->getSentCount());
     $monitorJob = new MonitorJob();
     $this->assertEquals(0, count(JobInProcess::getAll()));
     $this->assertEquals(0, count(Notification::getAll()));
     $jobInProcess = new JobInProcess();
     $jobInProcess->type = 'Test';
     $this->assertTrue($jobInProcess->save());
     //Should make createdDateTime long enough in past to trigger as stuck.
     $createdDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 1000);
     $sql = "Update item set createddatetime = '" . $createdDateTime . "' where id = " . $jobInProcess->getClassId('Item');
     R::exec($sql);
     $jobInProcess->forget();
     $monitorJob->run();
     $this->assertEquals(1, count(Notification::getAll()));
     //Confirm an email was sent
     $this->assertEquals(0, Yii::app()->emailHelper->getQueuedCount());
     $this->assertEquals(1, Yii::app()->emailHelper->getSentCount());
 }
 protected static function renderExpirationDateTimeContent(GameReward $gameReward)
 {
     if (!DateTimeUtil::isDateTimeStringNull($gameReward->expirationDateTime)) {
         $content = Zurmo::t('ZurmoModule', 'Until') . ' ';
         return $content . DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($gameReward->expirationDateTime);
     }
 }
 public function testRun()
 {
     $quote = DatabaseCompatibilityUtil::getQuote();
     //Create 2 imports, and set one with a date over a week ago (8 days ago) for the modifiedDateTime
     $import = new Import();
     $serializedData['importRulesType'] = 'ImportModelTestItem';
     $import->serializedData = serialize($serializedData);
     $this->assertTrue($import->save());
     ImportTestHelper::createTempTableByFileNameAndTableName('importAnalyzerTest.csv', $import->getTempTableName(), true);
     $modifiedDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 60 * 60 * 24 * 8);
     $sql = "Update item set modifieddatetime = '" . $modifiedDateTime . "' where id = " . $import->getClassId('Item');
     ZurmoRedBean::exec($sql);
     $staleImportId = $import->id;
     $import2 = new Import();
     $serializedData['importRulesType'] = 'ImportModelTestItem';
     $import2->serializedData = serialize($serializedData);
     $this->assertTrue($import2->save());
     ImportTestHelper::createTempTableByFileNameAndTableName('importAnalyzerTest.csv', $import2->getTempTableName(), true);
     $this->assertEquals(2, Import::getCount());
     $tableExists = ZurmoRedBean::$writer->doesTableExist($import->getTempTableName());
     $this->assertTrue($tableExists);
     $job = new ImportCleanupJob();
     $this->assertTrue($job->run());
     $tableExists = ZurmoRedBean::$writer->doesTableExist($import->getTempTableName());
     $this->assertFalse($tableExists);
     $imports = Import::getAll();
     $this->assertEquals(1, count($imports));
     $this->assertEquals($import2->id, $imports[0]->id);
 }
Esempio n. 5
0
 /**
  * Renders and returns string content of summary content for the given model.
  * @param RedBeanModel $model
  * @param mixed $redirectUrl
  * @param string $ownedByFilter
  * @param string $viewModuleClassName
  * @return string content
  */
 public static function renderItemAndCommentsContent(SocialItem $model, $redirectUrl, $renderToUserString)
 {
     assert('is_string($redirectUrl) || $redirectUrl == null');
     $userUrl = Yii::app()->createUrl('/users/default/details', array('id' => $model->owner->id));
     $content = '<div class="social-item">';
     $avatarImage = $model->owner->getAvatarImage(50);
     $content .= '<div class="comment model-details-summary clearfix">';
     $content .= '<span class="user-details">' . ZurmoHtml::link($avatarImage, $userUrl);
     $content .= '</span>';
     $userLink = ZurmoHtml::link(strval($model->owner), $userUrl, array('class' => 'user-link'));
     $content .= '<div class="comment-content"><p>';
     if ($model->toUser->id > 0 && $renderToUserString) {
         $toUserUrl = Yii::app()->createUrl('/users/default/details', array('id' => $model->toUser->id));
         $toUserLink = ZurmoHtml::link(strval($model->toUser), $toUserUrl, array('class' => 'user-link'));
         $content .= Zurmo::t('SocialItemsModule', '{postedFromUser} to {postedToUser}', array('{postedFromUser}' => $userLink, '{postedToUser}' => $toUserLink));
     } else {
         $content .= $userLink;
     }
     $content .= '</p>';
     $content .= self::renderModelDescription($model) . '</div>';
     $content .= self::renderAfterDescriptionContent($model);
     $content .= self::renderItemFileContent($model);
     $content .= '<span class="comment-details"><strong>' . DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($model->createdDateTime, 'long', null) . '</strong>';
     if ($model->canUserDelete(Yii::app()->user->userModel)) {
         $content .= ' · <span class="delete-comment">' . self::renderDeleteLinkContent($model) . '</span></span>';
     }
     $content .= '</div>';
     $content .= self::renderCommentsContent($model);
     $content .= self::renderCreateCommentContent($model);
     $content .= '</div>';
     self::registerListColumnScripts();
     return $content;
 }
 /**
  * @return array
  */
 protected function makeCombinedData()
 {
     $combinedRows = array();
     $groupBy = $this->resolveGroupBy('EmailMessage', 'sentDateTime');
     $beginDateTime = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($this->beginDate);
     $endDateTime = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($this->endDate);
     if ($this->marketingList == null) {
         $searchAttributeData = static::makeCampaignsSearchAttributeData('sentDateTime', $beginDateTime, $endDateTime, $this->campaign);
         $sql = static::makeCampaignsSqlQuery($searchAttributeData, $groupBy);
         $rows = R::getAll($sql);
         foreach ($rows as $row) {
             $chartIndexToCompare = $row[$this->resolveIndexGroupByToUse()];
             $combinedRows[$chartIndexToCompare] = $row;
         }
     }
     if ($this->campaign == null) {
         $searchAttributeData = static::makeAutorespondersSearchAttributeData('sentDateTime', $beginDateTime, $endDateTime, $this->marketingList);
         $sql = static::makeAutorespondersSqlQuery($searchAttributeData, $groupBy);
         $rows = R::getAll($sql);
         foreach ($rows as $row) {
             $chartIndexToCompare = $row[$this->resolveIndexGroupByToUse()];
             if (!isset($combinedRows[$chartIndexToCompare])) {
                 $combinedRows[$chartIndexToCompare] = $row;
             } else {
                 $combinedRows[$chartIndexToCompare][self::COUNT] += $row[self::COUNT];
                 $combinedRows[$chartIndexToCompare][self::UNIQUE_OPENS] += $row[self::UNIQUE_OPENS];
                 $combinedRows[$chartIndexToCompare][self::UNIQUE_CLICKS] += $row[self::UNIQUE_CLICKS];
             }
         }
     }
     return $combinedRows;
 }
 public function testRun()
 {
     $quote = DatabaseCompatibilityUtil::getQuote();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_SENT);
     //Create 2 sent notifications, and set one with a date over a week ago (8 days ago) for the modifiedDateTime
     $emailMessage = EmailMessageTestHelper::createDraftSystemEmail('My Email Message', $super);
     $emailMessage->folder = $folder;
     $saved = $emailMessage->save();
     $this->assertTrue($saved);
     $modifiedDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 60 * 60 * 24 * 8);
     $sql = "Update item set modifieddatetime = '" . $modifiedDateTime . "' where id = " . $emailMessage->getClassId('Item');
     ZurmoRedBean::exec($sql);
     $emailMessage2 = EmailMessageTestHelper::createDraftSystemEmail('My Email Message 2', $super);
     $emailMessage2->folder = $folder;
     $saved = $emailMessage2->save();
     $this->assertTrue($saved);
     $this->assertEquals(2, EmailMessage::getCount());
     $job = new ClearSentNotificationsEmailJob();
     $this->assertTrue($job->run());
     $emailMessages = EmailMessage::getAll();
     $this->assertEquals(1, count($emailMessages));
     $this->assertEquals($emailMessage2->id, $emailMessages[0]->id);
 }
Esempio n. 8
0
 public static function getCommonTimeScope()
 {
     static $timeScope = array();
     if (empty($timeScope)) {
         $time = EnvUtil::getRequest("time");
         $start = EnvUtil::getRequest("start");
         $end = EnvUtil::getRequest("end");
         if (!empty($time)) {
             if (!in_array($time, array("thisweek", "lastweek", "thismonth", "lastmonth"))) {
                 $time = "thisweek";
             }
         } else {
             if (!empty($start) && !empty($end)) {
                 $start = strtotime($start);
                 $end = strtotime($end);
                 if ($start && $end) {
                     $timeScope = array("timestr" => "custom", "start" => $start, "end" => $end);
                 }
             } else {
                 $time = "thisweek";
             }
         }
         if (empty($timeScope)) {
             $timeScope = DateTimeUtil::getStrTimeScope($time);
             $timeScope["timestr"] = $time;
         }
     }
     return $timeScope;
 }
Esempio n. 9
0
 public function testSanitizePostByDesignerTypeForSavingModel()
 {
     $language = Yii::app()->getLanguage();
     $this->assertEquals($language, 'en');
     $postData = array('aDate' => '5/4/11', 'aDateTime' => '5/4/11 5:45 PM');
     $sanitizedPostData = PostUtil::sanitizePostByDesignerTypeForSavingModel(new DateDateTime(), $postData);
     $compareData = array('aDate' => '2011-05-04', 'aDateTime' => DateTimeUtil::convertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero('5/4/11 5:45 PM'));
     $this->assertEquals($compareData, $sanitizedPostData);
     $this->assertTrue(is_string($compareData['aDateTime']));
     //now do German (de) to check a different locale.
     Yii::app()->setLanguage('de');
     $postData = array('aDate' => '04.05.11', 'aDateTime' => '04.05.11 17:45');
     $sanitizedPostData = PostUtil::sanitizePostByDesignerTypeForSavingModel(new DateDateTime(), $postData);
     $compareData = array('aDate' => '2011-05-04', 'aDateTime' => DateTimeUtil::convertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero('04.05.11 17:45'));
     $this->assertEquals($compareData, $sanitizedPostData);
     $this->assertTrue(is_string($compareData['aDateTime']));
     //reset language back to english
     Yii::app()->setLanguage('en');
     //test sanitizing a bad datetime
     $sanitizedPostData = PostUtil::sanitizePostByDesignerTypeForSavingModel(new DateDateTime(), array('aDateTime' => 'wang chung'));
     $this->assertNull($sanitizedPostData['aDateTime']);
     //sanitize an empty datetime
     $sanitizedPostData = PostUtil::sanitizePostByDesignerTypeForSavingModel(new DateDateTime(), array('aDateTime' => ''));
     $this->assertEmpty($sanitizedPostData['aDateTime']);
 }
Esempio n. 10
0
 public function testRun()
 {
     //Create 2 jobLogs, and set one with a date over a week ago (8 days ago) for the endDateTime
     $eightDaysAgoTimestamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 60 * 60 * 24 * 8);
     $jobLog = new JobLog();
     $jobLog->type = 'Monitor';
     $jobLog->startDateTime = $eightDaysAgoTimestamp;
     $jobLog->endDateTime = $eightDaysAgoTimestamp;
     $jobLog->status = JobLog::STATUS_COMPLETE_WITHOUT_ERROR;
     $jobLog->isProcessed = false;
     $jobLog->save();
     $jobLog2 = new JobLog();
     $jobLog2->type = 'ImportCleanup';
     $jobLog2->startDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
     $jobLog2->endDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
     $jobLog2->status = JobLog::STATUS_COMPLETE_WITHOUT_ERROR;
     $jobLog2->isProcessed = false;
     $jobLog2->save();
     $sql = 'select count(*) count from item';
     $row = R::getRow($sql);
     $this->assertEquals(4, $row['count']);
     $job = new JobLogCleanupJob();
     $this->assertTrue($job->run());
     $jobLogs = JobLog::getAll();
     $this->assertEquals(1, count($jobLogs));
     $this->assertEquals($jobLog2->id, $jobLogs[0]->id);
     $sql = 'select count(*) count from item';
     $row = R::getRow($sql);
     $this->assertEquals(3, $row['count']);
 }
 /**
  * Sanitize post data, specifically handling any date and date time conversions from local format to the
  * database format.
  * @param string $importRulesType
  * @param array $postMappingData
  */
 public static function sanitizePostByTypeForSavingMappingData($importRulesType, $postMappingData)
 {
     assert('is_string($importRulesType)');
     assert('is_array($postMappingData)');
     foreach ($postMappingData as $columnName => $mappingData) {
         if (!isset($mappingData['mappingRulesData'])) {
             $postMappingData[$columnName]['mappingRulesData'] = array();
         }
     }
     foreach ($postMappingData as $columnName => $mappingData) {
         foreach ($mappingData['mappingRulesData'] as $mappingRuleFormClassName => $mappingRuleFormData) {
             $model = MappingRuleFormAndElementTypeUtil::makeForm($importRulesType, $mappingData['attributeIndexOrDerivedType'], $mappingRuleFormClassName);
             foreach ($mappingRuleFormData as $attributeName => $value) {
                 if ($value !== null) {
                     if (!is_array($value)) {
                         if ($model->isAttribute($attributeName) && $model->isAttributeSafe($attributeName)) {
                             $type = ModelAttributeToMixedTypeUtil::getTypeByModelUsingValidator($model, $model::getAttributeName());
                             if ($type == 'Date') {
                                 $postMappingData[$columnName]['mappingRulesData'][$mappingRuleFormClassName][$attributeName] = DateTimeUtil::resolveValueForDateDBFormatted($value);
                             }
                             if ($type == 'DateTime' && !empty($value)) {
                                 $postMappingData[$columnName]['mappingRulesData'][$mappingRuleFormClassName][$attributeName] = DateTimeUtil::convertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero($value);
                             }
                         }
                     }
                 }
             }
         }
     }
     return $postMappingData;
 }
 public function testProcessAfterSaveWhenSendIsInFuture()
 {
     $this->assertEquals(0, WorkflowMessageInQueue::getCount());
     $workflow = new Workflow();
     $workflow->setId(self::$savedWorkflow->id);
     $workflow->type = Workflow::TYPE_ON_SAVE;
     $emailMessageForm = new EmailMessageForWorkflowForm('WorkflowModelTestItem', Workflow::TYPE_ON_SAVE);
     $emailMessageForm->sendAfterDurationInterval = 1;
     $emailMessageForm->sendAfterDurationType = TimeDurationUtil::DURATION_TYPE_DAY;
     $recipients = array(array('type' => WorkflowEmailMessageRecipientForm::TYPE_DYNAMIC_TRIGGERED_MODEL_USER, 'audienceType' => EmailMessageRecipient::TYPE_TO, 'dynamicUserType' => DynamicTriggeredModelUserWorkflowEmailMessageRecipientForm::DYNAMIC_USER_TYPE_CREATED_BY_USER));
     $emailMessageForm->setAttributes(array(EmailMessageForWorkflowForm::EMAIL_MESSAGE_RECIPIENTS => $recipients));
     $workflow->addEmailMessage($emailMessageForm);
     $model = new WorkflowModelTestItem();
     $model->lastName = 'lastName';
     $model->string = 'string';
     $this->assertTrue($model->save());
     $compareDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 86400);
     WorkflowEmailMessagesUtil::processAfterSave($workflow, $model, Yii::app()->user->userModel);
     $workflowMessageInQueues = WorkflowMessageInQueue::getAll();
     $this->assertEquals(1, count($workflowMessageInQueues));
     $this->assertTrue($workflowMessageInQueues[0]->savedWorkflow->isSame(self::$savedWorkflow));
     $this->assertTrue($workflowMessageInQueues[0]->triggeredByUser->isSame(Yii::app()->user->userModel));
     $this->assertEquals($model->getClassId('Item'), $workflowMessageInQueues[0]->modelItem->getClassId('Item'));
     $this->assertEquals('WorkflowModelTestItem', $workflowMessageInQueues[0]->modelClassName);
     $this->assertEquals($compareDateTime, $workflowMessageInQueues[0]->processDateTime);
     $emailMessageData = SavedWorkflowToWorkflowAdapter::makeArrayFromEmailMessageForWorkflowFormAttributesData(array($emailMessageForm));
     $this->assertEquals(serialize($emailMessageData), $workflowMessageInQueues[0]->serializedData);
     $this->assertTrue($workflowMessageInQueues[0]->delete());
 }
 public static function resolveAndSaveEmailMessage($textContent, $htmlContent, Item $itemOwnerModel, Contact $contact, MarketingList $marketingList, $itemId, $folderId)
 {
     $recipient = static::resolveRecipient($contact);
     if (empty($recipient)) {
         throw new MissingRecipientsForEmailMessageException();
     }
     $userId = static::resolveCurrentUserId();
     if (get_class($itemOwnerModel) == 'Campaign') {
         $ownerId = $itemOwnerModel->owner->id;
     } else {
         $ownerId = $marketingList->owner->id;
     }
     $subject = $itemOwnerModel->subject;
     $serializedData = serialize($subject);
     $headers = static::resolveHeaders($itemId);
     $nowTimestamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
     $emailMessageData = compact('subject', 'serializedData', 'textContent', 'htmlContent', 'userId', 'ownerId', 'headers', 'attachments', 'folderId', 'nowTimestamp');
     $attachments = array('relatedModelType' => strtolower(get_class($itemOwnerModel)), 'relatedModelId' => $itemOwnerModel->id);
     $sender = static::resolveSender($marketingList, $itemOwnerModel);
     $emailMessageData = CMap::mergeArray($emailMessageData, $sender, $recipient, $attachments);
     $emailMessageId = static::saveEmailMessageWithRelated($emailMessageData);
     if (empty($emailMessageId)) {
         throw new FailedToSaveModelException();
     }
     $emailMessage = EmailMessage::getById($emailMessageId);
     return $emailMessage;
 }
 public function testSanitizePostByTypeForSavingMappingData()
 {
     $language = Yii::app()->getLanguage();
     $this->assertEquals($language, 'en');
     $postData = array('column_0' => array('attributeIndexOrDerivedType' => 'date', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => '5/4/2011'))), 'column_1' => array('attributeIndexOrDerivedType' => 'dateTime', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => '5/4/2011 5:45 PM'))));
     $sanitizedPostData = ImportWizardFormPostUtil::sanitizePostByTypeForSavingMappingData('ImportModelTestItem', $postData);
     $compareDateTime = DateTimeUtil::convertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero('5/4/2011 5:45 PM');
     $compareData = array('column_0' => array('attributeIndexOrDerivedType' => 'date', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => '2011-05-04'))), 'column_1' => array('attributeIndexOrDerivedType' => 'dateTime', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => $compareDateTime))));
     $this->assertEquals($compareData, $sanitizedPostData);
     //now do German (de) to check a different locale.
     Yii::app()->setLanguage('de');
     $postData = array('column_0' => array('attributeIndexOrDerivedType' => 'date', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => '04.05.2011'))), 'column_1' => array('attributeIndexOrDerivedType' => 'dateTime', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => '04.05.2011 17:45'))));
     $sanitizedPostData = ImportWizardFormPostUtil::sanitizePostByTypeForSavingMappingData('ImportModelTestItem', $postData);
     $compareDateTime = DateTimeUtil::convertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero('04.05.2011 17:45');
     $compareData = array('column_0' => array('attributeIndexOrDerivedType' => 'date', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => '2011-05-04'))), 'column_1' => array('attributeIndexOrDerivedType' => 'dateTime', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => $compareDateTime))));
     $this->assertEquals($compareData, $sanitizedPostData);
     //reset language back to english
     Yii::app()->setLanguage('en');
     //test sanitizing a bad datetime
     $postData = array('column_0' => array('attributeIndexOrDerivedType' => 'dateTime', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => 'wang chung'))));
     $sanitizedPostData = ImportWizardFormPostUtil::sanitizePostByTypeForSavingMappingData('ImportModelTestItem', $postData);
     $this->assertNull($sanitizedPostData['column_0']['mappingRulesData']['DefaultValueModelAttributeMappingRuleForm']['defaultValue']);
     //sanitize an empty datetime
     $postData = array('column_0' => array('attributeIndexOrDerivedType' => 'dateTime', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => ''))));
     $sanitizedPostData = ImportWizardFormPostUtil::sanitizePostByTypeForSavingMappingData('ImportModelTestItem', $postData);
     $this->assertEmpty($sanitizedPostData['column_0']['mappingRulesData']['DefaultValueModelAttributeMappingRuleForm']['defaultValue']);
 }
Esempio n. 15
0
 public function testCreateAndGetMissionById()
 {
     $super = User::getByUsername('super');
     $fileModel = ZurmoTestHelper::createFileModel();
     $steven = UserTestHelper::createBasicUser('steven');
     $dueStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 10000);
     $mission = new Mission();
     $mission->owner = $super;
     $mission->takenByUser = $steven;
     $mission->dueDateTime = $dueStamp;
     $mission->description = 'My test description';
     $mission->reward = 'My test reward';
     $mission->status = Mission::STATUS_AVAILABLE;
     $mission->files->add($fileModel);
     $mission->addPermissions(Group::getByName(Group::EVERYONE_GROUP_NAME), Permission::READ_WRITE);
     $this->assertTrue($mission->save());
     $id = $mission->id;
     $mission->forget();
     unset($mission);
     $mission = Mission::getById($id);
     $this->assertEquals('My test description', $mission->description);
     $this->assertEquals('My test reward', $mission->reward);
     $this->assertEquals(Mission::STATUS_AVAILABLE, $mission->status);
     $this->assertEquals($super, $mission->owner);
     $this->assertEquals($steven, $mission->takenByUser);
     $this->assertEquals(1, $mission->files->count());
     $this->assertEquals($fileModel, $mission->files->offsetGet(0));
     $this->assertEquals($dueStamp, $mission->dueDateTime);
     $this->assertTrue(MissionsUtil::hasUserReadMissionLatest($mission, $super));
     $this->assertFalse(MissionsUtil::hasUserReadMissionLatest($mission, $steven));
 }
 /**
  * Runs a query to get all the dates for meetings based on SearchAttributeData.  Then the data is processed
  * and @returns a data array of dates and quantity.  Quantity stands for how many meetings in a given date.
  * (non-PHPdoc)
  * @see CalendarDataProvider::getData()
  */
 public function getData()
 {
     $sql = $this->makeSqlQuery();
     $rows = ZurmoRedBean::getAll($sql);
     $data = array();
     foreach ($rows as $row) {
         $localTimeZoneAdjustedDate = DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($row['startdatetime'], 'medium', null);
         if (isset($data[$localTimeZoneAdjustedDate])) {
             $data[$localTimeZoneAdjustedDate]['quantity'] = $data[$localTimeZoneAdjustedDate]['quantity'] + 1;
         } else {
             $data[$localTimeZoneAdjustedDate] = array('date' => $localTimeZoneAdjustedDate, 'quantity' => 1, 'dbDate' => $row['startdatetime']);
         }
     }
     foreach ($data as $key => $item) {
         if ($item['quantity'] == 1) {
             $label = Zurmo::t('MeetingsModule', '{quantity} MeetingsModuleSingularLabel', array_merge(LabelUtil::getTranslationParamsForAllModules(), array('{quantity}' => $item['quantity'])));
         } else {
             $label = Zurmo::t('MeetingsModule', '{quantity} MeetingsModulePluralLabel', array_merge(LabelUtil::getTranslationParamsForAllModules(), array('{quantity}' => $item['quantity'])));
         }
         $data[$key]['label'] = $label;
         if ($item['quantity'] > 5) {
             $quantityClassSuffix = 6;
         } else {
             $quantityClassSuffix = $item['quantity'];
         }
         $data[$key]['className'] = 'calendar-events-' . $quantityClassSuffix;
     }
     return $data;
 }
Esempio n. 17
0
 public function handleInitEnvironment($event)
 {
     Ibos::app()->performance->startClock();
     Ibos::app()->performance->startMemoryUsageMarker();
     define("STATICURL", Ibos::app()->assetManager->getBaseUrl());
     define("IN_MOBILE", EnvUtil::checkInMobile());
     define("IN_DASHBOARD", EnvUtil::checkInDashboard());
     define("TIMESTAMP", time());
     define("IN_APP", EnvUtil::checkInApp());
     $this->setTimezone();
     if (function_exists("ini_get")) {
         $memorylimit = @ini_get("memory_limit");
         if ($memorylimit && ConvertUtil::ConvertBytes($memorylimit) < 33554432 && function_exists("ini_set")) {
             ini_set("memory_limit", "128m");
         }
     }
     $global = array("timestamp" => TIMESTAMP, "version" => VERSION, "clientip" => EnvUtil::getClientIp(), "referer" => "", "charset" => CHARSET, "authkey" => "", "newversion" => 0, "config" => array(), "setting" => array(), "user" => array(), "cookie" => array(), "session" => array(), "lunar" => DateTimeUtil::getlunarCalendar(), "title" => MainUtil::getIncentiveWord(), "staticurl" => STATICURL);
     $global["phpself"] = $this->getScriptUrl();
     $sitePath = substr($global["phpself"], 0, strrpos($global["phpself"], "/"));
     $global["isHTTPS"] = isset($_SERVER["HTTPS"]) && strtolower($_SERVER["HTTPS"]) != "off" ? true : false;
     $global["siteurl"] = StringUtil::ihtmlSpecialChars("http" . ($global["isHTTPS"] ? "s" : "") . "://" . $_SERVER["HTTP_HOST"] . $sitePath . "/");
     $url = parse_url($global["siteurl"]);
     $global["siteroot"] = isset($url["path"]) ? $url["path"] : "";
     $global["siteport"] = empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] == "80" || $_SERVER["SERVER_PORT"] == "443" ? "" : ":" . $_SERVER["SERVER_PORT"];
     $config = @(include PATH_ROOT . "/system/config/config.php");
     if (empty($config)) {
         throw new NotFoundException(Ibos::Lang("Config not found", "error"));
     } else {
         $global["config"] = $config;
     }
     Ibos::app()->setting->copyFrom($global);
 }
 public function testGetSearchAttributesDataByModelClassNamesAndRelatedItemIds()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $modelClassNames = array('Meeting', 'Task', 'Note');
     $relationItemIds = array(5, 7, 9);
     $searchAttributesData = LatestActivitiesUtil::getSearchAttributesDataByModelClassNamesAndRelatedItemIds($modelClassNames, $relationItemIds, LatestActivitiesConfigurationForm::OWNED_BY_FILTER_ALL);
     $compareSearchAttributesData = array();
     $compareSearchAttributesData['Meeting']['clauses'] = array(1 => array('attributeName' => 'activityItems', 'relatedAttributeName' => 'id', 'operatorType' => 'oneOf', 'value' => array(5, 7, 9)), 2 => array('attributeName' => 'startDateTime', 'operatorType' => 'lessThan', 'value' => DateTimeUtil::convertTimestampToDbFormatDateTime(time())), 3 => array('attributeName' => 'logged', 'operatorType' => 'equals', 'value' => true));
     $compareSearchAttributesData['Meeting']['structure'] = '1 and (2 or 3)';
     $compareSearchAttributesData['Task']['clauses'] = array(1 => array('attributeName' => 'activityItems', 'relatedAttributeName' => 'id', 'operatorType' => 'oneOf', 'value' => array(5, 7, 9)), 2 => array('attributeName' => 'completed', 'operatorType' => 'equals', 'value' => (bool) 1));
     $compareSearchAttributesData['Task']['structure'] = '1 and 2';
     $compareSearchAttributesData['Note']['clauses'] = array(1 => array('attributeName' => 'activityItems', 'relatedAttributeName' => 'id', 'operatorType' => 'oneOf', 'value' => array(5, 7, 9)));
     $compareSearchAttributesData['Note']['structure'] = '1';
     $this->assertEquals($compareSearchAttributesData['Meeting'], $searchAttributesData[0]['Meeting']);
     $this->assertEquals($compareSearchAttributesData['Task'], $searchAttributesData[1]['Task']);
     $this->assertEquals($compareSearchAttributesData['Note'], $searchAttributesData[2]['Note']);
     $searchAttributesData = LatestActivitiesUtil::getSearchAttributesDataByModelClassNamesAndRelatedItemIds($modelClassNames, $relationItemIds, LatestActivitiesConfigurationForm::OWNED_BY_FILTER_USER);
     $compareSearchAttributesData['Meeting']['structure'] = '1 and (2 or 3) and 4';
     $compareSearchAttributesData['Meeting']['clauses'][4] = array('attributeName' => 'owner', 'operatorType' => 'equals', 'value' => Yii::app()->user->userModel->id);
     $compareSearchAttributesData['Task']['structure'] = '1 and 2 and 3';
     $compareSearchAttributesData['Task']['clauses'][3] = array('attributeName' => 'owner', 'operatorType' => 'equals', 'value' => Yii::app()->user->userModel->id);
     $compareSearchAttributesData['Note']['structure'] = '1 and 2';
     $compareSearchAttributesData['Note']['clauses'][2] = array('attributeName' => 'owner', 'operatorType' => 'equals', 'value' => Yii::app()->user->userModel->id);
     $this->assertEquals($compareSearchAttributesData['Meeting'], $searchAttributesData[0]['Meeting']);
     $this->assertEquals($compareSearchAttributesData['Task'], $searchAttributesData[1]['Task']);
     $this->assertEquals($compareSearchAttributesData['Note'], $searchAttributesData[2]['Note']);
 }
 /**
  * Deletes all job logs where the modifiedDateTime was more than 1 week ago.
  * Runs operation in bulk to improve performance when large jobLogs are present.
  *
  * @see BaseJob::run()
  */
 public function run()
 {
     $oneWeekAgoTimeStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 60 * 60 * 24 * 7);
     $sql = 'DELETE from item, joblog using joblog inner join item on ' . 'item.id = joblog.item_id where joblog.enddatetime <= "' . $oneWeekAgoTimeStamp . '"';
     ZurmoRedBean::exec($sql);
     return true;
 }
 /**
  * @return array
  */
 protected function makeCombinedData()
 {
     $combinedRows = array();
     //todo: should fix and get proper table name of attribute instead of passing in item
     $groupBy = $this->resolveGroupBy('EmailMessage', 'sentDateTime');
     $beginDateTime = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($this->beginDate);
     $endDateTime = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($this->endDate);
     if ($this->marketingList == null) {
         $searchAttributeData = static::makeCampaignsSearchAttributeData('createdDateTime', $beginDateTime, $endDateTime, $this->campaign);
         $sql = static::makeCampaignsSqlQuery($searchAttributeData, $groupBy);
         $rows = ZurmoRedBean::getAll($sql);
         foreach ($rows as $row) {
             $this->addNewRowToCombinedRows($row, $combinedRows);
         }
     }
     if ($this->campaign == null) {
         $searchAttributeData = static::makeAutorespondersSearchAttributeData('createdDateTime', $beginDateTime, $endDateTime, $this->marketingList);
         $sql = static::makeAutorespondersSqlQuery($searchAttributeData, $groupBy);
         $rows = ZurmoRedBean::getAll($sql);
         foreach ($rows as $row) {
             $this->addNewRowToCombinedRows($row, $combinedRows);
         }
     }
     return $combinedRows;
 }
Esempio n. 21
0
 /**
  * @param Meeting $meeting
  * @param string $link
  * @return string
  */
 public static function renderDaySummaryContent(Meeting $meeting, $link)
 {
     $content = null;
     $content .= '<h3>' . $meeting->name . '<span>' . $link . '</span></h3>';
     $content .= DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($meeting->startDateTime);
     $localEndDateTime = DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($meeting->endDateTime);
     if ($localEndDateTime != null) {
         $content .= ' - ' . $localEndDateTime;
     }
     $content .= '<br/>';
     $content .= self::renderActivityItemsContentsExcludingContacts($meeting);
     if (count($meeting->activityItems) > 0) {
         $contactsContent = null;
         $contactLabels = self::getExistingContactRelationsLabels($meeting->activityItems);
         foreach ($contactLabels as $label) {
             if ($contactsContent != null) {
                 $contactsContent .= ', ';
             }
             $contactsContent .= $label;
         }
         $content .= $contactsContent . '<br/>';
     }
     if ($meeting->description != null) {
         $content .= '<br/>';
         $content .= Zurmo::t('MeetingsModule', 'Description') . ':<br/>';
         $content .= $meeting->description;
     }
     return $content;
 }
Esempio n. 22
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);
 }
Esempio n. 23
0
 /**
  * Renders the attribute from the model.
  * @return The element's content.
  */
 protected function renderControlNonEditable()
 {
     if ($this->model->{$this->attribute} != null) {
         $content = DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($this->model->{$this->attribute});
         return ZurmoHtml::encode($content);
     }
 }
Esempio n. 24
0
 public function testCreateAndGetMissionById()
 {
     $super = User::getByUsername('super');
     $fileModel = ZurmoTestHelper::createFileModel();
     $steven = UserTestHelper::createBasicUserWithEmailAddress('steven');
     $steven->setRight('MissionsModule', MissionsModule::RIGHT_ACCESS_MISSIONS);
     $steven->save();
     $dueStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 10000);
     $mission = new Mission();
     $mission->owner = $super;
     $mission->takenByUser = $steven;
     $mission->dueDateTime = $dueStamp;
     $mission->description = 'My test description';
     $mission->reward = 'My test reward';
     $mission->status = Mission::STATUS_AVAILABLE;
     $mission->files->add($fileModel);
     $everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
     $mission->addPermissions($everyoneGroup, Permission::READ_WRITE);
     $this->assertTrue($mission->save());
     AllPermissionsOptimizationUtil::securableItemGivenPermissionsForGroup($mission, $everyoneGroup);
     $id = $mission->id;
     $mission->forget();
     unset($mission);
     $mission = Mission::getById($id);
     $this->assertEquals('My test description', $mission->description);
     $this->assertEquals('My test reward', $mission->reward);
     $this->assertEquals(Mission::STATUS_AVAILABLE, $mission->status);
     $this->assertEquals($super, $mission->owner);
     $this->assertEquals($steven, $mission->takenByUser);
     $this->assertEquals(1, $mission->files->count());
     $this->assertEquals($fileModel, $mission->files->offsetGet(0));
     $this->assertEquals($dueStamp, $mission->dueDateTime);
     $this->assertTrue(MissionsUtil::hasUserReadMissionLatest($mission, $super));
     $this->assertFalse(MissionsUtil::hasUserReadMissionLatest($mission, $steven));
 }
Esempio n. 25
0
 /**
  * @depends testPurifyHtmlAndModifyInputUsingArrayWalkRecursive
  */
 public function testSanitizeDataByDesignerTypeForSavingModel()
 {
     $data = array('firstName' => 'Steve', 'lastName' => 'Thunder<SCRIPT>alert(\'XSS\')</SCRIPT>', 'boolean' => '0', 'date' => '3/25/11', 'dateTime' => '04/05/11 5:00 AM', 'float' => '3.68', 'integer' => '10', 'phone' => '435655', 'string' => 'some string<SCRIPT>alert(\'XSS\')</SCRIPT>', 'textArea' => 'more text here<SCRIPT>alert(\'XSS\')</SCRIPT>', 'url' => 'http://www.zurmo.org', 'dropDown' => array('value' => 'test value<SCRIPT>alert(\'XSS\')</SCRIPT>'), 'radioDropDown' => array('value' => 'my value'), 'multiDropDown' => array('values' => array('multi1', 'multi2')), 'tagCloud' => array('values' => 'tag1,tag2<SCRIPT>alert(\'XSS\')</SCRIPT>'));
     $model = new TestDataUtilModel();
     $sanitizedData = DataUtil::sanitizeDataByDesignerTypeForSavingModel($model, $data);
     $compareData = array('firstName' => 'Steve', 'lastName' => 'Thunder', 'boolean' => '0', 'date' => DateTimeUtil::resolveValueForDateDBFormatted('3/25/11'), 'dateTime' => DateTimeUtil::convertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero('04/05/11 5:00 AM'), 'float' => '3.68', 'integer' => '10', 'phone' => '435655', 'string' => 'some string', 'textArea' => 'more text here', 'url' => 'http://www.zurmo.org', 'dropDown' => array('value' => 'test value'), 'radioDropDown' => array('value' => 'my value'), 'multiDropDown' => array('values' => array('multi1', 'multi2')), 'tagCloud' => array('values' => array('tag1', 'tag2')));
     $this->assertEquals($compareData, $sanitizedData);
 }
 /**
  * Renders string content for the conversation subject and either the description or latest conversation comment
  * if it exists.
  * @param Conversation $conversation
  * @return string
  */
 public static function renderSubjectAndLatestForDisplayView(Conversation $conversation)
 {
     $url = Yii::app()->createUrl('/conversations/default/details', array('id' => $conversation->id));
     $content = $conversation->subject;
     $details = ZurmoHtml::tag('span', array('class' => 'list-item-details'), DateTimeUtil::getTimeSinceDisplayContent($conversation->latestDateTime));
     $link = ZurmoHtml::link($content, $url);
     return $link . $details;
 }
 /**
  * @param null $stringTime
  * @return array
  */
 protected function makeSearchAttributeData($stringTime = null)
 {
     assert('is_string($stringTime) || $stringTime == null');
     $searchAttributeData = array();
     $searchAttributeData['clauses'] = array(1 => array('attributeName' => 'startDateTime', 'operatorType' => 'greaterThan', 'value' => DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay(DateTimeUtil::getFirstDayOfAMonthDate($stringTime))), 2 => array('attributeName' => 'startDateTime', 'operatorType' => 'lessThan', 'value' => DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay(DateTimeUtil::getLastDayOfAMonthDate($stringTime))), 3 => array('attributeName' => 'logged', 'operatorType' => 'doesNotEqual', 'value' => true), 4 => array('attributeName' => 'logged', 'operatorType' => 'isNull', 'value' => null), 5 => array('attributeName' => 'activityItems', 'relatedAttributeName' => 'id', 'operatorType' => 'equals', 'value' => (int) $this->params['relationModel']->getClassId('Item')));
     $searchAttributeData['structure'] = '(1 and 2 and (3 or 4) and 5)';
     return $searchAttributeData;
 }
Esempio n. 28
0
 protected function resolveDefaultOptions()
 {
     $this->options['showOn'] = 'both';
     $this->options['buttonText'] = ZurmoHtml::tag('span', array(), '<!--Date-->');
     $this->options['showButtonPanel'] = true;
     $this->options['buttonImageOnly'] = false;
     $this->options['dateFormat'] = YiiToJqueryUIDatePickerLocalization::resolveDateFormat(DateTimeUtil::getLocaleDateFormatForInput());
 }
Esempio n. 29
0
 public function testSimpleUserImportWhereAllRowsSucceed()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $tasks = Task::getAll();
     $this->assertEquals(0, count($tasks));
     $import = new Import();
     $serializedData['importRulesType'] = 'Tasks';
     $serializedData['firstRowIsHeaderRow'] = true;
     $import->serializedData = serialize($serializedData);
     $this->assertTrue($import->save());
     ImportTestHelper::createTempTableByFileNameAndTableName('simpleImportTest.csv', $import->getTempTableName(), Yii::getPathOfAlias('application.modules.tasks.tests.unit.files'));
     $this->assertEquals(4, ImportDatabaseUtil::getCount($import->getTempTableName()));
     // includes header rows.
     $mappingData = array('column_0' => ImportMappingUtil::makeStringColumnMappingData('name'), 'column_1' => ImportMappingUtil::makeDateTimeColumnMappingData('dueDateTime'), 'column_2' => ImportMappingUtil::makeDateTimeColumnMappingData('completedDateTime'), 'column_3' => ImportMappingUtil::makeBooleanColumnMappingData('completed'), 'column_4' => ImportMappingUtil::makeModelDerivedColumnMappingData('AccountDerived'), 'column_5' => ImportMappingUtil::makeModelDerivedColumnMappingData('ContactDerived'), 'column_6' => ImportMappingUtil::makeModelDerivedColumnMappingData('OpportunityDerived'), 'column_7' => ImportMappingUtil::makeTextAreaColumnMappingData('description'));
     $importRules = ImportRulesUtil::makeImportRulesByType('Tasks');
     $page = 0;
     $config = array('pagination' => array('pageSize' => 50));
     //This way all rows are processed.
     $dataProvider = new ImportDataProvider($import->getTempTableName(), true, $config);
     $dataProvider->getPagination()->setCurrentPage($page);
     $importResultsUtil = new ImportResultsUtil($import);
     $actionDateTime = substr(DateTimeUtil::convertTimestampToDbFormatDateTime(time()), 0, -3);
     $messageLogger = new ImportMessageLogger();
     ImportUtil::importByDataProvider($dataProvider, $importRules, $mappingData, $importResultsUtil, new ExplicitReadWriteModelPermissions(), $messageLogger);
     $importResultsUtil->processStatusAndMessagesForEachRow();
     //Confirm that 3 models where created.
     $tasks = Task::getAll();
     $this->assertEquals(3, count($tasks));
     $tasks = Task::getByName('task1');
     $this->assertEquals(1, count($tasks[0]));
     $this->assertEquals(1, count($tasks[0]->activityItems));
     $this->assertEquals('testAccount', $tasks[0]->activityItems[0]->name);
     $this->assertEquals('Account', get_class($tasks[0]->activityItems[0]));
     $this->assertNull($tasks[0]->completed);
     $this->assertEquals($actionDateTime, substr($tasks[0]->latestDateTime, 0, -3));
     $tasks = Task::getByName('task2');
     $this->assertEquals(1, count($tasks[0]));
     $this->assertEquals(1, count($tasks[0]->activityItems));
     $this->assertEquals('testContact', $tasks[0]->activityItems[0]->firstName);
     $this->assertEquals('Contact', get_class($tasks[0]->activityItems[0]));
     $this->assertEquals(1, $tasks[0]->completed);
     $this->assertEquals('2011-12-22 06:03', substr($tasks[0]->latestDateTime, 0, -3));
     $tasks = Task::getByName('task3');
     $this->assertEquals(1, count($tasks[0]));
     $this->assertEquals(1, count($tasks[0]->activityItems));
     $this->assertEquals('testOpportunity', $tasks[0]->activityItems[0]->name);
     $this->assertEquals('Opportunity', get_class($tasks[0]->activityItems[0]));
     $this->assertNull($tasks[0]->completed);
     $this->assertEquals($actionDateTime, substr($tasks[0]->latestDateTime, 0, -3));
     //Confirm 10 rows were processed as 'created'.
     $this->assertEquals(3, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::CREATED));
     //Confirm that 0 rows were processed as 'updated'.
     $this->assertEquals(0, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::UPDATED));
     //Confirm 2 rows were processed as 'errors'.
     $this->assertEquals(0, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::ERROR));
     $beansWithErrors = ImportDatabaseUtil::getSubset($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::ERROR);
     $this->assertEquals(0, count($beansWithErrors));
 }
 protected function renderDescriptionContent()
 {
     $innerContent = '<b>' . $this->model->getAttributeLabel('sendOnDateTime') . ':</b> ';
     $innerContent .= DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($this->model->sendOnDateTime);
     $innerContent .= "</BR><b>" . $this->model->getAttributeLabel('subject') . ':</b> ';
     $innerContent .= $this->model->subject;
     $content = ZurmoHtml::tag('div', array('class' => static::DESCRIPTION_CLASS), $innerContent);
     return $content;
 }