예제 #1
0
 /**
  * fetchByPaymentRefono, retrieves a single payment as an array 
  * @param string $paymentRefnoId of the payment to be removed
  * @return array The row to be returned
  */
 public function getByRefNo($paymentrefno)
 {
     $ccObject = new Model_Core_Creditcard();
     $fields = array('refNo' => 'refno', 'policyNumber' => 'policynumber', 'paymentFrequency' => 'paymentfrequency', 'cardName' => 'cardname', 'cardNumber' => 'cardnumber', 'cardType' => 'cardtype', 'expiryDate' => 'expirydate', 'startDate' => 'startdate', 'issueNo' => 'issueno', 'paymentDate' => 'paymentdate', 'paymentRefNo' => 'paymentrefno', 'merchantId' => 'merchantid', 'expWarnLetterSent' => 'expwarnlettersent');
     $select = $this->select()->from($this->_name, $fields)->where('refno = ?', $paymentrefno)->order('paymentdate DESC')->order('paymentrefno DESC')->limit(1);
     $row = array();
     $row = $this->fetchRow($select);
     if (!empty($row)) {
         $ccObject->refNo = $row->refNo;
         $ccObject->policyNumber = $row->policyNumber;
         $ccObject->paymentFrequency = $row->paymentFrequency;
         $ccObject->cardName = $row->cardName;
         $ccObject->cardNumber = $row->cardNumber;
         $ccObject->cardType = $row->cardType;
         $ccObject->expiryDate = $row->expiryDate;
         $ccObject->startDate = $row->startDate;
         $ccObject->issueNo = $row->issueNo;
         $ccObject->paymentDate = $row->paymentDate;
         $ccObject->paymentRefNo = $row->paymentRefNo;
         $ccObject->merchantId = $row->merchantId;
         $ccObject->expWarnLetterSent = $row->expWarnLetterSent;
         return $ccObject;
     } else {
         // Could not find a requested Payment
         Application_Core_Logger::log("No Credit Card Payment for this reference number {$paymentrefno}. Not found in table {$this->_name}", 'warning');
         return false;
     }
 }
 /**
  * Returns all the previous claim types.
  *
  * This method reads in all the previous claim types recognised by the
  * system and populates each one into a PreviousClaimType object. An
  * array of these objects will then be returned. The results can be filtered
  * by supplying an argument to reflect this.
  *
  * @param string $productName
  * Filters the results by product name. Must correspond to a const exposed by the
  * Model_Insurance_ProductNames class.
  *
  * @return array
  * An array of PreviousClaimType objects, each one encapsulating a valid previous
  * claim type.
  */
 public function getPreviousClaimTypes($productName = null)
 {
     $select = $this->select();
     //Prepare the where clause, if applicable.
     if (!empty($productName)) {
         switch ($productName) {
             case Model_Insurance_ProductNames::TENANTCONTENTSPLUS:
                 $fieldValue = 'tenants';
                 break;
             case Model_Insurance_ProductNames::LANDLORDSPLUS:
                 $fieldValue = 'landlords';
                 break;
             case Model_Insurance_ProductNames::PORTFOLIOINSURANCE:
                 $fieldValue = 'portfolio';
                 break;
             default:
                 throw new Zend_Exception(get_class() > __FUNCTION__ . ': argument supplied is invalid.');
         }
         $select->where('claimType = ?', $fieldValue);
     }
     $claimTypesAll = $this->fetchAll($select);
     if (count($claimTypesAll) > 0) {
         //Populate the data retrieved into PreviousClaimType objects.
         $returnArray = array();
         foreach ($claimTypesAll as $currentClaimType) {
             $returnArray[] = new Model_Insurance_PreviousClaimType($currentClaimType['claimTypeID'], $currentClaimType['claimType'], $currentClaimType['claimTypeText']);
         }
         return $returnArray;
     } else {
         // Can't get previous claim types - log a warning
         Application_Core_Logger::log("Can't get previous claim types from table {$this->_name} (filterBy = {$productName})", 'warning');
     }
 }
