master
yulingwei 5 years ago
parent 93601a3302
commit 5b604ab073

@ -604,8 +604,8 @@ WHERE old_change_promote_id in ({$promoteData})";
if(in_array($defaultService['id'], $ids)) {
return $this->error('无法删除默认模板');
}
$useingService = M('promote_company', 'tab_')->where(['service_agreement_show'=>['in', $ids]])->find();
if (!empty($useingService)) return $this->error('有正在使用该服务合同的公司,无法删除');
$usingService = M('promote_company', 'tab_')->where(['service_agreement_show'=>['in', $ids]])->find();
if (!empty($usingService)) return $this->error('有正在使用该服务合同的公司,无法删除');
$result = M('service_agreement', 'tab_')->where(['id'=>['in', $ids]])->delete();
return $result ? $this->success('删除完成') : $this->error('删除失败');
}
@ -625,6 +625,18 @@ WHERE old_change_promote_id in ({$promoteData})";
}
} else {
if (!empty($id)) {
if ($delete) {
$ids = [$id];
// 获取默认合同id
$defaultService = M('service_agreement', 'tab_')->where(['status'=>2])->find();
if(in_array($defaultService['id'], $ids)) {
return $this->error('无法删除默认模板');
}
$usingService = M('promote_company', 'tab_')->where(['service_agreement_show'=>['in', $ids]])->find();
if (!empty($usingService)) return $this->error('有正在使用该服务合同的公司,无法删除');
$result = M('service_agreement', 'tab_')->where(['id'=>['in', $ids]])->delete();
return $result ? $this->success('删除完成') : $this->error('删除失败');
}
$info = M('service_agreement', 'tab_')->where(['id'=>$id])->find();
if (empty($info)) return $this->error('未找到协议');
$this->assign('info', $info);
@ -635,7 +647,7 @@ WHERE old_change_promote_id in ({$promoteData})";
public function serviceAgreementSetDefault($id)
{
M('service_agreement', 'tab_')->save(['status'=>1]);
M('service_agreement', 'tab_')->where('id > 0')->save(['status'=>1]);
M('service_agreement', 'tab_')->where(['id'=>$id])->save(['status'=>2]);
return $this->success('设置完成');
}

@ -77,7 +77,7 @@
<td><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]"></td>
<td>{$data.id}</td>
<td>{$data.name}</td>
<td>{$data.status}</td>
<td><?php echo $data['status'] == 1 ? '否' : '是';?></td>
<td style="width: 500px;">
<div style="height: 100px;overflow-x: hidden;overflow-y: scroll;">
{$data.company_name}

Loading…
Cancel
Save