Ejemplo n.º 1
0
 /**
  * Gets a location history object with the given parameters
  */
 private function _getLocationHistory($empNum, $subDivisionCode, $locationName, $startDate, $endDate)
 {
     if (!empty($startDate)) {
         $startDate = date(LocaleUtil::STANDARD_TIMESTAMP_FORMAT, strtotime($startDate));
     }
     if (!empty($endDate)) {
         $endDate = date(LocaleUtil::STANDARD_TIMESTAMP_FORMAT, strtotime($endDate));
     }
     $locationHis = new LocationHistory();
     $locationHis->setEmpNumber($empNum);
     $locationHis->setCode($subDivisionCode);
     $locationHis->setName($locationName);
     $locationHis->setStartDate($startDate);
     $locationHis->setEndDate($endDate);
     return $locationHis;
 }
Ejemplo n.º 2
0
 public function parseEditData($postArr)
 {
     $historyItems = array();
     $empNum = trim($postArr['txtEmpID']);
     // Get job title history
     if (isset($postArr['jobTitleHisId'])) {
         $jobTitleIds = $postArr['jobTitleHisId'];
         $jobTitleCodes = $postArr['jobTitleHisCode'];
         $jobTitleFromDates = $postArr['jobTitleHisFromDate'];
         $jobTitleToDates = $postArr['jobTitleHisToDate'];
         for ($i = 0; $i < count($jobTitleIds); $i++) {
             $history = new JobTitleHistory();
             $id = $jobTitleIds[$i];
             $code = $jobTitleCodes[$i];
             $startDate = LocaleUtil::getInstance()->convertToStandardDateFormat($jobTitleFromDates[$i]);
             $endDate = LocaleUtil::getInstance()->convertToStandardDateFormat($jobTitleToDates[$i]);
             $history->setId($id);
             $history->setCode($code);
             $history->setEmpNumber($empNum);
             $history->setStartDate($startDate);
             $history->setEndDate($endDate);
             $historyItems[] = $history;
         }
     }
     // Get sub division history
     if (isset($postArr['subDivHisId'])) {
         $subDivIds = $postArr['subDivHisId'];
         $subDivCodes = $postArr['subDivHisCode'];
         $subDivFromDates = $postArr['subDivHisFromDate'];
         $subDivToDates = $postArr['subDivHisToDate'];
         for ($i = 0; $i < count($subDivIds); $i++) {
             $history = new SubDivisionHistory();
             $id = $subDivIds[$i];
             $code = $subDivCodes[$i];
             $startDate = LocaleUtil::getInstance()->convertToStandardDateFormat($subDivFromDates[$i]);
             $endDate = LocaleUtil::getInstance()->convertToStandardDateFormat($subDivToDates[$i]);
             $history->setId($id);
             $history->setCode($code);
             $history->setEmpNumber($empNum);
             $history->setStartDate($startDate);
             $history->setEndDate($endDate);
             $historyItems[] = $history;
         }
     }
     // Get location history
     if (isset($postArr['locHisId'])) {
         $locIds = $postArr['locHisId'];
         $locCodes = $postArr['locHisCode'];
         $locFromDates = $postArr['locHisFromDate'];
         $locToDates = $postArr['locHisToDate'];
         for ($i = 0; $i < count($locIds); $i++) {
             $history = new LocationHistory();
             $id = $locIds[$i];
             $startDate = LocaleUtil::getInstance()->convertToStandardDateFormat($locFromDates[$i]);
             $endDate = LocaleUtil::getInstance()->convertToStandardDateFormat($locToDates[$i]);
             $history->setId($id);
             $code = $locCodes[$i];
             $history->setCode($code);
             $history->setEmpNumber($empNum);
             $history->setStartDate($startDate);
             $history->setEndDate($endDate);
             $historyItems[] = $history;
         }
     }
     return $historyItems;
 }