51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?php
|
|
include_once '_common.php';
|
|
if(!$_SESSION['user_id']) exit;
|
|
|
|
if ( isset($_POST['tid']) && isset($_POST['tname']) && isset($_POST['tused']) ) {
|
|
$tid = trim($_POST['tid']);
|
|
$tname = trim($_POST['tname']);
|
|
$tused = trim($_POST['tused']);
|
|
|
|
// 업데이트 전 정보 불러오기
|
|
$q = "SELECT * FROM {$fg['member_group_table']} WHERE tid = '{$tid}'";
|
|
$team = sql_fetch($q);
|
|
|
|
// 변경된 정보 넣어주기
|
|
$w1 = "";
|
|
$w2 = "";
|
|
if($team['tname'] != $tname) {
|
|
$w1 .= "부서명 변경";
|
|
$w2 .= $team['tname']."->".$tname;
|
|
}
|
|
if($team['tused'] != $tused) {
|
|
if(!empty($w1)) {
|
|
$w1 .= ", ";
|
|
$w2 .= ", ";
|
|
}
|
|
$w1 .= "부서출력 변경";
|
|
if($team['tused'] == 1) {
|
|
$w2 .= "사용 -> 미사용";
|
|
} else {
|
|
$w2 .= "미사용 -> 사용";
|
|
}
|
|
}
|
|
|
|
// DB에 업데이트
|
|
$query = "UPDATE {$fg['member_group_table']} SET tname = '{$tname}', tused = '{$tused}'";
|
|
$query .= " WHERE tid = '{$tid}'";
|
|
|
|
$result = sql_query($query);
|
|
|
|
if ( $result ) {
|
|
$work_detail = $w2.", 처리자 : ".$_SESSION['user_name'];
|
|
$time = date("Y-m-d H:i:s");
|
|
$logquery = "INSERT INTO {$fg['log_table']} (work, work_detail, id, date) VALUES ('{$w1}', '{$work_detail}', '{$_SESSION['user_id']}', '{$time}')";
|
|
// log 쿼리 실행
|
|
$result = sql_query($logquery);
|
|
|
|
$data = array("isSuccess" => $result);
|
|
header("Content-Type: application/json");
|
|
echo json_encode($data);
|
|
}
|
|
} |