public function testArchiveForEvent_OtherEventsUnaffected() { $ev1 = $this->createEvent(); $ev1_em1 = $this->createEmail($ev1); $ev1_em2 = $this->createEmail($ev1); $ev2 = $this->createEvent(); $ev2_em1 = $this->createEmail($ev2); $ev2_em2 = $this->createEmail($ev2); OphCoTherapyapplication_Email::model()->archiveForEvent($ev1); $ev2_em1->refresh(); $ev2_em2->refresh(); $this->assertEquals(0, $ev2_em1->archived); $this->assertEquals(0, $ev2_em2->archived); }
/** * Appends information about the submission of the application to the $record. * * @param array $record * @param int $event_id */ protected function appendSubmissionValues(&$record, $event_id) { if (@$_GET['submission']) { $event = Event::model()->findByPk($event_id); $svc = new OphCoTherapyapplication_Processor($event); $record['submission_status'] = $svc->getApplicationStatus(); if ($record['submission_status'] == OphCoTherapyapplication_Processor::STATUS_SENT) { $most_recent = OphCoTherapyapplication_Email::model()->forEvent($event)->unarchived()->findAll(array('limit' => 1)); $record['submission_date'] = Helper::convertDate2NHS($most_recent[0]->created_date); } else { $record['submission_date'] = 'N/A'; } } }
/** * @return OphCoTherapyapplication_Email[] */ public function getRightSentEmails() { return OphCoTherapyapplication_Email::model()->forEvent($this->event)->rightEye()->findAll(); }
/** * After an update, mark any existing emails as archived. */ protected function afterUpdateElements($event) { OphCoTherapyapplication_Email::model()->archiveForEvent($event); }