当前位置: 首页>>代码示例>>PHP>>正文


PHP EmployeeService::saveEmployee方法代码示例

本文整理汇总了PHP中EmployeeService::saveEmployee方法的典型用法代码示例。如果您正苦于以下问题:PHP EmployeeService::saveEmployee方法的具体用法?PHP EmployeeService::saveEmployee怎么用?PHP EmployeeService::saveEmployee使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EmployeeService的用法示例。


在下文中一共展示了EmployeeService::saveEmployee方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testBulkAssignLeaveEntitlements

 public function testBulkAssignLeaveEntitlements()
 {
     $this->fixture = sfConfig::get('sf_plugins_dir') . '/orangehrmLeavePlugin/test/fixtures/LeaveEntitlement.yml';
     TestDataService::populate($this->fixture);
     $dao = new LeaveEntitlementDao();
     $limit = 5000;
     $empList = array();
     $employeeService = new EmployeeService();
     $employeeService->setEmployeeDao(new EmployeeDao());
     for ($i = 0; $i < $limit; $i++) {
         $employee = new Employee();
         $employee->setFirstName($i);
         $employee = $employeeService->saveEmployee($employee);
         array_push($empList, $employee->getEmpNumber());
     }
     $start_time = microtime(true);
     $leaveEntitlement = new LeaveEntitlement();
     $leaveEntitlement->setLeaveTypeId(1);
     $leaveEntitlement->setCreditedDate(date('Y-m-d'));
     $leaveEntitlement->setEntitlementType(LeaveEntitlement::ENTITLEMENT_TYPE_ADD);
     $leaveEntitlement->setDeleted(0);
     $leaveEntitlement->setNoOfDays(2);
     $leaveEntitlement->setFromDate('2012-01-01');
     $leaveEntitlement->setToDate('2012-08-01');
     $result = $dao->bulkAssignLeaveEntitlements($empList, $leaveEntitlement);
     $deference = microtime(true) - $start_time;
     $this->assertEquals(count($empList), $result, "Time Deference - " . $deference);
     echo "Add Entitlement 5000 Time " . $deference;
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:29,代码来源:LeavePerformanceTest.php

示例2: execute

 public function execute($request)
 {
     $loggedInEmpNum = $this->getUser()->getEmployeeNumber();
     $loggedInUserName = $_SESSION['fname'];
     $job = $request->getParameter('job');
     $empNumber = isset($job['emp_number']) ? $job['emp_number'] : $request->getParameter('empNumber');
     /*
      * TODO: $empNumber gets empty when uploaded file size exceeds PHP max upload size.
      * Check for a better solution.
      */
     if (empty($empNumber)) {
         $this->getUser()->setFlash('templateMessage', array('warning', __(TopLevelMessages::FILE_SIZE_SAVE_FAILURE)));
         $this->redirect($request->getReferer());
     }
     $this->empNumber = $empNumber;
     $this->jobInformationPermission = $this->getDataGroupPermissions('job_details', $empNumber);
     $this->ownRecords = $loggedInEmpNum == $empNumber ? true : false;
     if (!$this->IsActionAccessible($empNumber)) {
         $this->forward(sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action'));
     }
     if ($this->getUser()->hasFlash('templateMessage')) {
         list($this->messageType, $this->message) = $this->getUser()->getFlash('templateMessage');
     }
     $employee = $this->getEmployeeService()->getEmployee($empNumber);
     $param = array('empNumber' => $empNumber, 'ESS' => $this->essMode, 'employee' => $employee, 'loggedInUser' => $loggedInEmpNum, 'loggedInUserName' => $loggedInUserName);
     $this->form = new EmployeeJobDetailsForm(array(), $param, true);
     $this->employeeState = $employee->getState();
     if ($loggedInEmpNum == $empNumber) {
         $this->allowActivate = FALSE;
         $this->allowTerminate = FALSE;
     } else {
         $allowedActions = $this->getContext()->getUserRoleManager()->getAllowedActions(WorkflowStateMachine::FLOW_EMPLOYEE, $this->employeeState);
         $this->allowActivate = in_array(WorkflowStateMachine::EMPLOYEE_ACTION_REACTIVE, $allowedActions);
         $this->allowTerminate = in_array(WorkflowStateMachine::EMPLOYEE_ACTION_TERMINATE, $allowedActions);
     }
     $paramForTerminationForm = array('empNumber' => $empNumber, 'employee' => $employee, 'allowTerminate' => $this->allowTerminate, 'allowActivate' => $this->allowActivate);
     $this->employeeTerminateForm = new EmployeeTerminateForm(array(), $paramForTerminationForm, true);
     if ($this->getRequest()->isMethod('post')) {
         // Handle the form submission
         $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName()));
         if ($this->form->isValid()) {
             // save data
             if ($this->jobInformationPermission->canUpdate()) {
                 $service = new EmployeeService();
                 $service->saveEmployee($this->form->getEmployee(), false);
             }
             $this->form->updateAttachment();
             $this->getUser()->setFlash('templateMessage', array('success', __(TopLevelMessages::UPDATE_SUCCESS)));
         } else {
             $validationMsg = '';
             foreach ($this->form->getWidgetSchema()->getPositions() as $widgetName) {
                 if ($this->form[$widgetName]->hasError()) {
                     $validationMsg .= $this->form[$widgetName]->getError()->getMessageFormat();
                 }
             }
             $this->getUser()->setFlash('templateMessage', array('warning', $validationMsg));
         }
         $this->redirect('pim/viewJobDetails?empNumber=' . $empNumber);
     }
 }
