Skip to content

Commit 427c2c3

Browse files
author
Michael Yu
committed
MAGETWO-71415 [The system grids] Mass actions process only 20 elements from all selected
- Allow more than 20 elements to be updated at once.
1 parent c8c6aaf commit 427c2c3

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

app/code/Magento/Customer/Controller/Adminhtml/Index/AbstractMassAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function __construct(Context $context, Filter $filter, CollectionFactory
6161
public function execute()
6262
{
6363
try {
64-
$collection = $this->filter->getCollection($this->collectionFactory->create());
64+
$collection = $this->filter->getCollection($this->collectionFactory->create(), false);
6565
return $this->massAction($collection);
6666
} catch (\Exception $e) {
6767
$this->messageManager->addError($e->getMessage());

app/code/Magento/Ui/Component/MassAction/Filter.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,11 @@ public function getComponent()
8282
* Adds filters to collection using DataProvider filter results
8383
*
8484
* @param AbstractDb $collection
85+
* @param bool $limit for limiting maximum amount of query results
8586
* @return AbstractDb
8687
* @throws LocalizedException
8788
*/
88-
public function getCollection(AbstractDb $collection)
89+
public function getCollection(AbstractDb $collection, $limit = true)
8990
{
9091
$selected = $this->request->getParam(static::SELECTED_PARAM);
9192
$excluded = $this->request->getParam(static::EXCLUDED_PARAM);
@@ -99,7 +100,7 @@ public function getCollection(AbstractDb $collection)
99100
}
100101
}
101102
/** @var \Magento\Customer\Model\ResourceModel\Customer\Collection $collection */
102-
$idsArray = $this->getFilterIds();
103+
$idsArray = $this->getFilterIds($limit);
103104
if (!empty($idsArray)) {
104105
$collection->addFieldToFilter(
105106
$collection->getIdFieldName(),
@@ -212,22 +213,27 @@ private function getDataProvider()
212213

213214
/**
214215
* Get filter ids as array
215-
*
216+
* @param bool $limit
216217
* @return int[]
217218
*/
218-
private function getFilterIds()
219+
private function getFilterIds($limit = true)
219220
{
220221
$idsArray = [];
221222
$this->applySelectionOnTargetProvider();
222223
if ($this->getDataProvider() instanceof \Magento\Ui\DataProvider\AbstractDataProvider) {
223224
// Use collection's getAllIds for optimization purposes.
224225
$idsArray = $this->getDataProvider()->getAllIds();
225-
} else {
226+
}else {
226227
$searchResult = $this->getDataProvider()->getSearchResult();
227-
// Use compatible search api getItems when searchResult is not a collection.
228-
foreach ($searchResult->getItems() as $item) {
229-
/** @var $item \Magento\Framework\Api\Search\DocumentInterface */
230-
$idsArray[] = $item->getId();
228+
if($limit){
229+
// Use compatible search api getItems when searchResult is not a collection.
230+
foreach ($searchResult->getItems() as $item) {
231+
/** @var $item \Magento\Framework\Api\Search\DocumentInterface */
232+
$idsArray[] = $item->getId();
233+
}
234+
}else{
235+
//Grab all selected even if they are not on the current page.
236+
$idsArray = $searchResult->getAllIds();
231237
}
232238
}
233239
return $idsArray;

0 commit comments

Comments
 (0)