예제 #3
0
 /**
  * Retrieves the specified property lease.
  *
  * @param integer $propertyLeaseId
  * The unique property lease identifier.
  *
  * @return mixed
  * The property lease details, encapsulated in a Model_Referencing_PropertyLease
  * object, or null if the property lease cannot be found.
  */
 public function getByPropertyLeaseId($propertyLeaseId)
 {
     $select = $this->select();
     $select->where('id = ?', $propertyLeaseId);
     $propertyLeaseRow = $this->fetchRow($select);
     if (empty($propertyLeaseRow)) {
         Application_Core_Logger::log(get_class() . '::' . __FUNCTION__ . ':Unable to find property lease.');
         $returnVal = null;
     } else {
         $propertyLease = new Model_Referencing_PropertyLease();
         $propertyLease->id = $propertyLeaseRow->id;
         //Add the address details
         if (!empty($propertyLeaseRow->address_id)) {
             $addressDatasource = new Datasource_Core_Addresses();
             $propertyLease->address = $addressDatasource->getById($propertyLeaseRow->address_id);
         }
         if ($propertyLeaseRow->monthly_rent >= 0) {
             $propertyLease->rentPerMonth = new Zend_Currency(array('value' => $propertyLeaseRow->monthly_rent, 'precision' => 0));
         }
         if (!empty($propertyLeaseRow->start_date)) {
             if ($propertyLeaseRow->start_date != '0000-00-00') {
                 $propertyLease->tenancyStartDate = new Zend_Date($propertyLeaseRow->start_date, Zend_Date::ISO_8601);
             }
         }
         $propertyLease->tenancyTerm = $propertyLeaseRow->term;
         $propertyLease->noOfTenants = $propertyLeaseRow->no_of_tenants;
         $returnVal = $propertyLease;
     }
     return $returnVal;
 }
예제 #4
0
 /**
  * Update an existing Schedule
  * @param $policyNumber A policy number
  * 
  */
 public function store($policyNumber, $data)
 {
     $dataArray = array();
     $dataArray['paymentrefno'] = $data->paymentRefNo;
     $dataArray['january'] = $data->january;
     $dataArray['february'] = $data->february;
     $dataArray['march'] = $data->march;
     $dataArray['april'] = $data->april;
     $dataArray['may'] = $data->may;
     $dataArray['june'] = $data->june;
     $dataArray['july'] = $data->july;
     $dataArray['august'] = $data->august;
     $dataArray['september'] = $data->september;
     $dataArray['october'] = $data->october;
     $dataArray['november'] = $data->november;
     $dataArray['december'] = $data->december;
     #$dataArray['policynumber'] = $data->policyNumber;
     $dataArray['sixmonthfee'] = $data->sixMonthFee;
     $dataArray['ddfee'] = $data->ddFee;
     $dataArray['banked'] = $data->banked;
     // Save the record
     $where = $this->quoteInto('policynumber = ?', $policyNumber);
     if (!$this->update($dataArray, $where)) {
         // Failed update
         Application_Core_Logger::log("Can't update schedule in table {$this->_name}", 'error');
     }
 }
예제 #5
0
 /**
  * Returns an existing address.
  *
  * @param integer $addressId
  * The unique address identifier.
  *
  * @return mixed
  * A Model_Core_Address encapsulating the address details, or null if
  * the address cannot be found.
  */
 public function getById($addressId)
 {
     if (empty($addressId)) {
         return null;
     }
     $select = $this->select();
     $select->where('id = ?', $addressId);
     $addressRow = $this->fetchRow($select);
     if (empty($addressRow)) {
         Application_Core_Logger::log(get_class() . '::' . __FUNCTION__ . ':Unable to find address.');
         $returnVal = null;
     } else {
         $address = new Model_Core_Address();
         $address->id = $addressRow->id;
         $address->flatNumber = $addressRow->flat_number;
         $address->houseName = $addressRow->house_name;
         $address->houseNumber = $addressRow->house_number;
         $address->addressLine1 = $addressRow->address_line1;
         $address->addressLine2 = $addressRow->address_line2;
         $address->town = $addressRow->town;
         $address->county = $addressRow->county;
         $address->postCode = $addressRow->postcode;
         $address->country = $addressRow->country;
         $address->isOverseasAddress = $addressRow->is_overseas == 1 ? true : false;
         $returnVal = $address;
     }
     return $returnVal;
 }
