📄 stop.php
字号:
<?php
include_once( "inc/auth.php" );
include_once( "inc/utility_sms1.php" );
include_once( "../prcs_role.php" );
ob_end_clean( );
if ( !run_role( $RUN_ID, 0 ) )
{
exit( );
}
$CUR_TIME = date( "Y-m-d H:i:s", time( ) );
$query = "SELECT FLOW_TYPE from FLOW_RUN,FLOW_TYPE WHERE FLOW_RUN.RUN_ID='".$RUN_ID."' AND FLOW_RUN.FLOW_ID=FLOW_TYPE.FLOW_ID";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$FLOW_TYPE = $ROW['FLOW_TYPE'];
}
if ( $OP_FLAG || $OP == "MANAGE" )
{
$PRCS_ID_NEXT = $PRCS_ID + 1;
$query = "SELECT * from FLOW_RUN_PRCS WHERE RUN_ID=".$RUN_ID." and PRCS_ID='{$PRCS_ID_NEXT}' and PRCS_FLAG=5";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
if ( $OP != "MANAGE" )
{
echo "本流程存在后续预设步骤,不能结束!";
exit( );
}
$query = "delete from FLOW_RUN_PRCS WHERE RUN_ID=".$RUN_ID." and PRCS_ID>='{$PRCS_ID_NEXT}'";
exequery( $connection, $query );
}
if ( $OP != "MANAGE" )
{
$query = "update FLOW_RUN_PRCS set DELIVER_TIME='".$CUR_TIME."' WHERE RUN_ID='{$RUN_ID}' and PRCS_ID='{$PRCS_ID}' and USER_ID='{$LOGIN_USER_ID}'";
exequery( $connection, $query );
}
else
{
$query = "update FLOW_RUN_PRCS set DELIVER_TIME='".$CUR_TIME."' WHERE RUN_ID='{$RUN_ID}' and DELIVER_TIME is null";
exequery( $connection, $query );
$query = "update FLOW_RUN_PRCS set PRCS_TIME='".$CUR_TIME."' WHERE RUN_ID='{$RUN_ID}' and PRCS_TIME is null";
exequery( $connection, $query );
}
$query = "update FLOW_RUN_PRCS set PRCS_FLAG='4' WHERE RUN_ID='".$RUN_ID."'";
exequery( $connection, $query );
$query = "update FLOW_RUN set END_TIME='".$CUR_TIME."' where RUN_ID={$RUN_ID} LIMIT 1";
exequery( $connection, $query );
if ( $OP != "MANAGE" )
{
$CONTENT = "结束流程";
}
else
{
$CONTENT = $LOGIN_USER_NAME."强制结束流程";
}
run_log( $RUN_ID, $PRCS_ID, $FLOW_PRCS, $LOGIN_USER_ID, 1, $CONTENT );
if ( $FLOW_TYPE == 2 && $FLAG != 1 )
{
header( "location: index.php?FLOW_ID=".$FLOW_ID );
exit( );
}
$query = "select PARENT_RUN FROM FLOW_RUN WHERE RUN_ID='".$RUN_ID."'";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$PARENT_RUN = $ROW['PARENT_RUN'];
}
if ( $PARENT_RUN != 0 )
{
$query = "select FLOW_ID FROM FLOW_RUN WHERE RUN_ID='".$PARENT_RUN."'";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$PARENT_FLOW_ID = $ROW['FLOW_ID'];
}
$query = "select PRCS_ID,FLOW_PRCS FROM FLOW_RUN_PRCS WHERE RUN_ID='".$PARENT_RUN."' AND CHILD_RUN='{$RUN_ID}'";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$PARENT_PRCS_ID = $ROW['PRCS_ID'];
$PARENT_FLOW_RPCS = $ROW['FLOW_PRCS'];
}
$query = "select PRCS_TO,AUTO_USER_OP,AUTO_USER FROM FLOW_PROCESS WHERE FLOW_ID='".$PARENT_FLOW_ID."' AND PRCS_ID='{$PARENT_FLOW_RPCS}'";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$PRCS_BACK = $ROW['PRCS_TO'];
$BACK_USER_OP = $ROW['AUTO_USER_OP'];
$BACK_USER = $ROW['AUTO_USER'];
}
$query = "update FLOW_RUN_PRCS set DELIVER_TIME='".$CUR_TIME."',PRCS_FLAG='4' WHERE RUN_ID={$PARENT_RUN} and PRCS_ID={$PARENT_PRCS_ID} and FLOW_PRCS='{$PARENT_FLOW_RPCS}' and PRCS_FLAG in (1,2)";
exequery( $connection, $query );
if ( $PRCS_BACK != "" )
{
$PARENT_PRCS_ID_NEW = $PARENT_PRCS_ID + 1;
$query = "insert into FLOW_RUN_PRCS(RUN_ID,PRCS_ID,USER_ID,PRCS_FLAG,FLOW_PRCS,OP_FLAG,TOP_FLAG,PARENT) values (".$PARENT_RUN.",{$PARENT_PRCS_ID_NEW},'{$BACK_USER_OP}','1',{$PRCS_BACK},1,0,'{$PARENT_FLOW_RPCS}')";
exequery( $connection, $query );
$BACK_USER_ARR = explode( ",", $BACK_USER );
$k = 0;
for ( ; $k < count( $BACK_USER_ARR ); ++$k )
{
if ( !( $BACK_USER_ARR[$k] != "" ) && !( $BACK_USER_ARR[$k] != $BACK_USER_OP ) )
{
$query = "insert into FLOW_RUN_PRCS(RUN_ID,PRCS_ID,USER_ID,PRCS_FLAG,FLOW_PRCS,OP_FLAG,TOP_FLAG,PARENT) values (".$PARENT_RUN.",{$PARENT_PRCS_ID_NEW},'{$BACK_USER_ARR[$k]}','1',{$PRCS_BACK},0,0,'{$PARENT_FLOW_RPCS}')";
exequery( $connection, $query );
}
}
}
}
echo $RUN_ID;
}
else
{
if ( $TOP_FLAG == 2 )
{
$query = "select 1 FROM FLOW_RUN_PRCS WHERE RUN_ID='".$RUN_ID."' AND PRCS_ID='{$PRCS_ID}' AND FLOW_PRCS='{$FLOW_PRCS}' AND USER_ID<>'{$LOGIN_USER_ID}' AND PRCS_FLAG IN(1,2)";
$cursor = exequery( $connection, $query );
if ( !( $ROW = mysql_fetch_array( $cursor ) ) )
{
if ( $FLOW_PRCS == "" || $FLOW_PRCS == "0" )
{
$TURN_PAGE = "turn_next_free";
}
else
{
$TURN_PAGE = "turn_next";
}
$query = "select FLOW_ID FROM FLOW_RUN WHERE RUN_ID='".$RUN_ID."'";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$FLOW_ID = $ROW['FLOW_ID'];
}
header( "location: turn/".$TURN_PAGE.".php?RUN_ID={$RUN_ID}&MENU_FLAG={$MENU_FLAG}&FLOW_ID={$FLOW_ID}&PRCS_ID={$PRCS_ID}&FLOW_PRCS={$FLOW_PRCS}&TOP_FLAG={$TOP_FLAG}" );
exit( );
}
}
if ( $FLOW_PRCS == "" || $FLOW_PRCS == "0" )
{
$query = "update FLOW_RUN_PRCS set PRCS_FLAG='4',DELIVER_TIME='".$CUR_TIME."' WHERE RUN_ID='{$RUN_ID}' and PRCS_ID='{$PRCS_ID}' and USER_ID='{$LOGIN_USER_ID}'";
}
else
{
$query = "update FLOW_RUN_PRCS set PRCS_FLAG='4',DELIVER_TIME='".$CUR_TIME."' WHERE RUN_ID='{$RUN_ID}' and PRCS_ID='{$PRCS_ID}' and FLOW_PRCS='{$FLOW_PRCS}' and USER_ID='{$LOGIN_USER_ID}'";
}
exequery( $connection, $query );
$query = "SELECT 1 from FLOW_RUN_PRCS WHERE RUN_ID='".$RUN_ID."' AND PRCS_ID={$PRCS_ID} AND OP_FLAG='0' AND PRCS_FLAG<>'4'";
$cursor = exequery( $connection, $query );
if ( !mysql_fetch_array( $cursor ) )
{
$query = "SELECT RUN_NAME,FLOW_ID from FLOW_RUN WHERE RUN_ID='".$RUN_ID."'";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$RUN_NAME = $ROW['RUN_NAME'];
$FLOW_ID1 = $ROW['FLOW_ID'];
}
$query = "SELECT USER_ID from FLOW_RUN_PRCS WHERE RUN_ID='".$RUN_ID."' AND PRCS_ID={$PRCS_ID} AND OP_FLAG='1' AND PRCS_FLAG<>'4'";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$USER_ID = $ROW['USER_ID'];
}
if ( $USER_ID != "" )
{
$REMIND_URL = "workflow/list/input_form?RUN_ID=".$RUN_ID."&FLOW_ID={$FLOW_ID1}&PRCS_ID={$PRCS_ID}&FLOW_PRCS={$FLOW_PRCS}";
$SMS_CONTENT = "工作流已会签完毕:".$RUN_NAME."\n您作为主办人,可以转交下一步骤";
send_sms( "", $LOGIN_USER_ID, $USER_ID, 7, $SMS_CONTENT, $REMIND_URL );
}
}
header( "location: index.php?FLOW_ID=".$FLOW_ID );
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -