Exemplo n.º 1
0
 /**
  * Resends the TAT invitation email to the reference subject.
  *
  * @param string $enquiryId
  * Identifies the reference. Can be either the IRN or the ERN.
  *
  * @return boolean
  * Returns true on success, false otherwise.
  */
 public function resendTatInvitation($enquiryId)
 {
     $returnVal = false;
     $tatManager = new Manager_Referencing_Tat($enquiryId);
     if ($tatManager->isTatApplicable()) {
         //Does not check if initial invitation has been sent.
         $tatMailManager = new Manager_Referencing_TatMail($tatManager->_reference);
         if ($tatMailManager->sendTatInvitation()) {
             $returnVal = true;
         }
     }
     return $returnVal;
 }
 /**
  * Helper function for generating email attachment HTML fragment
  *
  * @param Model_Referencing_Reference
  * Encapsulates details of the reference.
  *
  * @return string
  */
 public function uploadEmailAttachments($reference)
 {
     $pageSession = new Zend_Session_Namespace('tenants_referencing_tracker');
     $tatMailManager = new Manager_Referencing_TatMail($reference);
     $attachments = $tatMailManager->detailAttachments();
     // Filter out names from complete paths and make HTML safe, and add up total file size
     $fileNames = array();
     $totalSize = 0;
     foreach ($attachments as $file => $size) {
         $fileNames[] = htmlentities(substr($file, strrpos($file, '/') + 1));
         $totalSize += $size;
     }
     // Return partial view HTML
     return $this->view->partial('tenants-referencing-tracker/partials/upload-email-attachments.phtml', array('totalSize' => $totalSize, 'maxSize' => 4194304, 'attachments' => $fileNames));
 }
 /**
  * Send e-mail to HomeLet screen
  *
  * @return void
  */
 public function emailAction()
 {
     if ($this->_enquiryId == null) {
         return;
     }
     $pageForm = new Form_TenantsReferencingTracker_Email();
     $request = $this->getRequest();
     $formData = $request->getPost();
     $pageForm->populate($formData);
     $tatManager = new Manager_Referencing_Tat($this->_enquiryId);
     $tat = $tatManager->getTat();
     $tatMailManager = new Manager_Referencing_TatMail($tatManager->_reference);
     if ($request->isPost()) {
         // Check if user's going back to the TAT index, or is submitting the form
         if (isset($formData['back'])) {
             // Redirect to index page
             $this->_helper->redirector->gotoUrl('/tenants/reference-tracker');
             return;
         } else {
             // Check if this is to add/remove attachments, or is a full submit
             // TODO: It'd be nice to handle this by separating it out into a smooth non-page-refreshing AJAX method
             if (isset($formData['attachButton']) || isset($formData['deleteButton'])) {
                 // Handle attachments
                 if (isset($formData['attachButton'])) {
                     $tatMailManager->addAttachments();
                 } else {
                     $tatMailManager->deleteAttachments();
                 }
             } else {
                 if ($pageForm->isValid($formData)) {
                     // Successful set of data, send e-mail and show message to user
                     $data = $pageForm->getValues();
                     $content = '';
                     $content .= "Enquiry ID: {$this->_enquiryId}\r\n\r\n";
                     $content .= "Name: {$data['name']}\r\n\r\n";
                     $content .= "Contact number or e-mail address: {$data['contact_info']}\r\n\r\n";
                     $content .= "Message to assessor:\r\n{$data['message']}\r\n\r\n";
                     $attachmentInfo = $tatMailManager->detailAttachments();
                     if (count($attachmentInfo) > 0) {
                         $tatMailManager->notifyAssessorWithAttachments($content);
                         $tatMailManager->deleteAttachments();
                     } else {
                         $tatMailManager->notifyAssessor($content);
                     }
                     // Log MI event
                     Application_Core_ActivityLogger::log('TAT Email HomeLet', 'complete', 'TAT', null, "IRN: {$this->_enquiryId}");
                     // Redirect to confirmation page, the redirect prevents
                     //   multiple submissions if user refreshes browser
                     $this->_helper->redirector->gotoUrl('/tenants/reference-tracker/emailsent');
                     return;
                 }
             }
         }
     }
     $this->view->reference = $tatManager->_reference;
     $this->view->form = $pageForm;
 }
 /**
  * Call me form.
  */
 public function callMeAction()
 {
     // Get TAT status
     $tatStatus = $this->getIrisSystemContext()->getTatClient()->getTatStatus(array('agentSchemeNumber' => (int) $this->agentSchemeNumber, 'applicationReferenceNumber' => $this->applicationReferenceNumber, 'applicantBirthDate' => $this->applicantBirthDate));
     // Create new call me form
     $form = $this->getFormFactory()->create(new TatCallMeType());
     // Process POSTed form
     if ($this->getSymfonyRequest()->isMethod('POST')) {
         $form->submit($this->getSymfonyRequest());
         if ($form->isValid()) {
             $formData = $form->getData();
             // Send e-mail to campaign team
             $content = '';
             $content .= 'Name: ' . $tatStatus->getFirstName() . ' ' . $tatStatus->getLastName() . "\r\n\r\n";
             $content .= "Reference number: {$this->applicationReferenceNumber}\r\n\r\n";
             $content .= "Mobile number: {$formData['mobileNumber']}\r\n\r\n";
             $content .= "Landline number: {$formData['landlineNumber']}\r\n\r\n";
             $content .= "Additional information:\r\n{$formData['additionalInfo']}\r\n\r\n";
             $content .= "Best time to call: {$formData['timeToCall']}\r\n\r\n";
             $content .= "Agent Scheme Number: {$this->agentSchemeNumber}\r\n\r\n";
             $tatMailManager = new Manager_Referencing_TatMail($this->applicationReferenceNumber);
             $tatMailManager->notifyCampaignTeam($content);
             // Show confirmation screen and end here
             $this->renderTwigView('/iris-tat/call-me-sent.html.twig', array('bodyTitle' => 'HomeLet Tenant\'s Insurance - Message Sent'));
             return;
         }
     }
     $this->renderTwigView('/iris-tat/call-me.html.twig', array('bodyTitle' => 'HomeLet Tenant\'s Insurance', 'formTheme' => 'tat-widgets.html.twig', 'tatStatus' => $tatStatus, 'agentSchemeNumber' => $this->agentSchemeNumber, 'form' => $form->createView()));
 }