query($sql); if ($_SESSION['id'] && ((isset($_GET['id']) && is_numeric($_GET['id']) && $_GET['id']>0) || (isset($_GET['req_id']) && is_numeric($_GET['req_id']) && $_GET['req_id']>0))) { $gmtmsk = get_time_zone_user(); $time_zone = ''; $time_zone_sql = 'INTERVAL 0 HOUR'; if($gmtmsk >= 0){ $time_zone = '+'.$gmtmsk.' hour'; $time_zone_sql = 'INTERVAL '.$gmtmsk.' HOUR'; } else { $time_zone = '-'.$gmtmsk.' hour'; $time_zone_sql = 'INTERVAL -'.$gmtmsk.' HOUR'; } $get = clearInputData($_GET); $is_req = false; // обновляем метку у меню календаря // считаем события объектов $sql = "SELECT count(id) FROM user_object_events WHERE user_id = $_SESSION[id] and calendar_view = 0 and schedule_date is not null and DATE(schedule_date) <= '".date("Y-m-d")."'"; $rez = mysql_query($sql); $objectEventCount = mysql_result($rez,0); // считаем события клиентов $sql = "SELECT count(id) FROM user_client_events WHERE user_id = $_SESSION[id] and calendar_view = 0 and cancel = 0 and schedule_date is not null and DATE(schedule_date) <= '".date("Y-m-d")."'"; $rez = mysql_query($sql); $clientEventCount = mysql_result($rez,0); // суммарное количество событий по объектам, клиентам и найденным листингам $sumCount = intval($objectEventCount) + intval($clientEventCount) + get_user_listing_tasks_count($_SESSION['id']); echo ""; if($get['id'] > 0){ $client = new Clients; $client->get($get['id']); $dateAdd = date("d.m.Y", strtotime($client->date_add)); list($d, $m, $y) = explode(".", $dateAdd); if ($y == date("Y")) { $y = ""; } } $date_del = ''; if (isset($get['req_id']) && $get['req_id'] > 0){ $is_req = true; $sql="SELECT *, created_at as date_add, name as fio FROM requisitions WHERE id=$get[req_id]"; $rez=mysql_query($sql); $client = mysql_fetch_assoc($rez); $dateAdd = date("d.m.Y", strtotime($client['date_add'])); list($d, $m, $y) = explode(".", $dateAdd); if ($y == date("Y")) { $y = ""; } if($client['deleted'] > 0){ $sql_del = "SELECT date_update FROM `events_clients` WHERE req_id=$client[id] and event='delete' order by id desc limit 1"; $q_del = mysql_query($sql_del); if(mysql_num_rows($q_del) > 0){ $r_del = mysql_fetch_assoc($q_del); $dateDel = date("d.m.Y", strtotime($r_del['date_update'])); list($dd, $md, $yd) = explode(".", $dateDel); if ($yd == date("Y")) { $yd = ""; } $date_del = $dd." ".getRusMonth($md)." ".$yd; $reason = $client['reason']; } } } else { if($client->deleted > 0){ $client_id = $client->id; $sql_del = "SELECT date_update FROM `events_clients` WHERE client_id=$client_id and event='delete' order by id desc limit 1"; $q_del = mysql_query($sql_del); if(mysql_num_rows($q_del) > 0){ $r_del = mysql_fetch_assoc($q_del); $dateDel = date("d.m.Y", strtotime($r_del['date_update'])); list($dd, $md, $yd) = explode(".", $dateDel); if ($yd == date("Y")) { $yd = ""; } $date_del = $dd." ".getRusMonth($md)." ".$yd; $reason = $client->reason; } } } $date_add = $d." ".getRusMonth($m)." ".$y; echo '
'.$date_add.'
'; $text = 'Клиент добавлен'; if($is_req){ $text = 'Заявка добавлена'; } echo '
'.$text.'
'; $users = array(); $user = new User; $user->get($_SESSION['id']); $agency_id = $user->agencyId; $usersIds = array(); $usersIds[] = $agency_id; $sql_users = "SELECT id FROM users WHERE id in (select id from users where id=$agency_id or id_manager=$agency_id or id_manager in (select id from users where id_manager=$agency_id or id_manager in (select id from users where id_manager=$agency_id)))"; $q_users = mysql_query($sql_users); while($r_users = mysql_fetch_assoc($q_users)){ $usersIds[] = (int)$r_users['id']; } $usersIds = array_unique($usersIds); $sql_users2 = "SELECT id, user_logo, CONCAT(last_name, ' ', first_name, ' ', middle_name) as user_fio FROM users WHERE id in (".implode(',',$usersIds).")"; $q_users2 = mysql_query($sql_users2); while($r_users2 = mysql_fetch_assoc($q_users2)){ $users[$r_users2['id']] = $r_users2; } //Доступ к задаче $user_access = $_SESSION['id']; if($user->users_admin == 1){ $user_access = $user->agencyId; } $req = new Requisitions(null, true); $usersCanEdit = $req->getIdsUsers($user_access); // если смотрит руководитель - показываем все // if ($_SESSION['agency'] || $_SESSION['manager'] || $_SESSION['users_admin']) { $sql = "SELECT e.id, e.comment, e.name, e.create_date, IF ((mango<>1 AND megafon<>1 AND telphin<>1 AND beeline<>1 AND mts<>1 AND tele2<>1 AND allo<>1), DATE_ADD(create_date, {$time_zone_sql}), create_date) as date_sort, e.checklist, e.type, e.type_call, e.user_id, e.partner_id, e.record, e.client_id, e.document_id, e.schedule_date, e.schedule_date_to, e.address, e.sum, e.from_id, e.calendar_view, `e`.`mango`, `e`.`megafon`, e.telphin,e.beeline, e.mts, e.tele2, e.allo, e.tracking, e.cancel, e.open_step, e.deal_id " . "FROM user_client_events as e WHERE e.client_id = $get[id] union SELECT ev.id, '' as comment, '' as name, ev.date as create_date, ev.date as date_sort, 0 as checklist, 'partner' as `type`, NULL as type_call, ev.user_id, 0 AS partner_id, '' as record, ev.client_id, '' as document_id, ev.date as schedule_date, '' as schedule_date_to, '' as address, '' as `sum`, ev.from_id, '' as calendar_view, '' as `mango`, '' as `megafon`, '' as telphin, '' as beeline, '' as mts, '' as tele2, '' as allo, '' as tracking, 0 as cancel, 0 as open_step, 0 as deal_id from events_clients as ev WHERE ev.client_id = $get[id] and event = 'transmitted_parallel' ORDER BY date_sort ASC"; if(isset($get['req_id']) && $get['req_id'] > 0){ $sql = "SELECT e.id, e.comment, e.name, e.create_date, IF ((mango<>1 AND megafon<>1 AND telphin<>1 AND beeline<>1 AND mts<>1 AND tele2<>1 AND allo<>1), DATE_ADD(create_date, {$time_zone_sql}), create_date) as date_sort, e.checklist, e.type, e.type_call, e.user_id, e.partner_id, e.record, e.client_id, e.document_id, e.req_id, e.old_req_id, e.schedule_date, e.schedule_date_to, e.address, e.sum, e.from_id, e.calendar_view, `e`.`mango`, `e`.`megafon`, e.telphin,e.beeline, e.mts, e.tele2, e.allo, e.tracking, e.cancel, e.open_step, e.deal_id " . "FROM user_client_events as e WHERE e.req_id = $get[req_id] union SELECT ev.id, '' as comment, '' as name, ev.date as create_date, ev.date as date_sort, 0 as checklist, 'partner' as `type`, NULL as type_call, ev.user_id, 0 AS partner_id, '' as record, ev.client_id, '' as document_id, ev.req_id, 0 as old_req_id, ev.date as schedule_date, '' as schedule_date_to, '' as address, '' as `sum`, ev.from_id, '' as calendar_view, '' as `mango`, '' as `megafon`, '' as telphin, '' as beeline, '' as mts, '' as tele2, '' as allo, '' as tracking, 0 as cancel, 0 as open_step, 0 as deal_id from events_clients as ev WHERE ev.req_id = $get[req_id] and event = 'transmitted_parallel' ORDER BY date_sort ASC"; $arrSin = array(); $sql_obj_sin = "SELECT object_id FROM object_req_synchronization WHERE req_id = {$get['req_id']}"; $q_obj_sin = $pdo->query($sql_obj_sin); while($r_obj_sin = $pdo->fetch_assoc($q_obj_sin)){ $arrSin[] = $r_obj_sin['object_id']; } if(!empty($arrSin)){ $sql = "SELECT e.id, e.comment, e.name, e.create_date, IF ((mango<>1 AND megafon<>1 AND telphin<>1 AND beeline<>1 AND mts<>1 AND tele2<>1 AND allo<>1), DATE_ADD(create_date, {$time_zone_sql}), create_date) as date_sort, e.checklist, e.type, e.type_call, e.user_id, e.partner_id, e.record, e.client_id, e.document_id, e.req_id, e.old_req_id, e.schedule_date, e.schedule_date_to, e.address, e.sum, e.from_id, e.calendar_view, `e`.`mango`, `e`.`megafon`, e.telphin,e.beeline, e.mts, e.tele2, e.allo, e.tracking, e.cancel, e.open_step, e.deal_id " . "FROM user_client_events as e WHERE e.req_id = $get[req_id] union SELECT ev.id, '' as comment, '' as name, ev.date as create_date, ev.date as date_sort, 0 as checklist, 'partner' as `type`, NULL as type_call, ev.user_id, 0 AS partner_id, '' as record, ev.client_id, '' as document_id, ev.req_id, 0 as old_req_id, ev.date as schedule_date, '' as schedule_date_to, '' as address, '' as `sum`, ev.from_id, '' as calendar_view, '' as `mango`, '' as `megafon`, '' as telphin, '' as beeline, '' as mts, '' as tele2, '' as allo, '' as tracking, 0 as cancel, 0 as open_step, 0 as deal_id from events_clients as ev WHERE ev.req_id = $get[req_id] and event = 'transmitted_parallel' union SELECT e.id, e.comment, '' as name, e.create_date, e.create_date as date_sort, '0' as checklist, 'show_object' as type, NULL as type_call, e.user_id, '' as record, e.object_id, 0 as client_id, e.document_id, e.req_id, 0 as old_req_id, e.schedule_date, '' as schedule_date_to, e.address, e.sum, e.from_id, e.calendar_view, '' as `mango`, '' as `megafon`, '' as telphin, '' as beeline, '' as mts, '' as tele2, '' as allo, '' as tracking, e.cancel, 0 as open_step " . "FROM user_object_events as e WHERE e.req_id={$get['req_id']} AND e.object_id in (".implode(',', $arrSin).") AND e.type='show' ORDER BY date_sort ASC"; //echo $sql; } } /* if($_SESSION['id'] == 5238){ echo $sql; }*/ $rez = mysql_query($sql); $date = null; $createDate = null; while ($event = mysql_fetch_assoc($rez)) { if ($createDate == null || $createDate != date("d.m.Y", strtotime($event['create_date']))) { $createDate = date("d.m.Y", strtotime($event['create_date'])); list($d, $m, $y) = explode(".", $createDate); if ($y == date("Y")) { $y = ""; } echo '
' . $d . " " . getRusMonth($m) . " " . $y . '
'; } $class_ev = " is__right"; $from_id = $event['user_id']; if(!empty($event['from_id'])) $from_id = $event['from_id']; if($_SESSION['id'] == $from_id){ $class_ev = " is__left"; } $sql_user = "SELECT user_logo, CONCAT(last_name, ' ', first_name, ' ', middle_name) as user_fio FROM users WHERE id = {$from_id} UNION SELECT user_logo, CONCAT(last_name, ' ', first_name, ' ', middle_name, ' (удален)') as user_fio FROM users_delete WHERE user_id = {$from_id}"; // echo $sql_user."
"; $from_user = mysql_fetch_assoc(mysql_query($sql_user)); $event['user_logo'] = $from_user['user_logo']; $event['user_fio'] = $from_user['user_fio']; if ($event['partner_id'] > 0) { $sql_partner = "SELECT name FROM `partners_employees` WHERE id = {$from_id} AND partner_id = {$event['partner_id']} LIMIT 1"; $q_partner = mysql_query($sql_partner); if (mysql_num_rows($q_partner) > 0) { $r_partner = mysql_fetch_assoc($q_partner); if (!empty($r_partner['name'])) { $event['user_fio'] = $r_partner['name']; } } $sql_avatar = "SELECT avatar_logo, path FROM `partner_avatars` WHERE employee_id = {$from_id} AND partner_id = {$event['partner_id']} LIMIT 1"; $q_avatar = mysql_query($sql_avatar); if (mysql_num_rows($q_avatar) > 0) { $r_avatar = mysql_fetch_assoc($q_avatar); if (!empty($r_avatar['path']) && strpos($r_avatar['path'], 'http') === 0) { $event['user_logo'] = $r_avatar['path']; } elseif (!empty($r_avatar['avatar_logo'])) { $event['user_logo'] = $r_avatar['avatar_logo']; } } } if ($event['type'] == 'comment') { ?>
Примечание от партнёра
0){?>
Примечание добавлено автоматически при переходе на этап 0){?>
Из заявки ID:
  • ' . $row['name'] . '.pdf
  • '; } } $docs_q = mysql_query("SELECT * FROM clients_files WHERE event_id = '".$event['id']."'"); $name_files = ''; while ($file = mysql_fetch_assoc($docs_q)) { if($file['name_id'] > 0 && $name_files == ''){ $sql_n = "SELECT * FROM names_client_files WHERE id={$file['name_id']}"; $q_n = mysql_query($sql_n); if(mysql_num_rows($q_n) > 0){ $r_n = mysql_fetch_assoc($q_n); $name_files = $r_n['name']; } } $name_doc = $_SERVER['DOCUMENT_ROOT'].'/upload/clients/'.$file['client_id'].'/'.$file['guid'].'.'.$file['type']; if ($file['req_id'] > 0) { $name_doc = $_SERVER['DOCUMENT_ROOT'].'/upload/reqs/'.$file['req_id'].'/'.$file['guid'].'.'.$file['type']; } if ($file['client_id'] > 0 && $event['partner_id']) { $file_path = 'https://partner.joywork.ru/upload/clients/'.$file['client_id'].'/'.$file['guid'].'.'.$file['type']; if (!empty($file_path) && !empty($file['name'])) { $file_list .= '
  • ' . $file['name'] . '
  • '; } } else { $file_path = ''; if ($file['client_id'] > 0) $file_path = 'https://uf.joywork.ru/upload/clients/'.$file['client_id'].'/'.$file['guid'].'.'.$file['type']; if ($file['req_id'] > 0) $file_path = 'https://uf.joywork.ru/upload/reqs/'.$file['req_id'].'/'.$file['guid'].'.'.$file['type']; if (!empty($file_path) && !empty($file['name'])) { $file_list .= '
  • ' . $file['name'] . '
  • '; } } } if (!empty($file_list)) { ?>
    Файл
      ' . $file_list . '
    ' : ''; ?>
    0){?>
    Файл добавлен автоматически при переходе на этап 0){?>
    Из заявки ID:
    Звонок от партнёра
    Позвонить c
    по в
    ссылка', $event['comment']); if(!empty($event['type_call'])){ switch($event['type_call']){ case 1:{ $comment = ''.$comment.''; break; } case 2:{ $comment = ''.$comment.''; break; } case 3:{ $comment = ''.$comment.''; break; } case 4:{ $comment = ''.$comment.''; break; } } } ?>
    Комментарий:
    0 || $event['megafon']>0 || $event['telphin']>0 || $event['beeline']>0 || $event['mts']>0 || $event['tele2']>0 || $event['allo']>0){ ?> 0 && isset($users[$event['user_id']])){?>
    0){?>
    Задача добавлена автоматически при переходе на этап 0){?>
    Из заявки ID:
    agencyId."/"; if(!file_exists($_SERVER['DOCUMENT_ROOT'].$path.$rec.'.mp3')){ $href = 'https://voice.joywork.ru/mts/'.$user->agencyId.'/'; $Headers = @get_headers($href.$rec.'.mp3'); if(strpos($Headers[0],'200')) { $path = $href; } else { $path = ''; } } //echo $pach; } else if($event['tele2'] == 1) { $date_patch = date('Ymd', strtotime($event['create_date'])); $path = '/server/tele2/'.$user->agencyId.'/'.$date_patch.'/'; if(!file_exists($_SERVER['DOCUMENT_ROOT'].$path.$rec.'.mp3')){ $href = 'https://voice.joywork.ru/tele2/'.$user->agencyId.'/'.$date_patch.'/'; $Headers = @get_headers($href.$rec.'.mp3'); if(strpos($Headers[0],'200')) { $path = $href; } else { $path = ''; } } //echo $pach; } else if($event['allo'] == 1) { $date_patch = date('Ymd', strtotime($event['create_date'])); $path = '/server/allo/'.$user->agencyId.'/'; if(!file_exists($_SERVER['DOCUMENT_ROOT'].$path.$rec.'.mp3')){ $href = 'https://voice.joywork.ru/allo/'.$user->agencyId.'/'; $Headers = @get_headers($href.$rec.'.mp3'); if(strpos($Headers[0],'200')) { $path = $href; } else { $path = ''; } } //echo $pach; }else { $path = '/server/mango/'; if(!file_exists($_SERVER['DOCUMENT_ROOT'].$path.$rec.'.mp3')){ $href = 'https://voice.joywork.ru/mango/'; $Headers = @get_headers($href.$rec.'.mp3'); if(strpos($Headers[0],'200')) { $path = $href; } else { $path = ''; } } } if(!empty($path)){ ?>
    Встреча от партнёра
    Встреча будет в
    Адрес:
    ссылка', $event['comment']);?>
    Комментарий:
    0 && isset($users[$event['user_id']])){?>
    0){?>
    Задача добавлена автоматически при переходе на этап 0){?>
    Из заявки ID:
    Показ от партнёра
    Показ будет в
    Адрес:
    ссылка', $event['comment']); ?>
    Комментарий:
    0 && isset($users[$event['user_id']])){?>
    0){?>
    Задача добавлена автоматически при переходе на этап 0){?>
    Из заявки ID:
    0, ( SELECT CONCAT(u.last_name, ' ', u.first_name, ' ', u.middle_name) FROM users as u WHERE u.id = s.created_by ), NULL ) as sub_comment_author FROM `user_sub_comments` AS s WHERE s.event_id IN ( SELECT id AS event_id FROM `user_object_events` WHERE user_id = '$_SESSION[id]' AND req_id = '$event[req_id]' AND object_id = '$event[client_id]' AND comment = '$event[comment]' AND schedule_date = '$event[schedule_date]' ) AND s.section_id = 1 AND s.req_id = '$event[req_id]' LIMIT 1"; //echo ""; if ($query = mysql_query($sql)) { $row = mysql_fetch_assoc($query); if (!empty($row['sub_comment']) && !empty($row['sub_comment_author'])) { $event['sub_comment'] = $row['sub_comment']; $event['sub_comment_author'] = $row['sub_comment_author']; } } ?>
    Показ из объекта
    Показ будет в
    Адрес:
    ссылка', $event['comment']); ?>
    Комментарий:
    Комментарий к задаче: ()
    0 && isset($users[$event['user_id']])){?>
    0){?>
    Задача добавлена автоматически при переходе на этап 0){?>
    Из заявки ID:
    Сделка от партнёра
    Запланирована сделка на в

    Сумма в договоре: руб.
    Комиссия агента: руб.
    Стороны сделки:
    0) { $row_req1 = mysql_fetch_assoc($rez_req1); $side1_text .= ': Заявка «' . htmlspecialchars($row_req1['name']) . '»'; if (!empty($row_req1['client_id'])) { $sql_cl1 = "SELECT id, fio FROM clients WHERE id = " . intval($row_req1['client_id']) . " LIMIT 1"; $rez_cl1 = mysql_query($sql_cl1); if ($rez_cl1 && mysql_num_rows($rez_cl1) > 0) { $row_cl1 = mysql_fetch_assoc($rez_cl1); $side1_text .= ' — ' . htmlspecialchars($row_cl1['fio']) . ''; } } } } echo '' . $side1_text . '
    '; // Сторона 2 $side2_text = htmlspecialchars($deal_data['side_two']); if (!empty($deal_data['side_two_requisition_id'])) { $sql_req2 = "SELECT name, client_id FROM requisitions WHERE id = " . intval($deal_data['side_two_requisition_id']) . " LIMIT 1"; $rez_req2 = mysql_query($sql_req2); if ($rez_req2 && mysql_num_rows($rez_req2) > 0) { $row_req2 = mysql_fetch_assoc($rez_req2); $side2_text .= ': Заявка «' . htmlspecialchars($row_req2['name']) . '»'; if (!empty($row_req2['client_id'])) { $sql_cl2 = "SELECT id, fio FROM clients WHERE id = " . intval($row_req2['client_id']) . " LIMIT 1"; $rez_cl2 = mysql_query($sql_cl2); if ($rez_cl2 && mysql_num_rows($rez_cl2) > 0) { $row_cl2 = mysql_fetch_assoc($rez_cl2); $side2_text .= ' — ' . htmlspecialchars($row_cl2['fio']) . ''; } } } } echo '' . $side2_text . ''; ?>
    0) { echo '
    Объекты:
    '; while ($obj_row = mysql_fetch_assoc($rez_objs)) { echo '' . htmlspecialchars($obj_row['nazv']) . ' (' . htmlspecialchars($obj_row['adres']) . ')
    '; } echo '
    '; } } // Документы сделки $sql_inner_docs = "SELECT d.id, d.name, did.comment FROM inner_docs d JOIN deal_inner_doc did ON did.inner_doc_id = d.id WHERE did.deal_id = " . intval($deal_id_for_edit); $rez_inner_docs = mysql_query($sql_inner_docs); if ($rez_inner_docs && mysql_num_rows($rez_inner_docs) > 0) { echo '
    Документы:'; while ($doc_row = mysql_fetch_assoc($rez_inner_docs)) { echo '
    '; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
    '; } echo '
    '; } if ($deal_data['status'] == 1) { echo '
    ✓ Сделка закрыта успешно
    '; } else if ($deal_data['status'] == 2) { echo '
    ✗ Сделка отменена
    '; } ?> ?>
    Сумма сделки: p
    ссылка', $event['comment']); ?>
    Комментарий:
    Клиент: '.$doc_cls['fio'] . ((!empty($cls_contacts)) ? ' (' . implode(', ', $cls_contacts) . ')' : '') . '
  • '; } } if (isset($params['client_id']) && (!isset($client_ids) || empty($client_ids))) { $sql_cl = "SELECT id, fio, phone, email FROM `clients` WHERE `id` = '$params[client_id]' LIMIT 1"; $rez_cl = mysql_query($sql_cl); if ($doc_cl = mysql_fetch_assoc($rez_cl)) { mask_client_contacts_inplace($doc_cl); $cl_contacts = []; if ($doc_cl['email']) $cl_contacts[] = $doc_cl['email']; if ($doc_cl['phone']) $cl_contacts[] = $doc_cl['phone']; $doc_parties .= '
  • Клиент: '.$doc_cl['fio'] . ((!empty($cl_contacts)) ? ' (' . implode(', ', $cl_contacts) . ')' : '') . '
  • '; } } if (isset($params['object_id'])) { $sql_obj = "SELECT id, nazv, adres FROM `objects` WHERE `id` = '$params[object_id]' LIMIT 1"; $rez_obj = mysql_query($sql_obj); if ($doc_obj = mysql_fetch_assoc($rez_obj)) { $doc_parties .= '
  • Объект: '.$doc_obj['nazv'].' ('.$doc_obj['adres'].')
  • '; } } if (!empty($doc_parties)) { ?>
    Стороны сделки:
    0 && isset($users[$event['user_id']])){?>
    0){?>
    Задача добавлена автоматически при переходе на этап 0){?>
    Из заявки ID:
  • от партнёра
    Мероприятие состоится в
    Сумма сделки: p
    ссылка', $event['comment']); ?>
    Комментарий:
    0 && isset($users[$event['user_id']])){?>
    0){?>
    Задача добавлена автоматически при переходе на этап 0){?>
    Из заявки ID:
    Этап «»
    Закрыт со следующими событиями:
    Добавлено событие по чек листу:
    0 && isset($users[$event['user_id']])){?>
    0){?>
    Задача добавлена автоматически при переходе на этап 0){?>
    Из заявки ID:
    doers)){ $doers_arr = json_decode(html_entity_decode($client->doers)); foreach($doers_arr as $key => $doer){ $doers[$key] = $doer; } } else if((isset($get['req_id']) && $get['req_id'] > 0) && !empty($client['doers'])){ $doers_arr = json_decode(html_entity_decode($client['doers'])); foreach($doers_arr as $key => $doer){ $doers[$key] = $doer; } } ?>
    Партнер от партнёра
    Добавлен к совместной работе
    0 && isset($users[$event['user_id']])){?>
    0){?>
    Задача добавлена автоматически при переходе на этап 0){?>
    Из заявки ID:
    '.$date_del.''; $text2 = 'Клиент закрыт'; if($is_req){ $text2 = 'Заявка закрыта'; } echo '
    '.$text2; if(isset($reason) && !empty($reason)){ echo " - ".$reason; } echo '
    '; } }