Joywork/admin/ajax/addClientMeet.php

25 lines
967 B
PHP
Raw Normal View History

2026-05-22 20:21:54 +02:00
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/config.php");
if ($_SESSION['id'] && $_POST['schedule_date'] && $_POST['client_id'] && is_numeric($_POST['client_id'])) {
$post = clearInputData($_POST);
$scheduleDate = DateTime::createFromFormat('d.m.Y H:i', $post['schedule_date']);
$scheduleDate = "'".date("Y-m-d H:i:s", $scheduleDate->getTimestamp())."'";
$sql="SELECT * FROM clients_jw WHERE id=$post[client_id]";
$rez=mysql_query($sql);
$client = mysql_fetch_assoc($rez);
$idUser = $_SESSION['id'];
if ($client['who_work'] > 0) {
// тому событие, чей клиент
$idUser = $client['who_work'];
}
$from_id = $_SESSION['id'];
$sql = "INSERT INTO user_client_jw_events(user_id, client_id, type, comment, address, schedule_date, from_id) ";
$sql .= " VALUES($idUser, $post[client_id], 'meet', '$post[comment]', '$post[address]', $scheduleDate, $from_id)";
mysql_query($sql);
}