示例#1
0
 /**
  * Returns the missing information on a reference, if any.
  *
  * @param Model_Referencing_Reference $reference
  * The Reference object to check for missing information.
  *
  * @return mixed
  * Returns an array of all missing informations, or null if there are no
  * missing informations.
  */
 public function getMissingInformation($reference)
 {
     //First check the $reference object to see if there is an interim report time. If yes,
     //then we know that all information has been provided, so return null.
     if (!empty($reference->progress)) {
         $progressItem = Manager_Referencing_Progress::findSpecificProgressItem($reference->progress, Model_Referencing_ProgressItemVariables::INTERIM_REPORT_BUILT);
         if ($progressItem->itemState == Model_Referencing_ProgressItemStates::COMPLETE) {
             return null;
         }
     }
     //No interim report time yet, so check if there are missing informations on this reference.
     $notesDatasource = new Datasource_Referencing_Notes();
     $notesArray = $notesDatasource->getNotes($reference->externalId);
     $initialMissingInformation = null;
     if (!empty($notesArray)) {
         foreach ($notesArray as $currentNote) {
             if (preg_match("/There were the following problems/", $currentNote['text'])) {
                 $initialMissingInformation = $currentNote['text'];
                 break;
             }
         }
     }
     if (empty($initialMissingInformation)) {
         //No missing information.
         return null;
     }
     //If here then at some point there was missing information on this reference. Look to see
     //if some information was subsequently provided.
     $isSubsequentlyUpdated = false;
     foreach ($notesArray as $currentNote) {
         if ($currentNote['textId'] == '31' || $currentNote['textId'] == '59') {
             $isSubsequentlyUpdated = true;
             break;
         }
     }
     if (!$isSubsequentlyUpdated) {
         //There have been no subsequent updates. Return the missing information as an array.
         preg_match_all('/\\d+\\)(.+)\\n/m', $initialMissingInformation, $matches);
         return $matches[1];
     }
     //If here then determine what information was subsequently provided. Explode the
     //missing information blob into an array and check each item to see if it has
     //been subsequently provided.
     preg_match_all('/\\d+\\)(.+)\\n/m', $initialMissingInformation, $matches);
     $updatedMissingInformation = array();
     foreach ($matches[1] as $currentMissingItem) {
         if ($this->_isStillMissing($reference, $currentMissingItem)) {
             $updatedMissingInformation[] = $currentMissingItem;
         }
     }
     if (empty($updatedMissingInformation)) {
         $updatedMissingInformation = null;
     }
     return $updatedMissingInformation;
 }
 protected function _privateLandlordTerms()
 {
     $session = new Zend_Session_Namespace('referencing_global');
     $session->currentFlowItem = Model_Referencing_DataEntry_FlowItems::TERMS;
     $termsForm = new LandlordsReferencing_Form_Terms();
     $request = $this->getRequest();
     $data = $request->getPost();
     $referenceManager = new Manager_Referencing_Reference();
     $reference = $referenceManager->getReference($session->referenceId);
     //Check if the terms were previously agreed by the tenant. If yes, disable the controls and require the PLL to agree to the terms only.
     $progressManager = new Manager_Referencing_Progress();
     $progressItem = $progressManager->findSpecificProgressItem($reference->progress, Model_Referencing_ProgressItemVariables::TERMS_AGREED);
     if (!empty($progressItem) && $progressItem->itemState == Model_Referencing_ProgressItemStates::COMPLETE) {
         if ($request->isPost()) {
             $termsForm->setClearValidators(true);
             if ($termsForm->isValid($data)) {
                 //Capture the data.
                 if ($data['terms_agreed'] == 'Yes') {
                     //Push to munt now that all data is completed and the PLL has agreed to
                     //the terms.
                     $this->_pushToMunt($reference);
                     $this->_despatchToNext();
                     return;
                 }
             } else {
                 $previouslyLoaded = "var previouslyLoaded = true;\n";
                 $this->view->headScript()->appendScript($previouslyLoaded, $type = 'text/javascript');
             }
         }
         // Get the declaration version
         $declarationVersion = $this->_getDeclarationVersion();
         //Check or uncheck tbe DPA controls according to the reference subject's preferences.
         $dpaManager = new Manager_Core_DataProtection();
         $dpaItems = $dpaManager->getItems($session->referenceId, Model_Core_DataProtection_ItemEntityTypes::REFERENCING);
         foreach ($dpaItems as $item) {
             if ($item->isAllowed) {
                 $isChecked = true;
             } else {
                 $isChecked = false;
             }
             $element = null;
             switch ($item->constraintTypeId) {
                 case Model_Core_DataProtection_ItemConstraintTypes::MARKETING_BY_NONDIGITAL_MEANS:
                     $element = $termsForm->consent_nondigital_marketing;
                     $element->setChecked(3 == $declarationVersion ? !$isChecked : $isChecked);
                     $element->setAttrib('disabled', 'disabled');
                     break;
                 case Model_Core_DataProtection_ItemConstraintTypes::MARKETING_BY_DIGITAL_MEANS:
                     $element = $termsForm->consent_digital_marketing;
                     // If this is declaration version 3, invert preference
                     $element->setChecked($isChecked);
                     $element->setAttrib('disabled', 'disabled');
                     break;
                 default:
                     throw new Zend_Exception();
             }
         }
         $termsForm->consent_information_stored->setChecked(true);
         $termsForm->consent_information_stored->setAttrib('disabled', 'disabled');
         $termsForm->consent_referee->setChecked(true);
         $termsForm->consent_referee->setAttrib('disabled', 'disabled');
     } else {
         //Tell page to use AJAX validation as we go
         $this->view->headScript()->appendScript('var ajaxValidate = true; var ajaxValidatePage = "terms";');
         //If here then the PLL has logged the reference without emailing a link to the tenant.
         if ($termsForm->isValid($data)) {
             //Capture the data.
             if ($data['terms_agreed'] == 'Yes') {
                 $this->_storeDataProtections();
                 $this->_pushToMunt($reference);
                 $this->_despatchToNext();
                 return;
             }
         } else {
             $previouslyLoaded = "var previouslyLoaded = true;\n";
             $this->view->headScript()->appendScript($previouslyLoaded, $type = 'text/javascript');
         }
     }
     $termsForm->populate($termsForm->getValues());
     //Set this to whatever you want the progress bar to how in percents
     $this->view->fractionComplete = 95;
     $this->view->form = $termsForm;
 }
