public function sendEditedMail($vks, $toRequester = true)
 {
     $vks->link = ST::linkToVksPage($vks->id, false, true);
     $vksArray = $vks->toArray();
     $vksCa = $vks->other_tb_required && !empty($vks->link_ca_vks_id) ? CAVksNoSupport::with('participants')->find($vks->link_ca_vks_id) : false;
     $message = App::$instance->twig->render('mails/v2/vksWs-edited.twig', array('vks' => $vksArray, 'http_path' => HTTP_BASE_PATH, 'appHttpPath' => NODE_HTTP_PATH, 'vksCa' => $vksCa));
     if (!$toRequester) {
         Mail::sendMailToStack($vks->owner->email, "ВКС #{$vks['id']} | {$vks['title']}, отредактирована администратором", $message);
     } else {
         Mail::sendMailToStack(App::$instance->user->email, "ВКС #{$vks['id']} | {$vks['title']}, отредактирована администратором", $message);
     }
     if (mb_strtolower($vks->owner->email) != mb_strtolower($vks->init_customer_mail)) {
         Mail::sendMailToStack($vks->init_customer_mail, "ВКС #{$vks->id} | {$vks['title']}, в которой вы заявлены как ответственный, отредактирована администратором", $message);
     }
     App::$instance->log->logWrite(LOG_MAIL_SENDED, "VKS WS #{$vks['id']} | {$vks['title']}, отредактирована администратором");
 }
Пример #2
0
 public function aksTransportVksInPeriod(DateTime $start, DateTime $end, $poolCodes)
 {
     $result = array();
     if (count($poolCodes)) {
         $result = CAVksNoSupport::where('start_date_time', ">=", $start)->where('start_date_time', '<=', $end)->where('status', VKS_STATUS_TRANSPORT_FOR_TB)->whereIn('v_room_num', $poolCodes)->get();
     }
     return $result;
 }
Пример #3
0
 public function joinCaStore($referral)
 {
     $request = $this->request->request;
     $this->fillParticipants("vks_participants_create", $this->request);
     $report = new VksReport($request);
     $this->validator->validate(['ФИО ответственного' => [$request->get('init_customer_fio'), 'required|max(255)'], 'Почта ответственного' => [$request->get('init_customer_mail'), 'required|max(255)'], 'Тел. ответственного' => [$request->get('init_customer_phone'), 'required|max(255)'], 'Подразделение' => [$request->get('department'), 'required|int'], 'Кол-во участников с рабочих мест (IP телефоны)' => [$request->get('in_place_participants_count'), 'int'], 'Участники ВКС' => [$request->get('inner_participants'), 'array'], 'Точка для технической поддержки' => [$request->get('tech_support_att_id'), "int|attendance_is_tech_supportable"], 'Комментарий для Тех. поддержки' => [$request->get('user_message'), 'max(255)'], 'Комментарий для Администратора' => [$request->get('comment_for_admin'), 'max(255)']]);
     //if no passes
     if (!$this->validator->passes()) {
         $this->backWithData($this->validator->errors()->all());
     }
     //any participants required
     if (!intval($request->get('in_place_participants_count')) && !count($request->get('inner_participants'))) {
         $this->backWithData('Вы не выбрали участников для ВКС');
     }
     Capsule::beginTransaction();
     $caWS = CAVks::where('referral', $referral)->with('connection_codes')->first();
     $caNS = CAVksNoSupport::where('referral', $referral)->first();
     if (!$caWS && !$caNS) {
         $this->backWithData("Приглашение {$request->get('referrer')}  не действительно");
     }
     $caVKSType = $caWS ? VKS_WAS : VKS_NS;
     $caVks = $caWS ? $caWS : $caNS;
     $this->convertToLocalTime($caVks);
     $vks = new Vks();
     $vks->is_private = $request->has('is_private') ? 1 : 0;
     $vks->record_required = $request->has('record_required') ? 1 : 0;
     $vks->title = $caVks->title;
     $vks->date = $caVks->local->start_date_time->format("Y-m-d");
     $vks->start_date_time = $caVks->local->start_date_time;
     $vks->end_date_time = $caVks->local->end_date_time;
     $vks->presentation = isset($caVks->presentation) ? $caVks->presentation : 0;
     $vks->department = $request->get('department');
     $vks->initiator = 1;
     //always CA
     $vks->init_customer_fio = $request->get('init_customer_fio');
     $vks->init_customer_phone = $request->get('init_customer_phone');
     $vks->init_customer_mail = $request->get('init_customer_mail');
     $vks->comment_for_admin = $request->get('comment_for_admin');
     $vks->link_ca_vks_id = $caVks->id;
     $vks->link_ca_vks_type = $caVKSType;
     $vks->owner_id = App::$instance->user->id;
     $vks->from_ip = App::$instance->user->ip;
     $vks->ca_code = isset($caVks->connectionCode->value) ? $caVks->connectionCode->value : $caVks->v_room_num;
     $vks->in_place_participants_count = $request->get('in_place_participants_count');
     //        die(dump($vks));
     $vks->save();
     if ($request->get('tech_support_required')) {
         TechSupportRequest::create(array('att_id' => $request->get('tech_support_att_id'), 'vks_id' => $vks->id, 'owner_id' => App::$instance->user->id, 'user_message' => $request->get('user_message'), 'status' => TechSupportRequest::STATUS_WAIT_VKS_DECISION));
     }
     if (!Auth::isAdmin(App::$instance)) {
         if (self::isVksInPastTime($vks)) {
             throw new LogicException('bad vks date, it on past time');
         }
     }
     //create participants
     $this->createInnerOrPhoneParp($request->get('inner_participants'), $vks);
     App::$instance->log->logWrite(LOG_VKSWS_CREATED, "VKS " . ST::linkToVksPage($vks->id) . " Created");
     Capsule::commit();
     //refill for report
     $this->request->request->set("date", $vks->date->format("d.m.Y"));
     $this->request->request->set("start_time", $vks->start_date_time->format("H:i"));
     $this->request->request->set("end_time", $vks->end_date_time->format("H:i"));
     $report->setObject($vks);
     $report->setResult(true);
     $result[] = $report;
     $_SESSION['savedResult_' . App::$instance->main->appkey] = $result;
     ST::redirectToRoute('vks/checkout');
 }