|
@@ -9,6 +9,7 @@ Doo::loadClass('actmeasure');
|
|
Doo::loadClass('numofperact');
|
|
Doo::loadClass('numofperact');
|
|
Doo::loadClass('measureauditact');
|
|
Doo::loadClass('measureauditact');
|
|
Doo::loadClass('sign');
|
|
Doo::loadClass('sign');
|
|
|
|
+Doo::loadClass('sms');
|
|
Doo::loadModelAt('aconfig', 'admin');
|
|
Doo::loadModelAt('aconfig', 'admin');
|
|
//define('FPDF_FONTPATH','protected/class/fpdf1.5/font/');
|
|
//define('FPDF_FONTPATH','protected/class/fpdf1.5/font/');
|
|
//Doo::loadClass('fpdf');
|
|
//Doo::loadClass('fpdf');
|
|
@@ -23,7 +24,7 @@ Doo::loadModelAt('aconfig', 'admin');
|
|
class SignController extends DooController
|
|
class SignController extends DooController
|
|
{
|
|
{
|
|
|
|
|
|
- private $aconfig, $data, $sign, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $measureauditact, $numofperact, $statusArray = array('uncheck' => '<span class = "colGray">未审批</span>', 'checking' => '<span class = "colOrange">审批中</span>', 'checked' => '<span class = "colGreen">审批通过</span>', 'checkno' => '<span class = "colRed">审批不通过</span>');
|
|
|
|
|
|
+ private $aconfig, $data, $sms, $sign, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $measureauditact, $numofperact, $statusArray = array('uncheck' => '<span class = "colGray">未审批</span>', 'checking' => '<span class = "colOrange">审批中</span>', 'checked' => '<span class = "colGreen">审批通过</span>', 'checkno' => '<span class = "colRed">审批不通过</span>');
|
|
|
|
|
|
public function beforeRun($resource, $action)
|
|
public function beforeRun($resource, $action)
|
|
{
|
|
{
|
|
@@ -49,6 +50,7 @@ class SignController extends DooController
|
|
$this->numofperact = new NumofperAct();
|
|
$this->numofperact = new NumofperAct();
|
|
$this->measureauditact = new MeasureauditAct();
|
|
$this->measureauditact = new MeasureauditAct();
|
|
$this->sign = new Signn();
|
|
$this->sign = new Signn();
|
|
|
|
+ $this->sms = new Sms(Doo::conf()->SMS_URL, Doo::conf()->SMS_AUTHKEY);
|
|
// $this->pdf = new FPDF('P','mm','A4');
|
|
// $this->pdf = new FPDF('P','mm','A4');
|
|
$this->data['rootUrl'] = Doo::conf()->APP_URL;
|
|
$this->data['rootUrl'] = Doo::conf()->APP_URL;
|
|
$this->data['currChannle'] = 'sign';
|
|
$this->data['currChannle'] = 'sign';
|
|
@@ -133,7 +135,7 @@ class SignController extends DooController
|
|
$needlist[$k]['tlist'][$tk]['plist'][$pk]['phaseno'] = $pv['phaseno'];
|
|
$needlist[$k]['tlist'][$tk]['plist'][$pk]['phaseno'] = $pv['phaseno'];
|
|
$needlist[$k]['tlist'][$tk]['plist'][$pk]['signlist'] = array();
|
|
$needlist[$k]['tlist'][$tk]['plist'][$pk]['signlist'] = array();
|
|
|
|
|
|
- $signlist = $this->sign->getSignList($searchsql.' and status="checking" and tender='.$tv['tender'].' and phaseno='.$pv['phaseno'], '0,1000');
|
|
|
|
|
|
+ $signlist = $this->sign->getSignList($searchsql.' and (status="checking" or status="back") and tender='.$tv['tender'].' and phaseno='.$pv['phaseno'], '0,1000');
|
|
if(!empty($signlist)) {
|
|
if(!empty($signlist)) {
|
|
foreach ($signlist as $sk => $sv) {
|
|
foreach ($signlist as $sk => $sv) {
|
|
$needlist[$k]['tlist'][$tk]['plist'][$pk]['signlist'][$sk]['sid'] = $sv['sid'];
|
|
$needlist[$k]['tlist'][$tk]['plist'][$pk]['signlist'][$sk]['sid'] = $sv['sid'];
|
|
@@ -160,6 +162,73 @@ class SignController extends DooController
|
|
exit('不是当前签署人无法访问本页');
|
|
exit('不是当前签署人无法访问本页');
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if(isset($_POST['status'])){
|
|
|
|
+ //终止签署
|
|
|
|
+ if($_POST['status'] == 'stop'){
|
|
|
|
+ $result = $this->sign->updateSignStatusAndTime($this->params['sid'],'stop',time());
|
|
|
|
+ $signAudit = $this->sign->getOneSignAudit($this->params['sid'],$this->auth->getUid());
|
|
|
|
+ $result2 = $this->sign->updateSignAudit($signAudit['satid'],'stop',time());
|
|
|
|
+ if($result && $result2){
|
|
|
|
+ // SMS Start
|
|
|
|
+ $signArray = $this->sign->getOneSignbysid($this->params['sid']);
|
|
|
|
+ $pmname = $this->actmeasure->getRowByPmid($signArray['tender']);
|
|
|
|
+ $userProArray = $this->profile->getProWithUid($signArray['audituid']);
|
|
|
|
+ if (isset($userProArray) && !empty($userProArray['mobile'])) {
|
|
|
|
+ $sendarr1 = '“' .$pmname['pmname'].'”的“'. $signArray["name"] .'”';
|
|
|
|
+ $sendarr2 = str_replace('【','',$sendarr1);
|
|
|
|
+ $sendmsg = str_replace('】','',$sendarr2);
|
|
|
|
+ $retval = $this->__auditNotice($userProArray['mobile'], Doo::conf()->SMS_TIPS_PRE . $sendmsg .Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR6"]);
|
|
|
|
+ }
|
|
|
|
+ // SMS End
|
|
|
|
+ echo json_encode(array('code' => 200, 'url' => '/sign/list'));
|
|
|
|
+ exit;
|
|
|
|
+ }
|
|
|
|
+ echo json_encode(array('code' => 400, 'msg' => '终止签署失败'));
|
|
|
|
+ exit;
|
|
|
|
+ }elseif($_POST['status'] == 'back'){
|
|
|
|
+ $signauditlist = $this->sign->getSignAuditList($this->params['sid']);
|
|
|
|
+ $change = -1;
|
|
|
|
+ foreach($signauditlist as $k => $v){
|
|
|
|
+ if($v['status'] == 'checking' && $k != 0) {
|
|
|
|
+ $change = $k-1;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if($change != -1){
|
|
|
|
+ $result = $this->sign->updateSignStatusAndTime($this->params['sid'],'back',time());
|
|
|
|
+ $signAudit = $this->sign->getOneSignAudit($this->params['sid'],$this->auth->getUid());
|
|
|
|
+ $result3 = $this->sign->updateSignAudit($signAudit['satid'],'uncheck',0);
|
|
|
|
+ $result2 = $this->sign->updateSignAudit($signauditlist[$change]['satid'],'checking',0);
|
|
|
|
+ if($result && $result2 && $result3){
|
|
|
|
+ //删除上一个签名者的所有签名
|
|
|
|
+ $signattlist = $this->sign->getSignAttList($this->params['sid']);
|
|
|
|
+ foreach($signattlist as $key => $value){
|
|
|
|
+ $sign2 = new SignAuditAtt();
|
|
|
|
+ $sign2->audituid = $signauditlist[$change]['audituid'];
|
|
|
|
+ $sign2->said = $value['said'];
|
|
|
|
+ $sign2->delete();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // SMS Start
|
|
|
|
+ $signArray = $this->sign->getOneSignbysid($this->params['sid']);
|
|
|
|
+ $pmname = $this->actmeasure->getRowByPmid($signArray['tender']);
|
|
|
|
+ $userProArray = $this->profile->getProWithUid($signauditlist[$change]['audituid']);
|
|
|
|
+ if (isset($userProArray) && !empty($userProArray['mobile'])) {
|
|
|
|
+ $sendarr1 = '“' .$pmname['pmname'].'”的“'. $signArray["name"] .'”';
|
|
|
|
+ $sendarr2 = str_replace('【','',$sendarr1);
|
|
|
|
+ $sendmsg = str_replace('】','',$sendarr2);
|
|
|
|
+ $retval = $this->__auditNotice($userProArray['mobile'], Doo::conf()->SMS_TIPS_PRE . $sendmsg .Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR7"]);
|
|
|
|
+ }
|
|
|
|
+ // SMS End
|
|
|
|
+ echo json_encode(array('code' => 200, 'url' => '/sign/onlist'));
|
|
|
|
+ exit;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ echo json_encode(array('code' => 400, 'msg' => '退回签署失败'));
|
|
|
|
+ exit;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
//获取报表信息
|
|
//获取报表信息
|
|
$signmsg = $this->sign->getOneSignbysid($this->params['sid']);
|
|
$signmsg = $this->sign->getOneSignbysid($this->params['sid']);
|
|
//获取项目名,标段名,标段期数
|
|
//获取项目名,标段名,标段期数
|
|
@@ -173,12 +242,16 @@ class SignController extends DooController
|
|
|
|
|
|
|
|
|
|
//获取签署人列表
|
|
//获取签署人列表
|
|
|
|
+ $firstsign = 0;
|
|
$signauditlist = $this->sign->getSignAuditList($this->params['sid']);
|
|
$signauditlist = $this->sign->getSignAuditList($this->params['sid']);
|
|
if(!empty($signauditlist)){
|
|
if(!empty($signauditlist)){
|
|
foreach($signauditlist as $k => $v){
|
|
foreach($signauditlist as $k => $v){
|
|
//获取签署人头像
|
|
//获取签署人头像
|
|
$signauditlist[$k]['index'] = $k+1;
|
|
$signauditlist[$k]['index'] = $k+1;
|
|
$signauditlist[$k]['avatar'] = $this->auth->getAvatar($v['audituid']);
|
|
$signauditlist[$k]['avatar'] = $this->auth->getAvatar($v['audituid']);
|
|
|
|
+ if($this->auth->getUid() == $v['audituid'] && $k == 0){
|
|
|
|
+ $firstsign = 1;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -211,7 +284,7 @@ class SignController extends DooController
|
|
$this->data['maxwidth'] = $maxwidth;
|
|
$this->data['maxwidth'] = $maxwidth;
|
|
$this->data['maxheight'] = $maxheight;
|
|
$this->data['maxheight'] = $maxheight;
|
|
$this->data['style'] = $style;
|
|
$this->data['style'] = $style;
|
|
-
|
|
|
|
|
|
+ $this->data['firstsign'] = $firstsign;
|
|
$this->render('sign-view-signer_sign',$this->data, TRUE);
|
|
$this->render('sign-view-signer_sign',$this->data, TRUE);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -242,6 +315,18 @@ class SignController extends DooController
|
|
if($v['status'] == 'uncheck'){
|
|
if($v['status'] == 'uncheck'){
|
|
$sign2->updateSignAudit($v['satid'],'checking');
|
|
$sign2->updateSignAudit($v['satid'],'checking');
|
|
$flag = false;
|
|
$flag = false;
|
|
|
|
+ //发送签署短信
|
|
|
|
+ // SMS Start
|
|
|
|
+ $signArray = $this->sign->getOneSignbysid($_POST['sid']);
|
|
|
|
+ $pmname = $this->actmeasure->getRowByPmid($signArray['tender']);
|
|
|
|
+ $userProArray = $this->profile->getProWithUid($v['audituid']);
|
|
|
|
+ if (isset($userProArray) && !empty($userProArray['mobile'])) {
|
|
|
|
+ $sendarr1 = '“' .$pmname['pmname'].'”的“'. $signArray["name"] .'”';
|
|
|
|
+ $sendarr2 = str_replace('【','',$sendarr1);
|
|
|
|
+ $sendmsg = str_replace('】','',$sendarr2);
|
|
|
|
+ $retval = $this->__auditNotice($userProArray['mobile'], Doo::conf()->SMS_TIPS_PRE . $sendmsg .Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR5"]);
|
|
|
|
+ }
|
|
|
|
+ // SMS End
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -250,6 +335,7 @@ class SignController extends DooController
|
|
echo json_encode(array('code' => 200, 'url' => '/sign/view/'.$_POST['sid'].'?status=done'));
|
|
echo json_encode(array('code' => 200, 'url' => '/sign/view/'.$_POST['sid'].'?status=done'));
|
|
exit;
|
|
exit;
|
|
}else{
|
|
}else{
|
|
|
|
+ $this->sign->updateSignStatusAndTime($_POST['sid'],'checking',0);
|
|
echo json_encode(array('code' => 200, 'url' => '/sign/view/'.$_POST['sid'].'?status=doing'));
|
|
echo json_encode(array('code' => 200, 'url' => '/sign/view/'.$_POST['sid'].'?status=doing'));
|
|
exit;
|
|
exit;
|
|
}
|
|
}
|
|
@@ -367,7 +453,7 @@ class SignController extends DooController
|
|
$this->data['phaseno'] = '';
|
|
$this->data['phaseno'] = '';
|
|
|
|
|
|
//获取项目信息
|
|
//获取项目信息
|
|
- $searchsql = 'status="checking" and sid in(select `jl_sign_audit`.sid from `jl_sign_audit` where `jl_sign_audit`.audituid='.$this->auth->getUid().')';
|
|
|
|
|
|
+ $searchsql = '(status="checking" or status="back") and sid in(select `jl_sign_audit`.sid from `jl_sign_audit` where `jl_sign_audit`.audituid='.$this->auth->getUid().')';
|
|
$itemlist = $this->sign->getSignGroupByProject($searchsql);
|
|
$itemlist = $this->sign->getSignGroupByProject($searchsql);
|
|
if(!empty($itemlist)){
|
|
if(!empty($itemlist)){
|
|
foreach($itemlist as $ik => $iv){
|
|
foreach($itemlist as $ik => $iv){
|
|
@@ -539,7 +625,7 @@ class SignController extends DooController
|
|
$this->data['phaseno'] = '';
|
|
$this->data['phaseno'] = '';
|
|
|
|
|
|
//获取项目信息
|
|
//获取项目信息
|
|
- $searchsql = 'status="uncheck" AND (`ownuid`='.$this->auth->getUid().' OR tender IN (SELECT pmid FROM jl_measure_audit WHERE auditoruid='.$this->auth->getUid().') OR project IN (SELECT pid FROM jl_project_measure WHERE uid='.$this->auth->getUid().'))';
|
|
|
|
|
|
+ $searchsql = 'status="uncheck" AND (`isinter`=0 OR `isinter`=3) AND (`ownuid`='.$this->auth->getUid().' OR tender IN (SELECT pmid FROM jl_measure_audit WHERE auditoruid='.$this->auth->getUid().') OR project IN (SELECT pid FROM jl_project_measure WHERE uid='.$this->auth->getUid().'))';
|
|
$itemlist = $this->sign->getSignGroupByProject($searchsql);
|
|
$itemlist = $this->sign->getSignGroupByProject($searchsql);
|
|
if(!empty($itemlist)){
|
|
if(!empty($itemlist)){
|
|
foreach($itemlist as $ik => $iv){
|
|
foreach($itemlist as $ik => $iv){
|
|
@@ -642,7 +728,7 @@ class SignController extends DooController
|
|
$this->data['nosign'] = '';
|
|
$this->data['nosign'] = '';
|
|
|
|
|
|
//获取项目信息
|
|
//获取项目信息
|
|
- $searchsql = '(`ownuid`='.$this->auth->getUid().' OR `audituid`='.$this->auth->getUid().' OR sid IN (SELECT sid FROM jl_sign_audit WHERE jl_sign_audit.audituid='.$this->auth->getUid().'))';
|
|
|
|
|
|
+ $searchsql = '(`isinter`=0 OR `isinter`=3) AND (`ownuid`='.$this->auth->getUid().' OR `audituid`='.$this->auth->getUid().' OR sid IN (SELECT sid FROM jl_sign_audit WHERE jl_sign_audit.audituid='.$this->auth->getUid().'))';
|
|
$itemlist = $this->sign->getSignGroupByProject($searchsql);
|
|
$itemlist = $this->sign->getSignGroupByProject($searchsql);
|
|
if(!empty($itemlist)){
|
|
if(!empty($itemlist)){
|
|
foreach($itemlist as $ik => $iv){
|
|
foreach($itemlist as $ik => $iv){
|
|
@@ -688,7 +774,7 @@ class SignController extends DooController
|
|
if((isset($this->params['nosign']) && ($this->params['nosign'] == 'nosign')) || isset($_GET['nosign'])){
|
|
if((isset($this->params['nosign']) && ($this->params['nosign'] == 'nosign')) || isset($_GET['nosign'])){
|
|
$this->data['nosign'] = 1;
|
|
$this->data['nosign'] = 1;
|
|
$pagestr .= '/nosign';
|
|
$pagestr .= '/nosign';
|
|
- $searchsql = '(`ownuid`='.$this->auth->getUid().' AND `status`="uncheck")';
|
|
|
|
|
|
+ $searchsql = '(`isinter`=0 OR `isinter`=3) AND (`ownuid`='.$this->auth->getUid().' AND `status`="uncheck")';
|
|
}
|
|
}
|
|
|
|
|
|
$totalArchive = $this->sign->getSignNum($sqlstr.' and '.$searchsql);
|
|
$totalArchive = $this->sign->getSignNum($sqlstr.' and '.$searchsql);
|
|
@@ -712,7 +798,7 @@ class SignController extends DooController
|
|
// $list[$k]['phaseno'] = $phaseno['numpname'];
|
|
// $list[$k]['phaseno'] = $phaseno['numpname'];
|
|
$list[$k]['ownname'] = $this->auth->getName($v['ownuid']);
|
|
$list[$k]['ownname'] = $this->auth->getName($v['ownuid']);
|
|
$list[$k]['auditname'] = $this->auth->getName($v['audituid']);
|
|
$list[$k]['auditname'] = $this->auth->getName($v['audituid']);
|
|
- $list[$k]['delstatus'] = $this->auth->getUid() == $v['ownuid'] && $v['status'] != 'checked' ? 1 : 0;
|
|
|
|
|
|
+ $list[$k]['delstatus'] = $this->auth->getUid() == $v['ownuid'] && $v['status'] != 'checked' && $v['isinter'] != 3 ? 1 : 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -838,6 +924,20 @@ class SignController extends DooController
|
|
echo json_encode(array('code' => 400, 'msg' => '添加签署人出错'));
|
|
echo json_encode(array('code' => 400, 'msg' => '添加签署人出错'));
|
|
exit;
|
|
exit;
|
|
}
|
|
}
|
|
|
|
+ //发送签署短信
|
|
|
|
+ if($k == 0){
|
|
|
|
+ // SMS Start
|
|
|
|
+ $signArray = $this->sign->getOneSignbysid($_POST['sid']);
|
|
|
|
+ $pmname = $this->actmeasure->getRowByPmid($signArray['tender']);
|
|
|
|
+ $userProArray = $this->profile->getProWithUid($v);
|
|
|
|
+ if (isset($userProArray) && !empty($userProArray['mobile'])) {
|
|
|
|
+ $sendarr1 = '“' .$pmname['pmname'].'”的“'. $signArray["name"] .'”';
|
|
|
|
+ $sendarr2 = str_replace('【','',$sendarr1);
|
|
|
|
+ $sendmsg = str_replace('】','',$sendarr2);
|
|
|
|
+ $retval = $this->__auditNotice($userProArray['mobile'], Doo::conf()->SMS_TIPS_PRE . $sendmsg .Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR5"]);
|
|
|
|
+ }
|
|
|
|
+ // SMS End
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//更新报表信息
|
|
//更新报表信息
|
|
$result2 = $this->sign->updateSignMsg($_POST['sid'],$this->auth->getUid());
|
|
$result2 = $this->sign->updateSignMsg($_POST['sid'],$this->auth->getUid());
|
|
@@ -992,6 +1092,14 @@ class SignController extends DooController
|
|
return $name;
|
|
return $name;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private function __auditNotice($mobile, $text)
|
|
|
|
+ {
|
|
|
|
+ $smsSignSwitch = $this->aconfig->getOne(array('select' => 'smssignswitch', 'asArray' => TRUE))['smssignswitch'];
|
|
|
|
+ if ($smsSignSwitch > 0)
|
|
|
|
+ return $this->sms->sendSms($mobile, $text);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
?>
|
|
?>
|