示例#3
0
 /**
  * Returns a TAT object encapsulating details of the Enquiry.
  *
  * @param void
  * The unique Enquiry identifier (internal or external). May be integer or string.
  *
  * @return mixed
  * Returns a Model_Referencing_Tat object holds details of the reference,
  * or null if not found.
  */
 public function getTat()
 {
     $tat = new Model_Referencing_Tat();
     //Set the isInvitationSent attribute.
     $tatDatasource = new Datasource_Referencing_TatInvitation();
     $tat->isInvitationSent = $tatDatasource->getIsTatInvitationSent($this->_reference->externalId);
     //Set the referenceSubject attribute.
     $referenceSubject = $this->_reference->referenceSubject;
     $tat->referenceSubject = $referenceSubject;
     //Set the propertyLease attribute.
     $tat->propertyLease = $this->_reference->propertyLease;
     //Arrive at the Enquiry state by a cascade: Start by assuming the Enquiry state is complete.
     $tat->enquiryStatus = Model_Referencing_TatStates::REFERENCE_COMPLETE;
     //Next identify if the state should be changed to 'In Progress' based on the
     //current Enquiry conclusion
     switch ($this->_reference->status->state) {
         case Model_Referencing_ReferenceStates::INPROGRESS:
         case Model_Referencing_ReferenceStates::INCOMPLETE:
             $tat->enquiryStatus = Model_Referencing_TatStates::REFERENCE_INPROGRESS;
             break;
     }
     $progressItem = Manager_Referencing_Progress::findSpecificProgressItem($this->_reference->progress, Model_Referencing_ProgressItemVariables::FINISHED);
     //Finally, override the conclusion if the progress result is not complete.
     if ($progressItem->itemState != Model_Referencing_ProgressItemStates::COMPLETE) {
         //The progress object also has to indicate complete - this will allow us to detect
         //references that have been reopened.
         $tat->enquiryStatus = Model_Referencing_TatStates::REFERENCE_INPROGRESS;
     }
     //Set the occupation attributes.
     foreach ($referenceSubject->occupations as $occupation) {
         //Set the occupation reference status.
         if (empty($occupation->referencingDetails)) {
             $isReferencedString = Model_Referencing_TatStates::REFERENCE_ITEM_NOTAPPLICABLE;
         } else {
             if ($occupation->isComplete) {
                 $isReferencedString = Model_Referencing_TatStates::REFERENCE_ITEM_COMPLETE;
             } else {
                 $isReferencedString = Model_Referencing_TatStates::REFERENCE_ITEM_INPROGRESS;
             }
         }
         //Now identify which occupation we are dealing with.
         if ($occupation->chronology == Model_Referencing_OccupationChronology::FUTURE) {
             $tat->futureOccupationReferenceStatus = $isReferencedString;
         } else {
             if ($occupation->chronology == Model_Referencing_OccupationChronology::CURRENT) {
                 if ($occupation->importance == Model_Referencing_OccupationImportance::FIRST) {
                     $tat->currentOccupationReferenceStatus = $isReferencedString;
                 } else {
                     $tat->secondOccupationReferenceStatus = $isReferencedString;
                 }
             }
         }
     }
     //Some of the occupation attributes may not be applicable. Set them to N/A as appropriate.
     if (empty($tat->currentOccupationReferenceStatus)) {
         $tat->currentOccupationReferenceStatus = Model_Referencing_TatStates::REFERENCE_ITEM_NOTAPPLICABLE;
     }
     if (empty($tat->secondOccupationReferenceStatus)) {
         $tat->secondOccupationReferenceStatus = Model_Referencing_TatStates::REFERENCE_ITEM_NOTAPPLICABLE;
     }
     if (empty($tat->futureOccupationReferenceStatus)) {
         $tat->futureOccupationReferenceStatus = Model_Referencing_TatStates::REFERENCE_ITEM_NOTAPPLICABLE;
     }
     //Set the landlord attribute.
     $residenceManager = new Manager_Referencing_Residence();
     $currentResidence = $residenceManager->findSpecificResidence($this->_reference->referenceSubject->residences, Model_Referencing_ResidenceChronology::CURRENT);
     if ($currentResidence->status != Model_Referencing_ResidenceStatus::TENANT) {
         $tat->currentResidentialReferenceStatus = Model_Referencing_TatStates::REFERENCE_ITEM_NOTAPPLICABLE;
     } else {
         if (empty($currentResidence->referencingDetails)) {
             $tat->currentResidentialReferenceStatus = Model_Referencing_TatStates::REFERENCE_ITEM_INPROGRESS;
         } else {
             if ($currentResidence->referencingDetails->submissionType == null) {
                 $tat->currentResidentialReferenceStatus = Model_Referencing_TatStates::REFERENCE_ITEM_INPROGRESS;
             } else {
                 $tat->currentResidentialReferenceStatus = Model_Referencing_TatStates::REFERENCE_ITEM_COMPLETE;
             }
         }
     }
     //Set the missing information attribute.
     /*
             $productName = $enquiry->productSelection->product->name;
             $flowManager = Manager_Referencing_DataEntry_Flow_FlowFactory::createFlowManager($productName);
     		$missingInformationManager = new Manager_Referencing_DataEntry_MissingInformation_Despatcher();
     		$missingInfoList = array();
     		do {
     
     	$missingInfoSubList = $missingInformationManager->getMissingInformation($enquiry->externalId, $flowManager->currentFlowItem);
     	if(!empty($missingInfoSubList)) {
     
     		foreach($missingInfoSubList as $subListItem) {
     
     			$missingInfoList[] = $subListItem;
     		}
     	}
     }
     while($flowManager->moveToNext($enquiryId));
     $tat->missingInformation = $missingInfoList;
     */
     //Use the legacy missing information manager until the new one is fully operational.
     $missingInformationManager = new Manager_Referencing_DataEntry_MissingInformation_Legacy();
     $tat->missingInformation = $missingInformationManager->getMissingInformation($this->_reference);
     //Set the tat notifications.
     $tatNotifications = new Datasource_Referencing_TatNotification();
     $tat->tatNotifications = $tatNotifications->getByEnquiry($this->_reference->externalId);
     return $tat;
 }