예제 #6
0
 /**
  * Insert a new row into the portfolio table
  *
  * @param Model_Insurance_Portfolio_Portfolio propertyObject The Property to save
  *
  * @return int The last insert ID
  */
 public function save($propertyObject)
 {
     $insertArray = array();
     $insertArray['policynumber'] = $propertyObject->policyNumber;
     $insertArray['premium'] = $propertyObject->premium;
     $insertArray['quote'] = $propertyObject->quote;
     $insertArray['IPT'] = $propertyObject->ipt;
     $insertArray['policyoptions'] = $propertyObject->policyOptions;
     $insertArray['amountscovered'] = $propertyObject->amountsCovered;
     $insertArray['optionpremiums'] = $propertyObject->optionPremiums;
     $insertArray['propaddress1'] = $propertyObject->propAddress1;
     $insertArray['propaddress3'] = $propertyObject->propAddress3;
     $insertArray['propaddress5'] = $propertyObject->propAddress5;
     $insertArray['proppostcode'] = $propertyObject->propPostcode;
     $insertArray['riskarea'] = $propertyObject->riskArea;
     $insertArray['discount'] = $propertyObject->discount;
     $insertArray['surcharge'] = $propertyObject->surcharge;
     $insertArray['rateSetID'] = 0;
     $insertArray['excessID'] = $propertyObject->excessId;
     $insertArray['optiondiscounts'] = $propertyObject->optionDiscounts;
     $insertArray['riskareab'] = $propertyObject->riskAreaB;
     if ($lastId = $this->insert($insertArray)) {
         return $lastId;
     } else {
         // Error
         Application_Core_Logger::log("Could not insert into table {$this->_name}", 'error');
         return false;
     }
 }
 /**
  * Inserts a new additional information record into the additionalinfo table.
  *
  * Function responsible for adding additional information to a quote or policy,
  * to supplement the underwriting answers.
  *
  * @param Model_Insurance_AdditionalInformation $additionalInformation
  * A Model_Insurance_AdditionalInformation object containing all the additional
  * information provided by the user when applying for a policy / policy
  * renewal etc.
  *
  * @return void
  */
 public function insertAdditionalInformation($additionalInformation)
 {
     $data = array('policynumber' => $additionalInformation->getPolicyNumber(), 'additionalinfo' => $additionalInformation->getAdditionalInformation());
     if (!$this->insert($data)) {
         // Failed insertion
         Application_Core_Logger::log("Can't insert specified possession in table {$this->_name}", 'error');
     }
 }
예제 #8
0
 /**
  * Inserts a single previous claim into the dbase.
  *
  * Receives a single Model_Insurance_PreviousClaim object - which
  * represents an instance where the customer has made a claim on a previous
  * policy - and attempts to insert it intothe previousClaims table.
  *
  * @param Model_Insurance_PreviousClaim $previousClaim
  * A Model_Underwriting_DomainObjects_PreviousClaim object which provide information
  * about the previous claim to insert.
  */
 public function insertPreviousClaim($previousClaim)
 {
     $data = array('refno' => $previousClaim->getRefno(), 'claimmonth' => $previousClaim->getClaimMonth(), 'claimyear' => $previousClaim->getClaimYear(), 'claimvalue' => $previousClaim->getClaimValue()->getValue(), 'claimTypeID' => $previousClaim->getClaimType()->getClaimTypeID());
     if (!$this->insert($data)) {
         // Failed insertion
         Application_Core_Logger::log("Can't insert previous claim in table {$this->_name}", 'error');
     }
 }