开发者ID:THM068,项目名称:orangehrm,代码行数:60,代码来源:viewJobDetailsAction.class.php

示例3: setUp

 protected function setUp()
 {
     TestDataService::truncateSpecificTables(array('Employee', 'Leave', 'LeaveRequest', 'LeaveType', 'EmployeeLeaveEntitlement', 'LeavePeriod'));
     // Save leave type
     $leaveTypeData = sfYaml::load(sfConfig::get('sf_plugins_dir') . '/orangehrmCoreLeavePlugin/test/fixtures/leaveType.yml');
     $leaveTypeDao = new LeaveTypeDao();
     $leaveType = new LeaveType();
     $leaveType->setLeaveTypeName($leaveTypeData['leaveType']['LT_001']['name']);
     //                $leaveType->setLeaveRules($leaveTypeData['leaveType']['LT_001']['rule']);
     $leaveTypeDao->saveLeaveType($leaveType);
     $this->leaveType = $leaveType;
     $this->leaveTypeId = $leaveType->getLeaveTypeId();
     // Save leave Period
     $leavePeriodData = sfYaml::load(sfConfig::get('sf_plugins_dir') . '/orangehrmCoreLeavePlugin/test/fixtures/leavePeriod.yml');
     $leavePeriodService = new LeavePeriodService();
     $leavePeriodService->setLeavePeriodDao(new LeavePeriodDao());
     $leavePeriod = new LeavePeriod();
     $leavePeriod->setStartDate($leavePeriodData['leavePeriod']['1']['startDate']);
     $leavePeriod->setEndDate($leavePeriodData['leavePeriod']['1']['endDate']);
     $leavePeriodService->saveLeavePeriod($leavePeriod);
     $this->leavePeriod = $leavePeriod;
     $this->leavePeriodId = $leavePeriod->getLeavePeriodId();
     // Save Employee
     $employeeservice = new EmployeeService();
     $this->employee = new Employee();
     $employeeservice->saveEmployee($this->employee);
     $this->empNumber = $this->employee->getEmpNumber();
     // save leave quota
     $this->leaveEntitlement = sfYaml::load(sfConfig::get('sf_plugins_dir') . '/orangehrmCoreLeavePlugin/test/fixtures/leaveEntitlement.yml');
     $this->leaveEntitlementDao = new LeaveEntitlementDao();
 }
开发者ID:THM068,项目名称:orangehrm,代码行数:31,代码来源:LeaveEntitlementDaoTest.php

示例4: import


