/** * @return \Bitrix\Sale\Result * @throws Exception * @throws \Bitrix\Main\ArgumentException * @internal */ public static function convertPSRelations() { $result = new \Bitrix\Sale\Result(); $con = \Bitrix\Main\Application::getConnection(); if (!$con->isTableExists("b_sale_delivery2paysystem")) { return $result; } $query = new \Bitrix\Main\Entity\Query(DeliveryPaySystemTable::getEntity()); $query->setSelect(array('DELIVERY_ID')); $query->addFilter('LINK_DIRECTION', NULL); $query->setLimit(1); $res = $query->exec(); if (!$res->fetch()) { return $result; } $con->queryExecute('UPDATE b_sale_delivery2paysystem SET LINK_DIRECTION=\'' . DeliveryPaySystemTable::LINK_DIRECTION_DELIVERY_PAYSYSTEM . '\''); $res = DeliveryPaySystemTable::getList(array()); while ($rec = $res->fetch()) { unset($rec["ID"]); $rec["LINK_DIRECTION"] = DeliveryPaySystemTable::LINK_DIRECTION_PAYSYSTEM_DELIVERY; DeliveryPaySystemTable::Add($rec); } return $result; }