예제 #9
0
 /**
  * Writes a single UW answer to the dbase.
  *
  * This method writes to the dbase the UW answer passed in. It expects a single
  * underwriting answer, encapsulated in an Model_Insurance_Answer
  * object.
  *
  * @param Model_Insurance_Answer $answer
  * An Model_Insurance_Answer object encapsulating the answer given
  * by the user in response to the corresponding UW question.
  */
 public function insertUnderwritingAnswer($answer)
 {
     $dateAnswered = $answer->getDateAnswered()->toString(Zend_Date::ISO_8601);
     $data = array('policyNumber' => $answer->getPolicyNumber(), 'questionID' => $answer->getQuestionNumber(), 'answerGiven' => $answer->getAnswer(), 'dateAnswered' => $dateAnswered);
     if (!$this->insert($data)) {
         // Failed insertion
         Application_Core_Logger::log("Can't insert underwriting answer in table {$this->_name}", 'error');
     }
 }
예제 #10
0
 /**
  * Inserts sharers into the database.
  *
  * This method provides a convenient way of inserting sharers into the database.
  *
  * @param Model_Insurance_TenantsContentsPlus_Sharers $sharers
  * The Model_Insurance_TenantsContentsPlus_Sharers object containing all the sharers
  * information to be inserted.
  *
  * @return void
  */
 public function insertSharers($sharer)
 {
     //Put it all together and insert.
     $data = array('policynumber' => $sharer->getPolicyNumber(), 'sharer1' => $sharer->getSharerOccupation(Model_Insurance_TenantsContentsPlus_Sharers::SHARER_01), 'sharer2' => $sharer->getSharerOccupation(Model_Insurance_TenantsContentsPlus_Sharers::SHARER_02));
     if (!$this->insert($data)) {
         // Failed insertion
         Application_Core_Logger::log("Can't insert sharers in table {$this->_name}", 'error');
     }
 }
 /**
  * TODO: Document this
  * @param
  * @return
  * @author John Burrin
  */
 private function _insert($insertArray)
 {
     if ($id = $this->insert($insertArray)) {
         return $id;
     } else {
         // Error
         Application_Core_Logger::log("Could not insert into table {$this->_name}", 'error');
         return false;
     }
 }
예제 #12
0
 /**
  * Save a mta object in the database
  *
  * @param Model_Insurance_MTA $mta this is the MTA object you want saving
  * @return bool|int
  */
 public function create(Model_Insurance_MTA $mta)
 {
     $data = array('policynumber' => $mta->getPolicynumber(), 'policyoptions' => $mta->getPolicyoptions(), 'amountscovered' => $mta->getAmountscovered(), 'optionpremiums' => $mta->getOptionpremiums(), 'dateAdded' => $mta->getDateAdded(), 'dateOnRisk' => $mta->getDateOnRisk(), 'dateOffRisk' => $mta->getDateOffRisk(), 'status' => $mta->getStatus(), 'MTAId' => $mta->getMTAId(), 'premium' => $mta->getPremium(), 'quote' => $mta->getQuote(), 'ipt' => $mta->getIpt(), 'amountToPay' => $mta->getAmountToPay(), 'AdminCharge' => $mta->getAdminCharge(), 'displayNotes' => $mta->getDisplayNotes(), 'monthsRemaining' => $mta->getmonthsRemaining(), 'propAddress1' => $mta->getPropAddress1(), 'propAddress3' => $mta->getPropAddress3(), 'propAddress5' => $mta->getPropAddress5(), 'propPostcode' => $mta->getPropPostcode(), 'changeCorrespondenceAndPersonal' => $mta->getChangeCorrespondenceAndPersonal(), 'riskArea' => $mta->getRiskArea(), 'riskAreaB' => $mta->getRiskAreaB(), 'paidNet' => $mta->getPaidNet(), 'paragonMortgageNumber' => $mta->getParagonMortgageNumber());
     $mtaID = $this->insert($data);
     if (!$mtaID) {
         // Failed insertion
         Application_Core_Logger::log("Can't insert MTA in table {$this->_name}", 'error');
         return false;
     }
     return $mtaID;
 }
예제 #13
0
 /**
  * Reflects in the datasource the loading(s) to be applied to a particular policy.
  *
  * @param string $policyNumber
  * The quote or policy number.
  *
  * @param string $optionsdiscounts
  * The pipe-delimited loadings to insert into the record. This will reflect the
  * loading applied to the particular coverages.
  *
  * @param Zend_Date $date
  * The date on which the loading applies.
  *
  * @return boolean
  * Returns true if loading is successfully inserted.
  */
 public function addLoadingHistory($policyNumber, $optionDiscounts, $date)
 {
     $data = array('policynumber' => $policyNumber, 'optiondiscounts' => $optionDiscounts, 'date' => $date->toString(Zend_Date::ISO_8601));
     if ($this->insert($data)) {
         $returnVal = true;
     } else {
         // Failed insertion
         Application_Core_Logger::log("Can't insert loading in table {$this->_name}", 'error');
         $returnVal = false;
     }
     return $returnVal;
 }
예제 #14
0
 /**
  * This function will add a new note into the cleanupnotes table
  *
  * @param int schemeNumber
  * @param string note
  * @return boolean
  */
 public function addNote($schemeNumber, $note)
 {
     $data = array('AGENTSCHEMENUMBER' => $schemeNumber, 'DATETIME' => new Zend_Db_Expr('NOW()'), 'NOTES' => $note);
     // Insert the data into a new row in the table
     if ($this->insert($data)) {
         return true;
     } else {
         // Failed insertion
         Application_Core_Logger::log("Can't insert note in table {$this->_name} (AGENTSCHEMENUMBER = {$schemeNumber})", 'error');
         return false;
     }
 }
예제 #15
0
 /**
  * Fetch options from the database
  *
  * @param none
  * @return array
  */
 public function fetchOptionsByProduct($productName)
 {
     $select = $this->select()->from(array('p' => $this->_name))->setIntegrityCheck(false)->join(array('o' => 'productOptions'), 'p.productID = o.productID')->join(array('s' => 'policyOptions'), 'o.policyOptionID = s.policyOptionID')->join(array('r' => 'productRates'), 'o.productOptionsID = r.productOptionsID')->where('p.productID = ?', 1);
     $rows = $this->fetchAll($select);
     if (!empty($rows)) {
         return $rows;
     } else {
         // Can't find policy options for this type - log a warning
         Application_Core_Logger::log("Policy options not found in database (productName = {$productName})", 'warning');
         return false;
     }
 }
예제 #16
0
 /**
  * This function will add a new note into the agentNotes table
  *
  * @param int schemeNumber
  * @param string note
  * @return boolean
  *
  */
 public function addNote($schemeNumber, $note, $csuid)
 {
     $data = array('agentschemeno' => $schemeNumber, 'dateEntered' => new Zend_Db_Expr('NOW()'), 'csuid' => $csuid, 'text' => $note);
     // Insert the data into a new row in the table
     if ($this->insert($data)) {
         return true;
     } else {
         // Failed insertion
         Application_Core_Logger::log("Can't insert note in table {$this->_name} (AGENTSCHEMENUMBER = {$schemeNumber})", 'error');
         return false;
     }
 }
예제 #17
0
 public function getByKey($key)
 {
     $select = $this->select()->where('`key` = ?', $key);
     $panel = $this->fetchRow($select);
     if (count($panel) > 0) {
         return array('id' => $panel->id, 'key' => $panel->key, 'description' => $panel->description, 'content' => $panel->content);
     } else {
         // Can't find content for that key - log a warning
         Application_Core_Logger::log('Panel content not found in database (key = ' . $key . ')', 'warning');
         return false;
     }
 }
 /**
  * Creates a new record in the rent_recovery_plus_mta table
  *
  * @param Model_Insurance_RentRecoveryPlus_RentRecoveryPlusMta $rrpMta
  * @param int $mtaId
  * @return bool
  */
 public function create($rrpMta, $mtaId)
 {
     $isSuccessful = true;
     $data = array('mta_id' => $mtaId, 'policynumber' => $rrpMta->getPolicyNumber(), 'claim_info' => $rrpMta->getClaimInfo());
     // New quote so just insert
     if (!$this->insert($data)) {
         // Failed insertion
         Application_Core_Logger::log("Can't insert quote in table {$this->_name}", 'error');
         $isSuccessful = false;
     }
     return $isSuccessful;
 }
 /**
  * Returns the PropertyLease identifier associated with the Reference identifier passed in.
  *
  * @param integer $referenceId
  * The unique Reference identifier.
  *
  * @return mixed
  * Returns the integer PropertyLease identifier, if found. Else returns null.
  */
 public function getPropertyLeaseId($referenceId)
 {
     $select = $this->select();
     $select->where('reference_id = ?', $referenceId);
     $mapRow = $this->fetchRow($select);
     if (empty($mapRow)) {
         Application_Core_Logger::log(get_class() . '::' . __FUNCTION__ . ': Unable to find PropertyLeaseMap.');
         $returnVal = null;
     } else {
         $returnVal = $mapRow->property_lease_id;
     }
     return $returnVal;
 }
