echo getHelp('warnings.planner.terms'); exit; } if ($_POST['ajax_reminder'] == "session_was_shown") { // отправляется клиентом когда очередная сессия оповещений была показа первый раз // яваскрипт отправляет запрос после того как были выгруженны окна оповещений // здесь в любом случае передаем id реального юзера (да же если админом в другом месте используется фейковый id для отладки) Planner::remaind_counter($_SESSION['access']['user_id']); exit; } } } if (isset($_GET['add_data_to_rt_from_basket'])) { include_once ROOT . '/libs/php/classes/rt_class.php'; //echo $_GET['client_data'].' - '.$_GET['manager_login']; echo RT::add_data_from_basket_directly($_GET['client_data'], $_GET['dop_info'], $_GET['manager_login']); exit; } if (isset($_GET['subquery_for_planner_window'])) { include_once ROOT . '/libs/php/classes/client_class.php'; echo Client::cont_faces_list($_GET['client_id']); exit; } function get_content($path) { $fd = fopen($path, "rb"); if (filesize($path) > 0) { $content = fread($fd, filesize($path)); } else { $content = ''; }
} if($_POST['AJAX']=='update_new_sort_rt'){ RT::update_new_sort_rt_AJAX(); exit; } } ///////////////////// END AJAX ////////////////////// $cont_face_data = RT::fetch_query_client_face($query_num); //print_r($cont_face_data); $cont_face = '<div class="client_faces_select2" sourse="rt" query_num="'.$query_num.'" client_id="'.$client_id.'" onclick="openCloseMenu(event,\'clientManagerMenu\');">Контактное лицо: '.(($cont_face_data['id']==0)?'не установлено':$cont_face_data['details']['last_name'].' '.$cont_face_data['details']['name'].' '.$cont_face_data['details']['surname']).'</div>'; $create_time = RT::fetch_query_create_time($query_num); $query_related_data = RT::fetch_query_related_data($query_num); $theme = $query_related_data['theme']; $query_status = $query_related_data['status']; $manager_id = $query_related_data['manager_id']; $calculator_level = ($query_related_data['calculator_level']!='')?$query_related_data['calculator_level']:'full'; $CALCULATOR_LEVELS = array('full'=>"Конечники",'ra'=>"Рекламщики"); $calculator_level_ru = $CALCULATOR_LEVELS[$calculator_level]; $block_page_elements = ($_SESSION['access']['access']!= 1 && $query_status!='in_work')?true:false; $theme_block = '<input id="query_theme_input" class="query_theme" query_num="'.$query_num.'" type="text" value="'.(($theme=='')?'Введите тему':htmlspecialchars($theme,ENT_QUOTES)).'" onclick="fff(this,\'Введите тему\');">'; // шаблон поиска include ROOT.'/skins/tpl/common/quick_bar.tpl'; // планка клиента include_once './libs/php/classes/client_class.php'; Client::get_client__information($_GET['client_id']);
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; }
if(isset($_GET['set_recipient'])){ // print_r($_GET); Com_pred::set_recipient($_GET['set_recipient'],$_GET['row_id']); exit; } if(isset($_POST['AJAX']) && isset($_POST['action'])){ if($_POST['action']=='changeKpPosDescription') Com_pred::changePosDescription($_POST['id'],$_POST['field_val'],$_POST['field_name']); if($_POST['action']=='changeKpRepresentedData') Com_pred::changeRepresentedData($_POST['id'],$_POST['field_val'],$_POST['field_name']);//,$_POST['field_name'] exit; } if(isset($_POST['AJAX'])){ if($_POST['AJAX']=='edit_query_theme'){ include_once (ROOT.'/libs/php/classes/rt_class.php'); RT::save_theme($_POST['query_num'],$_POST['theme']); echo '{"response":"OK"}'; exit; } } /////////////////////////////////////// END AJAX ///////////////////////////////////////////////// /////////////////////////////////////// Временно /////////////////////////////////////// $create_list = TRUE; if(isset($_GET['save_in_pdf'])){ $kp_id=(int)$_GET['save_in_pdf']; Com_pred::save_in_pdf($kp_id,$client_id,$user_id); }
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; }
function fetch_rows_from_rt($query_num){ global $mysqli; global $Position_no_catalog; $rows = array(); $query = "SELECT main_tbl.id AS main_id ,main_tbl.type AS main_row_type ,main_tbl.art_id AS art_id ,main_tbl.art AS art ,main_tbl.name AS item_name ,main_tbl.master_btn AS master_btn , main_tbl.svetofor_display AS svetofor_display , dop_data_tbl.id AS dop_data_id , dop_data_tbl.row_id AS dop_t_row_id , dop_data_tbl.quantity AS dop_t_quantity , dop_data_tbl.price_in AS dop_t_price_in , dop_data_tbl.price_out AS dop_t_price_out , dop_data_tbl.discount AS dop_t_discount , dop_data_tbl.row_status AS row_status, dop_data_tbl.glob_status AS glob_status, dop_data_tbl.expel AS expel, dop_data_tbl.shipping_date AS shipping_date,dop_data_tbl.shipping_type AS shipping_type, dop_data_tbl.shipping_time AS shipping_time, dop_data_tbl.status_snab AS status_snab, dop_data_tbl.dop_men_text AS dop_men_text, dop_uslugi_tbl.id AS uslgi_t_id ,dop_uslugi_tbl.other_name AS uslugi_t_other_name ,dop_uslugi_tbl.uslugi_id AS uslgi_t_uslugi_id ,dop_uslugi_tbl.dop_row_id AS uslugi_t_dop_row_id ,dop_uslugi_tbl.type AS uslugi_t_type , dop_uslugi_tbl.glob_type AS uslugi_t_glob_type , dop_uslugi_tbl.quantity AS uslugi_t_quantity , dop_uslugi_tbl.price_in AS uslugi_t_price_in , dop_uslugi_tbl.price_out AS uslugi_t_price_out, dop_uslugi_tbl.discount AS uslugi_t_discount , dop_uslugi_tbl.for_how AS uslugi_t_for_how , dop_uslugi_tbl.print_details AS uslugi_t_print_details FROM `".RT_MAIN_ROWS."` main_tbl LEFT JOIN `".RT_DOP_DATA."` dop_data_tbl ON main_tbl.id = dop_data_tbl.row_id LEFT JOIN `".RT_DOP_USLUGI."` dop_uslugi_tbl ON dop_data_tbl.id = dop_uslugi_tbl.dop_row_id WHERE main_tbl.query_num ='".$query_num."' ORDER BY main_tbl.sort,dop_data_tbl.id"; // echo $query; $result = $mysqli->query($query) or die($mysqli->error); $multi_dim_arr = array(); while($row = $result->fetch_assoc()){ if(!isset($multi_dim_arr[$row['main_id']])){ $multi_dim_arr[$row['main_id']]['row_type'] = $row['main_row_type']; $multi_dim_arr[$row['main_id']]['master_btn'] = $row['master_btn']; $multi_dim_arr[$row['main_id']]['art_id'] = $row['art_id']; $multi_dim_arr[$row['main_id']]['art'] = $row['art']; $multi_dim_arr[$row['main_id']]['name'] = $row['item_name']; $multi_dim_arr[$row['main_id']]['svetofor_display'] = $row['svetofor_display']; if($row['main_row_type']=='cat'){ $data = RT::getArtRelatedPrintInfo($row['art_id']); $multi_dim_arr[$row['main_id']]['dop_details'] = $data; } } //$multi_dim_arr[$row['main_id']]['uslgi_t_id'][] = $row['uslgi_t_id']; if(isset($multi_dim_arr[$row['main_id']]) && !isset($multi_dim_arr[$row['main_id']]['dop_data'][$row['dop_data_id']]) &&!empty($row['dop_data_id'])){ $multi_dim_arr[$row['main_id']]['dop_data'][$row['dop_data_id']] = array( 'expel' => $row['expel'], 'shipping_date' => $row['shipping_date'], 'shipping_type' => $row['shipping_type'], 'shipping_time' => $row['shipping_time'], 'row_status' => $row['row_status'], 'glob_status' => $row['glob_status'], 'status_snab' => $row['status_snab'], 'dop_men_text_class' => ($row['dop_men_text']!='')?'filled':'empty', 'quantity' => $row['dop_t_quantity'], 'discount' => $row['dop_t_discount'], 'price_in' => $row['dop_t_price_in'], 'price_out' => $row['dop_t_price_out']); } if(isset($multi_dim_arr[$row['main_id']]['dop_data'][$row['dop_data_id']]) && !empty($row['uslgi_t_id'])){ $multi_dim_arr[$row['main_id']]['dop_data'][$row['dop_data_id']]['dop_uslugi'][$row['uslugi_t_glob_type']][$row['uslgi_t_id']] = array( 'type' => $row['uslugi_t_type'], 'id' => $row['uslgi_t_id'], 'uslugi_id' => $row['uslgi_t_uslugi_id'], 'quantity' => $row['uslugi_t_quantity'], 'other_name' => $row['uslugi_t_other_name'], 'price_in' => $row['uslugi_t_price_in'], 'price_out' => $row['uslugi_t_price_out'], 'discount' => $row['uslugi_t_discount'], 'for_how' => $row['uslugi_t_for_how'], 'print_details' => $row['uslugi_t_print_details'] ); } //print_r( $multi_dim_arr[$row['main_id']]['dop_data'][$row['dop_data_id']]['print_data']); echo "<br>"; $rows[]= '<tr><td>'.implode('</td><td>',$row).'</td></tr>'; } return array($multi_dim_arr,$rows); }