通达OA触发器--压缩保存工作流中的表单文件和所有附件到服务器的指定目录(2013adv,2015,2016)
来源:互联网 发布:泰国有4g网络吗 编辑:程序博客网 时间:2024/05/16 07:01
<?//qq:1027167227include_once("inc/auth.inc.php");include_once("inc/utility_file.php");include_once("../../list/export_flow.php");include_once("inc/header.inc.php");include_once("inc/workflow/inc/common.inc.php");include_once("inc/workflow/inc/workflow.inc.php");include_once("inc/workflow/tform/twork_export.class.php");$RUN_ID_STR="7857";//echo $RUN_ID_STR."<br>";//workflow/query/explot_zip.phpif($archive_data){$archive_time="_".$archive_data;$use_databases = "td_oa_archive.";}else{$archive_time =="";$use_databases = "";}$zip_name = sprintf(_($RUN_ID_STR."OA工作(%s).zip"), date("Y-m-d",time()));$zip_file = get_tmp_filename("workflow", $zip_name);$zip = new ZipArchive;$res = $zip->open($zip_file, ZipArchive::CREATE|ZIPARCHIVE::OVERWRITE);if($res !== TRUE){ Message(_("提示"),_("创建文件错误,代码:").$res); exit;}if($RUN_ID_STR=="") $RUN_ID_STR=0;elseif(substr($RUN_ID_STR,-1,1)==",") $RUN_ID_STR=substr($RUN_ID_STR,0,-1);$tmp_file_array = array();$tmp_file_array[] = $zip_file;$query = "SELECT * from FLOW_RUN where RUN_ID IN ($RUN_ID_STR)";//echo $query."<br>";$cursor= exequery(TD::conn(),$query);while($ROW=mysql_fetch_array($cursor)){ $zipfiles=""; $role_str = ""; $RUN_ID = $run_id = $ROW["RUN_ID"]; $flow_id = $ROW["FLOW_ID"]; $run_name = trim($ROW["RUN_NAME"]); //判断查看权限 $role_str = run_role($run_id, 0, $archive_time); //判断保密字段规则 0 - 无保密字段 1 - 根据步骤号获得保密字段 2 - 对所有步骤的保密字段都设定为保密字段 $flag_hidden_type = 1; $table_flow_run_prcs = $use_databases."flow_run_prcs".$archive_time; if(find_id($role_str, 1) || find_id($role_str, 3) || find_id($role_str, 5) || find_id($role_str, 9) || find_id($role_str, 10) || find_id($role_str, 11)) { //系统管理员、查询、管理、监控、点评、编辑权限人可以看所有字段 $PRCS_ID = 0; $flag_hidden_type = 0; } else if(find_id($role_str, 2) || find_id($role_str, 4) || find_id($role_str, 6)) { //主办、经办、原始委托人可以查看其办理的最后一步流程步骤的所有字段 $query2 = "select prcs_id from ".$table_flow_run_prcs." where ID = ( select MAX(ID) from ".$table_flow_run_prcs." where RUN_ID = '".$run_id."' AND (USER_ID = '".$_SESSION["LOGIN_USER_ID"]."' or FIND_IN_SET('".$_SESSION["LOGIN_USER_ID"]."',OTHER_USER))) "; $cursor2 = exequery(TD::conn(), $query2); if($row2 = mysql_fetch_array($cursor2)) { $PRCS_ID = $row2['prcs_id']; } $flag_hidden_type = 1; } else if(find_id($role_str, 8) || find_id($role_str, 7)) { //传阅人或者父、子流程权限所有人,所有步骤的保密字段 $PRCS_ID = 0; $flag_hidden_type = 2; } //获取保密字段 if($flag_hidden_type == 0) { $secret_fields = ""; } else if($flag_hidden_type == 1) { //获得设计步骤号 $query3 = "select FLOW_PRCS from ".$table_flow_run_prcs." where RUN_ID = '".$run_id."' and PRCS_ID = '".$PRCS_ID."' limit 1"; $cursor3 = exequery(TD::conn(),$query3); if($row3 = mysql_fetch_array($cursor3)) { $FLOW_PRCS = $row3['FLOW_PRCS']; } //获得步骤保密字段 $table_flow_prcocess = $use_databases."flow_process".$archive_time; $secret_fields = ""; $query3 = "select HIDDEN_ITEM from ".$table_flow_prcocess." where FLOW_ID = '".$flow_id."' and PRCS_ID = '".$FLOW_PRCS."' "; $cursor3 = exequery(TD::conn(),$query3); if($row3 = mysql_fetch_array($cursor3)) { $secret_fields = $row3['HIDDEN_ITEM']; } } else if($flag_hidden_type == 2) { //获得流程所有步骤的保密字段 $table_flow_prcocess = $use_databases."flow_process".$archive_time; $secret_fields = ""; $query3 = "select HIDDEN_ITEM from ".$table_flow_prcocess." where FLOW_ID = '".$flow_id."' "; $cursor3 = exequery(TD::conn(),$query3); while($row3 = mysql_fetch_array($cursor3)) { $secret_fields .= $row3['HIDDEN_ITEM'].","; } //去掉重复的 $secret_fields = td_trim($secret_fields); $secret_fields = str_remove_dup($secret_fields); } $config = Array( 'FLOW_VIEW' => '12345', 'db' => $use_databases, 'archive_time' => $archive_time, 'secret_fields' => $secret_fields ); $obj_export_zip = new TWorkExport($flow_id, $run_id, 0,0,0, $config); $a_export = $obj_export_zip->export_all_run();//print_r($a_export); $s_attachment_id = $a_export['attachment_id']; $s_attachment_name = $a_export['attachment_name']; $content_html = $a_export['content_html'];$query4="select data_2,data_2_key from flow_data_161 where run_id='$RUN_ID' limit 1";$cursor4=exequery(TD::conn(),$query4);while($row4=mysql_fetch_array($cursor4)){$data_2=str_replace("*",",",$row4["data_2"]);$data_2_key=$row4["data_2_key"];} $s_attachment_id.=$data_2_key; $s_attachment_name.=$data_2;// echo $s_attachment_id."<br>";//echo $s_attachment_name."<br>"; //处理文件名称 /\*:?"<>| $j = 0; $char="/,\\,*,:,?,\",<,>,|"; while($j < strlen($run_name)) { $str = substr($run_name, $j, 1); if(find_id($char, $str)) { $run_name = str_replace($str,"",$run_name); } $j++; } if(!$zip->addEmptyDir($run_name)) { continue; } $zip->addFromString($run_name."/".$run_name.".html", $content_html); // echo $s_attachment_id."<br>"; $a_attachment_id = explode(",",$s_attachment_id); $a_attachment_name = explode(",",$s_attachment_name); $feedbck_count_id = sizeof($a_attachment_id); for($k=0; $k < $feedbck_count_id; $k++) { if($a_attachment_id[$k] == '') { continue; } $filename = attach_real_path($a_attachment_id[$k],$a_attachment_name[$k]); if(!$filename) { continue; } $tmp_filename = get_tmp_filename("workflow_attach", basename($filename)); if(decrypt_attach($filename, $tmp_filename)) { $filename = $tmp_filename; $tmp_file_array[] = $tmp_filename; } $zip->addFile($filename, $run_name."/".$a_attachment_name[$k]); }}//while$zip->close();ob_end_clean();/*Header("Cache-control: private");Header("Content-type: application/x-zip");header("Accept-Ranges: bytes");header("Accept-Length: ".sprintf("%u", filesize($zip_file)));header("Content-Disposition: attachment; ".get_attachment_filename($zip_name));*///readfile($zip_file);echo $zip_file."<br>";$PATH="E:/MYOA/attach/".$zip_name; echo @copy($zip_file,$PATH)?'成功':'失败';//echo @rename($file1,$PATH)?'成功':'失败';//2677@1505_1668115426foreach ($tmp_file_array as $tmp_file){ @unlink($tmp_file);}?>
0 0
- 通达OA触发器--压缩保存工作流中的表单文件和所有附件到服务器的指定目录(2013adv,2015,2016)
- 通达OA工作流插件--保存OA流程中的所有附件+流程表单到指定目录(2013adv,2015,2016)
- 通达OA工作流附件自动转存到文件柜的触发器
- 通达OA 测试2015新版工作流触发器(插件)的系统兼容性(图文)
- 通达OA数据库服务起不来的解决办法,支持2013adv,2015,2016
- 通达OA工作流-表单设计
- 通达OA 开发工作流触发器碰到的一个特殊现象
- 如何更改通达OA附件的存储目录
- 通达OA 体验升级到2013新版本的通达OA
- 通达OA 工作流表单里的红头标题需要变成选项的处理(图文)
- 通达OA 在工作流中直接查询表单内容的开发尝试(图文)
- 通达OA 小飞鱼工作流在线培训教程(六)HTML的Form表单
- 通达OA 工作流表单中关联查询另外一个工作流方法(源码)
- 通达OA 小飞鱼工作流在线培训教程(四)HTML的frameset和iframe
- 批处理简单执行rar压缩 并保存附件到服务器指定文件夹
- 通达OA工作流主要表的数据结构
- 如何控制通达OA的工作流表单列表控件的列输入框
- 通达OA 关于直接在数据库中修改工作流表单值的问题
- XSS学习笔记(入门篇)
- 5.1 Tomcat学习(servlet容器)
- Android studio异常Class not found using the boot class loader; no stack available
- 重写与重载编译时运行时不同之处
- 筛选需要的log信息保存到本地
- 通达OA触发器--压缩保存工作流中的表单文件和所有附件到服务器的指定目录(2013adv,2015,2016)
- 设置互斥锁的类型
- Codeforces 755F 规模较大的装箱dp
- OPC之DCOM配置
- ButterKnife v6.1.0的, v8.0.1主要的不同在以下几个关键词:
- 听讲座
- SpringMVC注解@RequestParam全面解析
- 浅谈信息安全及解决方案
- Java之多线程的实现: