function addsotr_exec($Frm, $Err) { if (!$Err) { $fil = $Frm->GetNmValueI('filial'); $grp = $Frm->GetNmValueI('group'); $password = $Frm->GetNmValue('password'); $email = strtolower($Frm->GetNmValueH('email')); if (Employee::exist($email)) { $Frm->_gui->informer->ERR("Сотрудник с таким email существует"); return; } $ryk_group_id = get_role_id_by_name('Руководитель'); $author_group_id = get_role_id_by_name('Автор'); if ($fil == 0 && $grp != $ryk_group_id && $grp != $author_group_id) { $Frm->_gui->informer->ERR("Для данной группы необходимо указать филиал"); return; } if (TEST_MODE) { $password = TEST_PASSWORD; } $user_id = Employee::create(array('filial_id' => $fil, 'fio' => $Frm->GetNmValueH('fio'), 'email' => $email, 'password' => $password, 'telnum' => $Frm->GetNmValueH('phone'), 'cont' => $Frm->GetNmValueH('contacts'), 'group_id' => $grp, 'comments' => $Frm->GetNmValueH('comments'), 'payment_requisites' => $Frm->GetNmValueH('payment_requisites'))); if ($author_group_id == $grp) { Author::add_napravl($user_id, $Frm->GetNmValue('author_napravl')); } if (TEST_MODE) { $Frm->_gui->informer->OK("Добавлено (тестовый режим - пароль " . TEST_PASSWORD . ")"); } else { $Frm->_gui->informer->OK("Добавлено"); } page_reloadSec(); } }
$t->AddValidator(new CGUI_VALIDATOR_MAXLEN(10)); $t->AddValidator(new CGUI_VALIDATOR_09()); $t->AddValidator(new CGUI_VALIDATOR_NOZERO()); } $ypos += 30; $frm->Label("Комментарий автора:", 10, $ypos); $t = $frm->TextArea(10, $ypos + 20, 370, 80, $offer_info['comment']); $t->linkName = "comment"; $ypos += 100; $frm->VLine(10, $ypos += 40, 370); $frm->Button("Сохранить", 70, $ypos += 20, 150, true); $b = $frm->Button("К списку", 230, $ypos, 100, false); $b->Event = "document.location.href='?section=ord&subsection=2'"; } } else { if ($_SESSION['user']['data']['group_id'] > get_role_id_by_name('Старший менеджер')) { $GUI->ERR('Заказ еще не распределялся'); page_reloadSubSec(); } $frm = $GUI->Form("Распределение заказа №" . $order_id, 400, 340); $frm->OnExecute = "assign_order"; $ypos = 10; $h = $frm->Hidden($order_id); $h->linkName = "order_id"; $manager_list = array(); foreach (get_users_groups() as $group) { if (user_can($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $group["id"], "Возможность вести заказ")) { foreach (get_users_by_group($group["id"], $order_info['filial_id']) as $u) { $manager_list[$u['id']] = $u['fio']; } }
$fltr = 'status_id != ' . get_status_id_by_iname('ORDER_CANCELED') . ' AND status_id != ' . get_status_id_by_iname('DONE'); if ($_SESSION["user"]["data"]["group_id"] > 1 && $_SESSION["user"]["data"]["group_id"] != get_role_id_by_name('Автор')) { if ($fltr != "") { $fltr .= " AND "; } $fltr .= "filial_id=" . $_SESSION["user"]["data"]["filial_id"]; } if ($_SESSION["user"]["data"]["group_id"] == get_role_id_by_name('Отдел качества')) { $status_id = get_status_id_by_iname('RECEIVED_FILE_FROM_AUTHOR'); if ($status_id) { if ($fltr != "") { $fltr .= " AND "; } $fltr .= "status_id = " . $status_id; } } elseif ($_SESSION["user"]["data"]["group_id"] == get_role_id_by_name('Автор')) { $distribution_status_id = get_status_id_by_iname('ON_THE_DISTRIBUTION'); if ($fltr != "") { $fltr .= " AND "; } // Чтобы не показывать заказ со статусом "ждет предоплаты" всем подряд, если он за кем-то закреплен $fltr .= "(status_id = " . $distribution_status_id . " OR author_id = " . $_SESSION["user"]["data"]["id"] . ")"; // $fltr .= "(status_id IN(" . $distribution_status_id . ", " . get_status_id_by_iname('WAITING_PREPAYMENT') . ") OR author_id = " . $_SESSION["user"]["data"]["id"] . ")"; if ($_SESSION['cgui_filcol_ord']['selset'] != "std2") { //Если выбран набор "мои заказы" - пропускаем фильтрацию по дисциплинам $author_disciplines = db::get_single_values_string("SELECT discipline_id FROM " . TBL_PREF . "author_to_discipline WHERE author_id = " . $_SESSION["user"]["data"]["id"]); if (!empty($author_disciplines)) { $fltr .= " AND disc_id IN(" . $author_disciplines . ")"; } } } elseif ($_SESSION["user"]["data"]["group_id"] == 5) {
<?php $frm = $GUI->Form("Добавить филиал", 600, 420); $ypos = 10; $frm->Label("Название", 10, $ypos); $frm->Label("Руководитель", 310, $ypos); $t = $frm->Text(10, $ypos += 20, 278); $t->linkName = 'name'; $t->AddValidator(new CGUI_VALIDATOR_NOEMPTY()); $t->AddValidator(new CGUI_VALIDATOR_MAXLEN(40)); $usrs = array(); $usrs[0] = "-выберите-"; $ruk_group_id = get_role_id_by_name('Руководитель'); $elder_manager_group_id = get_role_id_by_name('Старший менеджер'); foreach ($data_users as $u) { if ($u["black_list"]) { continue; } if ($u["group_id"] == $ruk_group_id || $u["group_id"] == $elder_manager_group_id) { $usrs[$u["id"]] = sotr_getFullName($u["id"]); } } $f = $frm->Select(310, $ypos, 278, $usrs); $f->linkName = 'manager'; $f->AddValidator(new CGUI_VALIDATOR_NOZERO()); $h = $frm->Hidden(''); $h->linkName = 'city'; city_modal($h->idname); $b = $frm->Button("Города", 10, $ypos += 30, 70); $b->Event = 'jQuery("#' . $GUI->Vars["city_modal_form"]->idname . '").modal();'; $frm->Label("Email филиала", 10, $ypos += 30);
<?php //add $ypos = 10; $author_group_id = get_role_id_by_name('Автор'); need_data('data_napravl'); $height = 540; $frm = $GUI->Form("Добавить сотрудника", 500, $height); $frm->Label("Фамилия, Имя, Отчество", 10, $ypos); $t = $frm->Text(10, $ypos += 20, 480); $t->linkName = 'fio'; $t->AddValidator(new CGUI_VALIDATOR_NOEMPTY()); $t->AddValidator(new CGUI_VALIDATOR_MAXLEN(60)); $frm->Label("Пароль (" . PASSWORD_MIN_CHARS . "-" . PASSWORD_MAX_CHARS . ")", 10, $ypos += 30); $frm->Label("email", 260, $ypos); $t = $frm->Text(10, $ypos += 20, 230); $t->linkName = 'password'; $t->AddValidator(new CGUI_VALIDATOR_NOEMPTY()); $t->AddValidator(new CGUI_VALIDATOR_MINLEN(PASSWORD_MIN_CHARS)); $t->AddValidator(new CGUI_VALIDATOR_MAXLEN(PASSWORD_MAX_CHARS)); $t->AddValidator(new CGUI_VALIDATOR_AZaz09()); $t = $frm->Text(260, $ypos, 230); $t->linkName = 'email'; $t->AddValidator(new CGUI_VALIDATOR_NOEMPTY()); $t->AddValidator(new CGUI_VALIDATOR_EMAIL()); $frm->Label("Телефон", 10, $ypos += 30); $frm->Label("Группа", 260, $ypos); $t = $frm->Text(10, $ypos += 20, 230); $t->linkName = 'phone'; $t->AddValidator(new CGUI_VALIDATOR_NOEMPTY()); $t->AddValidator(new CGUI_VALIDATOR_TELNUM());
$f = $Filter->AddFilter("CGUI_FilterSelect"); $f->name = "Филиал"; $f->keyid = "filial_id"; $d = $data_filials; $d[0] = array('name' => 'не указан'); $f->SetSelectData($d, "name"); $Filter->MakeUserSets(3); $Filter->Requests(); $Filter->Filtering(); $pan1 = $GUI->UPanel(); $pan1->Caption = "Фильтры"; $pan1->defOpen = $Filter->OpenPanel; $pan1->AddHTML($Filter->GetHTML()); $tbl = $GUI->Table("sotr" . $n); $tbl->DataMYSQL($Filter->DstTable); $ryk_group_id = get_role_id_by_name('Руководитель'); $mysql_filter = ''; if ($_SESSION["user"]["data"]["group_id"] > $ryk_group_id) { $mysql_filter .= ' AND (filial_id = ' . $_SESSION["user"]["data"]["filial_id"] . ' OR filial_id = 0) AND group_id > 0'; } $tbl->FilterMYSQL("black_list <> 1" . $mysql_filter); $tbl->Pager(CGUI_PAGER_FLAG_SEL | CGUI_PAGER_FLAG_RR | CGUI_PAGER_FLAG_R | CGUI_PAGER_FLAG_FF | CGUI_PAGER_FLAG_F, 10, array(10, 20, 50, 100, 0)); $tbl->OnRowStart = "_on_row_start"; $tbl->Width = "100%"; if (user_can($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"], "Редактировать")) { $tbl->RowEvent2 = "document.location.href=\"?section=sotr&subsection=2&edit=%var%\""; } if (isset($_REQUEST["light"])) { $tbl->Highlite = array("id", intval($_REQUEST["light"])); } $rm = $tbl->CreateRowMenu();