function addvisit_2_exec($Frm, $Err) { if (!$Err) { if (!isset($_SESSION["make_visit_tmp"]["klient"])) { $Frm->_gui->ERR("Клиент не определен"); return; } $kln = kln_get($_SESSION["make_visit_tmp"]["klient"]); if (!$kln) { $Frm->_gui->ERR("Клиент не определен"); return; } $ord_id = 0; if (isset($_SESSION["make_visit_tmp"]["order"]) && intval($_SESSION["make_visit_tmp"]["order"])) { $ord_id = intval($_SESSION["make_visit_tmp"]["order"]); if (!Order::find($ord_id)) { $Frm->_gui->ERR("Заказ не найден"); return; } } // Проверить время $t1 = $Frm->GetNmValue("start"); $t2 = $Frm->GetNmValue("finish"); if ($t2 <= $t1) { $Frm->_gui->ERR("Некорректно задано время"); return; } $dt = explode("-", $_SESSION["make_visit_tmp"]["date"]); $dt = mktime(0, 0, 0, $dt[1], $dt[0], $dt[2]); $fil = intval($_SESSION["make_visit_tmp"]["filial_id"]); if ($fil <= 0) { $Frm->_gui->ERR("Некорректный филиал"); return false; } $courier_id = $Frm->GetNmValueI("user"); $visits = db::get_single_value("SELECT COUNT(*) FROM " . TABLE_VISITS . " WHERE user_id = " . db::input($courier_id) . " AND tm_start <= " . db::input($t1) . " AND tm_finish > " . db::input($t1) . " AND date = " . db::input($dt)); if ($visits) { $Frm->_gui->ERR("На это время уже назначена встреча"); return false; } $vis_id = Meeting::create(array("user_id" => $courier_id, "date" => $dt, "status" => 0, "tm_start" => $t1, "tm_finish" => $t2, "client_id" => $kln["id"], "order_id" => $ord_id, "filial_id" => $fil, "created" => time(), "creator_id" => $_SESSION["user"]["data"]["id"], "summa" => $_SESSION["make_visit_tmp"]["summa1"], "about" => $_SESSION["make_visit_tmp"]["about"], "opisanie_klienta" => $Frm->GetNmValueH("opisanie_klienta"), "opisanie_pyti" => $Frm->GetNmValueH("opisanie_pyti"), "station_id" => $Frm->GetNmValueI("station"))); $Frm->_gui->OK("Встреча создана"); // Создаем сообщение при необходимости if ($courier_id != $_SESSION["user"]["data"]["id"]) { $prior = 1; $msg_id = mls_Send("u" . $courier_id, "u" . $_SESSION["user"]["data"]["id"], "Новая встреча №" . $vis_id, "Вы проводите встречу " . date("d.m.Y", $dt) . " c " . utils_cvt_i2times($t1) . " по " . utils_cvt_i2times($t2) . "." . " <a href='?section=vis&subsection=2&visit=" . $vis_id . "'>Подробнее...</a><br>Внимание! Ответ на данное сообщение обязателен!", $prior, 0, 0, 0, 0, $vis_id, 0); if ($msg_id) { \Components\Classes\Author::enqueue_message_to_email($msg_id, array($courier_id), \Components\Entity\EmailNotificationType::TO_CLIENT_ON_ORDER_CHANGE); Meeting::update($vis_id, array('uved_umsg' => $msg_id)); } } page_reloadToSec("2"); } }
function tp_get_id($value, $row, $table, &$info) { if ($table instanceof CGUI_Table && $table->rowmenu) { $table->rowmenu->Vars[1] = $value; $table->rowmenu->Vars[2] = $row["klient_id"]; $html = $table->rowmenu->GetHTML($value); } else { $html = $value; } if ($ref_id = db::get_single_value("SELECT ref_id FROM " . TBL_PREF . "clients WHERE id = " . $row["klient_id"])) { $info = new CGUI_TableCellInfo(); $info->Text("<p>Номер: #" . $ref_id . "</p>" . "<p>Имя: " . db::get_single_value("SELECT fio FROM " . TBL_PREF . "clients WHERE id = " . $ref_id) . "</p>"); $info->icon = '<img src="' . SITE_URL . '/gui/skin/coins.png"/>'; } return $html; }
function add_city_exec($Frm, $Err) { if (!$Err) { $name = str_replace("'", '"', htmlspecialchars($Frm->GetValue(0))); if (db::get_single_value("SELECT COUNT(*) FROM " . TABLE_CITIES . " WHERE name = '" . db::input($name) . "'")) { $Frm->_gui->informer->ERR("Запись существует"); page_reloadAll(); } db::insert(TABLE_CITIES, array('name' => $name)); $Frm->_gui->informer->OK("Добавлено"); page_reloadSubSec(); } }
$r1->DoSort = $custom_column['do_sort']; $r1->Key = $custom_column['internal_name']; $r1->Align = $custom_column['align']; $r1->Process = $custom_column['on_execute']; $r->Custom[] = $r1; } } else { $r = $tbl->NewColumn(); $r->Caption = $column['name']; $r->DoSort = $column['do_sort']; $r->Key = $column['internal_name']; $r->Align = $column['align']; $r->Process = $column['on_execute']; } } $GUI->Vars['tm_started'] = db::get_single_value("select p_value from ofc_sys_log where p_name='email_notify_last_tm_start'"); $ds = time() - $GUI->Vars['tm_started']; if ($ds < 60) { $GUI->Vars['tm_info'] = "менее минуты"; } else { if ($ds < 60 * 15) { $GUI->Vars['tm_info'] = ceil($ds / 60) . " мин."; } else { $GUI->Vars['tm_info'] = "более 15 мнут"; } } $GUI->Vars['tm_needcnt'] = db::get_single_value("select count(id) from ofc_email_notifications"); $GUI->Vars['tm_working'] = db::get_single_value("select p_value from ofc_sys_log where p_name='email_notify_last_tm_work'"); $GUI->Vars['tm_allcnt'] = db::get_single_value("select p_value from ofc_sys_log where p_name='email_notify_last_all_cnt'"); $GUI->Vars['tm_goodcnt'] = db::get_single_value("select p_value from ofc_sys_log where p_name='email_notify_last_good_cnt'");
public static function getName($napravl_id) { return db::get_single_value("SELECT name FROM " . TABLE_NAPRAVL . " WHERE id = " . db::input($napravl_id)); }
$i++; } $tbl->FilterMYSQL($result_filter); $totals = db::get_arrays("\n SELECT filial_id, SUM(`value`) as total_expenses\n FROM " . TBL_PREF . $Filter->DstTable . "\n WHERE " . $result_filter . "\n GROUP BY filial_id\n"); if ($totals) { $stat_tbl = $GUI->Table("expenses_stat" . $n); $stat_tbl->Width = "50%"; $column = $stat_tbl->NewColumn(); $column->Caption = "Филиал"; $column->Key = "id"; $column = $stat_tbl->NewColumn(); $column->Caption = "Общий расход"; $column->Key = "total_expenses"; if (is_director($_SESSION['user']['data']['id'])) { $column = $stat_tbl->NewColumn(); $column->Caption = "Итого расход руководителя"; $column->Key = "director_expenses"; } foreach ($totals as $row) { $res = array(); if ($row['filial_id'] == 0) { $res['id'] = 'Руководитель'; $res['director_expenses'] = ''; } else { $res['id'] = get_filial_name($row['filial_id']); $res['director_expenses'] = $row['total_expenses'] * (1 - db::get_single_value("SELECT consumption FROM " . TBL_PREF . "data_filials WHERE id = " . $row['filial_id'])); } $res['total_expenses'] = $row['total_expenses']; $stat_tbl->AddRow($res); } }
function editdiscip_exec($Frm, $Err) { if (!$Err) { $id = $Frm->GetNmValueI('id'); if (empty($id)) { $Frm->_gui->informer->ERR('Произошла ошибка. Попробуйте перезагрузить страницу'); page_reloadAll(); } $name = trim($Frm->GetNmValueH('name')); $napravl = $Frm->GetNmValue('napravl'); if (empty($napravl) || empty($name)) { $Frm->_gui->informer->ERR('Заполните Название и выберите Направление'); page_reloadAll(); } if (db::get_single_value("SELECT COUNT(*) FROM " . TABLE_DISCIPLINE . " WHERE LOWER(name) = '" . db::input(strtolower($name)) . "' AND id != " . db::input($id))) { $Frm->_gui->informer->ERR('Дисциплина с таким именем уже существует'); page_reloadAll(); } Discipline::update($id, array('code' => $Frm->GetNmValueI('code'), 'name' => $name)); Disciplines::addToNapravList($id, $napravl); $Frm->_gui->informer->OK("Сохранено"); page_reloadAll(); } }
function get_config_value_by_iname($internal_name) { return db::get_single_value("SELECT value FROM " . TBL_PREF . "configs WHERE internal_name = '" . db::input($internal_name) . "'"); }
$s->RowSize = 5; $s->linkName = 'employers'; $frm->Label("c", 330, $ypos); $t = $frm->DatePic(350, $ypos, 100); $t->linkName = 'date_from'; $frm->Label("по", 330, $ypos += 25); $t = $frm->DatePic(350, $ypos, 100); $t->linkName = 'date_to'; $frm->Label("Направление", 330, $ypos += 25); $s = $frm->Select(330, $ypos += 20, 100, array(0 => "все", 1 => "входящие", 2 => "исходящие")); $s->linkName = 'direction'; // С клиентами $clients1 = array(); $clients = kln_getrawlist(); foreach ($clients as $v) { if (db::get_single_value("SELECT COUNT(id) FROM " . TABLE_MESSAGES . " WHERE (addr='k" . $v["id"] . "' AND creator_id='u" . $id . "') OR (addr='u" . $id . "' AND creator_id='k" . $v["id"] . "')")) { $clients1[$v["id"]] = $v['fio']; } } if (count($clients1) > 1) { $clients1 = array(0 => "-любым-") + $clients1; } $t = $frm->Checkbox(10, $ypos += 30, false, 1); $t->linkName = 'with_clients'; $frm->Label("Переписка с клиентами:", 30, $ypos); $s = $frm->Select(10, $ypos += 20, 480, $clients1); $s->RowSize = 10; $s->linkName = 'clients'; $frm->VLine(10, $ypos += 200, 480); $frm->Button("Получить", 250 - 80 - 10, $ypos += 20, 80, true); $frm->OnExecute = "getmsgs_exec";
<?php use Components\Classes\db; require_once '../../includes/application_top.php'; if (!$_SESSION["user"]["auth"]) { die("запрещено"); } if (db::get_single_value("SELECT id FROM " . TABLE_MESSAGES . " WHERE addr = 'u" . db::input($_SESSION["user"]["data"]["id"]) . "' AND readed = '0' AND basket = '0'")) { die("1"); } else { die("0"); }
} else { if (!empty($_REQUEST['new']) && !empty($_REQUEST['r'])) { try { $receiver = Employee::find($_REQUEST['r']); } catch (Exception $e) { redirect("?type=cabinet&messages"); } if (!empty($_REQUEST['send'])) { if ($receiver['id'] != $_REQUEST['receiver']) { redirect("?type=cabinet&messages"); } $message_id = mls_Send('u' . $receiver['id'], 'k' . $_SESSION['frame']['client']['id'], $_REQUEST['subject'], $_REQUEST['text'], 1, 0); \Components\Classes\Author::enqueue_message_to_email($message_id, array($receiver['id']), \Components\Entity\EmailNotificationType::TO_RECEIVER_ON_MESSAGE_COMMON); redirect("?type=cabinet&messages"); } $receiver_full_name = db::get_single_value("SELECT sname FROM " . TABLE_ROLES . " WHERE id = " . $receiver['group_id']) . ' ' . $receiver['fio']; $subject = ''; if (!empty($_REQUEST['o'])) { $subject = 'Вопрос по заказу №' . $_REQUEST['o']; } echo "<div style='margin-bottom: 5px'><a href='?type=cabinet&messages'><< к списку сообщений</a></div>"; echo <<<HTML <div id="cgui_form_0" class="cgui_form_box" style="width:600px; height: 270px; margin: 0 auto;"> <div class="cgui_form_capt">Новое сообщение</div> <form class="cgui_form" method="post"> <input type="hidden" name="send" value="1"/> <div class="cgui_form_text" style="width: 530px; height: 50px; margin-left:50px; margin-top: 10px;"> <input type="text" value="{$receiver_full_name}" style="position: absolute; width:530px;"> <input name="receiver" value="{$receiver['id']}" type="hidden"> </div>
public static function add_client($client_params) { $result = array('status' => false, 'msg' => ''); if (empty($client_params['fio'])) { $client_params['fio'] = 'Клиент с сайта'; } if (Client::exist($client_params['email'])) { $result['msg'] = "Клиент с email - " . $client_params['email'] . " уже существует"; return $result; } $date = mktime(); if (!empty($client_params['filial_id'])) { $filial_id = Filials::check($client_params['filial_id']); } else { $filial_id = Filials::search($client_params['filial']); if ((!$filial_id || $filial_id == 9) && !empty($client_params['city'])) { $query = "SELECT ftc.filial_id FROM " . TBL_PREF . "data_city dc JOIN " . TBL_PREF . "filial_to_city ftc ON ftc.city_id = dc.id" . " WHERE dc.name = '" . db::input($client_params['city']) . "'"; $filial_id = db::get_single_value($query); if (!$filial_id) { $filial_id = 9; } } } $client_id = Client::create(array('filial_id' => $filial_id, 'fio' => $client_params['fio'], 'email' => $client_params['email'], 'telnum' => $client_params['telnum'], 'city' => $client_params['city'], 'liketel' => $client_params['liketel'], 'teltime' => $client_params['teltime'], 'icq' => $client_params['icq'], 'skype' => $client_params['skype'], 'contacts' => $client_params['contacts'], 'blocked' => $client_params['blocked'], 'about' => $client_params['about'], 'ocenka' => $client_params['ocenka'], 'ref_id' => $client_params['ref_id'], 'from_id' => $client_params['from_id'], 'added_by' => $client_params['added_by'], 'orderform' => $client_params['orderform'], 'password' => $client_params['password'])); return self::generate_response(true, "OK", array('id' => $client_id, 'date' => $date)); }
if (!user_can($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"], "Удалить")) { $GUI->informer->ERR(PERMISSION_DENIED); page_ReloadSubSec(); } $id = intval($_REQUEST["del"]); if ($_SESSION["user"]["data"]["id"] == $id) { $GUI->ERR("Нельзя удалить себя"); page_ReloadSubSec(); } $employer = Employee::find($id); if ($employer) { if (count(Order::findBy(array('manager_id' => $id)))) { $GUI->informer->ERR("У сотрудника есть назначенные заказы"); page_ReloadSubSec(); } if (db::get_single_value("SELECT COUNT(id) FROM " . TBL_PREF . "data_visits WHERE user_id = '" . $id . "' AND status <> 1")) { $GUI->informer->ERR("У сотрудника есть назначенные встречи"); page_ReloadSubSec(); } $frm = $GUI->Form("В черный список", 300, 260); $t = $frm->Hidden($id); $t->linkName = 'id'; $frm->VLine(10, 180, 280); $frm->Button("Выполнить", 60, 200, 80, true); $frm->OnExecute = "deluser_exec"; $b = $frm->Button("Назад", 160, 200, 80); $b->Event = "document.location.href=\"?" . $GUI->Url(array('section', 'subsection', 'del')) . "edit=" . $id . "\"; return false;"; $frm->Label("Перенести в черный список сотрудника", 10, 10); $frm->Label("'" . $employer["fio"] . "'?", 10, 30); $frm->Label("Причина:", 10, 60); $t = $frm->TextArea(10, 80, 280, 70);
function MakeHTML() { $this->_check_sort_links(); if ($this->isort) { $this->_inlinesort(); } $where = ""; if ($this->mysql_filter != "") { $where = " WHERE " . $this->mysql_filter; } if ($this->mysql_source) { $this->Rows = array(); $limit = ""; if ($this->pager) { $this->pager->allcount = intval(db::get_single_value("SELECT COUNT(" . $this->mysql_source_alias . "id) AS cnt FROM " . TBL_PREF . $this->mysql_source . $where)); $limit = $this->pager->GetLimitStr(); } $ord_str = "ORDER BY "; if (!is_null($this->order_rules)) { $ord_str .= $this->order_rules . ","; } $ord_str .= !$this->GetCurSortKey() ? $this->mysql_source_alias . "id" : $this->mysql_source_alias . $this->GetCurSortKey(); foreach (db::get_arrays("SELECT " . $this->mysql_flds . " FROM " . TBL_PREF . $this->mysql_source . $where . " " . $ord_str . $limit) as $r) { $this->AddRow($r, $this->mysql_source_alias . "id"); } } else { if ($this->pager) { $this->pager->allcount = count($this->Rows); if ($this->pager->GetLimitStr() != '') { $tmp = $this->Rows; $this->Rows = array(); for ($i = 0; $i < $this->pager->onPage; $i++) { if (isset($tmp[$this->pager->curPage * $this->pager->onPage + $i])) { $this->Rows[$i] = $tmp[$this->pager->curPage * $this->pager->onPage + $i]; } } } } } $this->StartTable(); $this->HtmlB = ""; foreach ($this->Rows as $kr => $r) { $rdata = $r["data"]; $r["style"]["cursor"] = "arrow"; $r["style"]["background-color"] = ""; if ($this->OnRowStart) { eval("\$" . "s = " . $this->OnRowStart . "(\$" . "r);"); } if (is_array($this->Highlite)) { if ($rdata[$this->Highlite[0]] == $this->Highlite[1]) { $r["style"]["background-color"] = "yellow"; } } if (!empty($_SESSION['user']['data']['conf_ord_colors']) && $this->useColors) { $currentColors = unserialize($_SESSION['user']['data']['conf_ord_colors']); $r["style"]["background-color"] = isset($currentColors[$rdata['id']]) ? $currentColors[$rdata['id']] : '#FFFFFF'; } else { $currentColors = array(); } $st = $this->makeRowStyle($r); $this->HtmlB .= "<tr style='" . $st . "' data-color='" . (isset($currentColors[$rdata['id']]) ? $currentColors[$rdata['id']] : '#FFFFFF') . "' data-row-id='" . $rdata['id'] . "'"; if ($this->RowSelect) { $this->HtmlB .= " onmouseover='jQuery(this).css(\"background-color\", \"" . $this->RowSelectCol . "\");' onmouseout='jQuery(this).css(\"background-color\", \"" . $r["style"]["background-color"] . "\");'"; if ($this->RowEvent != "") { $this->HtmlB .= " onclick='" . $this->RowEvent . "(" . $r["data"][$r["ek"]] . ");'"; } else { if ($this->RowEvent2 != "") { if (strpos($this->RowEvent2, "%var%") != false) { $s = str_replace("%var%", $r["data"][$r["ek"]], $this->RowEvent2); } else { $attr_index = strpos($this->RowEvent2, "%var."); $s = str_replace("%var.", '', $this->RowEvent2); $attr_ends = strpos($s, '%', $attr_index); $attr_name = substr($s, $attr_index, $attr_ends - $attr_index); $s = str_replace($attr_name . '%', $r["data"][$attr_name], $s); } $this->HtmlB .= " onclick='" . $s . "'"; } } } $this->HtmlB .= ">" . "\n"; foreach ($this->Columns as $k => $v) { $s = ""; if (count($v->Custom)) { $v = $v->Custom[$this->Settings["cust"][$k]]; } if ($v->Key != "" && isset($rdata[$v->Key])) { if (is_array($v->ExtData)) { $s = $v->ExtData[$rdata[$v->Key]]; } else { $s = $rdata[$v->Key]; } } if ($v->Process != "") { $this->Rows[$kr]['info'][$k] = ''; eval("\$" . "s=" . $v->Process . "(\$" . "s, \$" . "rdata, \$" . "this, \$" . "this->Rows[\$" . "kr]['info'][\$" . "k]);"); } elseif ($v->Format) { switch ($v->Format) { case CGUI_TABLE_FMT_SIZE: $s = _tbl_fmt_size($s); break; case CGUI_TABLE_FMT_DATE: $s = _tbl_fmt_date($s); break; case CGUI_TABLE_FMT_DATETIME: $s = _tbl_fmt_datetime($s); break; } } if (!empty($this->Rows[$kr]["info"][$k])) { $s = $this->Rows[$kr]["info"][$k]->GetHTML($s); } $this->HtmlB .= "<td"; if ($v->NoWrap) { $this->HtmlB .= " nowrap"; } if ($v->Align) { $this->HtmlB .= " style='text-align: " . $v->Align . "'"; } if ($v->hidden) { $this->HtmlB .= ' class="hide"'; } if ($v->id) { $this->HtmlB .= ' id="' . $v->id . '"'; } $this->HtmlB .= ">"; if ($v->instantEdit) { $this->HtmlB .= '<span class="instantEditOldValue">' . $s . '</span><span class="instantEdit" data-title="' . $v->Caption . '" data-field="' . $v->Key . '" data-value="' . $rdata[$v->Key] . '"></span>' . "\n"; } else { $this->HtmlB .= $s . "\n"; } $this->HtmlB .= "</td>" . "\n"; } $this->HtmlB .= "</tr>" . "\n"; } $this->EndTable(); }
public static function getName($discipline_id) { return db::get_single_value("SELECT name FROM " . TABLE_DISCIPLINE . " WHERE id = " . db::input($discipline_id)); }
foreach ($orders as $order_id) { $order_id = trim($order_id); if (empty($order_id)) { continue; } $order_info = get_order_info($order_id); $company_paid = calculate_debt_to_company($order_info['cost_kln'], $order_info['cost_auth'], $order_info['filial_id']); Order::update($order_id, array('company_paid' => $company_paid)); $data = array('change_date' => time(), 'change_user_id' => $_SESSION['user']['data']['id'], 'order_id' => $order_id, 'filial_id_new' => $order_info['filial_id'], 'klient_id_new' => $order_info['klient_id'], 'vuz_id_new' => $order_info['vuz_id'], 'vuz_user_new' => $order_info['vuz_user'], 'type_id_new' => $order_info['type_id'], 'type_user_new' => $order_info['type_user'], 'napr_id_new' => $order_info['napr_id'], 'disc_id_new' => $order_info['disc_id'], 'disc_user_new' => $order_info['disc_user'], 'time_kln_new' => $order_info['time_kln'], 'cost_kln_new' => $order_info['cost_kln'], 'payment_id_new' => $order_info['payment_id'], 'subject_new' => $order_info['subject'], 'about_kln_new' => $order_info['about_kln'], 'about_mng_new' => $order_info['about_mng'], 'kurs_new' => $order_info['kurs'], 'prakt_pc_new' => $order_info['prakt_pc'], 'pages_min_new' => $order_info['pages_min'], 'pages_max_new' => $order_info['pages_max'], 'src_min_new' => $order_info['src_min'], 'src_max_new' => $order_info['src_max'], 'from_id_new' => $order_info['from_id'], 'oform_new' => $order_info['oform'], 'next_rel_date_new' => $order_info['next_rel_date'], 'status_id_new' => $order_info['status_id'], 'ok_comment_new' => $order_info['ok_comment'], 'ok_comment_date_new' => $order_info['ok_comment_date'], 'payment_comment_new' => $order_info['payment_comment'], 'cost_auth_new' => $order_info['cost_auth'], 'time_auth_new' => $order_info['time_auth'], 'oplata_kln_new' => $order_info['oplata_kln'], 'author_paid_new' => $order_info['author_paid'], 'company_paid_new' => $company_paid, 'filial_id_old' => $order_info['filial_id'], 'klient_id_old' => $order_info['klient_id'], 'vuz_id_old' => $order_info['vuz_id'], 'vuz_user_old' => $order_info['vuz_user'], 'type_id_old' => $order_info['type_id'], 'type_user_old' => $order_info['type_user'], 'napr_id_old' => $order_info['napr_id'], 'disc_id_old' => $order_info['disc_id'], 'disc_user_old' => $order_info['disc_user'], 'time_kln_old' => $order_info['time_kln'], 'cost_kln_old' => $order_info['cost_kln'], 'payment_id_old' => $order_info['payment_id'], 'subject_old' => $order_info['subject'], 'about_kln_old' => $order_info['about_kln'], 'about_mng_old' => $order_info['about_mng'], 'kurs_old' => $order_info['kurs'], 'prakt_pc_old' => $order_info['prakt_pc'], 'pages_min_old' => $order_info['pages_min'], 'pages_max_old' => $order_info['pages_max'], 'src_min_old' => $order_info['src_min'], 'src_max_old' => $order_info['src_max'], 'from_id_old' => $order_info['from_id'], 'oform_old' => $order_info['oform'], 'next_rel_date_old' => $order_info['next_rel_date'], 'status_id_old' => $order_info['status_id'], 'ok_comment_old' => $order_info['ok_comment'], 'ok_comment_date_old' => $order_info['ok_comment_date'], 'payment_comment_old' => $order_info['payment_comment'], 'cost_auth_old' => $order_info['cost_auth'], 'time_auth_old' => $order_info['time_auth'], 'oplata_kln_old' => $order_info['oplata_kln'], 'author_paid_old' => $order_info['author_paid'], 'company_paid_old' => $order_info['company_paid']); OrderHistory::create($data); } $result[] = 0; break; case 'color': $bDoUpdate = false; $currentColors = db::get_single_value("SELECT conf_ord_colors FROM " . TBL_PREF . "data_users WHERE id = " . $_SESSION['user']['data']['id']); if (empty($currentColors)) { $currentColors = array(); } else { $currentColors = unserialize($currentColors); } $currentColors[$_GET['order_id']] = $_GET['value']; $currentColors = serialize($currentColors); Employee::update($_SESSION['user']['data']['id'], array('conf_ord_colors' => $currentColors)); $_SESSION['user']['data']['conf_ord_colors'] = $currentColors; break; case 'referrer_payment_status_all': $bDoUpdate = false; $orders = explode(',', $_GET['order_id']); foreach ($orders as $order_id) { $order_id = trim($order_id);
function deluser_exec($Frm, $Err) { if (!$Err) { if (is_director($_SESSION["user"]['data']['id'])) { $id = $Frm->GetNmValueI('id'); if (count(Order::findBy(array('manager_id' => $id)))) { $Frm->_gui->informer->ERR("У сотрудника есть назначенные заказы"); return; } if (db::get_single_value("SELECT COUNT(id) FROM " . TBL_PREF . "data_visits WHERE user_id = '" . $id . "' AND status <> 1")) { $Frm->_gui->informer->ERR("У сотрудника есть назначенные встречи"); return; } $resone = $Frm->GetNmValueH('reason'); db::query("insert into " . TABLE_USERS_BLACK . " select * from " . TABLE_USERS . " where id= " . $id); EmployeeBlack::update($id, array('comments' => $resone, 'blocked' => 1, 'black_list' => 1, 'removed_by' => $_SESSION['user']['data']['id'], 'removed_time' => time())); Employee::delete($id); $Frm->_gui->informer->OK("Сотрудник перенесен в черный список"); } else { $Frm->_gui->informer->ERR("Перемещать сотрудников в черный список может только руководитель"); } page_reloadSec(); } }