public function parseEditData($postArr)
 {
     $tmpArr = null;
     $duplicateArr = array();
     $durationArr = array();
     for ($i = 0; $i < count($postArr['cmbActivity']); $i++) {
         $tmpObj = new TimeEvent();
         $projectId = $postArr['cmbProject'][$i];
         if (!CommonFunctions::isValidId($projectId)) {
             continue;
         }
         $tmpObj->setActivityId($postArr['cmbActivity'][$i]);
         $tmpObj->setProjectId($projectId);
         $txtReportedDate = trim($postArr['txtReportedDate'][$i]);
         $tmpObj->setReportedDate(LocaleUtil::getInstance()->convertToStandardDateFormat($txtReportedDate));
         if (isset($postArr['txtDuration'][$i])) {
             $txtDuration = trim($postArr['txtDuration'][$i]);
             if (!empty($txtDuration) || $txtDuration == 0) {
                 $tmpObj->setDuration($txtDuration * 3600);
             }
         }
         $tmpObj->setDescription(stripslashes($postArr['txtDescription'][$i]));
         if (isset($postArr['txtTimeEventId'][$i])) {
             $tmpObj->setTimeEventId(trim($postArr['txtTimeEventId'][$i]));
         }
         $tmpObj->setEmployeeId(trim($postArr['txtEmployeeId']));
         $tmpObj->setTimesheetId(trim($postArr['txtTimesheetId']));
         $tmpArr[] = $tmpObj;
         /* Checking duplicate rows: Begins */
         $row = $postArr['cmbProject'][$i] . '-' . $postArr['cmbActivity'][$i] . '-' . $postArr['txtReportedDate'][$i];
         if (!in_array($row, $duplicateArr) && !$this->detailedDuplicate) {
             $duplicateArr[] = $row;
         } else {
             $this->detailedDuplicate = true;
         }
         /* Checking duplicate rows: Ends */
         /* Checking for invalid durations: Begins */
         if (!$this->detailedInvalidDuration) {
             $key = trim($postArr['txtReportedDate'][$i]);
             $value = (double) $postArr['txtDuration'][$i];
             if (array_key_exists($key, $durationArr)) {
                 if ($durationArr[$key] + $value > 24) {
                     $this->detailedInvalidDuration = true;
                 } else {
                     $durationArr[$key] = $durationArr[$key] + $value;
                 }
             } else {
                 $durationArr[$key] = $value;
             }
         }
         /* Checking for invalid durations: Ends */
     }
     return $tmpArr;
 }
 /**
  * Parse common data for edit and update
  * @return JobTitle object
  */
 private function _parseCommonData($postArr)
 {
     $jobTitle = new JobTitle();
     $jobTitle->setJobName(CommonFunctions::escapeHtml(trim($postArr['txtJobTitleName'])));
     $jobTitle->setJobDesc(CommonFunctions::escapeHtml(trim($postArr['txtJobTitleDesc'])));
     $jobTitle->setJobComm(CommonFunctions::escapeHtml(trim($postArr['txtJobTitleComments'])));
     $jobTitle->setJobSalGrd(trim($postArr['cmbPayGrade']));
     $jobSpecId = trim($postArr['cmbJobSpecId']);
     if (CommonFunctions::isValidId($jobSpecId)) {
         $jobTitle->setJobSpecId($jobSpecId);
     }
     return $jobTitle;
 }
 public function parseEditData($postArr)
 {
     $tmpArr = null;
     for ($i = 0; $i < count($postArr['cmbActivity']); $i++) {
         $tmpObj = new TimeEvent();
         $projectId = $postArr['cmbProject'][$i];
         if (!CommonFunctions::isValidId($projectId)) {
             continue;
         }
         $tmpObj->setActivityId($postArr['cmbActivity'][$i]);
         $tmpObj->setProjectId($projectId);
         $txtStartTime = trim($postArr['txtStartTime'][$i]);
         if (!empty($txtStartTime)) {
             $tmpObj->setStartTime(LocaleUtil::getInstance()->convertToStandardDateTimeFormat($txtStartTime));
         }
         $txtEndTime = trim($postArr['txtEndTime'][$i]);
         if (!empty($txtEndTime)) {
             $tmpObj->setEndTime(LocaleUtil::getInstance()->convertToStandardDateTimeFormat($txtEndTime));
         }
         $txtReportedDate = trim($postArr['txtReportedDate'][$i]);
         $tmpObj->setReportedDate(LocaleUtil::getInstance()->convertToStandardDateFormat($txtReportedDate));
         if (isset($postArr['txtDuration'][$i])) {
             $txtDuration = trim($postArr['txtDuration'][$i]);
             if (!empty($txtDuration)) {
                 $tmpObj->setDuration($txtDuration * 3600);
             }
         }
         $tmpObj->setDescription(stripslashes($postArr['txtDescription'][$i]));
         if (isset($postArr['txtTimeEventId'][$i])) {
             $tmpObj->setTimeEventId(trim($postArr['txtTimeEventId'][$i]));
         }
         $tmpObj->setEmployeeId(trim($postArr['txtEmployeeId']));
         $tmpObj->setTimesheetId(trim($postArr['txtTimesheetId']));
         $tmpArr[] = $tmpObj;
     }
     return $tmpArr;
 }
 /**
  * Get the job spec for the given job title
  * @param String $jobTitleCode The job title code
  * @return JobSpec JobSpec object or null if no job spec assigned for given job title
  */
 public function getJobSpecForJob($jobTitleCode)
 {
     $jobSpec = null;
     if (CommonFunctions::isValidId($jobTitleCode, 'JOB')) {
         $jobTitle = new JobTitle();
         $jobTitles = $jobTitle->filterJobTitles($jobTitleCode);
         if (is_array($jobTitles) && count($jobTitles) == 1) {
             $jobSpecId = $jobTitles[0][5];
             try {
                 $jobSpec = JobSpec::getJobSpec($jobSpecId);
             } catch (JobSpecException $ex) {
                 // ignore, we will be returning null
             }
         }
     }
     return $jobSpec;
 }
 function reDirect($getArr, $postArr, $object = null)
 {
     $form_creator = new FormCreator($getArr, $postArr);
     switch ($getArr['reqcode']) {
         case 'JSP':
             $form_creator->formPath = '/templates/hrfunct/hrempjobspec.php';
             $ejobsp = new EmpJobSpec();
             $empinfo = new EmpInfo();
             $jdcat = new JDCategory();
             $form_creator->popArr['empdet'] = $empinfo->filterEmpMain($getArr['id']);
             $form_creator->popArr['catlist'] = $jdcat->getJDCatCodes();
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID'];
                 $form_creator->popArr['editArr'] = $ejobsp->filterEmpJobSpec($arr);
             } else {
                 $form_creator->popArr['unasscatlist'] = $jdcat->getUnAssJDCatCodes($getArr['id']);
             }
             $form_creator->popArr['rset'] = $ejobsp->getAssEmpJobSpec($getArr['id']);
             //$form_creator ->popArr['catlist']=$ejobsp->getJDCatCodes();
             break;
         case 'CXT':
             $form_creator->formPath = '/templates/hrfunct/hrempconext.php';
             $empconext = new EmpConExt();
             $empinfo = new EmpInfo();
             $form_creator->popArr['empdet'] = $empinfo->filterEmpMain($getArr['id']);
             $form_creator->popArr['empstat'] = $empinfo->filterEmpJobStat($getArr['id']);
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID'];
                 $form_creator->popArr['editArr'] = $empconext->filterConExt($arr);
                 $form_creator->popArr['lastrec'] = $empconext->getLastRecord($getArr['id']);
             } else {
                 $form_creator->popArr['lastrec'] = $empconext->getLastRecord($getArr['id']);
             }
             $form_creator->popArr['rset'] = $empconext->getAssConExt($getArr['id']);
             break;
         case 'SAL':
             $form_creator->formPath = '/templates/hrfunct/hrempbassal.php';
             $empinfo = new EmpInfo();
             $empbassal = new EmpBasSalary();
             $currTyp = new CurrencyTypes();
             $form_creator->popArr['einfo'] = $empinfo->filterEmpMain($getArr['id']);
             $form_creator->popArr['empdet'] = $empdet = $empinfo->filterEmpJobInfo($getArr['id']);
             $salGrd = $empdet[0][5];
             if (isset($getArr['editID1'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID1'];
                 $arr[2] = $getArr['editID2'];
                 $form_creator->popArr['editArr'] = $edit = $empbassal->filterEmpBasSal($arr);
                 $form_creator->popArr['currlist'] = $empbassal->getCurrCodes($edit[0][1]);
             } else {
                 $form_creator->popArr['curlist'] = $empbassal->getUnAssCurrCodes($salGrd, $getArr['id']);
                 if ($object != null) {
                     $form_creator->popArr['cmbCurrCode'] = $object->cmbCurrCode;
                 }
             }
             $form_creator->popArr['rset'] = $empbassal->getAssEmpBasSal($getArr['id']);
             $form_creator->popArr['currAlllist'] = $currTyp->getAllCurrencyCodes();
             break;
         case 'LAN':
             $form_creator->formPath = '/templates/hrfunct/hremplan.php';
             $empinf = new EmpInfo();
             $emplan = new EmpLanguage();
             $laninfo = new LanguageInfo();
             $form_creator->popArr['empDet'] = $empinf->filterEmpMain($getArr['id']);
             $form_creator->popArr['lanlist'] = $lanlist = $laninfo->getLang();
             if (isset($getArr['editID1'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID1'];
                 $arr[2] = $getArr['editID2'];
                 $form_creator->popArr['editArr'] = $emplan->filterEmpLang($arr);
                 for ($c = 0; count($lanlist) > $c; $c++) {
                     if ($getArr['editID1'] == $lanlist[$c][0]) {
                         $ratSel = $lanlist[$c][2];
                     }
                 }
             } else {
                 if ($object != null) {
                     $form_creator->popArr['cmbLanCode'] = $object->cmbLanCode;
                     for ($c = 0; $lanlist && count($lanlist) > $c; $c++) {
                         if ($lanlist[$c][0] == $object->cmbLanCode) {
                             $ratSel = $lanlist[$c][2];
                         }
                     }
                     $form_creator->popArr['ratSel'] = $ratSel;
                 }
                 $form_creator->popArr['lanlist'] = $laninfo->getLang();
             }
             $form_creator->popArr['rsets'] = $emplan->getAssEmpLang($getArr['id']);
             break;
         case 'MEM':
             $form_creator->formPath = '/templates/hrfunct/hrempmemship.php';
             $empinf = new EmpInfo();
             $empmem = new EmpMembership();
             $memtype = new MembershipType();
             $memshipinfo = new MembershipInfo();
             $form_creator->popArr['empDet'] = $empinf->filterEmpMain($getArr['id']);
             $form_creator->popArr['typlist'] = $typlist = $memtype->getMembershipTypeCodes();
             if (isset($getArr['editID1'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID1'];
                 $arr[2] = $getArr['editID2'];
                 $form_creator->popArr['editArr'] = $edit = $empmem->filterEmpMembership($arr);
                 $form_creator->popArr['mship'] = $memshipinfo->getMembershipCodes($edit[0][2]);
             } else {
                 if ($object != null) {
                     $form_creator->popArr['cmbMemTypeCode'] = $object->cmbMemTypeCode;
                     $form_creator->popArr['mship'] = $memshipinfo->getUnAssMembershipCodes($getArr['id'], $object->cmbMemTypeCode);
                 }
                 $form_creator->popArr['typlist'] = $typlist = $memtype->getMembershipTypeCodes();
             }
             $form_creator->popArr['rset'] = $empmem->getAssEmpMembership($getArr['id']);
             $form_creator->popArr['mshipAll'] = $memshipinfo->getAllMembershipCodes();
             break;
         case 'EXC':
             $form_creator->formPath = '/templates/hrfunct/hrempextcur.php';
             $empinfo = new EmpInfo();
             $empextcur = new EmpExCur();
             $extracurr = new ExtraCurrActCat();
             $extrainfo = new ExtraCurActInfo();
             $form_creator->popArr['empdet'] = $empinfo->filterEmpMain($getArr['id']);
             $form_creator->popArr['catlist'] = $extracurr->getExCurCatCodes();
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID'];
                 $form_creator->popArr['editArr'] = $edit = $empextcur->filterEmpExCur($arr);
                 $form_creator->popArr['typelist'] = $extrainfo->getExCurTypeCodes($edit[0][2]);
             } else {
                 $form_creator->popArr['lastrec'] = $empextcur->getLastRecord($getArr['id']);
                 if ($object != null) {
                     $form_creator->popArr['cmbExtCurCat'] = $catcode = $object->cmbExtCurCat;
                     $form_creator->popArr['typeunasslist'] = $extrainfo->getUnAssExCurTypeCodes($getArr['id'], $catcode);
                 }
             }
             $form_creator->popArr['rset'] = $empextcur->getAssExCur($getArr['id']);
             $form_creator->popArr['allcatlist'] = $extracurr->getExCurCatCodes();
             $form_creator->popArr['alltypelist'] = $extrainfo->getAllExtraCurActInfo();
             break;
         case 'EXP':
             $form_creator->formPath = '/templates/hrfunct/hrempwrkexp.php';
             $empinfo = new EmpInfo();
             $empworkex = new EmpWorkExp();
             $countryinfo = new CountryInfo();
             $proinfo = new ProvinceInfo();
             $form_creator->popArr['empDet'] = $empinfo->filterEmpMain($getArr['id']);
             if ($object != null) {
                 $form_creator->popArr['txtEmpExpCompany'] = $object->txtEmpExpCompany;
                 $form_creator->popArr['txtEmpExpToDat'] = $object->txtEmpExpToDat;
                 $form_creator->popArr['txtEmpExpDesOnLev'] = $object->txtEmpExpDesOnLev;
                 $form_creator->popArr['txtEmpExpYears'] = $object->txtEmpExpYears;
                 $form_creator->popArr['chkEmpExpWorkRelFlag'] = $object->chkEmpExpWorkRelFlag;
                 $form_creator->popArr['txtEmpExpMonths'] = $object->txtEmpExpMonths;
                 $form_creator->popArr['txtEmpExpAdd1'] = $object->txtEmpExpAdd1;
                 $form_creator->popArr['txtEmpExpAcc'] = $object->txtEmpExpAcc;
                 $form_creator->popArr['txtEmpExpAdd2'] = $object->txtEmpExpAdd2;
             }
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID'];
                 $form_creator->popArr['editArr'] = $edit = $empworkex->filterEmpWorkExp($arr);
                 $form_creator->popArr['list'] = $countryinfo->getCountryCodes();
                 if ($object != null) {
                     $form_creator->popArr['txtEmpExpAdd2'] = $pli = $object->txtEmpExpAdd2;
                     $form_creator->popArr['txtEmpExpConPers'] = $object->txtEmpExpConPers;
                     $form_creator->popArr['txtEmpExpAdd3'] = $object->txtEmpExpAdd3;
                     $form_creator->popArr['txtEmpExpTelep'] = $object->txtEmpExpTelep;
                     $form_creator->popArr['txtEmpResLev'] = $object->txtEmpResLev;
                     $form_creator->popArr['txtEmpExpAchmnt'] = $object->txtEmpExpAchmnt;
                     $form_creator->popArr['txtEmpExpFromDat'] = $object->txtEmpExpFromDat;
                     $form_creator->popArr['txtEmpExpEmail'] = $object->txtEmpExpEmail;
                     $form_creator->popArr['plist'] = $empinfo->getProvinceCodes($pli);
                 } else {
                     $form_creator->popArr['plist1'] = $proinfo->getProvinceCodes($edit[0][4]);
                 }
             } else {
                 $form_creator->popArr['newID'] = $empworkex->getLastRecord($getArr['id']);
                 $form_creator->popArr['list'] = $countryinfo->getCountryCodes();
                 if ($object != null) {
                     $form_creator->popArr['txtEmpExpCompany'] = $object->txtEmpExpCompany;
                     $form_creator->popArr['txtEmpExpToDat'] = $object->txtEmpExpToDat;
                     $form_creator->popArr['txtEmpExpDesOnLev'] = $object->txtEmpExpDesOnLev;
                     $form_creator->popArr['txtEmpExpYears'] = $object->txtEmpExpYears;
                     $form_creator->popArr['chkEmpExpWorkRelFlag'] = $object->chkEmpExpWorkRelFlag;
                     $form_creator->popArr['txtEmpExpMonths'] = $object->txtEmpExpMonths;
                     $form_creator->popArr['txtEmpExpAdd1'] = $object->txtEmpExpAdd1;
                     $form_creator->popArr['txtEmpExpAcc'] = $object->txtEmpExpAcc;
                     $form_creator->popArr['txtEmpExpTelep'] = $object->txtEmpExpTelep;
                     $form_creator->popArr['txtEmpResLev'] = $object->txtEmpResLev;
                     $form_creator->popArr['txtEmpExpAchmnt'] = $object->txtEmpExpAchmnt;
                     $form_creator->popArr['txtEmpExpFromDat'] = $object->txtEmpExpFromDat;
                     $form_creator->popArr['txtEmpExpEmail'] = $object->txtEmpExpEmail;
                     $form_creator->popArr['txtEmpExpAdd2'] = $plis = $object->txtEmpExpAdd2;
                     $form_creator->popArr['txtEmpExpAdd3'] = $object->txtEmpExpAdd3;
                     $form_creator->popArr['txtEmpExpConPers'] = $object->txtEmpExpConPers;
                     $form_creator->popArr['plist2'] = $empinfo->getProvinceCodes($plis);
                 }
             }
             $form_creator->popArr['rset'] = $empworkex->getAssEmpWorkExp($getArr['id']);
             break;
         case 'QUA':
             $form_creator->formPath = '/templates/hrfunct/hrempqual.php';
             $empinfo = new EmpInfo();
             $empqual = new EmpQualification();
             $qualtyp = new QualificationType();
             $qual = new Qualifications();
             $form_creator->popArr['statlist'] = array('First Class', 'Second Class Upr.', 'Second Class Lwr.');
             $form_creator->popArr['empdet'] = $empinfo->filterEmpMain($getArr['id']);
             $form_creator->popArr['typlist'] = $qualtyp->getQualificationTypeCodes();
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['editID'];
                 $arr[1] = $getArr['id'];
                 $form_creator->popArr['editArr'] = $empqual->filterEmpQual($arr);
                 $form_creator->popArr['quallist'] = $qual->getAllQualifications();
             } else {
                 if ($object != null) {
                     $form_creator->popArr['TypeCode'] = $object->TypeCode;
                     $form_creator->popArr['mship'] = $qual->getUnAssQualifications($getArr['id'], $object->TypeCode);
                 }
             }
             $form_creator->popArr['rset'] = $empqual->getAssEmpQual($getArr['id']);
             $form_creator->popArr['allquallist'] = $qual->getAllQualifications();
             break;
         case 'QAS':
             $form_creator->formPath = '/templates/hrfunct/hrempqualsub.php';
             $empinfo = new EmpInfo();
             $qual = new Qualifications();
             $empqualsub = new EmpQualSubject();
             $subinfo = new SubjectInfo();
             $form_creator->popArr['empdet'] = $empinfo->filterEmpMain($getArr['id']);
             $form_creator->popArr['qualDet'] = $qual->filterQualifications($getArr['QUA']);
             $form_creator->popArr['sublistAll'] = $subinfo->getSubjectCodes($getArr['QUA']);
             $form_creator->popArr['ratlist'] = $empqualsub->getRatGrds($getArr['QUA']);
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['QUA'];
                 $arr[2] = $getArr['editID'];
                 $form_creator->popArr['editArr'] = $empqualsub->filterEmpQualSub($arr);
             } else {
                 $form_creator->popArr['sublistUnAss'] = $subinfo->getUnAssSubjects($getArr['id'], $getArr['QUA']);
             }
             $arr[0] = $getArr['id'];
             $arr[1] = $getArr['QUA'];
             $form_creator->popArr['sublistAss'] = $empqualsub->getAssEmpQualSub($arr);
             break;
         case 'CBN':
             $form_creator->formPath = '/templates/hrfunct/hrempcashben.php';
             $empinfo = new EmpInfo();
             $empcashben = new EmpCashBen();
             $cashben = new CashBen();
             $form_creator->popArr['empdet'] = $empinfo->filterEmpMain($getArr['id']);
             $form_creator->popArr['bfilter'] = array('Salary Point' => 1, 'Designation' => 2, 'Employee' => 3);
             $form_creator->popArr['benlist'] = $cashben->getBenCodes();
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID'];
                 $form_creator->popArr['editArr'] = $empcashben->filterEmpCashBen($arr);
             }
             $form_creator->popArr['cashbenAss'] = $empcashben->getAssEmpCashBen($getArr['id']);
             $form_creator->popArr['cashbenUnAss'] = $empcashben->getUnAssEmpCashBen($getArr['id']);
             if (isset($getArr['OBEN'])) {
                 $form_creator->popArr['cashbenOther'] = $cashben->getOthEmpCashBen($getArr['id']);
             }
             break;
         case 'NBN':
             $form_creator->formPath = '/templates/hrfunct/hrempnoncashben.php';
             $empinfo = new EmpInfo();
             $empnoncashben = new EmpNonCashBen();
             $noncashben = new NonCashBen();
             $form_creator->popArr['empdet'] = $empinfo->filterEmpMain($getArr['id']);
             $form_creator->popArr['bfilter'] = array('Salary Point' => 1, 'Designation' => 2, 'Employee' => 3);
             $form_creator->popArr['benlist'] = $noncashben->getBenCodes();
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID'];
                 $form_creator->popArr['editArr'] = $empnoncashben->filterEmpNonCashBen($arr);
             }
             $form_creator->popArr['cashbenAss'] = $empnoncashben->getAssEmpNonCashBen($getArr['id']);
             $form_creator->popArr['cashbenUnAss'] = $empnoncashben->getUnAssEmpNonCashBen($getArr['id']);
             if (isset($getArr['OBEN'])) {
                 $form_creator->popArr['cashbenOther'] = $noncashben->getOthEmpNonCashBen($getArr['id']);
             }
             break;
         case 'ESS':
         case 'EMP':
             $form_creator->formPath = '/templates/hrfunct/hrEmpMain.php';
             //hremp.php';
             $form_creator->popArr['arrMStat'] = array('Unmarried', 'Married', 'Divorced', 'Others');
             $empinfo = new EmpInfo();
             $pport = new EmpPassPort();
             $ddebit = new EmpDirectDebit();
             $dep = new EmpDependents();
             $econ = new EmpEmergencyCon();
             $chi = new EmpChildren();
             $attachment = new EmpAttach();
             $countryinfo = new CountryInfo();
             $porinfo = new ProvinceInfo();
             $nationinfo = new NationalityInfo();
             $location = new models_eimadmin_Location();
             $distric = new DistrictInfo();
             $jobtit = new JobTitle();
             $depen = new EmpDependents();
             $ethnicrace = new EthnicRace();
             $eeojobcat = new EEOJobCat();
             $emplan = new EmpLanguage();
             $laninfo = new LanguageInfo();
             $emplicen = new EmpLicenses();
             $licen = new Licenses();
             $empmem = new EmpMembership();
             $memtype = new MembershipType();
             $memshipinfo = new MembershipInfo();
             $emprepto = new EmpRepTo();
             $empskill = new EmpSkill();
             $skill = new Skills();
             $empworkex = new EmpWorkExp();
             $empeducation = new EmpEducation();
             $education = new Education();
             $empTax = new EmpTax();
             $form_creator->popArr['nation'] = $nationinfo->getNationCodes();
             $form_creator->popArr['loc'] = $location->getLocCodes();
             $form_creator->popArr['cntlist'] = $countryinfo->getCountryCodes();
             $form_creator->popArr['ethRace'] = $ethnicrace->getEthnicRaceCodes();
             $form_creator->popArr['eeojobcat'] = $eeojobcat->getEEOJobCatCodes();
             $form_creator->popArr['jobtit'] = $jobtit->getJobTit();
             $form_creator->popArr['hier'] = isset($res) ? $res : false;
             $form_creator->popArr['cntlist'] = $countrylist = $countryinfo->getCountryCodes();
             $form_creator->popArr['ppcntlist'] = $countrylist;
             $form_creator->popArr['customFieldList'] = CustomFields::getCustomFieldList();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $empinfo->getLastId();
                 if ($object != null) {
                     $form_creator->popArr['ctlist'] = $corptit->getCorpTitlesEmpInfo($object->cmbSalGrd);
                     $form_creator->popArr['deslist'] = $des->getDesEmpInfo($object->cmbCorpTit);
                     $form_creator->popArr['plist'] = $porinfo->getProvinceCodes($object->cmbTaxCountry);
                     $form_creator->popArr['resplist'] = $porinfo->getProvinceCodes($object->cmbPermCountry);
                     $form_creator->popArr['resdlist'] = $distric->getDistrictCodes($object->cmbPermProvince);
                     if (isset($postArr['cmbJobTitle'])) {
                         $form_creator->popArr['empstatlist'] = $view_controller->xajaxObjCall($postArr['cmbJobTitle'], 'JOB', 'allEmpStat');
                     }
                     $form_creator->popArr['ethRace'] = $ethnicrace->getEthnicRaceCodes($object->cmbEthnicRace);
                 }
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editTaxInfo'] = $empTax->getEmployeeTaxInfo($getArr['id']);
                 $form_creator->popArr['usStateList'] = $porinfo->getProvinceCodes('US');
                 $form_creator->popArr['empDDAss'] = $ddebit->getEmployeeDirectDebit($getArr['id']);
                 if (isset($getArr['DDSEQ'])) {
                     $form_creator->popArr['editDDForm'] = $ddebit->getDirectDebit($getArr['id'], $getArr['DDSEQ']);
                 }
                 $form_creator->popArr['editMainArr'] = $empinfo->filterEmpMain($getArr['id']);
                 $form_creator->popArr['editPersArr'] = $empinfo->filterEmpPers($getArr['id']);
                 $form_creator->popArr['editJobInfoArr'] = $empJobInfo = $empinfo->filterEmpJobInfo($getArr['id']);
                 $form_creator->popArr['editCustomInfoArr'] = $empCustomInfo = $empinfo->filterEmpCustomInfo($getArr['id']);
                 $view_controller = new ViewController();
                 $form_creator->popArr['empstatlist'] = $view_controller->xajaxObjCall($empJobInfo[0][2], 'JOB', 'allEmpStat');
                 $empJobTitle = $empJobInfo[0][2];
                 if (isset($postArr['cmbJobTitle'])) {
                     $form_creator->popArr['empstatlist'] = $view_controller->xajaxObjCall($postArr['cmbJobTitle'], 'JOB', 'allEmpStat');
                     $empJobTitle = $postArr['cmbJobTitle'];
                 }
                 if (CommonFunctions::isValidId($empJobTitle, 'JOB')) {
                     $empJobSpec = $view_controller->getJobSpecForJob($empJobTitle);
                 } else {
                     $empJobSpec = null;
                 }
                 $form_creator->popArr['jobSpec'] = $empJobSpec;
                 $jobTitleHistory = new JobTitleHistory();
                 $form_creator->popArr['jobTitleHistory'] = $jobTitleHistory->getHistory($getArr['id']);
                 $empDivisionHistory = new SubDivisionHistory();
                 $form_creator->popArr['subDivisionHistory'] = $empDivisionHistory->getHistory($getArr['id']);
                 $locationHistory = new LocationHistory();
                 $form_creator->popArr['locationHistory'] = $locationHistory->getHistory($getArr['id']);
                 $form_creator->popArr['assignedlocationList'] = EmpLocation::getEmpLocations($getArr['id']);
                 $form_creator->popArr['availablelocationList'] = EmpLocation::getUnassignedLocations($getArr['id']);
                 $form_creator->popArr['editPermResArr'] = $edit = $editPermRes = $empinfo->filterEmpContact($getArr['id']);
                 $form_creator->popArr['provlist'] = $porinfo->getProvinceCodes($edit[0][4]);
                 $form_creator->popArr['citylist'] = $distric->getDistrictCodes($edit[0][5]);
                 $form_creator->popArr['empPPAss'] = $pport->getAssEmpPP($getArr['id']);
                 $form_creator->popArr['empDepAss'] = $dep->getAssEmpDep($getArr['id']);
                 $form_creator->popArr['empECAss'] = $econ->getAssEmpEC($getArr['id']);
                 $form_creator->popArr['empChiAss'] = $chi->getAssEmpChi($getArr['id']);
                 $form_creator->popArr['empAttAss'] = $attachment->getAssEmpAtt($getArr['id']);
                 $form_creator->popArr['empDpAss'] = $depen->getAssEmpDep($getArr['id']);
                 $form_creator->popArr['newPPID'] = $pport->getLastRecord($getArr['id']);
                 if (isset($getArr['PPSEQ'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['PPSEQ'];
                     $form_creator->popArr['editPPForm'] = $pport->filterEmpPP($arr);
                 }
                 $form_creator->popArr['newECID'] = $econ->getLastRecord($getArr['id']);
                 if (isset($getArr['ECSEQ'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['ECSEQ'];
                     $form_creator->popArr['editECForm'] = $econ->filterEmpEC($arr);
                 }
                 $form_creator->popArr['newDepID'] = $dep->getLastRecord($getArr['id']);
                 if (isset($getArr['depSEQ'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['depSEQ'];
                     $form_creator->popArr['editDepForm'] = $dep->filterEmpDep($arr);
                 }
                 $form_creator->popArr['newCID'] = $chi->getLastRecord($getArr['id']);
                 if (isset($getArr['CHSEQ'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['CHSEQ'];
                     $form_creator->popArr['editChiForm'] = $chi->filterEmpChi($arr);
                 }
                 if (isset($getArr['ATTACH'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['ATTACH'];
                     $form_creator->popArr['editAttForm'] = $attachment->filterEmpAtt($arr);
                 }
                 $form_creator->popArr['lantype'] = array('Writing' => 1, 'Speaking' => 2, 'Reading' => 3);
                 $form_creator->popArr['grdcodes'] = array('Poor' => 1, 'Basic' => 2, 'Good' => 3, 'Mother Tongue' => 4);
                 $form_creator->popArr['lanlist'] = $lanlist = $laninfo->getLang();
                 if (isset($getArr['lanSEQ'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['lanSEQ'];
                     $arr[2] = $getArr['lanFLU'];
                     $form_creator->popArr['editLanArr'] = $emplan->filterEmpLang($arr);
                 }
                 $form_creator->popArr['rsetLang'] = $emplan->getAssEmpLang($getArr['id']);
                 $form_creator->popArr['allLicenlist'] = $licenlist = $licen->getLicensesCodes();
                 $form_creator->popArr['unassLicenlist'] = $licen->getUnAssLicensesCodes($getArr['id']);
                 if (isset($getArr['LIC'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['LIC'];
                     $form_creator->popArr['editLicenseArr'] = $emplicen->filterEmpLicenses($arr);
                 }
                 $form_creator->popArr['rsetLicense'] = $emplicen->getAssEmpLicenses($getArr['id']);
                 $form_creator->popArr['typlist'] = $typlist = $memtype->getMembershipTypeCodes();
                 if (isset($getArr['MEM'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['MEM'];
                     $arr[2] = $getArr['MTP'];
                     $form_creator->popArr['editMembershipArr'] = $edit = $empmem->filterEmpMembership($arr);
                     $form_creator->popArr['mship'] = $memshipinfo->getMembershipCodes($edit[0][2]);
                 }
                 $form_creator->popArr['rsetMembership'] = $empmem->getAssEmpMembership($getArr['id']);
                 $form_creator->popArr['mshipAll'] = $memshipinfo->getAllMembershipCodes();
                 $empbassal = new EmpBasSalary();
                 $currTyp = new CurrencyTypes();
                 $jobtit = new JobTitle();
                 $salgradelist = new SalaryGrades();
                 $form_creator->popArr['salgradelist'] = $salgradelist->getSalGrades(true);
                 $empdet = $empinfo->filterEmpJobInfo($getArr['id']);
                 $jt = $jobtit->filterJobTitles($empdet[0][2]);
                 $form_creator->popArr['payPeriodList'] = PayPeriod::getPayPeriodList();
                 $form_creator->popArr['salGrd'] = $salGrd = $empbassal->getEmpSalGrade($getArr['id']);
                 if (isset($getArr['PAY'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['PAY'];
                     $arr[2] = $getArr['CUR'];
                     $form_creator->popArr['editPaymentArr'] = $edit = $empbassal->filterEmpBasSal($arr);
                     $form_creator->popArr['salGrd'] = $salGrd = $edit[0][1];
                     $form_creator->popArr['currlist'] = $empbassal->getCurrCodes($edit[0][1]);
                 }
                 $form_creator->popArr['unAssCurrList'] = $empbassal->getUnAssCurrCodes($salGrd, $getArr['id']);
                 $form_creator->popArr['rsetPayment'] = $empbassal->getAssEmpBasSal($getArr['id']);
                 $form_creator->popArr['currAlllist'] = $currTyp->getAllCurrencyCodes();
                 $form_creator->popArr['suprset'] = $emprepto->getEmpSup($getArr['id']);
                 $form_creator->popArr['empname'] = $empinfo->getEmpInfo();
                 $form_creator->popArr['subrset'] = $emprepto->getEmpSub($getArr['id']);
                 if (isset($getArr['editIDSup'])) {
                     $arr[0] = $getArr['editIDSup'];
                     $arr[1] = $getArr['id'];
                     $arr[2] = $getArr['RepMethod'];
                     $form_creator->popArr['editIDSupInfo'] = $emprepto->filterEmpRepTo($arr);
                 }
                 if (isset($getArr['editIDSub'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['editIDSub'];
                     $arr[2] = $getArr['RepMethod'];
                     $form_creator->popArr['editIDSubInfo'] = $emprepto->filterEmpRepTo($arr);
                 }
                 $form_creator->popArr['allSkilllist'] = $skill->getSkillCodes();
                 $form_creator->popArr['uskilllist'] = $skill->getUnAssSkillCodes($getArr['id']);
                 if (isset($getArr['SKILL'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['SKILL'];
                     $form_creator->popArr['editSkillArr'] = $empskill->filterEmpSkill($arr);
                 }
                 $form_creator->popArr['rsetSkill'] = $empskill->getAssEmpSkill($getArr['id']);
                 $form_creator->popArr['newWrkExpID'] = $empworkex->getLastRecord($getArr['id']);
                 if (isset($getArr['WRKEXP'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['WRKEXP'];
                     $form_creator->popArr['editWrkExpArr'] = $edit = $empworkex->filterEmpWorkExp($arr);
                 }
                 $form_creator->popArr['rsetWrkExp'] = $empworkex->getAssEmpWorkExp($getArr['id']);
                 $form_creator->popArr['allEduCodes'] = $education->getListofEducation(0, '', 0);
                 $form_creator->popArr['unAssEduCodes'] = $empeducation->getUnAssEduCodes($getArr['id']);
                 if (isset($getArr['EDU'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['EDU'];
                     $form_creator->popArr['editEducationArr'] = $empeducation->filterEmpEducation($arr);
                 }
                 $form_creator->popArr['rsetEducation'] = $empeducation->getAssEmpEducation($getArr['id']);
                 if ($object != null) {
                     $form_creator->popArr['ctlist'] = $corptit->getCorpTitlesEmpInfo($object->cmbSalGrd);
                     $form_creator->popArr['deslist'] = $des->getDesEmpInfo($object->cmbCorpTit);
                     $form_creator->popArr['resplist'] = $porinfo->getProvinceCodes($object->cmbPermCountry);
                     $form_creator->popArr['resdlist'] = $distric->getDistrictCodes($object->cmbPermProvince);
                     $form_creator->popArr['brchlist'] = $brch->getUnAssBranchCodes($getArr['id'], $object->cmbBank);
                     $form_creator->popArr['ctlist'] = $empinfo->getCorpTitles($object->cmbSalGrd);
                     $form_creator->popArr['deslist'] = $empinfo->getDes($object->cmbCorpTit);
                     $form_creator->popArr['resplist'] = $empinfo->getProvinceCodes($object->cmbPermCountry);
                     $form_creator->popArr['resdlist'] = $empinfo->getDistrictCodes($object->cmbPermProvince);
                     $form_creator->popArr['brchlist'] = $brch->getUnAssBranchCodes($getArr['id'], $object->cmbBank);
                 } else {
                     $form_creator->popArr['resplist'] = $porinfo->getProvinceCodes($editPermRes[0][10]);
                     $form_creator->popArr['resdlist'] = $distric->getDistrictCodes($editPermRes[0][11]);
                 }
                 $empconext = new EmpConExt();
                 $form_creator->popArr['newConExtID'] = $empconext->getLastRecord($getArr['id']);
                 if (isset($getArr['CONEXT'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['CONEXT'];
                     $form_creator->popArr['editConExtArr'] = $empconext->filterConExt($arr);
                 }
                 $form_creator->popArr['rsetConExt'] = $empconext->getAssConExt($getArr['id']);
             }
             break;
         case 'REP':
             $form_creator->formPath = '/templates/hrfunct/hremprepto.php';
             $empinfo = new EmpInfo();
             $emprepto = new EmpRepTo();
             $form_creator->popArr['empdet'] = $empinfo->filterEmpMain($getArr['id']);
             $form_creator->popArr['suprset'] = $emprepto->getEmpSup($getArr['id']);
             $form_creator->popArr['empname'] = $empinfo->getEmpInfo();
             $form_creator->popArr['subrset'] = $emprepto->getEmpSub($getArr['id']);
             if (isset($getArr['editIDSup'])) {
                 $arr[0] = $getArr['editIDSup'];
                 $arr[1] = $getArr['id'];
                 $arr[2] = $getArr['repmethod'];
                 $form_creator->popArr['editIDSupInfo'] = $emprepto->filterEmpRepTo($arr);
             }
             if (isset($getArr['editIDSub'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editIDSub'];
                 $arr[2] = $getArr['repmethod'];
                 $form_creator->popArr['editIDSubInfo'] = $emprepto->filterEmpRepTo($arr);
             }
             break;
         case 'SKI':
             $form_creator->formPath = '/templates/hrfunct/hrempskill.php';
             $empinf = new EmpInfo();
             $empskill = new EmpSkill();
             $skill = new Skills();
             $form_creator->popArr['empDet'] = $empinf->filterEmpMain($getArr['id']);
             $form_creator->popArr['allSkilllist'] = $skill->getSkillCodes();
             if (isset($getArr['editID1'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID1'];
                 $arr[2] = $getArr['editID2'];
                 $form_creator->popArr['editArr'] = $empskill->filterEmpSkill($arr);
             } else {
                 $form_creator->popArr['uskilllist'] = $skill->getUnAssSkillCodes($getArr['id']);
             }
             $form_creator->popArr['rsets'] = $empskill->getAssEmpSkill($getArr['id']);
             break;
         case 'LIC':
             $form_creator->formPath = '/templates/hrfunct/hremplicenses.php';
             $empinf = new EmpInfo();
             $emplicen = new EmpLicenses();
             $licen = new Licenses();
             $form_creator->popArr['empDet'] = $empinf->filterEmpMain($getArr['id']);
             $form_creator->popArr['allLicenlist'] = $licenlist = $licen->getLicensesCodes();
             $form_creator->popArr['unassLicenlist'] = $licen->getUnAssLicensesCodes($getArr['id']);
             if (isset($getArr['editID1'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID1'];
                 $arr[2] = $getArr['editID2'];
                 $form_creator->popArr['editArr'] = $emplicen->filterEmpLicenses($arr);
             }
             $form_creator->popArr['rsets'] = $emplicen->getAssEmpLicenses($getArr['id']);
             break;
     }
     $form_creator->display();
 }
Exemple #6
0
 /**
  * Delete workshifts
  * @param array $workShiftIds array of work sheet id's to delete
  */
 public static function deleteWorkshifts($workshiftIds)
 {
     if (!is_array($workshiftIds) || empty($workshiftIds)) {
         throw new WorkshiftException("Invalid Parameter", WorkshiftException::INVALID_PARAMETER);
     }
     foreach ($workshiftIds as $id) {
         if (!CommonFunctions::isValidId($id)) {
             throw new WorkshiftException("Invalid ID in array", WorkshiftException::INVALID_ID);
         }
     }
     self::_deleteWorkshifts($workshiftIds);
 }
Exemple #7
0
 /**
  * Get list of job applications.
  * If optional emp number is given, only job applications associated with given manager
  * are returned.
  *
  * @param int $managerEmpNum Employee number of manager.
  * @return Array Array of JobApplication objects.
  */
 public static function getList($managerEmpNum = null)
 {
     if (!empty($managerEmpNum) && !CommonFunctions::isValidId($managerEmpNum)) {
         throw new JobApplicationException("Invalid id", JobApplicationException::INVALID_PARAMETER);
     }
     return self::_getList(null, $managerEmpNum);
 }
Exemple #8
0
 /**
  * Deletes the given custom fields
  *
  * @param array $fieldNumbers The list of custom fields to delete
  *
  * @return int Number of custom fields deleted.
  */
 public static function deleteFields($fieldNumbers)
 {
     $count = 0;
     if (!is_array($fieldNumbers)) {
         throw new CustomFieldsException("Invalid parameter to deleteFields(): activityIds should be an array");
     }
     foreach ($fieldNumbers as $num) {
         if (!CommonFunctions::isValidId($num)) {
             throw new CustomFieldsException("Invalid parameter to deleteFields(): field num = {$num}");
         }
     }
     if (!empty($fieldNumbers)) {
         $sql = sprintf("DELETE FROM %s WHERE `%s` IN (%s)", self::TABLE_NAME, self::DB_FIELDS_NUM, implode(",", $fieldNumbers));
         $conn = new DMLFunctions();
         $result = $conn->executeQuery($sql);
         if ($result) {
             $count = mysql_affected_rows();
         }
     }
     return $count;
 }
 /**
  * Get job application Event with given id
  *
  * @param int $id Job Application Event ID
  * @return JobApplicationEvent JobApplicationEvent object
  */
 public static function getJobApplicationEvent($id)
 {
     if (!CommonFunctions::isValidId($id)) {
         throw new JobApplicationEventException("Invalid id", JobApplicationEventException::INVALID_PARAMETER);
     }
     $conditions[] = self::DB_FIELD_ID . ' = ' . $id;
     $list = self::_getList($conditions);
     $application = count($list) == 1 ? $list[0] : null;
     return $application;
 }
Exemple #10
0
 /**
  * Validate the code
  *
  * @param mixed $code Code
  * @return boolean true if code valid, false otherwise
  */
 protected function validateCode($code)
 {
     return CommonFunctions::isValidId($code, 'JOB');
 }
Exemple #11
0
 /**
  * Get job spec with given ID
  * @param int $id The job spec ID
  * @return JobSpec Job Spec object with given id or null if not found
  */
 public static function getJobSpec($id)
 {
     if (!CommonFunctions::isValidId($id)) {
         throw new JobSpecException("Invalid parameters to getJobSpec(): id = {$id}", JobSpecException::INVALID_PARAMETER);
     }
     $selectCondition[] = self::DB_FIELD_ID . " = {$id}";
     $actList = self::_getList($selectCondition);
     $obj = count($actList) == 0 ? null : $actList[0];
     return $obj;
 }
 /**
  * Validates that the member variables are valid
  *
  * @throws EmpHistoryException if not valid
  */
 private function _validateParams()
 {
     if (!CommonFunctions::isValidId($this->empNumber)) {
         throw new EmpHistoryException("Invalid emp number", EmpHistoryException::INVALID_PARAMETER);
     }
     if (!$this->validateCode($this->code)) {
         throw new EmpHistoryException("Code invalid", EmpHistoryException::INVALID_PARAMETER);
     }
     if (!empty($this->id) && !CommonFunctions::isValidId($this->empNumber)) {
         throw new EmpHistoryException("Invalid ID", EmpHistoryException::INVALID_PARAMETER);
     }
     if (empty($this->startDate)) {
         throw new EmpHistoryException("Missing start date", EmpHistoryException::INVALID_PARAMETER);
     } else {
         $start = strtotime($this->startDate);
         if (!empty($this->endDate)) {
             $end = strtotime($this->endDate);
             if ($end < $start) {
                 throw new EmpHistoryException("Missing start date", EmpHistoryException::END_BEFORE_START);
             }
         }
     }
 }
Exemple #13
0
 public static function getPayPeriod($id)
 {
     if (!CommonFunctions::isValidId($id)) {
         throw new HspException("Invalid id", HspException::INVALID_ID);
     }
     $sqlBuilder = new SQLQBuilder();
     $selectTable = "`" . self::PAY_PERIOD_DB_TABLE . "`";
     $selectFields[] = "`" . self::PAY_PERIOD_DB_FIELD_ID . "`";
     $selectFields[] = "`" . self::PAY_PERIOD_DB_FIELD_START_DATE . "`";
     $selectFields[] = "`" . self::PAY_PERIOD_DB_FIELD_END_DATE . "`";
     $selectFields[] = "`" . self::PAY_PERIOD_DB_FIELD_CLOSE_DATE . "`";
     $selectFields[] = "`" . self::PAY_PERIOD_DB_FIELD_CHECK_DATE . "`";
     $selectFields[] = "`" . self::PAY_PERIOD_DB_FIELD_TIMESHEET_APROVAL_DUE_DATE . "`";
     $selectConditions[] = "`" . self::PAY_PERIOD_DB_FIELD_ID . "` = {$id}";
     $selectOrder = "ASC";
     $selectOrderBy = "`" . self::PAY_PERIOD_DB_FIELD_CHECK_DATE . "`";
     $query = $sqlBuilder->simpleSelect($selectTable, $selectFields, $selectConditions, $selectOrderBy, $selectOrder);
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
     $numResults = mysql_num_rows($result);
     if ($numResults == 1) {
         $objs = self::_buildObjArr($result);
         return $objs[0];
     } else {
         if ($numResults == 0) {
             throw new HspPayPeriodException("Invalid number of results returned.", HspPayPeriodException::HSP_NOT_FOUND);
         } else {
             throw new HspPayPeriodException("Invalid number of results returned.", HspPayPeriodException::INVALID_ROW_COUNT);
         }
     }
 }
Exemple #14
0
 private function _update()
 {
     if (!CommonFunctions::isValidId($this->id)) {
         throw new HspPaymentRequest("Invalid id", HspPaymentRequest::INVALID_ID);
     }
     $arrTable = '`' . self::HSP_PAYMENT_REQUEST_DB_TABLE . '`';
     if ($this->dateIncurred != null) {
         $updateFields[] = '`' . self::DB_FIELD_DATE_INCURRED . '`';
         $arrRecordsList[] = "'" . $this->dateIncurred . "'";
     }
     if ($this->providerName != null) {
         $updateFields[] = '`' . self::DB_FIELD_PROVIDER_NAME . '`';
         $arrRecordsList[] = "'" . $this->providerName . "'";
     }
     if ($this->personIncurringExpense != null) {
         $updateFields[] = '`' . self::DB_FIELD_PERSON_INCURRING_EXPENSE . '`';
         $arrRecordsList[] = "'" . $this->personIncurringExpense . "'";
     }
     if ($this->expenseDescription != null) {
         $updateFields[] = '`' . self::DB_FIELD_EXPENSE_DESCRIPTION . '`';
         $arrRecordsList[] = "'" . $this->expenseDescription . "'";
     }
     if ($this->expenseAmount != null) {
         $updateFields[] = '`' . self::DB_FIELD_EXPENSE_AMOUNT . '`';
         $arrRecordsList[] = "'" . $this->expenseAmount . "'";
     }
     if ($this->paymentMadeTo != null) {
         $updateFields[] = '`' . self::DB_FIELD_PAYMENT_MADE_TO . '`';
         $arrRecordsList[] = "'" . $this->paymentMadeTo . "'";
     }
     if ($this->thirdPartyAccountNumber != null) {
         $updateFields[] = '`' . self::DB_FIELD_THIRD_PARTY_ACCOUNT_NUMBER . '`';
         $arrRecordsList[] = "'" . $this->thirdPartyAccountNumber . "'";
     }
     if ($this->mailAddress != null) {
         $updateFields[] = '`' . self::DB_FIELD_MAIL_ADDRESS . '`';
         $arrRecordsList[] = "'" . $this->mailAddress . "'";
     }
     if ($this->comments != null) {
         $updateFields[] = '`' . self::DB_FIELD_COMMENTS . '`';
         $arrRecordsList[] = "'" . $this->comments . "'";
     }
     if ($this->status != null) {
         $updateFields[] = '`' . self::DB_FIELD_STATUS . '`';
         $arrRecordsList[] = "'" . $this->status . "'";
     }
     if ($this->datePaid != null) {
         $updateFields[] = '`' . self::DB_FIELD_DATE_PAID . '`';
         $arrRecordsList[] = "'" . $this->datePaid . "'";
     }
     if ($this->checkNumber != null) {
         $updateFields[] = '`' . self::DB_FIELD_CHECK_NUMBER . '`';
         $arrRecordsList[] = "'" . $this->checkNumber . "'";
     }
     if ($this->hrNotes != null) {
         $updateFields[] = '`' . self::DB_FIELD_HR_NOTES . '`';
         $arrRecordsList[] = "'" . $this->hrNotes . "'";
     }
     $updateConditions[0] = "`" . self::DB_FIELD_ID . "` = '" . $this->id . "'";
     $sqlBuilder = new SQLQBuilder();
     $query = $sqlBuilder->simpleUpdate($arrTable, $updateFields, $arrRecordsList, $updateConditions);
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
     if ($result === false) {
         throw new HspPaymentRequestException("Error in update", HspPaymentRequestException::ERROR_IN_DB_QUERY);
     }
     return mysql_affected_rows();
 }
 /**
  * Delete custom exports with the given ids
  *
  * @param array $ids Array of export id's
  * @return int the number of CustomExport's actually deleted
  */
 public static function deleteExports($ids)
 {
     $count = 0;
     if (!is_array($ids)) {
         throw new CustomExportException("Invalid parameter to deleteExports(): ids should be an array", CustomExportException::INVALID_PARAMETERS);
     }
     foreach ($ids as $id) {
         if (!CommonFunctions::isValidId($id)) {
             throw new CustomExportException("Invalid parameter to deleteExports(): id = {$id}", CustomExportException::INVALID_PARAMETERS);
         }
     }
     if (!empty($ids)) {
         $sql = sprintf("DELETE FROM %s WHERE `%s` IN (%s)", self::TABLE_NAME, self::DB_FIELDS_ID, implode(",", $ids));
         $conn = new DMLFunctions();
         $result = $conn->executeQuery($sql);
         if ($result) {
             $count = mysql_affected_rows();
         }
     }
     return $count;
 }
Exemple #16
0
 private function _getPlugin($type)
 {
     /* If the type is an ID, get the customizable CSV Import class */
     if (CommonFunctions::isValidId($type)) {
         $object = new CustomizableCSVImport($type);
     } else {
         require_once $this->pluginDir . "/" . $type . ".php";
         $object = new $type();
     }
     return $object;
 }
Exemple #17
0
 /**
  * Deletes the given activities
  *
  * @param int   projectId    If set, only activities of this project is affected.
  * @param array $activityIds The list of activities to delete
  *
  * @return int Number of activites deleted.
  */
 public static function deleteActivities($activityIds, $projectId = null)
 {
     $count = 0;
     if (!is_null($projectId) && !CommonFunctions::isValidId($projectId)) {
         throw new ProjectActivityException("Invalid parameters to deleteActivities(): projectId = {$projectId}");
     }
     if (!is_array($activityIds)) {
         throw new ProjectActivityException("Invalid parameter to deleteActivities(): activityIds should be an array");
     }
     foreach ($activityIds as $activityId) {
         if (!CommonFunctions::isValidId($activityId)) {
             throw new ProjectActivityException("Invalid parameter to deleteActivities(): activity id = {$activityId}");
         }
     }
     if (!empty($activityIds)) {
         $sql = sprintf("UPDATE %s SET %s = 1 WHERE %s IN (%s)", self::TABLE_NAME, self::DB_FIELD_DELETED, self::DB_FIELD_ACTIVITY_ID, implode(",", $activityIds));
         if (!empty($projectId)) {
             $sql .= " AND " . self::DB_FIELD_PROJECT_ID . " = {$projectId}";
         }
         $conn = new DMLFunctions();
         $result = $conn->executeQuery($sql);
         if ($result) {
             $count = mysql_affected_rows();
         }
     }
     return $count;
 }
 /**
  * Validates that the empNumber and location are set and valid
  *
  * @throws EmpLocationException if not valid
  */
 private function _validateParams()
 {
     if (!CommonFunctions::isValidId($this->empNumber)) {
         throw new EmpLocationException("Invalid emp number", EmpLocationException::INVALID_PARAMETER);
     }
     if (!CommonFunctions::isValidId($this->location, 'LOC')) {
         throw new EmpLocationException("Location code invalid", EmpLocationException::INVALID_PARAMETER);
     }
 }
 /**
  * Gets a array of projects for which the given employee is a project admin
  *
  * @param int  $empNumber       The employee number
  * @param bool $includeDeleted Included deleted projects
  * @return array Array of Projects objects
  */
 public function getProjectsForAdmin($empNumber, $includeDeleted = false)
 {
     if (!CommonFunctions::isValidId($empNumber)) {
         throw new ProjectAdminException("Invalid parameters to getProjectsForAdmin(): empNumber = {$empNumber}");
     }
     $results = $this->_getProjects($empNumber, null, $includeDeleted);
     if ($results) {
         $projects = Projects::projectObjArr($results);
     }
     if (empty($projects)) {
         $projects = array();
     }
     return $projects;
 }
Exemple #20
0
 /**
  * Get next direct debit sequence number for given employee
  *
  * @param string $empNumber The employee number
  *
  * @return next sequence number
  */
 function getNextSeqNum($empNumber)
 {
     if (!CommonFunctions::isValidId($empNumber)) {
         throw new EmpDirectDebitException("Invalid emp_number = {$empNumber}");
     }
     $sql = "SELECT MAX(" . self::DB_FIELD_SEQNO . ") + 1 FROM " . self::TABLE_NAME . " WHERE " . self::DB_FIELD_EMP_NUMBER . " = " . $empNumber;
     $conn = new DMLFunctions();
     $result = $conn->executeQuery($sql);
     if (!$result) {
         $errMsg = mysql_error();
         throw new EmpDirectDebitException("Error looking for existing MAX Seqence ID. SQL = {$sql}. Msg = {$errMsg}");
     }
     $row = mysql_fetch_array($result, MYSQL_NUM);
     if (empty($row)) {
         throw new IDGeneratorException("Error looking for existing MAX Sequence ID. SQL = {$sql}");
     }
     $nextSeqNum = $row[0];
     if (empty($nextSeqNum)) {
         $nextSeqNum = 1;
     }
     return $nextSeqNum;
 }