protected function insert_new_client_for_new_qury_AJAX() { if (!isset($_POST['company']) || trim($_POST['company']) == '') { $this->get_form_the_create_client_AJAX('insert_new_client_for_new_qury'); exit; } switch ($this->user_access) { case '1': $message = 'заведение запроса из под админа не предусмотрено т.к. это слишком трудоемкий и долгий процесс до запуска не актуально вывод кнопки будет отключен для админа'; // $message .= $this->print_arr($_POST); // $message = 'Для корректного сохранения данных по оплате, сначало заполните поле "дата"!!!'; $json = '{"response":"OK","show_new_window_simple","html":"' . base64_encode($message) . '"}'; echo $json; exit; break; case '5': // создаём клиента $this->client_id = $this->create_new_client($_POST['company'], $_POST['dop_info']); // куратором нового клиента будет менеджер $this->attach_relate_manager($this->client_id, $this->user_id); // создаем новый запрос include_once './libs/php/classes/rt_class.php'; $data_arr = array(); $qury_num_NEW = RT::create_new_query($this->client_id, $this->user_id, $data_arr, 'in_work'); $href = '?page=client_folder&client_id=' . $this->client_id . '&query_num=' . $qury_num_NEW; echo '{"response":"OK","function":"location_href","href":"' . $href . '"}'; exit; break; default: break; } $message = 'в методе insert_new_client_for_new_qury_AJAX() что-то пошло не так ... client_class.php'; $json = '{"response":"OK","function":"echo_message","message_type":"error_message","message":"' . base64_encode($message) . '"}'; echo $json; exit; }
static function add_data_from_basket($client_id, $manager_id_arr, $customer_data = FALSE, $dop_info = FALSE) { global $mysqli; // print_r($manager_id_arr); echo '--'; exit; $user_id = $_SESSION['access']['user_id']; // $date = date('Y-m-d H:i:s'); // содержимое корзины $basket_arr = $_SESSION['basket']; //print_r($dop_info_arr); //exit; foreach ($basket_arr as $key => $basket_data) { $id = $basket_data['article']; $characteristics = array(); // выбираем из базы каталога данные об артикуле $query = "SELECT*FROM `" . BASE_TBL . "` WHERE id = '" . $id . "'"; $result = $mysqli->query($query) or die($mysqli->error); $art_data = $result->fetch_assoc(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // получаем цвета артикула // /////////////////////////////////////////////////////////////////////////////////////////////////////////////// $query = "SELECT color FROM `" . BASE_COLORS_TBL . "` WHERE art_id ='" . $id . "' AND color<>''"; $result = $mysqli->query($query) or die($mysqli->error); while ($item = $result->fetch_assoc()) { $characteristics['colors'][] = $item['color']; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // получаем материалы артикула // /////////////////////////////////////////////////////////////////////////////////////////////////////////////// $query = "SELECT*FROM `" . BASE_MATERIALS_TBL . "` WHERE art_id ='" . $id . "'"; $result = $mysqli->query($query) or die($mysqli->error); while ($item = $result->fetch_assoc()) { $characteristics['materials'][] = $item['material']; } require_once ROOT . "/libs/php/classes/rt_calculators_class.php"; $characteristics = count($characteristics) > 0 ? rtCalculators::json_fix_cyr(json_encode($characteristics)) : ''; //print_r($dop_info); if ($dop_info) { $data_arr[$key]['dop_info'] = $dop_info[$key]; } $data_arr[$key]['art_id'] = $basket_data['article']; $data_arr[$key]['art'] = $art_data['art']; $data_arr[$key]['type'] = 'cat'; $data_arr[$key]['name'] = $art_data['name']; $data_arr[$key]['description'] = $art_data['description']; $data_arr[$key]['characteristics'] = $characteristics; /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // формируем tirage_json // /////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (!empty($basket_data['size_id']) && $basket_data['size_id'] != 'undefined') { // если id размера( id строки из BASE_DOP_PARAMS_TBL) указано в корзине используем эту информацию $tirage_json = array(); $tirage_json[$basket_data['size_id']] = array("dop" => "0", "tir" => $basket_data['quantity']); $tirage_json = json_encode($tirage_json); } else { // иначе обращаемся к BASE_DOP_PARAMS_TBL и считываем данные $query = "SELECT*FROM `" . BASE_DOP_PARAMS_TBL . "` WHERE art_id ='" . $id . "'"; $result = $mysqli->query($query) or die($mysqli->error); if ($result->num_rows > 0) { $item = $result->fetch_assoc(); $tirage_json = array(); $tirage_json[$item['id']] = array("dop" => "0", "tir" => $basket_data['quantity']); $tirage_json = json_encode($tirage_json); } else { $tirage_json = '{}'; } } $data_arr[$key]['dop_data'][0]['quantity'] = $basket_data['quantity']; $data_arr[$key]['dop_data'][0]['price_out'] = $basket_data['price']; $data_arr[$key]['dop_data'][0]['tirage_json'] = $tirage_json; unset($tirage_json); /* // пока нет калькуляторов это не востребованно // это просто пример $data_arr[$key]['dop_data'][0]['dop_uslugi'][0]['glob_type'] = 'print'; $data_arr[$key]['dop_data'][0]['dop_uslugi'][0]['type'] = ''; $data_arr[$key]['dop_data'][0]['dop_uslugi'][0]['quantity'] = $basket_data['quantity']; $data_arr[$key]['dop_data'][0]['dop_uslugi'][0]['price_in'] = 1; $data_arr[$key]['dop_data'][0]['dop_uslugi'][0]['price_out'] = 10; */ } $query_num = RT::create_new_query($client_id, $manager_id_arr, $data_arr); /** * сохраняем данные введённые в форму * отправки заказа из корзины в комментарии по запросу * * @author Алексей Капитонов * @version 15:60 30.10.2015 */ // ini_set('error_reporting', E_ALL); // ini_set('display_errors', 1); // ini_set('display_startup_errors', 1); // --> START <-- // if ($customer_data) { include_once ROOT . "/libs/php/classes/comments_class.php"; $COMMENTS = new Comments_for_query_class(); $text = trim($customer_data['name']) != '' ? 'Имя: ' . $customer_data['name'] . '<br>' : ''; $text .= trim($customer_data['reg_phone']) != '' ? 'Телефон: ' . $customer_data['reg_phone'] . '<br>' : ''; $text .= trim($customer_data['email']) != '' ? 'E-mail: ' . $customer_data['email'] . '<br>' : ''; $text .= trim(cor_data_for_SQL($customer_data['coment'])) != '' ? 'Пожелания: ' . cor_data_for_SQL($customer_data['coment']) . '<br>' : ''; $COMMENTS->save_query_comment_Pub(0, $query_num, 'Клиент', $text); // --> END <-- // } return $query_num; }