极限网络智能办公系统 - Office Automation 2008 官方100% 源码
源代码在线查看: delete.php
function tree_delete( $DEPT_ID )
{
$connection = openconnection( );
$query = "delete from DEPARTMENT where DEPT_ID=".$DEPT_ID;
exequery( $connection, $query );
$query = "select * from USER where DEPT_ID=".$DEPT_ID." and USER_ID='admin'";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$query = "update USER set DEPT_ID=0 where USER_ID='admin'";
exequery( $connection, $query );
}
$query = "delete from USER where DEPT_ID=".$DEPT_ID;
exequery( $connection, $query );
$query = "select * from DEPARTMENT where DEPT_PARENT=".$DEPT_ID;
$cursor = exequery( $connection, $query );
while ( $ROW = mysql_fetch_array( $cursor ) )
{
$DEPT_ID = $ROW['DEPT_ID'];
tree_delete( $DEPT_ID );
}
}
include_once( "inc/auth.php" );
include_once( "inc/utility_all.php" );
echo "\r\n\r\n\r\n删除部门\r\n\r\n\r\n\r\n\r\n\r\n";
$connection = openconnection( );
tree_delete( $DEPT_ID );
add_log( 5, $DEPT_ID, $LOGIN_USER_ID );
message( "提示", "部门/成员单位已删除" );
echo "\r\n\r\nparent.dept_list.location.reload();\r\n\r\n\r\n\r\n\r\n";
?>