public static function parseSaveData($postArr)
 {
     $hspPaymentRequest = new HspPaymentRequest();
     if (!empty($postArr['txtId'])) {
         $hspPaymentRequest->setId($postArr['txtId']);
     }
     if (!empty($postArr['txtEmployeeId'])) {
         $hspPaymentRequest->setEmployeeId($postArr['txtEmployeeId']);
     }
     if (!empty($postArr['cmbPlanName'])) {
         $hspPlanName = $postArr['cmbPlanName'];
     } else {
         if (!empty($postArr['hidPlanName'])) {
             $hspPlanName = $postArr['hidPlanName'];
         }
     }
     $hspPaymentRequest->setHspId(DefineHsp::getHspPlanId($hspPlanName));
     if (!empty($postArr['txtDateIncurred'])) {
         $hspPaymentRequest->setDateIncurred($postArr['txtDateIncurred']);
     }
     if (!empty($postArr['txtProviderName'])) {
         $hspPaymentRequest->setProviderName($postArr['txtProviderName']);
     }
     if (!empty($postArr['txtPersonIncurringExpense'])) {
         $hspPaymentRequest->setPersonIncurringExpense($postArr['txtPersonIncurringExpense']);
     }
     if (!empty($postArr['txtExpenseDescription'])) {
         $hspPaymentRequest->setExpenseDescription($postArr['txtExpenseDescription']);
     }
     if (!empty($postArr['txtExpenseAmount'])) {
         $hspPaymentRequest->setExpenseAmount($postArr['txtExpenseAmount']);
     }
     if (!empty($postArr['txtPaymentMadeTo'])) {
         $hspPaymentRequest->setPaymentMadeTo($postArr['txtPaymentMadeTo']);
     }
     if (!empty($postArr['txtThirdPartyAccountNumber'])) {
         $hspPaymentRequest->setThirdPartyAccountNumber($postArr['txtThirdPartyAccountNumber']);
     }
     if (!empty($postArr['txtMailAddress'])) {
         $hspPaymentRequest->setMailAddress($postArr['txtMailAddress']);
     }
     if (!empty($postArr['txtComments'])) {
         $hspPaymentRequest->setComments($postArr['txtComments']);
     }
     if (!empty($postArr['txtDatePaid'])) {
         $hspPaymentRequest->setDatePaid($postArr['txtDatePaid']);
     }
     if (!empty($postArr['txtCheckNumber'])) {
         $hspPaymentRequest->setCheckNumber($postArr['txtCheckNumber']);
     }
     if (!empty($postArr['checkPaperworkSubmitted'])) {
         $hspPaymentRequest->setPaperWorkSubmitted($postArr['checkPaperworkSubmitted']);
     }
     if (!empty($postArr['txtHrNotes'])) {
         $hspPaymentRequest->setHrNotes($postArr['txtHrNotes']);
     }
     return $hspPaymentRequest;
 }
Пример #2
0
 public function testPayHspRequest()
 {
     $paymentRequest = new HspPaymentRequest();
     $paymentRequest->setId(10);
     try {
         $paymentRequest->payHspRequest();
         $this->fail('Exception not thrown');
     } catch (HspPaymentRequestException $e) {
         $this->assertEquals(HspPaymentRequestException::ALREADY_PAID, $e->getCode(), 'Unexpected exception thrown');
     }
     $paymentRequest = new HspPaymentRequest();
     $paymentRequest->setId(11);
     $paymentRequest->setDatePaid(date('Y-m-d'));
     $paymentRequest->setCheckNumber('bsdfds-gfgbvbv-bfdtr');
     try {
         $paymentRequest->payHspRequest();
         $paymentRequest = HspPaymentRequest::getHspRequest(11);
         $this->assertNotNull($paymentRequest);
         $this->assertEquals(HspPaymentRequest::HSP_PAYMENT_REQUEST_STATUS_PAID, $paymentRequest->getStatus());
     } catch (HspPaymentRequestException $e) {
         $this->fail('Unexpected exception thrown');
     }
 }
Пример #3
0
 private static function _buildObjArr($result)
 {
     $objArr = array();
     while ($row = mysql_fetch_assoc($result)) {
         $tmpArr = new HspPaymentRequest();
         $tmpArr->setId($row[self::DB_FIELD_ID]);
         $tmpArr->setHspId($row[self::DB_FIELD_HSP_ID]);
         $tmpArr->setEmployeeId($row[self::DB_FIELD_EMPLOYEE_ID]);
         $tmpArr->setDateIncurred($row[self::DB_FIELD_DATE_INCURRED]);
         $tmpArr->setProviderName($row[self::DB_FIELD_PROVIDER_NAME]);
         $tmpArr->setPersonIncurringExpense($row[self::DB_FIELD_PERSON_INCURRING_EXPENSE]);
         $tmpArr->setExpenseDescription($row[self::DB_FIELD_EXPENSE_DESCRIPTION]);
         $tmpArr->setExpenseAmount($row[self::DB_FIELD_EXPENSE_AMOUNT]);
         $tmpArr->setPaymentMadeTo($row[self::DB_FIELD_PAYMENT_MADE_TO]);
         $tmpArr->setThirdPartyAccountNumber($row[self::DB_FIELD_THIRD_PARTY_ACCOUNT_NUMBER]);
         $tmpArr->setMailAddress($row[self::DB_FIELD_MAIL_ADDRESS]);
         $tmpArr->setComments($row[self::DB_FIELD_COMMENTS]);
         $tmpArr->setDatePaid($row[self::DB_FIELD_DATE_PAID]);
         $tmpArr->setCheckNumber($row[self::DB_FIELD_CHECK_NUMBER]);
         $tmpArr->setStatus($row[self::DB_FIELD_STATUS]);
         $tmpArr->setHrNotes($row[self::DB_FIELD_HR_NOTES]);
         $objArr[] = $tmpArr;
     }
     return $objArr;
 }