|
@@ -6,50 +6,52 @@
|
|
|
class HumanResourceController extends DooController {
|
|
|
public $data;
|
|
|
public function beforeRun($resource, $action) {
|
|
|
- $this->data ['isHR'] = false;
|
|
|
- $this->data ['isALLHR'] = false;
|
|
|
-
|
|
|
- if ($action == 'appliedEntry' || $action == 'appliedDimission') {
|
|
|
- return '';
|
|
|
- }
|
|
|
-
|
|
|
- Doo::loadModel ( "staffManage" );
|
|
|
- $staffManage = new staffManage ();
|
|
|
- $smList = $staffManage->getInvoiceCMByStaff ( $_COOKIE ["staff"] );
|
|
|
- if (! empty ( $smList )) {
|
|
|
- $this->data ['isHR'] = true;
|
|
|
- }
|
|
|
+ $this->data ['exempt'] = false;
|
|
|
|
|
|
Doo::loadModel ( 'staff' );
|
|
|
$staff = new staff ();
|
|
|
$detail = $staff->getStaffBySid ( $_COOKIE ["staff"] );
|
|
|
|
|
|
- if ($detail ['sid'] != superHR) {
|
|
|
- $accessModular = 'HR';
|
|
|
- $flag = true;
|
|
|
- if (empty ( $detail ['cldAccessArray'] ))
|
|
|
- die ( 'illegal request1' );
|
|
|
- else {
|
|
|
-
|
|
|
- if (in_array ( $accessModular, $detail ['cldAccessArray'] )) {
|
|
|
- if (Doo::acl ()->isAllowed ( $accessModular, $resource, $action )) {
|
|
|
- $flag = true;
|
|
|
- $this->data ['isALLHR'] = true;
|
|
|
- } else {
|
|
|
- $flag = false;
|
|
|
- }
|
|
|
+ // 拥有豁免权限
|
|
|
+ if ($action == 'appliedEntry' || $action == 'appliedDimission' || $action == 'appliedRegular' || $detail ['sid'] == superHR) {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+
|
|
|
+ // 全员权限判定
|
|
|
+ $accessModular = 'HR';
|
|
|
+ if (empty ( $detail ['cldAccessArray'] )) {
|
|
|
+ $flag = false;
|
|
|
+ } else {
|
|
|
+ if (in_array ( $accessModular, $detail ['cldAccessArray'] )) {
|
|
|
+ if (Doo::acl ()->isAllowed ( $accessModular, $resource, $action )) {
|
|
|
+ $flag = true;
|
|
|
} else {
|
|
|
- if ($this->data ['isHR'])
|
|
|
- return '';
|
|
|
- else
|
|
|
- die ( 'illegal request2' );
|
|
|
+ $flag = false;
|
|
|
}
|
|
|
+ } else {
|
|
|
+ $flag = false;
|
|
|
}
|
|
|
-
|
|
|
- if ($flag)
|
|
|
- die ( 'illegal request3' );
|
|
|
- } else {
|
|
|
- $this->data ['isALLHR'] = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 个别审批人临时访问首页权限
|
|
|
+ if (! $flag) {
|
|
|
+ $list = $staff->getApprovalData ( $detail ['sid'] );
|
|
|
+ // $staff->find ( array (
|
|
|
+ // 'asc' => 'sid',
|
|
|
+ // 'where' => "(pendStatus= '2' or pendStatus='3' or pendStatus='5') and ( pendingApprovalsLeave='" . $detail ['sid'] . "' or pendingApprovals='" . $detail ['sid'] . "') ",
|
|
|
+ // 'asArray' => TRUE
|
|
|
+ // ) );
|
|
|
+ $isVisit = count ( $list );
|
|
|
+ if ($isVisit > 0) { // 未做强制不能访问
|
|
|
+
|
|
|
+ if ($action == 'hrEmployee' || $action == 'position' || $action == 'employeeApprovals') {
|
|
|
+ die ( 'illegal request' );
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->data ['exempt'] = true;
|
|
|
+ return '';
|
|
|
+ } else
|
|
|
+ die ( 'illegal request' );
|
|
|
}
|
|
|
}
|
|
|
function __construct() {
|
|
@@ -162,10 +164,11 @@ class HumanResourceController extends DooController {
|
|
|
$staff->InductionDate = date ( "Y-m-d H:i:s" );
|
|
|
|
|
|
if ($staffDetail ['nature'] == 2)
|
|
|
- $staffDetail->practiceDate = date ( "Y-m-d H:i:s" );
|
|
|
+ $staff->practiceDate = date ( "Y-m-d H:i:s" );
|
|
|
if ($staffDetail ['nature'] == 3)
|
|
|
- $staffDetail->probationaryDate = date ( "Y-m-d H:i:s" );
|
|
|
+ $staff->probationaryDate = date ( "Y-m-d H:i:s" );
|
|
|
|
|
|
+ //发送短信
|
|
|
$passwork = mt_rand ( 100000, 999999 );
|
|
|
$staff->passwork = md5 ( $passwork );
|
|
|
|
|
@@ -174,36 +177,71 @@ class HumanResourceController extends DooController {
|
|
|
$msg = $staffDetail ['username'] . ',' . $passwork;
|
|
|
send_sms ( 17280, $staffDetail ['telephone'], '{"%msg%":"' . $msg . '"}' );
|
|
|
}
|
|
|
+
|
|
|
+ // 操作日志
|
|
|
+ Doo::loadModel ( 'staffOperationLog' );
|
|
|
+ $staffOperationLog = new staffOperationLog ();
|
|
|
+ $nature = '';
|
|
|
+ if ($staffDetail ['nature'] == 2) {
|
|
|
+ $nature = '实习';
|
|
|
+ } elseif ($staffDetail ['nature'] == 3) {
|
|
|
+ $nature = '试用';
|
|
|
+ }
|
|
|
+
|
|
|
+ $item = array (
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'operation' => "员工 入职审批通过",
|
|
|
+ 'status' => 3,
|
|
|
+ 'img' => $this->staff ['avatar'],
|
|
|
+ 'username' => $this->staff['username'],
|
|
|
+ 'uid' => $staffDetail ['sid'],
|
|
|
+ 'category' => $this->staff ['category'],
|
|
|
+ 'sid'=>$this->staff ['sid'],
|
|
|
+ );
|
|
|
+
|
|
|
+ $staffOperationLog->setInvoiceOperationLog ( $item );
|
|
|
+
|
|
|
+ //发送微信抄送
|
|
|
+ $msg = '[抄送]'.$staffDetail['category'].'-'.$staffDetail['username'].'申请入职成功\n入职时间:'.$staffDetail['hiredate'];
|
|
|
+
|
|
|
+ $cidmode=$staffDetail['cid'];
|
|
|
+ if(!empty($staffDetail['departmentID']))
|
|
|
+ $cidmode=$staffDetail['cid'].'-'.$staffDetail['departmentID'];
|
|
|
+ $InductionCC=$staffManage->getStaffManageByCid($cidmode);
|
|
|
+ $InductionCC = json_decode ( $InductionCC ['CC'], true );
|
|
|
+
|
|
|
+ foreach ($InductionCC as $value){
|
|
|
+ $this->setWXMsg ( $value[0],$msg );
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$staff->updateDate = date ( "Y-m-d H:i:s" );
|
|
|
$staff->update ( array (
|
|
|
'where' => 'sid=' . $sid
|
|
|
) );
|
|
|
|
|
|
- // 操作日志
|
|
|
- Doo::loadModel ( 'staffOperationLog' );
|
|
|
- $staffOperationLog = new staffOperationLog ();
|
|
|
- $nature = '';
|
|
|
- if ($staffDetail ['nature'] == 2) {
|
|
|
- $nature = '实习';
|
|
|
- } elseif ($staffDetail ['nature'] == 3) {
|
|
|
- $nature = '试用';
|
|
|
- }
|
|
|
|
|
|
- $item = array (
|
|
|
- 'date' => date ( "Y-m-d H:i:s" ),
|
|
|
- 'operation' => $this->staff ['username'] . " 审批通过" . $staffDetail ['username'] . $nature . "入职",
|
|
|
- 'status' => 3,
|
|
|
- 'img' => $staffDetail ['avatar'],
|
|
|
- 'username' => $staffDetail ['username'],
|
|
|
- 'uid' => $staffDetail ['sid'],
|
|
|
- 'category' => $staffDetail ['category']
|
|
|
- );
|
|
|
|
|
|
- $staffOperationLog->setInvoiceOperationLog ( $item );
|
|
|
|
|
|
- return '/hr';
|
|
|
+
|
|
|
+ // 权限跳转
|
|
|
+ $staff = new staff ();
|
|
|
+ $CAAdetail = $staff->getStaffBySid ( $_COOKIE ["staff"] );
|
|
|
+ $accessModular = 'HR';
|
|
|
+ if (in_array ( $accessModular, $CAAdetail ['cldAccessArray'] )) {
|
|
|
+ return '/hr';
|
|
|
+ } else {
|
|
|
+ $list = $staff->getApprovalData ( $CAAdetail ['sid'] );
|
|
|
+
|
|
|
+ $isVisit = count ( $list );
|
|
|
+ if ($isVisit > 0) { // 未做强制不能访问
|
|
|
+ return '/hr';
|
|
|
+ } else {
|
|
|
+ header ( 'Content-Type:text/html;charset=utf-8' );
|
|
|
+ echo "审批成功 <a href='/'>点击跳转首页</a>";
|
|
|
+ die ();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -266,8 +304,26 @@ class HumanResourceController extends DooController {
|
|
|
|
|
|
if (count ( $processApprovals ) == count ( $invoiceManage )) {
|
|
|
$staff->pendStatus = 4;
|
|
|
+ // $staff->nature=4;//离职后需要在人员页面确认离职不用在这改状态
|
|
|
// $staff->dimissionDate = date ( "Y-m-d" );
|
|
|
$staff->pendingApprovalsLeave = 0;
|
|
|
+
|
|
|
+
|
|
|
+ // 操作日志
|
|
|
+ Doo::loadModel ( 'staffOperationLog' );
|
|
|
+ $staffOperationLog = new staffOperationLog ();
|
|
|
+ $item = array (
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'operation' => "员工 离职审批通过",
|
|
|
+ 'status' => 2,
|
|
|
+ 'img' => $this->staff ['avatar'],
|
|
|
+ 'username' => $this->staff['username'],
|
|
|
+ 'uid' => $staffDetail ['sid'],
|
|
|
+ 'category' => $this->staff ['category'],
|
|
|
+ 'sid'=>$this->staff ['sid'],
|
|
|
+ );
|
|
|
+ $staffOperationLog->setInvoiceOperationLog ( $item );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
$staff->updateDate = date ( "Y-m-d H:i:s" );
|
|
@@ -275,21 +331,26 @@ class HumanResourceController extends DooController {
|
|
|
'where' => 'sid=' . $sid
|
|
|
) );
|
|
|
|
|
|
- // 操作日志
|
|
|
- Doo::loadModel ( 'staffOperationLog' );
|
|
|
- $staffOperationLog = new staffOperationLog ();
|
|
|
- $item = array (
|
|
|
- 'date' => date ( "Y-m-d H:i:s" ),
|
|
|
- 'operation' => $this->staff ['username'] . "离职 审批通过" . $staffDetail ['username'],
|
|
|
- 'status' => 2,
|
|
|
- 'img' => $staffDetail ['avatar'],
|
|
|
- 'username' => $staffDetail ['username'],
|
|
|
- 'uid' => $staffDetail ['sid'],
|
|
|
- 'category' => $staffDetail ['category']
|
|
|
- );
|
|
|
- $staffOperationLog->setInvoiceOperationLog ( $item );
|
|
|
|
|
|
- return '/hr';
|
|
|
+
|
|
|
+ // 权限跳转
|
|
|
+ $staff = new staff ();
|
|
|
+ $CAAdetail = $staff->getStaffBySid ( $_COOKIE ["staff"] );
|
|
|
+ $accessModular = 'HR';
|
|
|
+ if (in_array ( $accessModular, $CAAdetail ['cldAccessArray'] )) {
|
|
|
+ return '/hr';
|
|
|
+ } else {
|
|
|
+ $list = $staff->getApprovalData ( $CAAdetail ['sid'] );
|
|
|
+
|
|
|
+ $isVisit = count ( $list );
|
|
|
+ if ($isVisit > 0) { // 未做强制不能访问
|
|
|
+ return '/hr';
|
|
|
+ } else {
|
|
|
+ header ( 'Content-Type:text/html;charset=utf-8' );
|
|
|
+ echo "审批成功 <a href='/'>点击跳转首页</a>";
|
|
|
+ die ();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -352,8 +413,33 @@ class HumanResourceController extends DooController {
|
|
|
|
|
|
if (count ( $processApprovals ) == count ( $invoiceManage )) {
|
|
|
$staff->pendStatus = 0;
|
|
|
+ $staff->nature = 1;
|
|
|
+ // 工号
|
|
|
+ // 生成工号
|
|
|
+ $jobNumber = $this->createJobNumber ();
|
|
|
+ $staff->jobNumber = $jobNumber ['regularStaff'];
|
|
|
// $staff->dimissionDate = date ( "Y-m-d" );
|
|
|
$staff->pendingApprovalsLeave = 0;
|
|
|
+
|
|
|
+ // 操作日志
|
|
|
+ Doo::loadModel ( 'staffOperationLog' );
|
|
|
+ $staffOperationLog = new staffOperationLog ();
|
|
|
+ $item = array (
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'operation' =>"员工 转正审批通过",
|
|
|
+ 'status' => 2,
|
|
|
+
|
|
|
+ 'img' => $this->staff ['avatar'],
|
|
|
+ 'username' => $this->staff['username'],
|
|
|
+ 'uid' => $staffDetail ['sid'],
|
|
|
+ 'category' => $this->staff ['category'],
|
|
|
+ 'sid'=>$this->staff ['sid'],
|
|
|
+
|
|
|
+ );
|
|
|
+ $staffOperationLog->setInvoiceOperationLog ( $item );
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
$staff->updateDate = date ( "Y-m-d H:i:s" );
|
|
@@ -361,21 +447,26 @@ class HumanResourceController extends DooController {
|
|
|
'where' => 'sid=' . $sid
|
|
|
) );
|
|
|
|
|
|
- // 操作日志
|
|
|
- Doo::loadModel ( 'staffOperationLog' );
|
|
|
- $staffOperationLog = new staffOperationLog ();
|
|
|
- $item = array (
|
|
|
- 'date' => date ( "Y-m-d H:i:s" ),
|
|
|
- 'operation' => $this->staff ['username'] . "转正 审批通过" . $staffDetail ['username'],
|
|
|
- 'status' => 2,
|
|
|
- 'img' => $staffDetail ['avatar'],
|
|
|
- 'username' => $staffDetail ['username'],
|
|
|
- 'uid' => $staffDetail ['sid'],
|
|
|
- 'category' => $staffDetail ['category']
|
|
|
- );
|
|
|
- $staffOperationLog->setInvoiceOperationLog ( $item );
|
|
|
|
|
|
- return '/hr';
|
|
|
+
|
|
|
+ // 权限跳转
|
|
|
+ $staff = new staff ();
|
|
|
+ $CAAdetail = $staff->getStaffBySid ( $_COOKIE ["staff"] );
|
|
|
+ $accessModular = 'HR';
|
|
|
+ if (in_array ( $accessModular, $CAAdetail ['cldAccessArray'] )) {
|
|
|
+ return '/hr';
|
|
|
+ } else {
|
|
|
+ $list = $staff->getApprovalData ( $CAAdetail ['sid'] );
|
|
|
+
|
|
|
+ $isVisit = count ( $list );
|
|
|
+ if ($isVisit > 0) { // 未做强制不能访问
|
|
|
+ return '/hr';
|
|
|
+ } else {
|
|
|
+ header ( 'Content-Type:text/html;charset=utf-8' );
|
|
|
+ echo "审批成功 <a href='/'>点击跳转首页</a>";
|
|
|
+ die ();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -388,106 +479,133 @@ class HumanResourceController extends DooController {
|
|
|
$XDeode = new XDeode ( 5 );
|
|
|
Doo::loadModel ( 'staffManage' );
|
|
|
$staffManage = new staffManage ();
|
|
|
-
|
|
|
+
|
|
|
$sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
|
|
|
-
|
|
|
+
|
|
|
$sid = $XDeode->decode ( $sidKey );
|
|
|
if (! is_numeric ( $sid ) || empty ( $sid ))
|
|
|
die ( 'illegal request' );
|
|
|
-
|
|
|
- $staffDetail = $staff->getOne ( array (
|
|
|
- 'where' => 'pendStatus=2 and sid=' . $sid . ' and pendingApprovals=' . $this->staff ['sid'],
|
|
|
- 'asArray' => true
|
|
|
- ) );
|
|
|
-
|
|
|
- if (empty ( $staffDetail ))
|
|
|
- die ( 'illegal request' );
|
|
|
-
|
|
|
- $processApprovals = json_decode ( $staffDetail ['processApprovals'], true );
|
|
|
- $invoiceManage = json_decode ( $staffDetail ['staffManage'], true );
|
|
|
-
|
|
|
- $staff = new staff ();
|
|
|
- if (empty ( $processApprovals )) {
|
|
|
- $processApprovals = array (
|
|
|
- $this->staff ['sid'] => array (
|
|
|
- 'date' => date ( "Y-m-d H:i:s" )
|
|
|
- )
|
|
|
- );
|
|
|
- $nextInvoiceManage = next ( $invoiceManage );
|
|
|
-
|
|
|
- if ($nextInvoiceManage !== false)
|
|
|
- $staff->pendingApprovals = $nextInvoiceManage [0];
|
|
|
- $staff->processApprovals = json_encode ( $processApprovals );
|
|
|
- } else {
|
|
|
- $processApprovals [$this->staff ['sid']] = array (
|
|
|
- 'date' => date ( "Y-m-d H:i:s" )
|
|
|
- );
|
|
|
-
|
|
|
- $pendingApprovals = 0;
|
|
|
- foreach ( $invoiceManage as $key => $value ) {
|
|
|
- if ($value [0] == $this->staff ['sid']) {
|
|
|
- if (isset ( $invoiceManage [$key + 1] ))
|
|
|
- $pendingApprovals = $invoiceManage [$key + 1] [0];
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (! empty ( $pendingApprovals ))
|
|
|
- $staff->pendingApprovals = $pendingApprovals;
|
|
|
- $staff->processApprovals = json_encode ( $processApprovals );
|
|
|
- }
|
|
|
-
|
|
|
- if (count ( $processApprovals ) == count ( $invoiceManage )) {
|
|
|
- $staff->pendStatus = 0;
|
|
|
- $staff->pendingApprovals = 0;
|
|
|
- $staff->InductionDate = date ( "Y-m-d H:i:s" );
|
|
|
-
|
|
|
- if ($staffDetail ['nature'] == 2)
|
|
|
- $staffDetail->practiceDate = date ( "Y-m-d H:i:s" );
|
|
|
- if ($staffDetail ['nature'] == 3)
|
|
|
- $staffDetail->probationaryDate = date ( "Y-m-d H:i:s" );
|
|
|
-
|
|
|
- $passwork = mt_rand ( 100000, 999999 );
|
|
|
- $staff->passwork = md5 ( $passwork );
|
|
|
-
|
|
|
- if (! empty ( $staffDetail ['telephone'] ) && is_numeric ( $staffDetail ['telephone'] )) {
|
|
|
- Doo::loadClass ( 'Human.func' );
|
|
|
- $msg = $staffDetail ['username'] . ',' . $passwork;
|
|
|
- send_sms ( 17280, $staffDetail ['telephone'], '{"%msg%":"' . $msg . '"}' );
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- $staff->updateDate = date ( "Y-m-d H:i:s" );
|
|
|
- $staff->update ( array (
|
|
|
- 'where' => 'sid=' . $sid
|
|
|
- ) );
|
|
|
-
|
|
|
- // 操作日志
|
|
|
- Doo::loadModel ( 'staffOperationLog' );
|
|
|
- $staffOperationLog = new staffOperationLog ();
|
|
|
- $nature = '';
|
|
|
- if ($staffDetail ['nature'] == 2) {
|
|
|
- $nature = '实习';
|
|
|
- } elseif ($staffDetail ['nature'] == 3) {
|
|
|
- $nature = '试用';
|
|
|
+
|
|
|
+ $staffDetail = $staff->getOne ( array (
|
|
|
+ 'where' => 'pendStatus=6 and sid=' . $sid . ' and pendingApprovalsLeave=' . $this->staff ['sid'],
|
|
|
+ 'asArray' => true
|
|
|
+ ) );
|
|
|
+
|
|
|
+ if (empty ( $staffDetail ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ $processApprovals = json_decode ( $staffDetail ['processApprovalsLeave'], true );
|
|
|
+ $invoiceManage = json_decode ( $staffDetail ['staffManageLeave'], true );
|
|
|
+
|
|
|
+ // 审批过程
|
|
|
+ $staff = new staff ();
|
|
|
+ if (empty ( $processApprovals )) {
|
|
|
+ $processApprovals = array (
|
|
|
+ $this->staff ['sid'] => array (
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" )
|
|
|
+ )
|
|
|
+ );
|
|
|
+ $nextInvoiceManage = next ( $invoiceManage );
|
|
|
+
|
|
|
+ if ($nextInvoiceManage !== false)
|
|
|
+ $staff->pendingApprovalsLeave = $nextInvoiceManage [0];
|
|
|
+ $staff->processApprovalsLeave = json_encode ( $processApprovals );
|
|
|
+ } else {
|
|
|
+ $processApprovals [$this->staff ['sid']] = array (
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" )
|
|
|
+ );
|
|
|
+
|
|
|
+ $pendingApprovals = 0;
|
|
|
+ foreach ( $invoiceManage as $key => $value ) {
|
|
|
+ if ($value [0] == $this->staff ['sid']) {
|
|
|
+ if (isset ( $invoiceManage [$key + 1] ))
|
|
|
+ $pendingApprovals = $invoiceManage [$key + 1] [0];
|
|
|
+ break;
|
|
|
}
|
|
|
-
|
|
|
- $item = array (
|
|
|
- 'date' => date ( "Y-m-d H:i:s" ),
|
|
|
- 'operation' => $this->staff ['username'] . " 审批通过" . $staffDetail ['username'] . $nature . "入职",
|
|
|
- 'status' => 3,
|
|
|
- 'img' => $staffDetail ['avatar'],
|
|
|
- 'username' => $staffDetail ['username'],
|
|
|
- 'uid' => $staffDetail ['sid'],
|
|
|
- 'category' => $staffDetail ['category']
|
|
|
- );
|
|
|
-
|
|
|
- $staffOperationLog->setInvoiceOperationLog ( $item );
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
+ if (! empty ( $pendingApprovals ))
|
|
|
+ $staff->pendingApprovalsLeave = $pendingApprovals;
|
|
|
+ $staff->processApprovalsLeave = json_encode ( $processApprovals );
|
|
|
+ }
|
|
|
+
|
|
|
+ $appliedPromote = $staffDetail ['appliedPromote'];
|
|
|
+ $appliedPromote = explode ( '_', $appliedPromote );
|
|
|
+ if (count ( $processApprovals ) == count ( $invoiceManage )) {
|
|
|
+ $staff->pendStatus = 0;
|
|
|
+ $staff->pendingApprovalsLeave = 0;
|
|
|
+ // 岗位薪资调整
|
|
|
+
|
|
|
+ $appliedPromote [4];
|
|
|
+
|
|
|
+ $staff->baseWage = $appliedPromote [2];
|
|
|
+ $staff->postWage = $appliedPromote [3];
|
|
|
+ $staff->achievementBonus = $appliedPromote [4];
|
|
|
+ $staff->positionId = $XDeode->decode ( $appliedPromote [0] );
|
|
|
+
|
|
|
+
|
|
|
+ //发送微信抄送
|
|
|
+
|
|
|
+ $msg = '[抄送]'.$staffDetail['category'].'-'.$staffDetail['username'].'申请晋升成功\n晋升时间:'.date ( "Y-m-d" );
|
|
|
+
|
|
|
+ $cidmode=$staffDetail['cid'];
|
|
|
+ if(!empty($staffDetail['departmentID']))
|
|
|
+ $cidmode=$staffDetail['cid'].'-'.$staffDetail['departmentID'];
|
|
|
+ $InductionCC=$staffManage->getStaffManageByCid($cidmode);
|
|
|
+ $InductionCC = json_decode ( $InductionCC ['CC'], true );
|
|
|
+
|
|
|
+ foreach ($InductionCC as $value){
|
|
|
+ $this->setWXMsg ( $value[0],$msg );
|
|
|
+ }
|
|
|
+
|
|
|
+ // 操作日志
|
|
|
+ Doo::loadModel ( 'staffOperationLog' );
|
|
|
+ $staffOperationLog = new staffOperationLog ();
|
|
|
+ $nature = $appliedPromote [1];
|
|
|
+
|
|
|
+ $item = array (
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'operation' => "员工 晋升审批通过",
|
|
|
+ 'status' => 3,
|
|
|
+
|
|
|
+ 'img' => $this->staff ['avatar'],
|
|
|
+ 'username' => $this->staff['username'],
|
|
|
+ 'uid' => $staffDetail ['sid'],
|
|
|
+ 'category' => $this->staff ['category'],
|
|
|
+ 'sid'=>$this->staff ['sid'],
|
|
|
+ );
|
|
|
+
|
|
|
+ $staffOperationLog->setInvoiceOperationLog ( $item );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ $staff->updateDate = date ( "Y-m-d H:i:s" );
|
|
|
+ $staff->update ( array (
|
|
|
+ 'where' => 'sid=' . $sid
|
|
|
+ ) );
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // 权限跳转
|
|
|
+ $staff = new staff ();
|
|
|
+ $CAAdetail = $staff->getStaffBySid ( $_COOKIE ["staff"] );
|
|
|
+ $accessModular = 'HR';
|
|
|
+ if (in_array ( $accessModular, $CAAdetail ['cldAccessArray'] )) {
|
|
|
+ return '/hr';
|
|
|
+ } else {
|
|
|
+ $list = $staff->getApprovalData ( $CAAdetail ['sid'] );
|
|
|
+
|
|
|
+ $isVisit = count ( $list );
|
|
|
+ if ($isVisit > 0) { // 未做强制不能访问
|
|
|
return '/hr';
|
|
|
+ } else {
|
|
|
+ header ( 'Content-Type:text/html;charset=utf-8' );
|
|
|
+ echo "审批成功 <a href='/'>点击跳转首页</a>";
|
|
|
+ die ();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 员工信息
|
|
|
*/
|
|
@@ -594,7 +712,7 @@ class HumanResourceController extends DooController {
|
|
|
$this->data ['nature'] = $nature;
|
|
|
$this->data ['MebSea'] = $MebSea;
|
|
|
$this->data ['cid_did'] = $cid_did;
|
|
|
-
|
|
|
+ // print_r($stafflist[43]);
|
|
|
$this->data ['categoryList'] = $categoryList;
|
|
|
$this->data ['jobNumber'] = $jobNumber;
|
|
|
$this->data ['stafflist'] = $stafflist;
|
|
@@ -642,7 +760,7 @@ class HumanResourceController extends DooController {
|
|
|
$position = explode ( '_', $position );
|
|
|
|
|
|
$staff->position = $position [1];
|
|
|
- $staff->positionId = $position [0];
|
|
|
+ $staff->positionId = $XDeode->decode ( $position [0] );
|
|
|
|
|
|
$department = explode ( '_', $cid_did );
|
|
|
|
|
@@ -733,10 +851,11 @@ class HumanResourceController extends DooController {
|
|
|
'date' => date ( "Y-m-d H:i:s" ),
|
|
|
'status' => 1,
|
|
|
'img' => '/global/img/avtra',
|
|
|
- 'username' => $username,
|
|
|
+ 'username' =>$this->staff['username'] ,
|
|
|
'uid' => $id,
|
|
|
+ 'sid'=>$this->staff['sid'],
|
|
|
'operation' => "添加新员工",
|
|
|
- 'category' => $cagegory [0] ['title']
|
|
|
+ 'category' =>$this->staff['category']
|
|
|
);
|
|
|
$staffOperationLog->setInvoiceOperationLog ( $item );
|
|
|
|
|
@@ -782,6 +901,24 @@ class HumanResourceController extends DooController {
|
|
|
'jobNumber' => $jobNumber ['regularStaff'],
|
|
|
'regularsDate' => date ( "Y-m-d H:i:s" )
|
|
|
);
|
|
|
+
|
|
|
+
|
|
|
+ //发送微信抄送
|
|
|
+ Doo::loadModel ( 'staffRegularManage' );
|
|
|
+ $staffLeaveManage = new staffRegularManage ();
|
|
|
+ $msg = '[抄送]'.$staffDetail['category'].'-'.$staffDetail['username'].'申请转正成功\n转正时间:'.date ( "Y-m-d" );
|
|
|
+
|
|
|
+ $cidmode=$staffDetail['cid'];
|
|
|
+ if(!empty($staffDetail['departmentID']))
|
|
|
+ $cidmode=$staffDetail['cid'].'-'.$staffDetail['departmentID'];
|
|
|
+ $InductionCC=$staffLeaveManage->getStaffManageByCid($cidmode);
|
|
|
+ $InductionCC = json_decode ( $InductionCC ['CC'], true );
|
|
|
+
|
|
|
+ foreach ($InductionCC as $value){
|
|
|
+ $this->setWXMsg ( $value[0],$msg );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
$staff->setStaffByCondition ( $item );
|
|
|
|
|
@@ -791,10 +928,11 @@ class HumanResourceController extends DooController {
|
|
|
$item = array (
|
|
|
'date' => date ( "Y-m-d H:i:s" ),
|
|
|
'status' => 1,
|
|
|
- 'img' => $staffDetail ['avatar'],
|
|
|
- 'username' => $staffDetail ['username'],
|
|
|
+ 'img' => $this->staff ['avatar'],
|
|
|
+ 'username' => $this->staff['username'],
|
|
|
'uid' => $staffDetail ['sid'],
|
|
|
- 'category' => $staffDetail ['category']
|
|
|
+ 'category' => $this->staff ['category'],
|
|
|
+ 'sid'=>$this->staff ['sid'],
|
|
|
);
|
|
|
if ($nature == 'TRIAL')
|
|
|
$item += array (
|
|
@@ -891,11 +1029,15 @@ class HumanResourceController extends DooController {
|
|
|
$item = array (
|
|
|
'date' => date ( "Y-m-d H:i:s" ),
|
|
|
'status' => 2,
|
|
|
- 'img' => $staffDetail ['avatar'],
|
|
|
- 'username' => $staffDetail ['username'],
|
|
|
+
|
|
|
'operation' => "申请入职",
|
|
|
+
|
|
|
+ 'img' => $staffDetail ['avatar'],
|
|
|
+ 'username' => $staffDetail['username'],
|
|
|
'uid' => $staffDetail ['sid'],
|
|
|
- 'category' => $staffDetail ['category']
|
|
|
+ 'category' => $staffDetail ['category'],
|
|
|
+ 'sid'=>$staffDetail ['sid'],
|
|
|
+
|
|
|
);
|
|
|
$staffOperationLog->setInvoiceOperationLog ( $item );
|
|
|
|
|
@@ -957,7 +1099,10 @@ class HumanResourceController extends DooController {
|
|
|
'username' => $this->staff ['username'],
|
|
|
'operation' => "申请离职",
|
|
|
'uid' => $this->staff ['sid'],
|
|
|
- 'category' => $this->staff ['category']
|
|
|
+ 'category' => $this->staff ['category'] ,
|
|
|
+
|
|
|
+ 'sid'=>$this->staff ['sid'],
|
|
|
+
|
|
|
);
|
|
|
$staffOperationLog->setInvoiceOperationLog ( $item );
|
|
|
|
|
@@ -997,17 +1142,35 @@ class HumanResourceController extends DooController {
|
|
|
// 计算工龄天数
|
|
|
// echo $staff->seniorityFormula;
|
|
|
$day = $this->getSeniority ( $seniorityFormula );
|
|
|
-
|
|
|
+ $dimissionDate=date ( "Y-m-d " );
|
|
|
$item = array (
|
|
|
'sid' => $sid,
|
|
|
'nature' => 4,
|
|
|
'pendStatus' => 4,
|
|
|
'seniorityFormula' => json_encode ( $seniorityFormula ),
|
|
|
'hireBiasDate' => $day,
|
|
|
- 'dimissionDate' => date ( "Y-m-d H:i:s" )
|
|
|
+ 'dimissionDate' => $dimissionDate
|
|
|
);
|
|
|
$staff->setStaffByCondition ( $item );
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ //发送微信抄送
|
|
|
+ Doo::loadModel ( 'staffLeaveManage' );
|
|
|
+ $staffLeaveManage = new staffLeaveManage ();
|
|
|
+ $msg = '[抄送]'.$detail['category'].'-'.$detail['username'].'申请离职成功\n离职时间:'.$dimissionDate;
|
|
|
+
|
|
|
+ $cidmode=$detail['cid'];
|
|
|
+ if(!empty($detail['departmentID']))
|
|
|
+ $cidmode=$detail['cid'].'-'.$detail['departmentID'];
|
|
|
+ $InductionCC=$staffLeaveManage->getStaffManageByCid($cidmode);
|
|
|
+ $InductionCC = json_decode ( $InductionCC ['CC'], true );
|
|
|
+
|
|
|
+ foreach ($InductionCC as $value){
|
|
|
+ $this->setWXMsg ( $value[0],$msg );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
return '/hrEmployee';
|
|
|
}
|
|
|
die ( 'illegal request' );
|
|
@@ -1063,7 +1226,10 @@ class HumanResourceController extends DooController {
|
|
|
'username' => $this->staff ['username'],
|
|
|
'operation' => "申请转正",
|
|
|
'uid' => $this->staff ['sid'],
|
|
|
- 'category' => $this->staff ['category']
|
|
|
+ 'category' => $this->staff ['category'] ,
|
|
|
+
|
|
|
+
|
|
|
+ 'sid'=>$this->staff ['sid'],
|
|
|
);
|
|
|
$staffOperationLog->setInvoiceOperationLog ( $item );
|
|
|
|
|
@@ -1074,11 +1240,10 @@ class HumanResourceController extends DooController {
|
|
|
* 申请晋升
|
|
|
*/
|
|
|
function appliedPromote() {
|
|
|
-
|
|
|
$sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
|
|
|
|
|
|
$position = $this->get_args ( 'position' ) ? $this->get_args ( 'position' ) : '';
|
|
|
-
|
|
|
+
|
|
|
$baseWage = is_numeric ( $this->get_args ( 'baseWage' ) ) ? $this->get_args ( 'baseWage' ) : 0;
|
|
|
$postWage = is_numeric ( $this->get_args ( 'postWage' ) ) ? $this->get_args ( 'postWage' ) : 0;
|
|
|
$achievementBonus = is_numeric ( $this->get_args ( 'achievementBonus' ) ) ? $this->get_args ( 'achievementBonus' ) : 0;
|
|
@@ -1095,29 +1260,30 @@ class HumanResourceController extends DooController {
|
|
|
|
|
|
$detail = $staff->getStaffBySid ( $sid );
|
|
|
|
|
|
- $item = array (
|
|
|
- 'sid' => $sid,
|
|
|
- 'appliedPromote'=>$position.'_'.$baseWage.'_'.$postWage.'_'.$achievementBonus,
|
|
|
- // 状态改成申请晋升
|
|
|
- 'pendStatus' => 6
|
|
|
- );
|
|
|
- $staff->setStaffByCondition ( $item );
|
|
|
-
|
|
|
// 离职审批组
|
|
|
// 获得审批组KEY
|
|
|
- $staff = new staff ();
|
|
|
- $cidMode = $this->staff ['cid'];
|
|
|
- if (! empty ( $this->staff ['departmentID'] ))
|
|
|
- $cidMode = $this->staff ['cid'] . '_' . $this->staff ['departmentID'];
|
|
|
+
|
|
|
+ $cidMode = $detail ['cid'];
|
|
|
+ if (! empty ( $detail ['departmentID'] ))
|
|
|
+ $cidMode = $detail ['cid'] . '_' . $detail ['departmentID'];
|
|
|
|
|
|
$staffManageDetail = $staffLeaveManage->getStaffManageByCid ( $cidMode );
|
|
|
- if (empty ( $staffManageDetail ))
|
|
|
+ if (empty ( $staffManageDetail ['staffList'] ))
|
|
|
die ( 'illegal request ' );
|
|
|
|
|
|
$pendingApprovalsSid = current ( $staffManageDetail ['staffList'] ) [0];
|
|
|
if (empty ( $pendingApprovalsSid ))
|
|
|
die ( 'illegal request ' );
|
|
|
|
|
|
+ $item = array (
|
|
|
+ 'sid' => $sid,
|
|
|
+ 'appliedPromote' => $position . '_' . $baseWage . '_' . $postWage . '_' . $achievementBonus,
|
|
|
+ // 状态改成申请晋升
|
|
|
+ 'pendStatus' => 6
|
|
|
+ );
|
|
|
+ $staff->setStaffByCondition ( $item );
|
|
|
+
|
|
|
+ $staff = new staff ();
|
|
|
$staff->pendingApprovalsLeave = $pendingApprovalsSid;
|
|
|
$staff->staffManageLeave = $staffManageDetail ['staff'];
|
|
|
$staff->processApprovalsLeave = '';
|
|
@@ -1127,17 +1293,25 @@ class HumanResourceController extends DooController {
|
|
|
$staff->processLeaveCC = $staffManageDetail ['CC'];
|
|
|
$staff->update ();
|
|
|
|
|
|
+ $pDetail = explode ( '_', $position );
|
|
|
+
|
|
|
// 操作日志
|
|
|
Doo::loadModel ( 'staffOperationLog' );
|
|
|
$staffOperationLog = new staffOperationLog ();
|
|
|
$item = array (
|
|
|
'date' => date ( "Y-m-d H:i:s" ),
|
|
|
'status' => 3,
|
|
|
- 'img' => $detail ['avatar'],
|
|
|
- 'username' => $detail ['username'],
|
|
|
- 'operation' => "申请晋升",
|
|
|
+
|
|
|
+ 'operation' => "申请晋升" . $pDetail [1],
|
|
|
+
|
|
|
+
|
|
|
+ 'img' => $this->staff ['avatar'],
|
|
|
+ 'username' => $this->staff['username'],
|
|
|
'uid' => $detail ['sid'],
|
|
|
- 'category' => $detail ['category']
|
|
|
+ 'category' => $this->staff ['category'],
|
|
|
+ 'sid'=>$this->staff ['sid'],
|
|
|
+
|
|
|
+
|
|
|
);
|
|
|
$staffOperationLog->setInvoiceOperationLog ( $item );
|
|
|
|
|
@@ -2092,8 +2266,8 @@ class HumanResourceController extends DooController {
|
|
|
$baseWage = is_numeric ( $this->get_args ( 'baseWage' ) ) ? $this->get_args ( 'baseWage' ) : 0;
|
|
|
$postWage = is_numeric ( $this->get_args ( 'postWage' ) ) ? $this->get_args ( 'postWage' ) : 0;
|
|
|
$achievementBonus = is_numeric ( $this->get_args ( 'achievementBonus' ) ) ? $this->get_args ( 'achievementBonus' ) : 0;
|
|
|
-
|
|
|
- if (! empty ( $positionName ) && ! empty ( $positionDescribe ) && ! empty ( $baseWage ) && ! empty ( $postWage ) && ! empty ( $achievementBonus )) {
|
|
|
+ // && ! empty ( $postWage ) && ! empty ( $achievementBonus )
|
|
|
+ if (! empty ( $positionName ) && ! empty ( $positionDescribe ) && ! empty ( $baseWage )) {
|
|
|
|
|
|
Doo::loadClass ( 'XDeode' );
|
|
|
$XDeode = new XDeode ( 5 );
|
|
@@ -2123,8 +2297,8 @@ class HumanResourceController extends DooController {
|
|
|
$baseWage = is_numeric ( $this->get_args ( 'baseWage' ) ) ? $this->get_args ( 'baseWage' ) : 0;
|
|
|
$postWage = is_numeric ( $this->get_args ( 'postWage' ) ) ? $this->get_args ( 'postWage' ) : 0;
|
|
|
$achievementBonus = is_numeric ( $this->get_args ( 'achievementBonus' ) ) ? $this->get_args ( 'achievementBonus' ) : 0;
|
|
|
-
|
|
|
- if (! empty ( $pidkey ) && ! empty ( $positionName ) && ! empty ( $positionDescribe ) && ! empty ( $baseWage ) && ! empty ( $postWage ) && ! empty ( $achievementBonus )) {
|
|
|
+ // && ! empty ( $postWage ) && ! empty ( $achievementBonus )
|
|
|
+ if (! empty ( $pidkey ) && ! empty ( $positionName ) && ! empty ( $positionDescribe ) && ! empty ( $baseWage )) {
|
|
|
|
|
|
Doo::loadClass ( 'XDeode' );
|
|
|
$XDeode = new XDeode ( 5 );
|
|
@@ -2198,7 +2372,13 @@ class HumanResourceController extends DooController {
|
|
|
$XDeode = new XDeode ( 5 );
|
|
|
Doo::loadModel ( 'staff' );
|
|
|
$staff = new staff ();
|
|
|
- $list = $staff->getStaffByPositionId ();
|
|
|
+
|
|
|
+ Doo::loadModel ( 'position' );
|
|
|
+ $position = new position ();
|
|
|
+
|
|
|
+ $detail = $position->getPositionByPid ( $pidkey );
|
|
|
+
|
|
|
+ $list = $staff->getStaffByPositionId ( $pidkey );
|
|
|
$html = '<tr><th class="taC">办事处</th><th class="taC">姓名</th><th class="taC">入职时间</th></tr>';
|
|
|
foreach ( $list as $key => $value ) {
|
|
|
|
|
@@ -2212,6 +2392,7 @@ class HumanResourceController extends DooController {
|
|
|
}
|
|
|
echo json_encode ( array (
|
|
|
'status' => 1,
|
|
|
+ 'positionName' => $detail ['positionName'],
|
|
|
'html' => $html
|
|
|
) );
|
|
|
die ();
|
|
@@ -2449,10 +2630,20 @@ class HumanResourceController extends DooController {
|
|
|
';
|
|
|
|
|
|
foreach ( $categoryList as $key => $value ) {
|
|
|
- $html .= '<option value="' . $value ['cidKey'] . '_';
|
|
|
+ $html .= '<option value="' . $value ['cidKey'];
|
|
|
if (! empty ( $value ['did'] ))
|
|
|
- $html .= $value ['didKey'];
|
|
|
- $html .= '">' . $value ['title'];
|
|
|
+ $html .= '_' . $value ['didKey'];
|
|
|
+ $html .= '" ';
|
|
|
+
|
|
|
+ if (isset ( $value ['did'] )) {
|
|
|
+ if ($detail ['cid'] == $value ['cid'] && $detail ['departmentID'] == $value ['did'])
|
|
|
+ $html .= 'selected';
|
|
|
+ } else {
|
|
|
+ if ($detail ['cid'] == $value ['cid'])
|
|
|
+ $html .= 'selected';
|
|
|
+ }
|
|
|
+
|
|
|
+ $html .= '>' . $value ['title'];
|
|
|
if (! empty ( $value ['did'] ))
|
|
|
$html .= '/' . $value ['departmentName'] . '</option>';
|
|
|
}
|
|
@@ -2460,7 +2651,7 @@ class HumanResourceController extends DooController {
|
|
|
$html .= ' </select>
|
|
|
</td>
|
|
|
<th class="taC " width="150">岗位</th><td >
|
|
|
- <select name="position" id="position">
|
|
|
+ <select name="position_disabled" disabled id="position">
|
|
|
';
|
|
|
|
|
|
foreach ( $listPosition as $key => $value ) {
|
|
@@ -2956,6 +3147,7 @@ target="_blank">反面(照片)</a>
|
|
|
|
|
|
$listPosition = $position->getPositionByAll ();
|
|
|
$detail = $staff->getStaffBySid ( $sidkey );
|
|
|
+
|
|
|
// print_r($deta);
|
|
|
$html = '<table class="table table-bordered table-condensed">
|
|
|
<tr>
|
|
@@ -3024,6 +3216,28 @@ target="_blank">反面(照片)</a>
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 微信抄送功能
|
|
|
+ * @param unknown $rid
|
|
|
+ * @param string $typeMsg
|
|
|
+ */
|
|
|
+ function setWXMsg($sid, $msg = '',$msgtype='text') {
|
|
|
+ Doo::loadModel ( 'staff' );
|
|
|
+ $staff = new staff ();
|
|
|
+ $staffmsg = $staff->getOne ( array (
|
|
|
+ 'where' => "sid='" . $sid . "'",
|
|
|
+ 'asArray' => TRUE
|
|
|
+ ) );
|
|
|
+
|
|
|
+ if (! empty ( $staffmsg ['wxid'] )) {
|
|
|
+ require_once (SITE_PATH . '/protected/class/client.php');
|
|
|
+ $client = new client ( 'http://m.cld.smartcost.com.cn/' );
|
|
|
+ $user = $staffmsg ['wxid'];
|
|
|
+
|
|
|
+ $result = $client->SendMsg ( $user, $msg, $msgtype );
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 获取get或者POST值
|
|
|
*
|
|
|
* @param string $name 属性名称
|