<?php
session_start();
if(!isset($_SESSION['sys_id'])) header("Location: ?d=index");
require_once("config.php");
//$tablename = $_GET['table'];
$user_id = $_SESSION['sys_id'];
$id = (int)$_GET['id'];
$orgunitid = (int)$_GET['orgunitid'];
$name = mysql_escape_string($_GET['name']);
$short_name = mysql_escape_string($_GET['short_name']);
$combine = "(".$short_name.") ".$name;
$qry = mysql_fetch_array(mysql_query("SELECT doc_comment FROM tbl_in_out_document WHERE doc_id = '$id'"));
$comment = $qry['doc_comment']=="" ? $combine : $qry['doc_comment'].", ".$combine;
$a = mysql_query("UPDATE  tbl_in_out_document SET doc_comment = '$comment' WHERE doc_id = '$id'");
if($a){
	mysql_query("INSERT INTO  tbl_his_comment(doc_id, orgunitid, comment, sysuserid) VALUES('$id', '$orgunitid', '$combine', '$user_id')"); 
	mysql_query("UPDATE tbl_manage_doc SET receive_status=2 WHERE doc_id='$id' AND orgunitid='$orgunitid'");
}
