Skip to content

Commit 9656b96

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into Hammer-Plateform-Health-04Sept24
2 parents 7761a2e + 44cef3a commit 9656b96

File tree

4 files changed

+39
-20
lines changed

4 files changed

+39
-20
lines changed

app/code/Magento/Ui/Model/Export/ConvertToCsv.php

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,33 @@ public function getCsvFile()
8181
$searchCriteria = $dataProvider->getSearchCriteria()
8282
->setCurrentPage($i)
8383
->setPageSize($this->pageSize);
84-
$totalCount = (int) $dataProvider->getSearchResult()->getTotalCount();
85-
$totalPagesCount = (int) ceil($totalCount / $this->pageSize);
86-
while ($i <= $totalPagesCount) {
87-
// setTotalCount to prevent total count from being calculated in loop
84+
85+
$totalCount = null;
86+
$totalPagesCount = null;
87+
88+
do {
8889
$searchResult = $dataProvider->getSearchResult();
89-
$searchResult->setTotalCount($totalCount);
9090
$items = $searchResult->getItems();
91+
92+
if ($totalCount === null) { // get total count only once
93+
$totalCount = $searchResult->getTotalCount();
94+
$totalPagesCount = (int) ceil($totalCount / $this->pageSize);
95+
}
96+
97+
// call setTotalCount to prevent total count from being calculate in subsequent iterations of this loop
98+
$searchResult->setTotalCount($totalCount);
99+
// Ensure $items is always an array
100+
if ($items === null) {
101+
$items = [];
102+
}
91103
foreach ($items as $item) {
92104
$this->metadataProvider->convertDate($item, $component->getName());
93105
$stream->writeCsv($this->metadataProvider->getRowData($item, $fields, $options));
94106
}
107+
95108
$searchCriteria->setCurrentPage(++$i);
96-
}
109+
} while ($i <= $totalPagesCount);
110+
97111
$stream->unlock();
98112
$stream->close();
99113

app/code/Magento/Ui/Test/Unit/Model/Export/ConvertToCsvTest.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ protected function setUp(): void
102102
);
103103
}
104104

105+
/**
106+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
107+
*/
105108
public function testGetCsvFile()
106109
{
107110
$componentName = 'component_name';
@@ -142,7 +145,7 @@ public function testGetCsvFile()
142145
->method('getFields')
143146
->with($this->component)
144147
->willReturn([]);
145-
$this->metadataProvider->expects($this->exactly(2))
148+
$this->metadataProvider->expects($this->any())
146149
->method('getRowData')
147150
->willReturnCallback(
148151
function ($arg1, $arg2, $arg3) use ($document1, $document2, $data) {
@@ -153,7 +156,7 @@ function ($arg1, $arg2, $arg3) use ($document1, $document2, $data) {
153156
}
154157
}
155158
);
156-
$this->metadataProvider->expects($this->exactly(2))
159+
$this->metadataProvider->expects($this->any())
157160
->method('convertDate')
158161
->willReturnCallback(
159162
function ($arg1, $arg2) use ($document1, $document2, $componentName) {
@@ -245,25 +248,25 @@ private function mockComponent(string $componentName, array $page1Items, array $
245248
->method('getDataProvider')
246249
->willReturn($dataProvider);
247250

248-
$dataProvider->expects($this->exactly(3))
251+
$dataProvider->expects($this->exactly(2))
249252
->method('getSearchResult')
250253
->willReturnOnConsecutiveCalls($searchResult0, $searchResult1, $searchResult2);
251254

252255
$dataProvider->expects($this->once())
253256
->method('getSearchCriteria')
254257
->willReturn($searchCriteria);
255258

256-
$searchResult1->expects($this->once())
259+
$searchResult1->expects($this->any())
257260
->method('setTotalCount');
258261

259-
$searchResult2->expects($this->once())
262+
$searchResult2->expects($this->any())
260263
->method('setTotalCount');
261264

262-
$searchResult1->expects($this->once())
265+
$searchResult1->expects($this->any())
263266
->method('getItems')
264267
->willReturn($page1Items);
265268

266-
$searchResult2->expects($this->once())
269+
$searchResult2->expects($this->any())
267270
->method('getItems')
268271
->willReturn($page2Items);
269272

app/code/Magento/UrlRewrite/Model/UrlRewrite.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,15 @@ private function getFinalTargetUrlRewrite(string $path, int $storeId): ?UrlRewri
153153
]
154154
);
155155

156+
// to manage accent characters in URL rewrite
157+
if ($urlRewriteTarget) {
158+
$planeChars = iconv('UTF-8', 'ISO-8859-1//IGNORE', $urlRewriteTarget->getRequestPath());
159+
160+
if ($planeChars !== $urlRewriteTarget->getRequestPath()) {
161+
$urlRewriteTarget = null;
162+
}
163+
}
164+
156165
while ($urlRewriteTarget &&
157166
$urlRewriteTarget->getTargetPath() !== $urlRewriteTarget->getRequestPath() &&
158167
$urlRewriteTarget->getRedirectType() > 0

app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/_actions-bar.less

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@
2424
padding: @page-main-actions__padding;
2525
}
2626

27-
.actions-scrollable {
28-
.page-actions {
29-
display: flex;
30-
overflow-x: auto;
31-
}
32-
}
33-
3427
.page-main-actions {
3528
display: flex;
3629
margin: 0 0 @indent__l;

0 commit comments

Comments
 (0)