continue; } if (isset($arField['SHOW_IN_LIST']) && $arField['SHOW_IN_LIST'] !== $arPresetField['SHOW_IN_LIST']) { if ($arField['SHOW_IN_LIST'] === 'Y') { CCrmGridOptions::AddVisibleColumn($gridID, $arPresetField['FIELD_NAME']); } else { CCrmGridOptions::RemoveVisibleColumn($gridID, $arPresetField['FIELD_NAME']); } } } unset($arPostField); //Clear components cache $CACHE_MANAGER->ClearByTag('crm_fields_list_' . $arResult['ENTITY_ID']); } if ($_POST['action_all_rows_' . $arResult['GRID_ID']] == 'Y' && $_POST['action_button_' . $arResult['GRID_ID']] == 'delete') { $arFields = $CCrmFields->GetFields(); foreach ($arFields as $ID => $arField) { $CCrmFields->DeleteField($arField['ID']); } //Clear components cache $CACHE_MANAGER->ClearByTag('crm_fields_list_' . $arResult['ENTITY_ID']); } if (!isset($_POST['AJAX_CALL'])) { LocalRedirect($arResult['FIELDS_LIST_URL']); } } if ($this->StartResultCache(true)) { $CACHE_MANAGER->StartTagCache($this->GetCachePath()); $CACHE_MANAGER->RegisterTag('crm_fields_list_' . $arResult['ENTITY_ID']); $arFields = $CCrmFields->GetFields(); $arResult['ROWS'] = array();
function UnInstallDB($arParams = array()) { global $DB, $APPLICATION, $stackCacheManager, $USER_FIELD_MANAGER; $this->errors = false; if (!array_key_exists('savedata', $arParams) || $arParams['savedata'] != 'Y') { // delete extra fields for all entities require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/crm/include.php'; $arEntityIds = CCrmFields::GetEntityTypes(); foreach ($arEntityIds as $entityId => $ar) { $CCrmFields = new CCrmFields($USER_FIELD_MANAGER, $entityId); $arFields = $CCrmFields->GetFields(); foreach ($arFields as $arField) { $CCrmFields->DeleteField($arField['ID']); } } $this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/crm/install/db/' . strtolower($DB->type) . '/uninstall.sql'); if (CModule::IncludeModule('socialnetwork')) { $dbRes = CSocNetLog::GetList(array(), array("ENTITY_TYPE" => CCrmLiveFeedEntity::GetAll()), false, false, array("ID")); if ($dbRes) { while ($arRes = $dbRes->Fetch()) { CSocNetLog::Delete($arRes["ID"]); } } } } $stackCacheManager->Clear('b_crm_status'); $stackCacheManager->Clear('b_crm_perms'); COption::RemoveOption('crm'); UnRegisterModuleDependences('mail', 'OnGetFilterList', 'crm', 'CCrmEMail', 'OnGetFilterList'); UnRegisterModuleDependences('main', 'OnUserTypeBuildList', 'crm', 'CUserTypeCrm', 'GetUserTypeDescription'); UnRegisterModuleDependences('main', 'OnUserTypeBuildList', 'crm', 'CUserTypeCrmStatus', 'GetUserTypeDescription'); UnRegisterModuleDependences('search', 'OnReindex', 'crm', 'CCrmSearch', 'OnSearchReindex'); UnRegisterModuleDependences('search', 'OnSearchCheckPermissions', 'crm', 'CCrmSearch', 'OnSearchCheckPermissions'); UnRegisterModuleDependences('report', 'OnReportAdd', 'crm', 'CCrmReportHelper', 'clearMenuCache'); UnRegisterModuleDependences('report', 'OnReportUpdate', 'crm', 'CCrmReportHelper', 'clearMenuCache'); UnRegisterModuleDependences('report', 'OnReportDelete', 'crm', 'CCrmReportHelper', 'clearMenuCache'); UnRegisterModuleDependences('iblock', 'OnIBlockDelete', 'crm', 'CCrmCatalog', 'OnIBlockDelete'); UnRegisterModuleDependences('iblock', 'OnAfterIBlockElementDelete', 'crm', 'CAllCrmProduct', 'OnIBlockElementDelete'); UnRegisterModuleDependences('iblock', 'OnAfterIBlockElementDelete', 'crm', 'CCrmProduct', 'OnIBlockElementDelete'); UnRegisterModuleDependences("socialnetwork", "OnFillSocNetLogEvents", "crm", "CCrmExternalSaleImport", "OnFillSocNetLogEvents"); UnRegisterModuleDependences('tasks', 'OnBeforeTaskAdd', 'crm', 'CAllCrmActivity', 'OnBeforeTaskAdd'); UnRegisterModuleDependences('tasks', 'OnTaskAdd', 'crm', 'CAllCrmActivity', 'OnTaskAdd'); UnRegisterModuleDependences('tasks', 'OnTaskUpdate', 'crm', 'CAllCrmActivity', 'OnTaskUpdate'); UnRegisterModuleDependences('tasks', 'OnTaskDelete', 'crm', 'CAllCrmActivity', 'OnTaskDelete'); UnRegisterModuleDependences('webdav', 'OnFileDelete', 'crm', 'CCrmWebDavHelper', 'OnWebDavFileDelete'); UnRegisterModuleDependences('subscribe', 'BeforePostingSendMail', 'crm', 'CCrmEMail', 'BeforeSendMail'); UnRegisterModuleDependences('calendar', 'OnAfterCalendarEventEdit', 'crm', 'CAllCrmActivity', 'OnCalendarEventEdit'); UnRegisterModuleDependences('calendar', 'OnAfterCalendarEventDelete', 'crm', 'CAllCrmActivity', 'OnCalendarEventDelete'); UnRegisterModuleDependences('crm', 'OnCrmStatusGetList', 'crm', 'CCrmStatusInvoice', 'getStatusList'); UnRegisterModuleDependences('crm', 'OnGetEntityTypes', 'crm', 'CCrmStatusInvoice', 'onGetEntityTypes'); UnRegisterModuleDependences('crm', 'OnBeforeCrmStatusCreate', 'crm', 'CCrmStatusInvoice', 'createCrmStatus'); UnRegisterModuleDependences('rest', 'onRestServiceBuildDescription', 'crm', 'CCrmRestService', 'onRestServiceBuildDescription'); UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetAllowedSubscribeEntityTypes', 'crm', 'CCrmLiveFeed', 'OnFillSocNetAllowedSubscribeEntityTypes'); UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetLogEvents', 'crm', 'CCrmLiveFeed', 'OnFillSocNetLogEvents'); UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetLogFields', 'crm', 'CCrmLiveFeed', 'OnFillSocNetLogFields'); UnRegisterModuleDependences('socialnetwork', 'OnBuildSocNetLogFilter', 'crm', 'CCrmLiveFeed', 'OnBuildSocNetLogFilter'); UnRegisterModuleDependences('socialnetwork', 'OnBuildSocNetLogOrder', 'crm', 'CCrmLiveFeed', 'OnBuildSocNetLogOrder'); UnRegisterModuleDependences('socialnetwork', 'OnSocNetLogFormatDestination', 'crm', 'CCrmLiveFeed', 'OnSocNetLogFormatDestination'); UnRegisterModuleDependences('socialnetwork', 'OnBuildSocNetLogPerms', 'crm', 'CCrmLiveFeed', 'OnBuildSocNetLogPerms'); UnRegisterModuleDependences('socialnetwork', 'OnBeforeSocNetLogRightsAdd', 'crm', 'CCrmLiveFeed', 'OnBeforeSocNetLogRightsAdd'); UnRegisterModuleDependences('socialnetwork', 'OnBeforeSocNetLogCommentCounterIncrement', 'crm', 'CCrmLiveFeed', 'OnBeforeSocNetLogCommentCounterIncrement'); UnRegisterModuleDependences('socialnetwork', 'OnAfterSocNetLogEntryCommentAdd', 'crm', 'CCrmLiveFeed', 'OnAfterSocNetLogEntryCommentAdd'); UnRegisterModuleDependences('socialnetwork', 'OnBeforeSocNetLogEntryGetRights', 'crm', 'CCrmLiveFeed', 'OnBeforeSocNetLogEntryGetRights'); UnRegisterModuleDependences("socialnetwork", "OnSendMentionGetEntityFields", "crm", "CCrmLiveFeed", "OnSendMentionGetEntityFields"); UnRegisterModuleDependences('main', 'OnAddRatingVote', 'crm', 'CCrmLiveFeed', 'OnAddRatingVote'); UnRegisterModuleDependences('forum', 'OnAfterCommentAdd', 'crm', 'CCrmLiveFeed', 'onAfterCommentAdd'); UnRegisterModuleDependences('disk', 'onAfterDeleteFile', 'crm', '\\Bitrix\\Crm\\Integration\\DiskManager', 'OnDiskFileDelete'); if (CModule::IncludeModule('search')) { CSearch::DeleteIndex('crm'); } UnRegisterModule('crm'); if ($this->errors !== false) { $APPLICATION->ThrowException(implode('<br />', $this->errors)); return false; } return true; }