예제 #20
0
 /**
  * Returns a specific product located by its name.
  *
  * @param string $name
  * The product's name. Case insensitive.
  *
  * @return mixed
  * Returns a Model_Referencing_Product encapsulating the product details,
  * or null if no matching product found.
  */
 public function getByName($name)
 {
     $select = $this->select()->from;
     $select->where('name = ?', $name);
     $productRow = $this->fetchRow($select);
     if (empty($productRow)) {
         Application_Core_Logger::log(get_class() . '::' . __FUNCTION__ . ':Unable to find product.');
         $returnVal = null;
     } else {
         $returnVal = $this->_createDomainObject($productRow);
     }
     return $returnVal;
 }
예제 #21
0
 /**
  * Returns the expected (correct) answer for a specified underwriting question.
  *
  * @param integer $questionID
  * Identifies the underwriting question.
  * 
  * @return mixed
  * Returns a string corresponding to one of the consts exposed by the
  * Model_Insurance_Answer class, or null if the question cannot be found
  * in the datasource.
  */
 public function getExpectedAnswer($questionID)
 {
     $select = $this->select();
     $select->where('underwritingQuestionID = ?', $questionID);
     $row = $this->fetchRow($select);
     if (!empty($row)) {
         $expectedAnswer = $row->correctAnswer;
     } else {
         Application_Core_Logger::log("Can't retrieve underwriting question in table {$this->_name}", 'error');
         $expectedAnswer = null;
     }
     return $expectedAnswer;
 }
 /**
  * Finds a set of insurer rates by policy option and policy startdate
  *
  * @param int id
  * @param date $date
  * @return Array
  *
  * @example $commRate[]=$commR->getCommissionRatebyDate(1502469,'2011-01-01');
  */
 function getCommissionRate($agent, $date)
 {
     $select = $this->select()->where("agentschemeno = ?", $agent['agentschemeno'])->where("startdate <= ?", $date)->where("enddate >= ? OR enddate='0000-00-00' ", $date);
     $row = $this->fetchRow($select);
     if (count($row) > 0) {
         $this->_rateArr = array('newbuscommissionrate' => $row->newbuscommissionrate, 'commissionrate' => $row->commissionrate, 'newbuscommissionrate_tc' => $row->newbuscommissionrate_tc, 'commissionrate_tc' => $row->commissionrate_tc);
         return true;
     } else {
         // Can't find content for that key - log a warning
         Application_Core_Logger::log('Agent Commission Rate not found in database (agentschemeno = ' . $agent['agentschemeno'] . ')', 'warning');
         return false;
     }
 }
