diff --git a/app/code/Magento/Checkout/Controller/Index/Index.php b/app/code/Magento/Checkout/Controller/Index/Index.php index 6d8c3951b8cb7..f15f4259923f8 100644 --- a/app/code/Magento/Checkout/Controller/Index/Index.php +++ b/app/code/Magento/Checkout/Controller/Index/Index.php @@ -34,8 +34,6 @@ public function execute() $this->_customerSession->regenerateId(); $this->_objectManager->get('Magento\Checkout\Model\Session')->setCartWasUpdated(false); - $currentUrl = $this->_url->getUrl('*/*/*', ['_secure' => true]); - $this->_objectManager->get('Magento\Customer\Model\Session')->setBeforeAuthUrl($currentUrl); $this->getOnepage()->initCheckout(); $resultPage = $this->resultPageFactory->create(); $resultPage->getConfig()->getTitle()->set(__('Checkout')); diff --git a/app/code/Magento/Sales/Model/Order/AddressRepository.php b/app/code/Magento/Sales/Model/Order/AddressRepository.php index d314a08c10b72..e075d4afdcd34 100644 --- a/app/code/Magento/Sales/Model/Order/AddressRepository.php +++ b/app/code/Magento/Sales/Model/Order/AddressRepository.php @@ -91,7 +91,6 @@ public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) $searchResult->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); } } - $searchResult->setCurPage($searchCriteria->getCurrentPage()); $searchResult->setPageSize($searchCriteria->getPageSize()); diff --git a/app/code/Magento/Sales/Model/Order/CreditmemoRepository.php b/app/code/Magento/Sales/Model/Order/CreditmemoRepository.php index 439483fd65ba0..fb13153330312 100644 --- a/app/code/Magento/Sales/Model/Order/CreditmemoRepository.php +++ b/app/code/Magento/Sales/Model/Order/CreditmemoRepository.php @@ -99,6 +99,7 @@ public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) $searchResult->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); } } + $searchResult->setSearchCriteria($searchCriteria); $searchResult->setCurPage($searchCriteria->getCurrentPage()); $searchResult->setPageSize($searchCriteria->getPageSize()); return $searchResult; diff --git a/app/code/Magento/Sales/Model/Order/InvoiceRepository.php b/app/code/Magento/Sales/Model/Order/InvoiceRepository.php index 87f28c39bb050..38cd7bdc97f0f 100644 --- a/app/code/Magento/Sales/Model/Order/InvoiceRepository.php +++ b/app/code/Magento/Sales/Model/Order/InvoiceRepository.php @@ -95,6 +95,7 @@ public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) $collection->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); } } + $collection->setSearchCriteria($searchCriteria); $collection->setCurPage($searchCriteria->getCurrentPage()); $collection->setPageSize($searchCriteria->getPageSize()); return $collection; diff --git a/app/code/Magento/Sales/Model/Order/Payment/Transaction/Repository.php b/app/code/Magento/Sales/Model/Order/Payment/Transaction/Repository.php index a9b66e71bf468..687260cb185cc 100644 --- a/app/code/Magento/Sales/Model/Order/Payment/Transaction/Repository.php +++ b/app/code/Magento/Sales/Model/Order/Payment/Transaction/Repository.php @@ -193,6 +193,7 @@ public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) $collection->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); } } + $collection->setSearchCriteria($searchCriteria); $collection->setCurPage($searchCriteria->getCurrentPage()); $collection->setPageSize($searchCriteria->getPageSize()); $collection->addPaymentInformation(['method']); diff --git a/app/code/Magento/Sales/Model/Order/ShipmentRepository.php b/app/code/Magento/Sales/Model/Order/ShipmentRepository.php index b1dce96d6a215..d32a5f83f2d41 100644 --- a/app/code/Magento/Sales/Model/Order/ShipmentRepository.php +++ b/app/code/Magento/Sales/Model/Order/ShipmentRepository.php @@ -91,7 +91,7 @@ public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) $searchResult->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); } } - + $searchResult->setSearchCriteria($searchCriteria); $searchResult->setCurPage($searchCriteria->getCurrentPage()); $searchResult->setPageSize($searchCriteria->getPageSize()); diff --git a/app/code/Magento/Translation/etc/di.xml b/app/code/Magento/Translation/etc/di.xml index 0428924dbbb8d..c83ef46ea3080 100644 --- a/app/code/Magento/Translation/etc/di.xml +++ b/app/code/Magento/Translation/etc/di.xml @@ -58,6 +58,7 @@ + ~\$\.mage\.__\((?s)[^'"]*?(['"])(.+?)\1(?s).*?\)~ ~\$t\((?s)[^'"]*?(["'])(.+?)\1(?s).*?\)~ diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dnd.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dnd.js index e52177f74e461..d76fb433106ef 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dnd.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dnd.js @@ -58,8 +58,12 @@ define([ recordsCache: [], draggableElement: {}, draggableElementClass: '_dragged', + elemPositions: [], listens: { '${ $.recordsProvider }:elems': 'setCacheRecords' + }, + modules: { + parentComponent: '${ $.recordsProvider }' } }, @@ -189,7 +193,9 @@ define([ pageY = isTouchDevice ? event.originalEvent.touches[0].pageY : event.pageY, positionY = pageY - drEl.eventMousedownY; - drEl.depElement = this.getDepElement(drEl.instance, positionY); + drEl.depElement = this.getDepElement(drEl.instance, positionY, this.draggableElement.originRow); + + drEl.instance.remove(); if (drEl.depElement) { depElementCtx = this.getRecord(drEl.depElement.elem[0]); @@ -210,7 +216,6 @@ define([ this.body.unbind('mouseup', this.mouseupHandler); } - drEl.instance.remove(); this.draggableElement = {}; }, @@ -224,11 +229,34 @@ define([ setPosition: function (depElem, depElementCtx, dragData) { var depElemPosition = ~~depElementCtx.position; + this.cacheElementsPosition(); + if (dragData.depElement.insert === 'after') { dragData.instanceCtx.position = depElemPosition + 1; } else if (dragData.depElement.insert === 'before') { dragData.instanceCtx.position = depElemPosition; } + + this.normalizePositions(); + }, + + /** + * Saves elements position from current elements + */ + cacheElementsPosition: function () { + this.elemPositions = []; + this.parentComponent().elems.each(function (elem) { + this.elemPositions.push(elem.position); + }, this); + }, + + /** + * Normalize position, uses start elements position + */ + normalizePositions: function () { + this.parentComponent().elems.each(function (item, index) { + item.position = this.elemPositions[index]; + }, this); }, /** diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoListTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoListTest.php index 34cd077c4620c..18cababd5998c 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoListTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoListTest.php @@ -62,7 +62,8 @@ public function testCreditmemoList() [ $filterBuilder ->setField('state') - ->setValue(\Magento\Sales\Model\Order\Creditmemo::STATE_OPEN) + ->setValue((string)\Magento\Sales\Model\Order\Creditmemo::STATE_OPEN) + ->setConditionType('eq') ->create(), ] ); @@ -85,5 +86,7 @@ public function testCreditmemoList() // TODO Test fails, due to the inability of the framework API to handle data collection $this->assertArrayHasKey('items', $result); $this->assertCount(1, $result['items']); + $this->assertArrayHasKey('search_criteria', $result); + $this->assertEquals($searchData, $result['search_criteria']); } } diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceListTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceListTest.php index 06b5856230b52..d19b9f53d9496 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceListTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceListTest.php @@ -47,7 +47,8 @@ public function testInvoiceList() [ $filterBuilder ->setField('state') - ->setValue(2) + ->setValue((string)\Magento\Sales\Model\Order\Invoice::STATE_PAID) + ->setConditionType('eq') ->create(), ] ); @@ -70,5 +71,7 @@ public function testInvoiceList() // TODO Test fails, due to the inability of the framework API to handle data collection $this->assertArrayHasKey('items', $result); $this->assertCount(1, $result['items']); + $this->assertArrayHasKey('search_criteria', $result); + $this->assertEquals($searchData, $result['search_criteria']); } } diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentListTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentListTest.php index f4cd591bba56b..89d377fb2aceb 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentListTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentListTest.php @@ -43,7 +43,15 @@ public function testShipmentList() 'Magento\Framework\Api\FilterBuilder' ); - $searchCriteriaBuilder->addFilters([$filterBuilder->setField('shipment_status')->setValue(1)->create()]); + $searchCriteriaBuilder->addFilters( + [ + $filterBuilder + ->setField('shipment_status') + ->setValue((string)\Magento\Sales\Model\Order\Shipment::STATUS_NEW) + ->setConditionType('eq') + ->create() + ] + ); $searchData = $searchCriteriaBuilder->create()->__toArray(); $requestData = ['searchCriteria' => $searchData]; @@ -63,5 +71,7 @@ public function testShipmentList() // TODO Test fails, due to the inability of the framework API to handle data collection $this->assertArrayHasKey('items', $result); $this->assertCount(1, $result['items']); + $this->assertArrayHasKey('search_criteria', $result); + $this->assertEquals($searchData, $result['search_criteria']); } } diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/TransactionTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/TransactionTest.php index b85ef9e08ce46..d88775f46f00c 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/TransactionTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/TransactionTest.php @@ -141,6 +141,8 @@ public function testTransactionList($filters) $expectedData = [$transactionData, $childTransactionData]; $this->assertEquals($expectedData, $result['items']); + $this->assertArrayHasKey('search_criteria', $result); + $this->assertEquals($searchData, $result['search_criteria']); } /** diff --git a/lib/internal/Magento/Framework/Url.php b/lib/internal/Magento/Framework/Url.php index a1e047e23fe80..7068efcf037a5 100644 --- a/lib/internal/Magento/Framework/Url.php +++ b/lib/internal/Magento/Framework/Url.php @@ -232,7 +232,7 @@ protected function _parseUrl($url) 'user' => 'setUser', 'pass' => 'setPassword', 'path' => 'setPath', - 'query' => 'setQuery', + 'query' => '_setQuery', 'fragment' => 'setFragment', ];