修改离线申请的pdf上传流程
This commit is contained in:
parent
3ae66dd5fb
commit
0e4e1111f5
|
@ -1789,7 +1789,6 @@ class DataController extends Zend_Controller_Action
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} elseif ($formData['submit']) {
|
} elseif ($formData['submit']) {
|
||||||
//提交
|
|
||||||
//生成PDF
|
//生成PDF
|
||||||
$order->setPdfData($rows);
|
$order->setPdfData($rows);
|
||||||
$s = $order->SubmitOrder($formData);
|
$s = $order->SubmitOrder($formData);
|
||||||
|
@ -1816,12 +1815,11 @@ class DataController extends Zend_Controller_Action
|
||||||
|
|
||||||
if($ac == "commitapplicationform")
|
if($ac == "commitapplicationform")
|
||||||
{
|
{
|
||||||
$this->_helper->viewRenderer->setNoRender();
|
|
||||||
$offlineappid = $this->_getParam('offlineappid');
|
$offlineappid = $this->_getParam('offlineappid');
|
||||||
|
|
||||||
if(!is_numeric($offlineappid) || $offlineappid < 1)
|
if(!is_numeric($offlineappid) || $offlineappid < 1)
|
||||||
{
|
{
|
||||||
$this->jsonexit(array('error'=>'参数错误'));
|
view::Post($this,"参数错误",-1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1830,9 +1828,9 @@ class DataController extends Zend_Controller_Action
|
||||||
|
|
||||||
if( $status !== true)
|
if( $status !== true)
|
||||||
{
|
{
|
||||||
$this->jsonexit(array("error"=>$status));
|
view::Post($this,$status,-1);
|
||||||
}else{
|
}else{
|
||||||
$this->jsonexit(array('success'=>1));
|
view::Post($this,"申请已提交,请等待管理员接收并通过数据所有者审核",'/data/order/ac/offline3');
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1904,6 +1902,9 @@ class DataController extends Zend_Controller_Action
|
||||||
break;
|
break;
|
||||||
case 'offline2' :
|
case 'offline2' :
|
||||||
if($v['status'] == 2) $showorders[] = $rows[$k];
|
if($v['status'] == 2) $showorders[] = $rows[$k];
|
||||||
|
$this->view->offlineappid = $v['offlineappid'];
|
||||||
|
$this->view->applicationform = $v['applicationform'];
|
||||||
|
$this->view->offlineappstatus = $v['status'];
|
||||||
break;
|
break;
|
||||||
case 'offline3' :
|
case 'offline3' :
|
||||||
if($v['status'] == 3 || $v['status'] == 4) $showorders[] = $rows[$k];
|
if($v['status'] == 3 || $v['status'] == 4) $showorders[] = $rows[$k];
|
||||||
|
|
|
@ -44,18 +44,18 @@
|
||||||
<?php if ($this->tabID=='order-offline1') {
|
<?php if ($this->tabID=='order-offline1') {
|
||||||
echo '<a class="btn btn-primary" href="/data/order/apply/all">提交所有数据</a>(一次最多5条)';
|
echo '<a class="btn btn-primary" href="/data/order/apply/all">提交所有数据</a>(一次最多5条)';
|
||||||
} elseif ($this->tabID=='order-offline2') {
|
} elseif ($this->tabID=='order-offline2') {
|
||||||
echo '<a class="btn btn-primary" href="/data/order/pdf/1">提交离线申请</a>';
|
|
||||||
} elseif ($this->tabID=='order-offline3') {
|
|
||||||
if(count($this->paginator))
|
if(count($this->paginator))
|
||||||
{
|
{
|
||||||
if(empty($this->applicationform))
|
if(empty($this->applicationform))
|
||||||
echo '<a class="btn btn-primary" href="javascript:void(0);" onclick="upload.showUploadForm('.$this->offlineappid.');">上传申请表</a>';
|
echo '<a class="btn btn-primary" href="/data/order/pdf/1">生成PDF</a> <a class="btn btn-primary" href="javascript:void(0);" onclick="upload.showUploadForm('.$this->offlineappid.');">上传申请表</a>';
|
||||||
else
|
else
|
||||||
if($this->offlineappstatus == 3)
|
echo '<a class="btn btn-warning" href="javascript:void(0);" onclick="upload.showUploadForm('.$this->offlineappid.');">重新上传申请表</a>
|
||||||
{
|
<a class="btn btn-success" href="/data/order/ac/commitapplicationform/?offlineappid='.$this->offlineappid.'">确认申请</a>';
|
||||||
echo '<a class="btn btn-warning" href="javascript:void(0);" onclick="upload.showUploadForm('.$this->offlineappid.');">重新上传申请表</a> ';
|
|
||||||
echo '<a class="btn btn-success" href="javascript:void(0);" onclick="commit('.$this->offlineappid.');">确认申请</a>';
|
|
||||||
}
|
}
|
||||||
|
} elseif ($this->tabID=='order-offline3') {
|
||||||
|
if(count($this->paginator))
|
||||||
|
{
|
||||||
|
echo "请等待审核";
|
||||||
}
|
}
|
||||||
} elseif ($this->tabID=='order-offline4') {
|
} elseif ($this->tabID=='order-offline4') {
|
||||||
echo '通过时间';
|
echo '通过时间';
|
||||||
|
@ -77,14 +77,13 @@ if ($this->tabID=='order-offline1') {
|
||||||
} elseif ($this->tabID=='order-offline2') {
|
} elseif ($this->tabID=='order-offline2') {
|
||||||
switch($order['status']) {
|
switch($order['status']) {
|
||||||
case 2:
|
case 2:
|
||||||
echo "请生成PDF申请表";
|
if(empty($order['applicationform']))
|
||||||
echo ' <a class="btn" href="/data/order/cancel/'.$order['id'].'">取消</a>';
|
echo "请生成PDF申请表并上传".' <a class="btn" href="/data/order/cancel/'.$order['id'].'">取消</a>';
|
||||||
|
else
|
||||||
|
echo '<span class="label label-success">PDF已上传,请确认提交申请</span>';
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if(!empty($order['applicationform']))
|
|
||||||
echo '<span class="label label-success">申请表已上传</span>';
|
echo '<span class="label label-success">申请表已上传</span>';
|
||||||
else
|
|
||||||
echo '<span class="label label-warning">请上传申请表</span>';
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -120,7 +120,13 @@
|
||||||
|
|
||||||
<input type="submit" name="save" id="savebutton" value="预览PDF" class="btn">
|
<input type="submit" name="save" id="savebutton" value="预览PDF" class="btn">
|
||||||
|
|
||||||
<input type="submit" name="submit" id="submitbutton" value="提交申请到数据中心" class="btn btn-primary">
|
<input type="submit" name="submit" id="submitbutton" value="生成并下载PDF" class="btn btn-primary">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<div class="alert alert-success">生成PDF并下载后,请<a href="/data/order/ac/offline2">在线上传PDF</a>,通过Email或者邮寄方式提交的申请将被拒绝</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace Order;
|
||||||
use Helpers\View as view;
|
use Helpers\View as view;
|
||||||
use Mail\Mail;
|
use Mail\Mail;
|
||||||
use Order\listener\OrderListener;
|
use Order\listener\OrderListener;
|
||||||
|
use Files\Output;
|
||||||
|
|
||||||
class Order
|
class Order
|
||||||
{
|
{
|
||||||
|
@ -242,7 +243,7 @@ class Order
|
||||||
|
|
||||||
}//SaveOrder
|
}//SaveOrder
|
||||||
|
|
||||||
//正式提交
|
//生成并下载PDF
|
||||||
public function SubmitOrder($formData,$uid = 0)
|
public function SubmitOrder($formData,$uid = 0)
|
||||||
{
|
{
|
||||||
if(empty($uid) || !is_numeric($uid))
|
if(empty($uid) || !is_numeric($uid))
|
||||||
|
@ -277,9 +278,20 @@ class Order
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->pushPdfDownload($pdf->pdflink);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}//SubmitOrder()
|
}//SubmitOrder()
|
||||||
|
|
||||||
|
public function pushPdfDownload($fn)
|
||||||
|
{
|
||||||
|
$output = new Output();
|
||||||
|
$path = realpath($this->config->offline->savepath);
|
||||||
|
$content = file_get_contents($path.DIRECTORY_SEPARATOR.$fn);
|
||||||
|
$output->pushDownload($content,"申请表.pdf",'pdf');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
//生成pdf
|
//生成pdf
|
||||||
public function pdfPrint($formData,$userid = 0,$save = false,$returnpdf = false)
|
public function pdfPrint($formData,$userid = 0,$save = false,$returnpdf = false)
|
||||||
{
|
{
|
||||||
|
@ -324,8 +336,8 @@ class Order
|
||||||
//header("Content-Length: " . strlen($pdfstring));
|
//header("Content-Length: " . strlen($pdfstring));
|
||||||
echo $pdf->Output('westdc-data-apply.pdf','S');
|
echo $pdf->Output('westdc-data-apply.pdf','S');
|
||||||
}else{
|
}else{
|
||||||
$fn = $formData['realname'].date('YmdHis').".pdf";
|
//$fn = $formData['realname'].date('YmdHis').".pdf";
|
||||||
//$fn = date('YmdHis').".pdf";
|
$fn = date('YmdHis').".pdf";
|
||||||
$path = realpath($this->config->offline->savepath);
|
$path = realpath($this->config->offline->savepath);
|
||||||
$pdf->pdflink = $fn;
|
$pdf->pdflink = $fn;
|
||||||
@$pdf->Output($path.DIRECTORY_SEPARATOR.$fn, 'F');
|
@$pdf->Output($path.DIRECTORY_SEPARATOR.$fn, 'F');
|
||||||
|
@ -371,6 +383,20 @@ class Order
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$uid = $user->id;
|
||||||
|
|
||||||
|
$sql="update dataorder set status=3 where status=2 and userid=$uid and offlineappid=$offlineappid";
|
||||||
|
if($this->db->exec($sql) < 0)
|
||||||
|
{
|
||||||
|
return "数据篮状态更新失败,请重试";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "UPDATE offlineapp SET status=3 WHERE id=$offlineappid ";
|
||||||
|
if($this->db->exec($sql) < 0)
|
||||||
|
{
|
||||||
|
return "数据篮状态更新有误,请联系管理员";
|
||||||
|
}
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
"user" => empty($user->realname) ? $user->username : $user->realname,
|
"user" => empty($user->realname) ? $user->username : $user->realname,
|
||||||
"link"=> view::getHostLink() . '/admin/down/offlineapps/ac/view/offlineappid/'.$offlineappid
|
"link"=> view::getHostLink() . '/admin/down/offlineapps/ac/view/offlineappid/'.$offlineappid
|
||||||
|
@ -380,6 +406,8 @@ class Order
|
||||||
$mail->loadTemplate("offline-pdf-commited",$data);
|
$mail->loadTemplate("offline-pdf-commited",$data);
|
||||||
$mail->setDefaultTo();
|
$mail->setDefaultTo();
|
||||||
$mail->send();
|
$mail->send();
|
||||||
|
|
||||||
|
return true;
|
||||||
}//确认申请
|
}//确认申请
|
||||||
|
|
||||||
//service_type 选择
|
//service_type 选择
|
||||||
|
|
|
@ -64,7 +64,7 @@ class PdfOperate implements \Order\listener\PdfEvents
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$id = $dbh->insert($this->tbl_offlineapp,$formData,true);
|
$id = $dbh->insert($this->tbl_offlineapp,$formData,true);
|
||||||
$this->updateToUserTable($formData,$id);
|
$this->updateToUserTable($formData,$uid);
|
||||||
if(empty($returnid))
|
if(empty($returnid))
|
||||||
{
|
{
|
||||||
if($id > 0)
|
if($id > 0)
|
||||||
|
@ -115,13 +115,13 @@ class PdfOperate implements \Order\listener\PdfEvents
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
$sql="update dataorder set status=3, offlineappid=$oid where status=2 and userid=$uid";
|
$sql="update dataorder set offlineappid=$oid where status=2 and userid=$uid";
|
||||||
if($this->db->exec($sql) < 0)
|
if($this->db->exec($sql) < 0)
|
||||||
{
|
{
|
||||||
return "数据篮状态更新失败,请重试";
|
return "数据篮状态更新失败,请重试";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "UPDATE offlineapp SET pdflink='".$pdf->pdflink."' WHERE id=$oid ";
|
$sql = "UPDATE offlineapp SET pdflink='".$pdf->pdflink."',status=2 WHERE id=$oid ";
|
||||||
if($this->db->exec($sql) < 0)
|
if($this->db->exec($sql) < 0)
|
||||||
{
|
{
|
||||||
return "数据篮状态更新有误,请联系管理员";
|
return "数据篮状态更新有误,请联系管理员";
|
||||||
|
@ -143,7 +143,7 @@ class PdfOperate implements \Order\listener\PdfEvents
|
||||||
$data = array(
|
$data = array(
|
||||||
"user"=>$formData['realname'],
|
"user"=>$formData['realname'],
|
||||||
"datalist"=>str_replace(";","\n",$formData['datalist']),
|
"datalist"=>str_replace(";","\n",$formData['datalist']),
|
||||||
"orderlink"=> view::getHostLink() . '/data/order/ac/offline3'
|
"orderlink"=> view::getHostLink() . '/data/order/ac/offline2'
|
||||||
);
|
);
|
||||||
|
|
||||||
$mail = new Mail();
|
$mail = new Mail();
|
||||||
|
|
Loading…
Reference in New Issue