Ejemplo n.º 1
0
 public static function parseHspSaveData($postArr)
 {
     for ($i = 0; $i < count($postArr['hidSummaryId']); $i++) {
         $hspSummaryObj = new HspSummary();
         $hspSummaryObj->setSummaryId($postArr['hidSummaryId'][$i]);
         if (!empty($postArr['hidEmployeeId'][$i]) && is_numeric($postArr['hidEmployeeId'][$i])) {
             $hspSummaryObj->setEmployeeId($postArr['hidEmployeeId'][$i]);
         } else {
             $hspSummaryObj->setEmployeeId(null);
         }
         if (!empty($postArr['txtAnnualLimit'][$i]) && is_numeric($postArr['txtAnnualLimit'][$i])) {
             $hspSummaryObj->setAnnualLimit($postArr['txtAnnualLimit'][$i]);
         } else {
             $hspSummaryObj->setAnnualLimit(0);
         }
         if (!empty($postArr['txtEmployerAmount'][$i]) && is_numeric($postArr['txtEmployerAmount'][$i])) {
             $hspSummaryObj->setEmployerAmount($postArr['txtEmployerAmount'][$i]);
         } else {
             $hspSummaryObj->setEmployerAmount(0);
         }
         if (!empty($postArr['txtEmployeeAmount'][$i]) && is_numeric($postArr['txtEmployeeAmount'][$i])) {
             $hspSummaryObj->setEmployeeAmount($postArr['txtEmployeeAmount'][$i]);
         } else {
             $hspSummaryObj->setEmployeeAmount(0);
         }
         if (!empty($postArr['txtTotalAccrued'][$i]) && is_numeric($postArr['txtTotalAccrued'][$i])) {
             $hspSummaryObj->setTotalAccrued($postArr['txtTotalAccrued'][$i]);
         } else {
             $hspSummaryObj->setTotalAccrued(0);
         }
         if (!empty($postArr['txtTotalUsed'][$i]) && is_numeric($postArr['txtTotalUsed'][$i])) {
             $hspSummaryObj->setTotalUsed($postArr['txtTotalUsed'][$i]);
         } else {
             $hspSummaryObj->setTotalUsed(0);
         }
         $summaryObjArr[] = $hspSummaryObj;
     }
     return $summaryObjArr;
 }