protected function getConfigStructure() { static $profiles = null; if ($profiles === null) { $profiles = array("" => ""); foreach ($this->parentHandlerInitParams["PROFILES"] as $profileId => $profileParams) { if (strlen($profileParams["TITLE"]) > 0) { $profiles[$profileId] = $profileParams["TITLE"] . " [" . $profileId . "]"; } } } $result = array("MAIN" => array("TITLE" => Loc::getMessage("SALE_DLVR_HANDL_AUTP_CONF_MAIN_TITLE"), "DESCRIPTION" => Loc::getMessage("SALE_DLVR_HANDL_AUTP_CONF_MAIN_DESCR"), "ITEMS" => array("PROFILE_ID" => array("TYPE" => "ENUM", "NAME" => Loc::getMessage("SALE_DLVR_HANDL_AUTP_CONF_MAIN_PROFILE_ID"), "OPTIONS" => $profiles, "ONCHANGE" => "top.BX.showWait(); if(this.form.elements['NAME'].value == '') this.form.elements['NAME'].value = this.selectedOptions[0].innerHTML.replace(/\\s*\\[.*\\]/g,''); this.form.submit();")))); $serviceCurrency = $this->currency; if (\Bitrix\Main\Loader::includeModule('currency')) { $currencyList = CurrencyManager::getCurrencyList(); if (isset($currencyList[$this->currency])) { $serviceCurrency = $currencyList[$this->currency]; } unset($currencyList); } $marginTypes = array("%" => "%", "CURRENCY" => $serviceCurrency); $result["MAIN"]["ITEMS"]["MARGIN_VALUE"] = array("TYPE" => "STRING", "NAME" => Loc::getMessage("SALE_DLVR_HANDL_AUT_MARGIN_VALUE"), "DEFAULT" => 0); $result["MAIN"]["ITEMS"]["MARGIN_TYPE"] = array("TYPE" => "ENUM", "NAME" => Loc::getMessage("SALE_DLVR_HANDL_AUT_MARGIN_TYPE"), "DEFAULT" => "%", "OPTIONS" => $marginTypes); $configProfileIds = array_keys($this->parentHandlerInitParams["PROFILES"]); if (strlen($this->profileId) > 0 && in_array($this->profileId, $configProfileIds)) { $oldAutoConfig = $this->parentAutomatic->getOldConfig(); if ($oldAutoConfig && isset($oldAutoConfig["CONFIG_GROUPS"]) && is_array($oldAutoConfig["CONFIG_GROUPS"])) { foreach ($oldAutoConfig["CONFIG_GROUPS"] as $key => $groupId) { if ($this->profileId != $groupId) { unset($oldAutoConfig["CONFIG_GROUPS"][$key]); } } foreach ($oldAutoConfig["CONFIG"] as $key => $params) { if ($this->profileId != $params["CONFIG"]) { unset($oldAutoConfig["CONFIG"][$key]); } } } $oldConfig = Automatic::convertOldConfigToNew($oldAutoConfig); if (!empty($oldConfig)) { if (isset($oldConfig["CONFIG_GROUPS"]["MAIN"])) { $oldConfig["CONFIG_GROUPS"]["MAIN_OLD"] = $oldConfig["CONFIG_GROUPS"]["MAIN"]; unset($oldConfig["CONFIG_GROUPS"]["MAIN"]); } $result = array_merge($result, $oldConfig); } } return $result; }