public function adapt(array $newProperty) { if (!isset($newProperty['TYPE'])) { return $newProperty; } if (is_array($newProperty)) { foreach ($newProperty as $k => $v) { if (isset($this->fieldProxy[$k])) { unset($newProperty[$k]); $newProperty[$this->fieldProxy[$k]] = $v; } } } $oldProperty = CSaleOrderPropsAdapter::convertNewToOld($newProperty); $oldProperty['VALUE'] = CSaleOrderPropsAdapter::getOldValue($newProperty['VALUE'], $newProperty['TYPE']); $oldProperty['PROP_TYPE'] = $oldProperty['TYPE']; $oldProperty['PROP_SIZE1'] = $oldProperty['SIZE1']; $oldProperty['PROP_SIZE2'] = $oldProperty['SIZE2']; return array_intersect_key($oldProperty, $this->select); }
function Update($ID, $arFields) { if (!$ID) { return false; } foreach (GetModuleEvents('sale', 'OnBeforeOrderPropsUpdate', true) as $arEvent) { if (ExecuteModuleEventEx($arEvent, array($ID, &$arFields)) === false) { return false; } } if (!self::CheckFields('UPDATE', $arFields, $ID)) { return false; } $newProperty = CSaleOrderPropsAdapter::convertOldToNew($arFields + self::GetByID($ID)); OrderPropsTable::update($ID, array_intersect_key($newProperty, CSaleOrderPropsAdapter::$allFields)); foreach (GetModuleEvents('sale', 'OnOrderPropsUpdate', true) as $arEvent) { ExecuteModuleEventEx($arEvent, array($ID, $arFields)); } return $ID; }
if ($statusName = Loc::getMessage("SALE_STATUS_{$statusId}")) { $statusLanguages[$statusId][] = array('LID' => $languageId, 'NAME' => $statusName, 'DESCRIPTION' => Loc::getMessage("SALE_STATUS_{$statusId}_DESCR")); } } } Bitrix\Sale\DeliveryStatus::install(array('ID' => $deliveryInitialStatus, 'SORT' => 300, 'NOTIFY' => 'Y', 'LANG' => $statusLanguages[$deliveryInitialStatus])); Bitrix\Sale\DeliveryStatus::install(array('ID' => $deliveryFinalStatus, 'SORT' => 400, 'NOTIFY' => 'Y', 'LANG' => $statusLanguages[$deliveryFinalStatus])); } catch (Exception $e) { \CEventLog::Add(array("SEVERITY" => "ERROR", "AUDIT_TYPE_ID" => "SALE_CONVERTER_ERROR", "MODULE_ID" => "sale", "ITEM_ID" => "Status::install", "DESCRIPTION" => $e->getMessage())); } try { if ($DB->Query('SELECT SIZE1 FROM b_sale_order_props WHERE 1=0', true)) { require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/sale/lib/compatible/compatible.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/sale/lib/internals/orderprops.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/sale/general/order_props.php'; CSaleOrderPropsAdapter::migrate(); } } catch (Exception $e) { \CEventLog::Add(array("SEVERITY" => "ERROR", "AUDIT_TYPE_ID" => "SALE_CONVERTER_ERROR", "MODULE_ID" => "sale", "ITEM_ID" => "CSaleOrderPropsAdapter::migrate", "DESCRIPTION" => $e->getMessage())); } if ($DB->Query('SELECT SIZE1 FROM b_sale_order_props WHERE 1=0', true)) { if ($DB->type == "MYSQL") { if (!$DB->Query('ALTER TABLE b_sale_order_props DROP SIZE1, DROP SIZE2', true)) { $error .= "<br>" . $DB->GetErrorMessage(); } } elseif ($DB->type == "MSSQL") { $DB->Query("ALTER TABLE B_SALE_ORDER_PROPS DROP CONSTRAINT DF_B_SALE_ORDER_PROPS_SIZE1", false); $DB->Query("ALTER TABLE B_SALE_ORDER_PROPS DROP CONSTRAINT DF_B_SALE_ORDER_PROPS_SIZE2", false); if (!$DB->Query("ALTER TABLE B_SALE_ORDER_PROPS DROP COLUMN SIZE1, SIZE2", true)) { $error .= "<br>" . $DB->GetErrorMessage(); }