diff --git a/app/api/controller/FinanceExpense.php b/app/api/controller/FinanceExpense.php index 745d578..75943cf 100644 --- a/app/api/controller/FinanceExpense.php +++ b/app/api/controller/FinanceExpense.php @@ -184,22 +184,6 @@ class FinanceExpense extends ApiController } } } - /* - if($flow[0]['flow_type'] == 1){ - //部门负责人 - $leader = get_department_leader($admin_id); - if($leader == 0){ - $this->apiError('审批流程设置有问题:当前部门负责人还未设置,请联系HR或者管理员'); - } - } - else if($flow[0]['flow_type'] == 2){ - //上级部门负责人 - $leader = get_department_leader($admin_id,1); - if($leader == 0){ - $this->apiError('审批流程设置有问题:上级部门负责人还未设置,请联系HR或者管理员'); - } - } - */ } $dbRes = false; diff --git a/app/api/controller/FinanceInvoice.php b/app/api/controller/FinanceInvoice.php index 0facca0..5a81b54 100644 --- a/app/api/controller/FinanceInvoice.php +++ b/app/api/controller/FinanceInvoice.php @@ -173,41 +173,43 @@ class FinanceInvoice extends ApiController $this->apiError("银行地址不能为空"); } } - foreach($flow as $item) { - // 当前部门负责人 - if ($item['flow_type'] == 1) { - $manager_id = Db::name('department')->where('id', $this->did)->value('manager_id'); - if (empty($manager_id)) { - $this->apiError('当前部门负责人不存在'); + if (!isset($param['check_admin_ids'])) { + foreach($flow as $item) { + // 当前部门负责人 + if ($item['flow_type'] == 1) { + $manager_id = Db::name('department')->where('id', $this->did)->value('manager_id'); + if (empty($manager_id)) { + $this->apiError('当前部门负责人不存在'); + } } - } - // 上一级部门负责人 - if ($item['flow_type'] == 2) { - $pid = Db::name('department')->where('id', $this->did)->value('pid'); - if (empty($pid)) { - $this->apiError('上一级部门不存在'); + // 上一级部门负责人 + if ($item['flow_type'] == 2) { + $pid = Db::name('department')->where('id', $this->did)->value('pid'); + if (empty($pid)) { + $this->apiError('上一级部门不存在'); + } + $manager_id = Db::name('department')->where('id', $pid)->value('manager_id'); + if (empty($manager_id)) { + $this->apiError('上一级部门负责人不存在'); + } } - $manager_id = Db::name('department')->where('id', $pid)->value('manager_id'); - if (empty($manager_id)) { - $this->apiError('上一级部门负责人不存在'); + // 当前部门分管领导 + if ($item['flow_type'] == 5) { + $leader_id = Db::name('department')->where('id', $this->did)->value('leader_id'); + if (empty($leader_id)) { + $this->apiError('当前部门分管领导不存在'); + } } - } - // 当前部门分管领导 - if ($item['flow_type'] == 5) { - $leader_id = Db::name('department')->where('id', $this->did)->value('leader_id'); - if (empty($leader_id)) { - $this->apiError('当前部门分管领导不存在'); - } - } - // 上一级部门分管领导 - if ($item['flow_type'] == 6) { - $pid = Db::name('department')->where('id', $this->did)->value('pid'); - if (empty($pid)) { - $this->apiError('上一级部门不存在'); - } - $leader_id = Db::name('department')->where('id', $pid)->value('leader_id'); - if (empty($leader_id)) { - $this->apiError('当前部门分管领导不存在'); + // 上一级部门分管领导 + if ($item['flow_type'] == 6) { + $pid = Db::name('department')->where('id', $this->did)->value('pid'); + if (empty($pid)) { + $this->apiError('上一级部门不存在'); + } + $leader_id = Db::name('department')->where('id', $pid)->value('leader_id'); + if (empty($leader_id)) { + $this->apiError('当前部门分管领导不存在'); + } } } } diff --git a/app/api/controller/OaApprove.php b/app/api/controller/OaApprove.php index 49b66d0..26aa67b 100644 --- a/app/api/controller/OaApprove.php +++ b/app/api/controller/OaApprove.php @@ -147,41 +147,43 @@ class OaApprove extends ApiController } $flow_list = Db::name('Flow')->where('id',$param['flow_id'])->value('flow_list'); $flow = unserialize($flow_list); - foreach($flow as $item) { - // 当前部门负责人 - if ($item['flow_type'] == 1) { - $manager_id = Db::name('department')->where('id', $this->did)->value('manager_id'); - if (empty($manager_id)) { - $this->apiError('当前部门负责人不存在'); + if (!isset($param['check_admin_ids'])) { + foreach($flow as $item) { + // 当前部门负责人 + if ($item['flow_type'] == 1) { + $manager_id = Db::name('department')->where('id', $this->did)->value('manager_id'); + if (empty($manager_id)) { + $this->apiError('当前部门负责人不存在'); + } } - } - // 上一级部门负责人 - if ($item['flow_type'] == 2) { - $pid = Db::name('department')->where('id', $this->did)->value('pid'); - if (empty($pid)) { - $this->apiError('上一级部门不存在'); + // 上一级部门负责人 + if ($item['flow_type'] == 2) { + $pid = Db::name('department')->where('id', $this->did)->value('pid'); + if (empty($pid)) { + $this->apiError('上一级部门不存在'); + } + $manager_id = Db::name('department')->where('id', $pid)->value('manager_id'); + if (empty($manager_id)) { + $this->apiError('上一级部门负责人不存在'); + } } - $manager_id = Db::name('department')->where('id', $pid)->value('manager_id'); - if (empty($manager_id)) { - $this->apiError('上一级部门负责人不存在'); + // 当前部门分管领导 + if ($item['flow_type'] == 5) { + $leader_id = Db::name('department')->where('id', $this->did)->value('leader_id'); + if (empty($leader_id)) { + $this->apiError('当前部门分管领导不存在'); + } } - } - // 当前部门分管领导 - if ($item['flow_type'] == 5) { - $leader_id = Db::name('department')->where('id', $this->did)->value('leader_id'); - if (empty($leader_id)) { - $this->apiError('当前部门分管领导不存在'); - } - } - // 上一级部门分管领导 - if ($item['flow_type'] == 6) { - $pid = Db::name('department')->where('id', $this->did)->value('pid'); - if (empty($pid)) { - $this->apiError('上一级部门不存在'); - } - $leader_id = Db::name('department')->where('id', $pid)->value('leader_id'); - if (empty($leader_id)) { - $this->apiError('当前部门分管领导不存在'); + // 上一级部门分管领导 + if ($item['flow_type'] == 6) { + $pid = Db::name('department')->where('id', $this->did)->value('pid'); + if (empty($pid)) { + $this->apiError('上一级部门不存在'); + } + $leader_id = Db::name('department')->where('id', $pid)->value('leader_id'); + if (empty($leader_id)) { + $this->apiError('当前部门分管领导不存在'); + } } } } diff --git a/app/finance/controller/Expense.php b/app/finance/controller/Expense.php index 51c5476..7c26c4e 100644 --- a/app/finance/controller/Expense.php +++ b/app/finance/controller/Expense.php @@ -152,7 +152,6 @@ class Expense extends BaseController $flow_list = Db::name('Flow')->where('id',$param['flow_id'])->value('flow_list'); $flow = unserialize($flow_list); - halt($flow); if (!isset($param['check_admin_ids'])) { foreach($flow as $item) { // 当前部门负责人 @@ -192,22 +191,6 @@ class Expense extends BaseController } } } - /* - if($flow[0]['flow_type'] == 1){ - //部门负责人 - $leader = get_department_leader($admin_id); - if($leader == 0){ - return to_assign(1,'审批流程设置有问题:当前部门负责人还未设置,请联系HR或者管理员'); - } - } - else if($flow[0]['flow_type'] == 2){ - //上级部门负责人 - $leader = get_department_leader($admin_id,1); - if($leader == 0){ - return to_assign(1,'审批流程设置有问题:上级部门负责人还未设置,请联系HR或者管理员'); - } - } - */ } $dbRes = false; diff --git a/app/finance/controller/Invoice.php b/app/finance/controller/Invoice.php index 5ad85d1..034b36a 100644 --- a/app/finance/controller/Invoice.php +++ b/app/finance/controller/Invoice.php @@ -152,41 +152,43 @@ class Invoice extends BaseController return to_assign(1, '银行地址不能为空'); } } - foreach($flow as $item) { - // 当前部门负责人 - if ($item['flow_type'] == 1) { - $manager_id = Db::name('department')->where('id', $this->did)->value('manager_id'); - if (empty($manager_id)) { - return to_assign(1,'当前部门负责人不存在'); + if (!isset($param['check_admin_ids'])) { + foreach($flow as $item) { + // 当前部门负责人 + if ($item['flow_type'] == 1) { + $manager_id = Db::name('department')->where('id', $this->did)->value('manager_id'); + if (empty($manager_id)) { + return to_assign(1,'当前部门负责人不存在'); + } } - } - // 上一级部门负责人 - if ($item['flow_type'] == 2) { - $pid = Db::name('department')->where('id', $this->did)->value('pid'); - if (empty($pid)) { - return to_assign(1,'上一级部门不存在'); + // 上一级部门负责人 + if ($item['flow_type'] == 2) { + $pid = Db::name('department')->where('id', $this->did)->value('pid'); + if (empty($pid)) { + return to_assign(1,'上一级部门不存在'); + } + $manager_id = Db::name('department')->where('id', $pid)->value('manager_id'); + if (empty($manager_id)) { + return to_assign(1,'上一级部门负责人不存在'); + } } - $manager_id = Db::name('department')->where('id', $pid)->value('manager_id'); - if (empty($manager_id)) { - return to_assign(1,'上一级部门负责人不存在'); + // 当前部门分管领导 + if ($item['flow_type'] == 5) { + $leader_id = Db::name('department')->where('id', $this->did)->value('leader_id'); + if (empty($leader_id)) { + return to_assign(1,'当前部门分管领导不存在'); + } } - } - // 当前部门分管领导 - if ($item['flow_type'] == 5) { - $leader_id = Db::name('department')->where('id', $this->did)->value('leader_id'); - if (empty($leader_id)) { - return to_assign(1,'当前部门分管领导不存在'); - } - } - // 上一级部门分管领导 - if ($item['flow_type'] == 6) { - $pid = Db::name('department')->where('id', $this->did)->value('pid'); - if (empty($pid)) { - return to_assign(1,'上一级部门不存在'); - } - $leader_id = Db::name('department')->where('id', $pid)->value('leader_id'); - if (empty($leader_id)) { - return to_assign(1,'当前部门分管领导不存在'); + // 上一级部门分管领导 + if ($item['flow_type'] == 6) { + $pid = Db::name('department')->where('id', $this->did)->value('pid'); + if (empty($pid)) { + return to_assign(1,'上一级部门不存在'); + } + $leader_id = Db::name('department')->where('id', $pid)->value('leader_id'); + if (empty($leader_id)) { + return to_assign(1,'当前部门分管领导不存在'); + } } } } diff --git a/app/oa/controller/Approve.php b/app/oa/controller/Approve.php index 1107ef5..9432edc 100644 --- a/app/oa/controller/Approve.php +++ b/app/oa/controller/Approve.php @@ -253,42 +253,43 @@ class Approve extends BaseController } $flow_list = Db::name('Flow')->where('id',$param['flow_id'])->value('flow_list'); $flow = unserialize($flow_list); - - foreach($flow as $item) { - // 当前部门负责人 - if ($item['flow_type'] == 1) { - $manager_id = Db::name('department')->where('id', $this->did)->value('manager_id'); - if (empty($manager_id)) { - return to_assign(1,'当前部门负责人不存在'); + if (!isset($param['check_admin_ids'])) { + foreach($flow as $item) { + // 当前部门负责人 + if ($item['flow_type'] == 1) { + $manager_id = Db::name('department')->where('id', $this->did)->value('manager_id'); + if (empty($manager_id)) { + return to_assign(1,'当前部门负责人不存在'); + } } - } - // 上一级部门负责人 - if ($item['flow_type'] == 2) { - $pid = Db::name('department')->where('id', $this->did)->value('pid'); - if (empty($pid)) { - return to_assign(1,'上一级部门不存在'); + // 上一级部门负责人 + if ($item['flow_type'] == 2) { + $pid = Db::name('department')->where('id', $this->did)->value('pid'); + if (empty($pid)) { + return to_assign(1,'上一级部门不存在'); + } + $manager_id = Db::name('department')->where('id', $pid)->value('manager_id'); + if (empty($manager_id)) { + return to_assign(1,'上一级部门负责人不存在'); + } } - $manager_id = Db::name('department')->where('id', $pid)->value('manager_id'); - if (empty($manager_id)) { - return to_assign(1,'上一级部门负责人不存在'); + // 当前部门分管领导 + if ($item['flow_type'] == 5) { + $leader_id = Db::name('department')->where('id', $this->did)->value('leader_id'); + if (empty($leader_id)) { + return to_assign(1,'当前部门分管领导不存在'); + } } - } - // 当前部门分管领导 - if ($item['flow_type'] == 5) { - $leader_id = Db::name('department')->where('id', $this->did)->value('leader_id'); - if (empty($leader_id)) { - return to_assign(1,'当前部门分管领导不存在'); - } - } - // 上一级部门分管领导 - if ($item['flow_type'] == 6) { - $pid = Db::name('department')->where('id', $this->did)->value('pid'); - if (empty($pid)) { - return to_assign(1,'上一级部门不存在'); - } - $leader_id = Db::name('department')->where('id', $pid)->value('leader_id'); - if (empty($leader_id)) { - return to_assign(1,'当前部门分管领导不存在'); + // 上一级部门分管领导 + if ($item['flow_type'] == 6) { + $pid = Db::name('department')->where('id', $this->did)->value('pid'); + if (empty($pid)) { + return to_assign(1,'上一级部门不存在'); + } + $leader_id = Db::name('department')->where('id', $pid)->value('leader_id'); + if (empty($leader_id)) { + return to_assign(1,'当前部门分管领导不存在'); + } } } }