예제 #23
0
 /**
  * Fetch options from the database
  *
  * @param none
  * @return array
  */
 public function fetchOptions()
 {
     $fields = array('policyOption', 'minimumSumInsured', 'policyOptionID');
     $select = $this->select();
     $select->from($this->_name, $fields);
     $select->where('optionType = ?', $this->_optionType);
     $this->_options = $this->fetchAll($select);
     if (count($this->_options) > 0) {
         return $this->_options;
     } else {
         // Can't find policy options for this type - log a warning
         Application_Core_Logger::log("Policy options not found in database (optionType = {$this->_optionType})", 'warning');
         return false;
     }
 }
 /**
  * This function will add a new note into the agentNotes table
  *
  * @param int schemeNumber
  * @param string note
  * @return boolean
  *
  */
 public function addEnquiry($enquiryData)
 {
     #	Zend_Debug::dump($enquiryData);
     $rsAddress = new Manager_Core_Postcode();
     $riskAddress = $rsAddress->getPropertyByID($enquiryData['ins_address'], false);
     #Zend_Debug::dump($riskAddress);die();
     $insertData = array('agentschemeno' => $enquiryData['agentschemeno'], 'title' => $enquiryData['title'], 'first_name' => $enquiryData['first_name'], 'last_name' => $enquiryData['last_name'], 'phone_number' => $enquiryData['phone_number'], 'mobile_number' => $enquiryData['mobile_number'], 'address_id' => $riskAddress['id'], 'houseNumber' => $riskAddress['houseNumber'], 'buildingName' => $riskAddress['buildingName'], 'address1' => $riskAddress['address1'], 'address2' => $riskAddress['address2'], 'address3' => $riskAddress['address3'], 'address4' => $riskAddress['address4'], 'address5' => $riskAddress['address5'], 'postcode' => $riskAddress['postcode'], 'county' => $riskAddress['county'], 'postcode' => $riskAddress['postcode'], 'organisation' => $riskAddress['organisation'], 'department' => $riskAddress['department'], 'additional_information' => $enquiryData['additional_information'], 'isSent' => 0, 'enquiry_type' => $enquiryData['prospector'], 'created' => new Zend_Db_Expr('NOW()'));
     // Insert the data into a new row in the table
     if ($this->insert($insertData)) {
         return true;
     } else {
         // Failed insertion
         Application_Core_Logger::log("Can't insert  in table {$this->_name} (AGENTSCHEMENUMBER = {$schemeNumber})", 'error');
         return false;
     }
 }
 /**
  * Updates a Transaction Support record
  *
  * @param Model_Core_TransactionSupport $transactionSupport
  * @return bool
  */
 public function updateTransactionSupport(Model_Core_TransactionSupport $transactionSupport)
 {
     // Firstly we need to see if this already exists
     $select = $this->select();
     $select->where('TransID = ?', $transactionSupport->getTransId());
     $row = $this->fetchRow($select);
     // There should only be a single transaction support with the given id
     if (count($row) == 1) {
         $data = array('TransID' => $transactionSupport->getTransId(), 'EnquiryID' => $transactionSupport->getEnquiryId(), 'ProductID' => $transactionSupport->getProductId(), 'AgentTypeID' => $transactionSupport->getAgentTypeId(), 'DealAgentTypeID' => $transactionSupport->getDealAgentTypeId(), 'Guarantor' => $transactionSupport->getGuarantor(), 'Band' => $transactionSupport->getBand(), 'Duration' => $transactionSupport->getDuration(), 'Renewal' => $transactionSupport->getRenewal(), 'RunningAmount' => $transactionSupport->getRunningAmount(), 'Insurance' => $transactionSupport->getInsurance(), 'IPT' => $transactionSupport->getIpt(), 'Income' => $transactionSupport->getIncome(), 'Invoiced' => $transactionSupport->getInvoiced(), 'Transdate' => $transactionSupport->getTransdate(), 'StatusChangeDate' => $transactionSupport->getStatusChangeDate());
         $where = $this->_db->quoteInto('TransID = ?', $transactionSupport->getTransId());
         $this->update($data, $where);
         return true;
     }
     Application_Core_Logger::log("Can't update transaction support claim in table {$this->_name}", 'error');
     return false;
 }