示例#4
0
 /**
  * Retrieves the specified Reference.
  *
  * @param mixed $referenceId
  * The unique Reference identifier. May be the IRN (internal refno) or the ERN (external
  * refno).
  *
  * @return mixed
  * The Reference details, encapsulated in a Model_Referencing_Reference object,
  * or null if the Reference cannot be found.
  */
 public function getEnquiry($referenceId)
 {
     $enquiryRow = $this->_getEnquiryRow($referenceId);
     if (empty($enquiryRow)) {
         Application_Core_Logger::log(get_class() . '::' . __FUNCTION__ . ':Unable to find Enquiry.');
         $returnVal = null;
     } else {
         //Populate the details into a Customer object.
         $reference = new Model_Referencing_Reference();
         $reference->internalId = $enquiryRow->ID;
         $reference->externalId = $enquiryRow->RefNo;
         $reference->declarationVersion = $enquiryRow->declaration_version;
         $productDatasource = new Datasource_ReferencingLegacy_Product();
         $product = $productDatasource->getProductByID($enquiryRow->ProductID);
         if (!empty($product)) {
             $reference->productSelection = new Model_Referencing_ProductSelection();
             $reference->productSelection->referenceId = $enquiryRow->ID;
             $reference->productSelection->product = $product;
             switch ($enquiryRow->PolicyLength) {
                 case 0:
                     $reference->productSelection->duration = 0;
                     break;
                 case 6:
                     $reference->productSelection->duration = 6;
                     break;
                 case 12:
                     $reference->productSelection->duration = 12;
                     break;
                 default:
                     $reference->productSelection->duration = 0;
             }
         }
         $progressDatasource = new Datasource_ReferencingLegacy_Progress();
         $reference->progress = $progressDatasource->getByEnquiry($enquiryRow->RefNo);
         $propertyLeaseDatasource = new Datasource_ReferencingLegacy_PropertyLease();
         $reference->propertyLease = $propertyLeaseDatasource->getPropertyLease($enquiryRow->proprefno, $enquiryRow->RefNo);
         $referenceSubjectDatasource = new Datasource_ReferencingLegacy_ReferenceSubject();
         $reference->referenceSubject = $referenceSubjectDatasource->getReferenceSubject($enquiryRow->TenantID, $enquiryRow->RefNo);
         //Build the reference status.
         $referenceStatus = new Model_Referencing_ReferenceStatus();
         $referenceStatus->referenceId = $enquiryRow->ID;
         if ($enquiryRow->nochange == 'cancelled') {
             $referenceStatus->state = Model_Referencing_ReferenceStates::CANCELLED;
         } else {
             $progressManager = new Manager_Referencing_Progress();
             $progressItem = $progressManager->findSpecificProgressItem($reference->progress, Model_Referencing_ProgressItemVariables::FINAL_REPORT_BUILT);
             if ($progressItem == null || $progressItem->itemState == Model_Referencing_ProgressItemStates::INCOMPLETE) {
                 $referenceStatus->state = Model_Referencing_ReferenceStates::INPROGRESS;
             } else {
                 if (strcasecmp("Incomplete - Awaiting further information", $enquiryRow->conclusion) == 0) {
                     $referenceStatus->state = Model_Referencing_ReferenceStates::INCOMPLETE;
                     $referenceStatus->reasonForState = Model_Referencing_ReferenceStateReasons::AWAITING_FURTHER_INFORMATION;
                 } else {
                     if (strcasecmp("Incomplete - Awaiting Completion of Tenant", $enquiryRow->conclusion) == 0) {
                         $referenceStatus->state = Model_Referencing_ReferenceStates::INCOMPLETE;
                         $referenceStatus->reasonForState = Model_Referencing_ReferenceStateReasons::AWAITING_TENANT_COMPLETION;
                     } else {
                         $referenceStatus->state = Model_Referencing_ReferenceStates::COMPLETE;
                     }
                 }
             }
         }
         $reference->status = $referenceStatus;
         //Build the reference decision
         if ($enquiryRow->conclusion == '' || preg_match("/incomplete/i", $enquiryRow->conclusion)) {
             $reference->decision = null;
         } else {
             $decision = new Model_Referencing_Decision();
             $decision->referenceId = $enquiryRow->ID;
             if (preg_match("/not acceptable/i", $enquiryRow->conclusion)) {
                 $decision->decision = Model_Referencing_Decisions::NOT_ACCEPTABLE;
                 $decision->decisionReasons = '';
                 //TO DO HERE
             } else {
                 $decision->decision = Model_Referencing_Decisions::ACCEPTABLE;
                 //Add caveats, if applicable
                 $caveats = array();
                 if (preg_match("/guarantor/i", $enquiryRow->conclusion)) {
                     $decisionCaveat = new Model_Referencing_DecisionCaveat();
                     $decisionCaveat->caveat = Model_Referencing_DecisionCaveats::WITH_GUARANTOR;
                     //Identify the caveat reasons.
                     $decisionCaveat->caveatReason = null;
                     $caveats[] = $decisionCaveat;
                 }
                 if (preg_match("/condition/i", $enquiryRow->conclusion)) {
                     $decisionCaveat = new Model_Referencing_DecisionCaveat();
                     $decisionCaveat->caveat = Model_Referencing_DecisionCaveats::WITH_CONDITION;
                     //Identify the caveat reasons.
                     $decisionCaveat->caveatReason = null;
                     $caveats[] = $decisionCaveat;
                 }
                 if (!empty($caveats)) {
                     //Attach the array of caveat(s) to the Decision object.
                     $decision->caveats = $caveats;
                 }
             }
             //Attach the Decision object to the Reference object.
             $reference->decision = $decision;
         }
         /*
                     $reference->termsAgreedBy = $enquiryRow->termsagreedby;
         */
         if ($enquiryRow->termsagreedby == 'Tenant') {
             $reference->completionMethod = Model_Referencing_ReferenceCompletionMethods::TWO_STEP;
         } else {
             $reference->completionMethod = Model_Referencing_ReferenceCompletionMethods::ONE_STEP;
         }
         //Set the customer details. If the agent is HomeLet Direct, then the customer is a PLL.
         $agentDatasource = new Datasource_Core_Agents();
         $lettingAgent = $agentDatasource->getAgent($enquiryRow->AgentID);
         $params = Zend_Registry::get('params');
         if ($lettingAgent->agentSchemeNumber != $params->homelet->defaultAgent) {
             $reference->customer = new Model_Referencing_CustomerMap();
             $reference->customer->customerType = Model_Referencing_CustomerTypes::AGENT;
             $reference->customer->customerId = $lettingAgent->agentSchemeNumber;
             $reference->customer->legacyCustomerId = null;
         } else {
             $reference->customer = new Model_Referencing_CustomerMap();
             $reference->customer->customerType = Model_Referencing_CustomerTypes::LANDLORD;
             if ($enquiryRow->landrefno != 0) {
                 $reference->customer->legacyCustomerId = $enquiryRow->landrefno;
             }
         }
         $returnVal = $reference;
     }
     return $returnVal;
 }
 /**
  * Displays the "ticks and crosses" reference summary + dynamic options for
  * a reference plucked from the legacy DB by its refno taken from a GET
  * parameter.
  *
  * @return void
  */
 public function summaryAction()
 {
     $this->view->headLink()->appendStylesheet('/assets/connect/css/referencingSummary.css');
     // See if there's a GET-based refno
     $request = $this->getRequest();
     if ($request->isGet() && !is_null($request->getParam('refno'))) {
         // Fetch reference by refno using the Referencing MUNT Manager class
         $refMuntManager = new Manager_ReferencingLegacy_Munt();
         $reference = $refMuntManager->getReference($request->getParam('refno'));
         // Check the owner of this reference
         if ($this->_agentSchemeNumber != $reference->customer->customerId) {
             // The session user is not the owner of this reference.
             // Renider auth failed status code and present error screen
             $this->getResponse()->setHttpResponseCode(401);
             throw new Exception('Authorisation failed when retreiving reference');
             return;
         }
         // Find related references
         $searchResult = $refMuntManager->searchLegacyReferences($this->_agentSchemeNumber, array('proprefno' => $reference->propertyLease->id), Model_Referencing_SearchResult::STARTDATE_ASC, 1, Model_Referencing_SearchResult::TWENTY_FIVE_ROWS);
         // Use the linked references array to determine if the current
         //   reference is complete
         // TODO: De-dirty this, shouldn't use the (even dirtier) linked refs
         //   array
         $refComplete = true;
         foreach ($searchResult->results as $linkedRef) {
             if ($linkedRef['RefNo'] == $reference->externalId) {
                 if (substr($linkedRef['refStatus'], 0, 10) == 'Incomplete') {
                     $refComplete = false;
                 }
             }
         }
         // Find if final report built or sent, and if so how long ago (to
         //   drive the availability of the "Add Guarantor" and "Print
         //   Guarantors Form" buttons)
         $interimReportBuiltItem = Manager_Referencing_Progress::findSpecificProgressItem($reference->progress, Model_Referencing_ProgressItemVariables::INTERIM_REPORT_BUILT);
         $finalReportBuilt = Manager_Referencing_Progress::findSpecificProgressItem($reference->progress, Model_Referencing_ProgressItemVariables::FINAL_REPORT_BUILT);
         // Fetch final-report-sent progress item
         $finalReportSent = Manager_Referencing_Progress::findSpecificProgressItem($reference->progress, Model_Referencing_ProgressItemVariables::FINAL_REPORT_SENT);
         $finalReportDaysAgo = null;
         $allowAddGuarantor = true;
         if (!is_null($finalReportSent) && $finalReportSent->itemState == Model_Referencing_ProgressItemStates::COMPLETE) {
             $date = new Zend_Date();
             $finalReportDaysAgo = $date->sub($finalReportSent->itemCompletionTimestamp)->toValue();
         } elseif (!is_null($finalReportBuilt) && $finalReportBuilt->itemState == Model_Referencing_ProgressItemStates::COMPLETE) {
             $date = new Zend_Date();
             $finalReportDaysAgo = $date->sub($finalReportBuilt->itemCompletionTimestamp)->toValue();
         }
         if (!is_null($finalReportDaysAgo)) {
             $finalReportDaysAgo = round($finalReportDaysAgo / (60 * 60 * 24));
             if ($finalReportDaysAgo > $this->_params->connect->referencing->disableGuarantorButtonAfterXDays) {
                 $allowAddGuarantor = false;
             }
         }
         // Instantiate security manager for generating MAC
         $securityManager = new Application_Core_Security($this->_params->connect->ref->security->securityString->agent);
         $macToken = $securityManager->generate(array($this->_agentSchemeNumber, $this->_agentId));
         // Pass vars into view
         $this->view->reference = $reference;
         $this->view->refComplete = $refComplete;
         $this->view->linkedRefs = $searchResult->results;
         $this->view->allowAddGuarantor = $allowAddGuarantor;
         // Set of URLs that link securely back to referencing
         $baseReferencingUrl = $this->_params->connect->baseUrl->referencing;
         $continueReferenceString = "{$baseReferencingUrl}frontEnd/referencingController.php?" . "refno={$reference->externalId}&" . "agentschemeno={$this->_agentSchemeNumber}&" . "agentid={$this->_agentId}&" . 'origin=connect&' . "agentToken={$macToken}=&" . 'refContinued=1';
         $applicationFormString = "{$baseReferencingUrl}frontEnd/displayForm.php?" . "agentid={$this->_agentId}&" . "refno={$reference->externalId}&" . 'form=application&' . "agentschemeno={$this->_agentSchemeNumber}&" . "agentToken={$macToken}";
         $addGuarantorString = "{$baseReferencingUrl}frontEnd/referencingController.php?" . "originalrefno={$reference->externalId}&" . 'isGuarantor=1&' . "agentschemeno={$this->_agentSchemeNumber}&" . "agentid={$this->_agentId}&" . 'origin=connect&' . "agentToken={$macToken}&" . 'newRefBegin=1';
         $addTenantString = "{$baseReferencingUrl}frontEnd/displayForm.php?" . "agentid={$this->_agentId}&" . 'isAddTenant=true&' . "startrefno={$reference->externalId}&" . 'form=product&' . "agentschemeno={$this->_agentSchemeNumber}&" . "agentToken={$macToken}";
         $viewCaseLogString = "{$baseReferencingUrl}frontEnd/displayForm.php?" . "agentid={$this->_agentId}&" . "refno={$reference->externalId}&" . 'form=caselog&' . "agentschemeno={$this->_agentSchemeNumber}&" . "agentToken={$macToken}";
         $emailAssessorString = "{$baseReferencingUrl}frontEnd/displayForm.php?" . "agentid={$this->_agentId}&" . "refno={$reference->externalId}&" . 'form=emailassessor&' . 'suppressStatus=1&' . "agentschemeno={$this->_agentSchemeNumber}&" . "agentToken={$macToken}";
         $printGuarantorFormString = "/referencing/agent-form?form=Agent-Guarantor&refno={$reference->externalId}";
         if ($reference->status->state == Model_Referencing_ReferenceStates::COMPLETE) {
             $tenantQuoteString = "{$baseReferencingUrl}cgi-bin/connect/tenantQuote.pl?" . "agentid={$this->_agentId}&" . "refno={$reference->externalId}&" . "form=tenantquote&" . "agentschemeno={$this->_agentSchemeNumber}&" . "agentToken={$macToken}";
         } else {
             $tenantQuoteString = '';
         }
         if ($interimReportBuiltItem != null && $interimReportBuiltItem->itemState == Model_Referencing_ProgressItemStates::COMPLETE) {
             /*
                         $retrieveReportString = "{$baseReferencingUrl}frontEnd/referencingController.php?"
                                 . "agentid={$this->_agentId}&"
                                 . "refno={$reference->externalId}&"
                                 . "agentschemeno={$this->_agentSchemeNumber}&"
                                 . "action=newReference&"
                                 . "brand=connect&"
                                 . "summaryConfirmed=1&"
                                 . "agentToken={$macToken}";
             */
             // Find if interim/final report built, and if so view the report via connect
             if ($interimReportBuiltItem != null && $interimReportBuiltItem->itemState === Model_Referencing_ProgressItemStates::COMPLETE) {
                 $repType = 'interim';
             }
             if ($finalReportBuilt != null && $finalReportBuilt->itemState === Model_Referencing_ProgressItemStates::COMPLETE) {
                 $repType = 'final';
             }
             $retrieveReportString = "{$this->_params->connectUrl->connectRootUrl}reports/view-report-pdf?refno={$reference->externalId}&repType={$repType}&contentDisposition=attachment";
             $this->view->refLinks = array('tenantQuote' => $tenantQuoteString, 'retrieveReport' => $retrieveReportString, 'applicationForm' => $applicationFormString, 'addGuarantor' => $addGuarantorString, 'printGuarantorForm' => $printGuarantorFormString, 'viewCaseLog' => $viewCaseLogString, 'addTenant' => $addTenantString, 'emailAssessor' => $emailAssessorString);
         } else {
             $this->view->refLinks = array('continueReference' => $continueReferenceString, 'applicationForm' => $applicationFormString, 'addGuarantor' => $addGuarantorString, 'printGuarantorForm' => $printGuarantorFormString, 'viewCaseLog' => $viewCaseLogString, 'addTenant' => $addTenantString, 'emailAssessor' => $emailAssessorString);
         }
     }
 }