Пример #1
0
 /**
  * Returns an array of Model_Insurance_PreviousClaim objects
  * related to the customer refno passed in, or null if the customer has not
  * specified any previous claims.
  *
  * @param string $customerRefno
  * The customer refno which identifies the previous claims.
  *
  * @return mixed
  * Returns an array of Model_Insurance_PreviousClaim objects, or
  * null if there are no previous claims.
  */
 public function getPreviousClaims($customerRefno)
 {
     $select = $this->select();
     $select->where('refno = ?', $customerRefno);
     $previousClaimArray = $this->fetchAll($select);
     $returnArray = array();
     $previousClaimTypeDatasource = new Datasource_Insurance_PreviousClaimTypes();
     foreach ($previousClaimArray as $current) {
         $previousClaim = new Model_Insurance_PreviousClaim();
         $previousClaim->setRefno($current['refno']);
         $previousClaim->setClaimMonth($current['claimmonth']);
         $previousClaimType = $previousClaimTypeDatasource->getByClaimTypeId($current['claimTypeID']);
         $previousClaim->setClaimType($previousClaimType);
         //Put the claim value in a Zend_Currency object.
         $claimValue = new Zend_Currency(array('value' => $current['claimvalue'], 'precision' => 2));
         $previousClaim->setClaimValue($claimValue);
         $previousClaim->setClaimYear($current['claimyear']);
         $returnArray[] = $previousClaim;
     }
     //Finalise the return value consistent with this functions contract.
     if (empty($returnArray)) {
         $returnVal = null;
     } else {
         $returnVal = $returnArray;
     }
     return $returnVal;
 }