function SendAgent() { global $DB; /** @noinspection PhpDynamicAsStaticMethodCallInspection */ $arFilter = array("<=REMIND_DATE" => (string) new \Bitrix\Main\Type\DateTime()); $rsReminders = CTaskReminders::GetList(array("date" => "asc"), $arFilter); while ($arReminder = $rsReminders->Fetch()) { $rsTask = CTasks::GetByID($arReminder["TASK_ID"], false); if ($arTask = $rsTask->Fetch()) { // remind about not closed tasks only if ($arTask['CLOSED_DATE'] === NULL) { /** @noinspection PhpDynamicAsStaticMethodCallInspection */ $rsUser = CUser::GetByID($arReminder["USER_ID"]); if ($arUser = $rsUser->Fetch()) { $arTask["PATH_TO_TASK"] = CTaskNotifications::GetNotificationPath($arUser, $arTask["ID"]); $arFilterForSendedRemind = array_merge($arFilter, array('TASK_ID' => $arReminder['TASK_ID'], 'USER_ID' => $arReminder['USER_ID'], 'TRANSPORT' => $arReminder['TRANSPORT'], 'TYPE' => $arReminder['TYPE'])); CTaskReminders::Delete($arFilterForSendedRemind); if ($arReminder["TRANSPORT"] == self::REMINDER_TRANSPORT_EMAIL || !CModule::IncludeModule("socialnetwork") || !CTaskReminders::__SendJabberReminder($arUser["ID"], $arTask)) { CTaskReminders::__SendEmailReminder($arUser["EMAIL"], $arTask); } } } } } // Some older items can still exists (for removed users, etc.) CTaskReminders::Delete($arFilter); return "CTaskReminders::SendAgent();"; }
$APPLICATION->RestartBuffer(); $task = new CTasks(); $rc = $task->Delete(intval($_POST["id"])); if ($rc === false) { $strError = 'Error'; if ($ex = $APPLICATION->GetException()) { $strError = $ex->GetString(); } if ($_POST["type"] == "json") { echo "['strError' : '" . CUtil::JSEscape(htmlspecialcharsbx($strError)) . "']"; } else { echo htmlspecialcharsbx($strError); } } } elseif ($_POST["mode"] == "reminders") { CTaskReminders::Delete(array("TASK_ID" => intval($_POST["id"]), "USER_ID" => $USER->GetID())); if (isset($_POST["reminders"])) { $obReminder = new CTaskReminders(); foreach ($_POST["reminders"] as $reminder) { $arFields = array("TASK_ID" => intval($_POST["id"]), "USER_ID" => $USER->GetID(), "REMIND_DATE" => $reminder["r_date"], "TYPE" => $reminder["type"], "TRANSPORT" => $reminder["transport"]); $obReminder->Add($arFields); } } } else { $arActionsMap = array('close' => 'complete', 'start' => 'startExecution', 'accept' => 'accept', 'renew' => 'renew', 'defer' => 'defer', 'decline' => 'decline', 'approve' => 'approve', 'disapprove' => 'disapprove', 'pause' => 'pauseExecution'); $arFields = array(); if ($_POST["mode"] == "mark" && in_array($_POST["mark"], array("NULL", "P", "N"))) { if ($_POST["mark"] == "NULL") { $arFields["MARK"] = false; } else { $arFields["MARK"] = $_POST["mark"];
$_SESSION['TASKS']['EDIT_COMPONENT']['STEPPER'][$_POST['FORM_GUID']]['index'] = $arResult['stepIndex']; } else { lambda_sgkrg455d_funcCreateSubtasks($arFields, $_POST['RESPONSIBLES'], 0, $loggedInUserId, $woStepper = true, array('COPY_PARAMS' => $arResult['COPY_PARAMS'])); } } } } if (sizeof($arResult["ERRORS"]) == 0) { if (is_array($arFields["FILES"]) && count($arFields["FILES"])) { foreach ($arFields["FILES"] as $fileId) { CTaskFiles::removeTemporaryFile($loggedInUserId, (int) $fileId); } } if (sizeof($_POST["REMINDERS"])) { if ($arResult["ACTION"] == "edit") { CTaskReminders::Delete(array("TASK_ID" => $taskID, "USER_ID" => $loggedInUserId)); } $obReminder = new CTaskReminders(); foreach ($_POST["REMINDERS"] as $reminder) { $arReminderFields = array("TASK_ID" => $taskID, "USER_ID" => $loggedInUserId, "REMIND_DATE" => $reminder["date"], "TYPE" => $reminder["type"], "TRANSPORT" => $reminder["transport"]); $obReminder->Add($arReminderFields); } } if ($arResult["ACTION"] == "create" && $_POST["apply"] == "save_and_back") { $redirectPath = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TASKS_TASK"], array("task_id" => 0, "action" => "edit")); if ($arResult["IS_IFRAME"]) { $redirectPath .= (strpos($redirectPath, "?") === false ? "?" : "&") . "IFRAME=Y"; $redirectPath .= "&CALLBACK=" . ($arResult["ACTION"] == "edit" ? "CHANGED" : "ADDED"); $redirectPath .= "&TASK_ID=" . $taskID; if (isset($_POST['TOP_FRAME_COLUMNS_IDS_DURING_ADD_UPDATE']) && $_POST['TOP_FRAME_COLUMNS_IDS_DURING_ADD_UPDATE'] !== '') { $redirectPath .= '&TOP_FRAME_COLUMNS_IDS_DURING_ADD_UPDATE=' . $_POST['TOP_FRAME_COLUMNS_IDS_DURING_ADD_UPDATE'];