function addClaim($in_num, $in_date, $type, $description, $sen_dep, $sen_name, $out_num, $out_date, $filename, $user) { //$sql = "INSERT INTO claim(in_num, in_date, type, description, sen_dep, sen_sec, sen_name, out_num, out_date, filename) // VALUES('$in_num', '$in_date', '$type', '$description', '$sen_dep', '$sen_sec', '$sen_name', '$out_num', '$out_date', '$filename')"; $sql = "INSERT INTO `dt`.`claim` (\r\n\t\t\t\t\t\t\t\t\t\t`in_num` ,\r\n\t\t\t\t\t\t\t\t\t\t`in_date` ,\r\n\t\t\t\t\t\t\t\t\t\t`out_num` ,\r\n\t\t\t\t\t\t\t\t\t\t`out_date` ,\r\n\t\t\t\t\t\t\t\t\t\t`type` ,\r\n\t\t\t\t\t\t\t\t\t\t`description` ,\r\n\t\t\t\t\t\t\t\t\t\t`sen_dep` ,\r\n\t\t\t\t\t\t\t\t\t\t`sen_name` ,\r\n\t\t\t\t\t\t\t\t\t\t`filename`\r\n\t\t\t\t\t\t\t\t\t) VALUES ('{$in_num}', '{$in_date}', '{$type}', '{$description}', '{$sen_dep}', '{$sen_name}', '{$out_num}', '{$out_date}', '{$filename}');"; query($sql); $claim = getlastclaim(); sendtouser($user, $claim, 0); }
protected function OnInput() { parent::OnInput(); $this->title = 'Заявка'; $this->id = $_GET['id']; $this->user = $_SESSION['uid']; makeopen($this->user, $this->id); $this->claiminfo = getClaimInfo($this->id); if (isset($_POST['submit']) && isClosed($this->id)) { closeThisClaim($this->id); } if (isset($_POST['submit']) && ($_SESSION['role'] == '2' || $_SESSION['role'] == '5')) { $comment = $_POST['comment']; $str = $_POST['manager']; $n = strlen($str); if ($n >= 4) { $manager = substr($str, 3, $n - 1); } else { $m = getManagerFromSection($_POST['manager']); $manager = $m->id; } if ($comment != '') { addcomment($this->user, $this->id, $manager, $comment); } makestate($_SESSION['uid'], $this->id); sendtouser($manager, $this->id, $this->user); } if (isset($_POST['submit']) && $_SESSION['role'] == '3') { $comment = $_POST['comment']; $user = $_POST['user']; if ($comment != '') { addcomment($this->user, $this->id, $user, $comment); } makestate($_SESSION['uid'], $this->id); sendtouser($user, $this->id, $this->user); } if (isset($_POST['submit']) && $_SESSION['role'] == '4') { move_uploaded_file($_FILES["filename"]['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . "/dt/uploads/act/" . $_FILES["filename"]["name"]); makestate($_SESSION['uid'], $this->id); closeClaim($this->id, $_SESSION['uid'], $_FILES['filename']['name']); if ($comment != '') { addcomment($this->user, $this->id, $user, $comment); } } }