//.........这里部分代码省略.........
         $employee->setJoinedDate($joinedDate);
     }
     $jobTitle = $this->isValidJobTitle($data[28]);
     if (!empty($jobTitle)) {
         $employee->setJobTitleCode($jobTitle);
     }
     if ($data[29] != "" && is_numeric($data[29])) {
         $employee->setTotalExperience($data[29]);
     }
     if ($data[30] != "" && is_numeric($data[30])) {
         $employee->setCurrentExperience($data[30]);
     }
     if ($data[31] != "" && is_numeric($data[31])) {
         $employee->setNoticePeriod($data[31]);
     }
     if (strlen($data[32]) <= 50) {
         $employee->setProject($data[32]);
     }
     if (strlen($data[33]) <= 50) {
         $employee->setReferredBy($data[33]);
     }
     if (strlen($data[34]) <= 50) {
         $employee->setCustom4($data[34]);
     }
     if (strlen($data[38]) <= 50) {
         $employee->setCustom2($data[38]);
     }
     if (strlen($data[39]) <= 50) {
         $employee->setCustom3($data[39]);
     }
     if (strlen($data[40]) <= 50) {
         $employee->setCustom1($data[40]);
     }
     $employee = $empService->saveEmployee($employee);
     if ($data[35] != "" && $data[36] != "") {
         $employeeSalary = new EmployeeSalary();
         $employeeSalary->setSalaryName("CTC");
         $employeeSalary->setPayPeriodId("4");
         $employeeSalary->setCurrencyCode($data[36]);
         $employeeSalary->setAmount($data[35]);
         $employeeSalary->setEmpNumber($employee);
         $empDirectDebit = new EmpDirectdebit();
         $empDirectDebit->setAccount($data[37]);
         $empDirectDebit->setAccountType("SAVINGS");
         $employeeSalary->setDirectDebit($empDirectDebit);
         $empService->saveEmployeeSalary($employeeSalary);
     }
     if ($data[41] != "" && strlen($data[41]) <= 50) {
         $empPassport = new EmployeeImmigrationRecord();
         $empPassport->setEmployee($employee);
         $empPassport->setNumber($data[41]);
         $empPassport->setCountryCode($data[42]);
         if ($data[43] != "") {
             $expiryDate = $this->formatDate($data[43]);
             $empPassport->setExpiryDate($expiryDate);
         }
         $empPassport->setType(1);
         $empService->saveEmployeeImmigrationRecord($empPassport);
     }
     if ($data[44] != "" && strlen($data[44]) <= 50) {
         $empVisaDetails = new EmployeeImmigrationRecord();
         $empVisaDetails->setEmployee($employee);
         $empVisaDetails->setNumber($data[44]);
         if ($data[45] != "") {
             $visaExpiryDate = $this->formatDate($data[45]);
             $empVisaDetails->setExpiryDate($visaExpiryDate);
开发者ID:abdocmd,项目名称:orangehrm-3.0.1,代码行数:67,代码来源:PimCsvDataImport.php

示例5: import

 public function import($data)
 {
     if ($data[0] == "" || $data[2] == "" || strlen($data[0]) > 30 || strlen($data[2]) > 30) {
         return false;
     }
     $employee = new Employee();
     $employee->setFirstName($data[0]);
     if (strlen($data[1]) <= 30) {
         $employee->setMiddleName($data[1]);
     }
     $employee->setLastName($data[2]);
     if (strlen($data[3]) <= 50) {
         $employee->setEmployeeId($data[3]);
     }
     if (strlen($data[4]) <= 30) {
         $employee->setOtherId($data[4]);
     }
     if (strlen($data[5]) <= 30) {
         $employee->setLicenseNo($data[5]);
     }
     if ($this->isValidDate($data[6])) {
         $employee->setEmpDriLiceExpDate($data[6]);
     }
     if (strtolower($data[7]) == 'male') {
         $employee->setEmpGender('1');
     } else {
         if (strtolower($data[7]) == 'female') {
             $employee->setEmpGender('2');
         }
     }
     if (strtolower($data[8]) == 'single') {
         $employee->setEmpMaritalStatus('Single');
     } else {
         if (strtolower($data[8]) == 'married') {
             $employee->setEmpMaritalStatus('Married');
         } else {
             if (strtolower($data[8]) == 'other') {
                 $employee->setEmpMaritalStatus('Other');
             }
         }
     }
     $nationality = $this->isValidNationality($data[9]);
     if (!empty($nationality)) {
         $employee->setNationality($nationality);
     }
     if ($this->isValidDate($data[10])) {
         $employee->setEmpBirthday($data[10]);
     }
     if (strlen($data[11]) <= 70) {
         $employee->setStreet1($data[11]);
     }
     if (strlen($data[12]) <= 70) {
         $employee->setStreet2($data[12]);
     }
     if (strlen($data[13]) <= 70) {
         $employee->setCity($data[13]);
     }
     if (strlen($data[15]) <= 10) {
         $employee->setEmpZipcode($data[15]);
     }
     $code = $this->isValidCountry($data[16]);
     if (!empty($code)) {
         $employee->setCountry($code);
         if (strtolower($data[16]) == 'united states') {
             $code = $this->isValidProvince($data[14]);
             if (!empty($code)) {
                 $employee->setProvince($code);
             }
         } else {
             if (strlen($data[14]) <= 70) {
                 $employee->setProvince($data[14]);
             }
         }
     }
     if (strlen($data[17]) <= 25 && $this->isValidPhoneNumber($data[17])) {
         $employee->setEmpHmTelephone($data[17]);
     }
     if (strlen($data[18]) <= 25 && $this->isValidPhoneNumber($data[18])) {
         $employee->setEmpMobile($data[18]);
     }
     if (strlen($data[19]) <= 25 && $this->isValidPhoneNumber($data[19])) {
         $employee->setEmpWorkTelephone($data[19]);
     }
     if ($this->isValidEmail($data[20]) && strlen($data[20]) <= 50 && $this->isUniqueEmail($data[20])) {
         $employee->setEmpWorkEmail($data[20]);
     }
     if ($this->isValidEmail($data[21]) && strlen($data[21]) <= 50 && $this->isUniqueEmail($data[21])) {
         $employee->setEmpOthEmail($data[21]);
     }
     $empService = new EmployeeService();
     $empService->saveEmployee($employee);
     return true;
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:93,代码来源:PimCsvDataImport.php


注:本文中的EmployeeService::saveEmployee方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。