while ($arResult = $dbResultList->Fetch()) { $arID[] = $arResult['ID']; } } foreach ($arID as $ID) { if (strlen($ID) <= 0) { continue; } switch ($_REQUEST['action']) { case "delete": if ($ID == "N" || $ID == "F") { continue; } @set_time_limit(0); $DB->StartTransaction(); if (!CSaleStatus::Delete($ID)) { $DB->Rollback(); if ($ex = $APPLICATION->GetException()) { $lAdmin->AddGroupError($ex->GetString(), $ID); } else { $lAdmin->AddGroupError(GetMessage("ERROR_DEL_STATUS"), $ID); } } $DB->Commit(); break; } } } $dbResultList = CSaleStatus::GetList(array($by => $order), $arFilter, false, false, array("ID", "SORT", "LID", "NAME", "DESCRIPTION", $by)); $dbResultList = new CAdminResult($dbResultList, $sTableID); $dbResultList->NavStart();
protected function deleteOStatus() { $code_status = \Bitrix\Main\Config\Option::get($this->MODULE_ID, "order_status_code_erip"); $order = CSaleOrder::GetList(array(), array("STATUS_ID" => $code_status))->Fetch(); if ($order["ID"] > 0) { throw new Exception(Loc::getMessage("DEVTM_ERIP_DELETE_STATUS_ERROR")); } $o_s = new CSaleStatus(); if (!$o_s->Delete($code_status)) { throw new Exception(Loc::getMessage("DEVTM_ERIP_DELETE_STATUS2_ERROR")); } return true; }
/** * Deletes sale order status * @param int $statusId Status ID * @return bool Deletion success.s */ public function Delete($statusId) { if (!CModule::IncludeModule('sale')) { return false; } $statusId = intval($statusId); if ($statusId === ($statusId & 0xff) && $statusId >= 65 && $statusId <= 90) { $statusId = chr($statusId); } else { return false; } $result = CSaleStatus::Delete($statusId); return $result; }