예제 #26
0
 /**
  * Updates a transaction record
  *
  * @param Model_Core_Transaction $transaction
  * @return bool
  */
 public function updateTransaction(Model_Core_Transaction $transaction)
 {
     // Firstly we need to see if this already exists
     $select = $this->select();
     $select->where('ID = ?', $transaction->getId());
     $row = $this->fetchRow($select);
     // There should only be a single transaction with the given id
     if (count($row) == 1) {
         $data = array('PreviousID' => $transaction->getPreviousId(), 'EnquiryID' => $transaction->getEnquiryId(), 'Amount' => $transaction->getAmount(), 'StatusID' => $transaction->getStatusId(), 'InvoiceID' => $transaction->getInvoiceId(), 'CreditNoteID' => $transaction->getCreditNoteId(), 'InsuranceNetAmount' => $transaction->getInsuranceNetAmount(), 'TransactionDate' => $transaction->getTransactionDate());
         $where = $this->_db->quoteInto('ID = ?', $transaction->getId());
         $this->update($data, $where);
         return true;
     }
     Application_Core_Logger::log("Can't update transaction claim in table {$this->_name}", 'error');
     return false;
 }
 public function updateInvoiceEmailStatus($agentSchemeNumber)
 {
     try {
         $update_data = array('emailSent' => 1, 'emailSentAt' => new Zend_Db_Expr('NOW()'));
         $where = $this->quoteInto('agentSchemeNumber = ?', $agentSchemeNumber);
         // Insert the data into a new row in the table
         if ($this->update($update_data, $where)) {
             return true;
         }
         // Failed update
         Application_Core_Logger::log("Can't update table {$this->_name} (AGENTSCHEMENUMBER = {$agentSchemeNumber})", 'error');
         return false;
     } catch (Exception $e) {
         throw new Zend_Exception('updateInvoiceEmailStatus - Couldn\'t update...: ' . $e->getMessage());
     }
 }
 /**
  * Retrieves the specified ProductSelection.
  *
  * @param integer $referenceId
  * The unique Reference identifier.
  *
  * @return mixed
  * The ProductSelection details, encapsulated in a Model_Referencing_ProductSelection object,
  * or null if the ProductSelection cannot be found.
  */
 public function getByReferenceId($referenceId)
 {
     $select = $this->select();
     $select->where('reference_id = ?', $referenceId);
     $row = $this->fetchRow($select);
     if (empty($row)) {
         Application_Core_Logger::log(get_class() . '::' . __FUNCTION__ . ':Unable to find ProductSelection.');
         $returnVal = null;
     } else {
         //Populate the details into an Enquiry object.
         $productSelection = new Model_Referencing_ProductSelection();
         $productSelection->referenceId = $referenceId;
         $productSelection->duration = $row->duration;
         $returnVal = $productSelection;
     }
     return $returnVal;
 }
예제 #29
0
 /**
  * Finds a specific tax rate by its type
  *
  * @param string $type
  * @param date $date
  * @return double 
  *
  * @example $ipt=$tax->getTaxByType('ipt');
  */
 function getTaxByType($type, $date = null)
 {
     if (is_null($date)) {
         $date = date("Y-m-d");
     }
     $type = strtoupper($type);
     // Just to be on the safe side ;-)
     $select = $this->select()->from($this->_name, array('id', 'rate'))->where('type = ?', $type)->where('start_date <= ?', $date)->where('end_date >= ? OR end_date IS NULL', $date);
     $row = $this->fetchRow($select);
     if (count($row) > 0) {
         return array('id' => $row['id'], 'rate' => round($row['rate'], 3));
     } else {
         // Can't get tax info - log a warning
         Application_Core_Logger::log("Can't get tax by type from table {$this->_name}", 'warning');
         return null;
     }
 }
예제 #30
0
 /**
  * Retrieves a Model_Referencing_CustomerMap object.
  *
  * @param integer $referenceId The unique Reference identifier.
  * @return mixed A Model_Referencing_CustomerMap, or null if none found.
  */
 public function getReferenceCustomer($referenceId)
 {
     $select = $this->select();
     $select->where('reference_id = ?', $referenceId);
     $referenceCustomerRow = $this->fetchRow($select);
     if (empty($referenceCustomerRow)) {
         Application_Core_Logger::log(get_class() . '::' . __FUNCTION__ . ': Unable to find CustomerMap.');
         $returnVal = null;
     } else {
         //Populate the details into an CustomerMap object.
         $referenceCustomer = new Model_Referencing_CustomerMap();
         $referenceCustomer->customerType = $referenceCustomerRow->customer_type_id;
         $referenceCustomer->customerId = $referenceCustomerRow->customer_id;
         $returnVal = $referenceCustomer;
     }
     return $returnVal;
 }