Skip to content

Commit d5e9e85

Browse files
committed
Merge branch '2.4-develop' of https://github.com/magento-commerce/magento2ce into ACP2E-1287
2 parents e60e655 + bab1f54 commit d5e9e85

File tree

118 files changed

+3810
-502
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+3810
-502
lines changed

app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ protected function saveAndReplaceAdvancedPrices()
416416
'website_id' => $this->getWebSiteId($rowData[self::COL_TIER_PRICE_WEBSITE])
417417
];
418418
if (\Magento\ImportExport\Model\Import::BEHAVIOR_APPEND == $behavior) {
419-
$bunchTierPrices[$rowSku][] = $tierPrice;
419+
$bunchTierPrices[$rowSku][] = $tierPrice;
420420
}
421421
if (\Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE == $behavior) {
422422
$tierPrices[$rowSku][] = $tierPrice;
@@ -436,9 +436,7 @@ protected function saveAndReplaceAdvancedPrices()
436436
if ($listSku) {
437437
$this->setUpdatedAt($listSku);
438438
}
439-
}
440-
441-
if (\Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE == $behavior) {
439+
} elseif (\Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE == $behavior) {
442440
if ($listSku) {
443441
$this->processCountNewPrices($tierPrices);
444442
if ($this->deleteProductTierPrices(array_unique($listSku), self::TABLE_TIER_PRICE)) {
@@ -447,6 +445,7 @@ protected function saveAndReplaceAdvancedPrices()
447445
}
448446
}
449447
}
448+
$this->finalizeCount();
450449

451450
return $this;
452451
}
@@ -651,11 +650,18 @@ protected function processCountNewPrices(array $tierPrices)
651650
foreach ($tierPrices as $productPrices) {
652651
$this->countItemsCreated += count($productPrices);
653652
}
654-
$this->countItemsCreated -= $this->countItemsUpdated;
655653

656654
return $this;
657655
}
658656

657+
/**
658+
* Finalize count of new and existing records
659+
*/
660+
protected function finalizeCount()
661+
{
662+
$this->countItemsCreated -= $this->countItemsUpdated;
663+
}
664+
659665
/**
660666
* Get product entity link field
661667
*

app/code/Magento/AwsS3/Driver/AwsS3.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -861,15 +861,21 @@ public function fileWrite($resource, $data)
861861
*/
862862
public function fileClose($resource): bool
863863
{
864+
if (!is_resource($resource)) {
865+
return false;
866+
}
864867
//phpcs:disable
865-
$resourcePath = stream_get_meta_data($resource)['uri'];
868+
$meta = stream_get_meta_data($resource);
866869
//phpcs:enable
867870

868871
foreach ($this->streams as $path => $stream) {
869872
// phpcs:ignore
870-
if (stream_get_meta_data($stream)['uri'] === $resourcePath) {
873+
if (stream_get_meta_data($stream)['uri'] === $meta['uri']) {
874+
if (isset($meta['seekable']) && $meta['seekable']) {
875+
// rewind the file pointer to make sure the full content of the file is saved
876+
$this->fileSeek($resource, 0);
877+
}
871878
$this->adapter->writeStream($path, $resource, new Config(self::CONFIG));
872-
873879
// Remove path from streams after
874880
unset($this->streams[$path]);
875881

app/code/Magento/AwsS3/Test/Unit/Driver/AwsS3Test.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,4 +513,28 @@ public function testRenameSameDestination(): void
513513

514514
self::assertTrue($this->driver->rename('test/path', 'test/path'));
515515
}
516+
517+
public function testFileShouldBeRewindBeforeSave(): void
518+
{
519+
$resource = $this->driver->fileOpen('test/path', 'w');
520+
$this->driver->fileWrite($resource, 'abc');
521+
$this->adapterMock->method('fileExists')->willReturn(false);
522+
$this->adapterMock->expects($this->once())
523+
->method('writeStream')
524+
->with(
525+
'test/path',
526+
$this->callback(
527+
// assert that the file pointer is at the beginning of the file before saving it in aws
528+
fn ($stream) => $stream === $resource && is_resource($stream) && ftell($stream) === 0
529+
)
530+
);
531+
$this->driver->fileClose($resource);
532+
}
533+
534+
public function testFileCloseShouldReturnFalseIfTheArgumentIsNotAResource(): void
535+
{
536+
$this->assertEquals(false, $this->driver->fileClose(''));
537+
$this->assertEquals(false, $this->driver->fileClose(null));
538+
$this->assertEquals(false, $this->driver->fileClose(false));
539+
}
516540
}

app/code/Magento/Bundle/Model/ResourceModel/Indexer/Price/DisabledProductOptionPriceModifier.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ public function modifyPrice(IndexTableStructure $priceTable, array $entityIds =
8585
foreach ($this->getBundleIds($entityIds) as $entityId) {
8686
$entityId = (int) $entityId;
8787
foreach ($this->getWebsiteIdsOfProduct($entityId) as $websiteId) {
88+
$websiteId = (int) $websiteId;
8889
$productIdsDisabledRequired = $this->selectionProductsDisabledRequired
89-
->getChildProductIds($entityId, (int)$websiteId);
90+
->getChildProductIds($entityId, $websiteId);
9091
if ($productIdsDisabledRequired) {
9192
$connection = $this->resourceConnection->getConnection('indexer');
9293
$select = $connection->select();
@@ -118,9 +119,8 @@ private function getWebsiteIdsOfProduct(int $entityId): array
118119
['product_in_websites' => $this->resourceConnection->getTableName('catalog_product_website')],
119120
['website_id']
120121
)->where('product_in_websites.product_id = ?', $entityId);
121-
foreach ($connection->fetchCol($select) as $websiteId) {
122-
$this->websiteIdsOfProduct[$entityId][] = (int)$websiteId;
123-
}
122+
$this->websiteIdsOfProduct[$entityId] = $connection->fetchCol($select);
123+
124124
return $this->websiteIdsOfProduct[$entityId];
125125
}
126126

app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ public function draw()
137137
foreach ($this->string->split($item->getSku(), 17) as $part) {
138138
$text[] = $part;
139139
}
140-
$line[] = ['text' => $text, 'feed' => $x];
140+
$line[] = ['text' => $text, 'feed' => $x, 'align' => 'right'];
141141
}
142142

143-
$x += 100;
143+
$x += 30;
144144

145145
// draw prices
146146
if ($this->canShowPriceInfo($childItem)) {
@@ -152,18 +152,18 @@ public function draw()
152152
// draw Discount
153153
$text = $order->formatPriceTxt(-$childItem->getDiscountAmount());
154154
$line[] = ['text' => $text, 'feed' => $x, 'font' => 'bold', 'align' => 'right', 'width' => 50];
155-
$x += 50;
155+
$x += 85;
156156

157157
// draw QTY
158158
$text = $childItem->getQty() * 1;
159159
$line[] = [
160160
'text' => $text,
161161
'feed' => $x,
162162
'font' => 'bold',
163-
'align' => 'center',
163+
'align' => 'right',
164164
'width' => 30,
165165
];
166-
$x += 30;
166+
$x += 35;
167167

168168
// draw Tax
169169
$text = $order->formatPriceTxt($childItem->getTaxAmount());

app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,11 @@ private function drawSkus(DataObject $childItem, array $lines): array
153153
foreach ($this->string->split($this->getItem()->getSku(), 17) as $part) {
154154
$text[] = $part;
155155
}
156-
$lines[$index][] = ['text' => $text, 'feed' => 255];
156+
$lines[$index][] = [
157+
'text' => $text,
158+
'feed' => 290,
159+
'align' => 'right'
160+
];
157161
}
158162

159163
return $lines;
@@ -177,8 +181,8 @@ private function drawPrices(DataObject $childItem, array $lines): array
177181

178182
$item = $this->getItem();
179183
$this->_item = $childItem;
180-
$feedPrice = 380;
181-
$feedSubtotal = $feedPrice + 185;
184+
$feedPrice = 395;
185+
$feedSubtotal = $feedPrice + 170;
182186
foreach ($this->getItemPricesForDisplay() as $priceData) {
183187
if (isset($priceData['label'])) {
184188
// draw Price label

app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function draw()
106106
$line[0] = [
107107
'font' => 'italic',
108108
'text' => $this->string->split($attributes['option_label'], 60, true, true),
109-
'feed' => 60,
109+
'feed' => 100,
110110
];
111111

112112
$drawItems[$optionId] = ['lines' => [$line], 'height' => 15];
@@ -134,10 +134,10 @@ public function draw()
134134

135135
// draw Name
136136
if ($childItem->getParentItem()) {
137-
$feed = 65;
137+
$feed = 110;
138138
$name = $this->getValueHtml($childItem);
139139
} else {
140-
$feed = 60;
140+
$feed = 100;
141141
$name = $childItem->getName();
142142
}
143143
$text = [];
@@ -151,7 +151,7 @@ public function draw()
151151
foreach ($this->string->split($childItem->getSku(), 25) as $part) {
152152
$text[] = $part;
153153
}
154-
$line[] = ['text' => $text, 'feed' => 440];
154+
$line[] = ['text' => $text, 'feed' => 565, 'align' => 'right'];
155155

156156
$drawItems[$optionId]['lines'][] = $line;
157157
}

app/code/Magento/Bundle/Test/Unit/Model/Sales/Order/Pdf/Items/InvoiceTestProvider.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function getData(): array
5252
],
5353
[
5454
'text' => 'Excl. Tax:',
55-
'feed' => 380,
55+
'feed' => 395,
5656
'align' => 'right',
5757
],
5858
[
@@ -64,7 +64,7 @@ public function getData(): array
6464
[
6565
[
6666
'text' => '10.00',
67-
'feed' => 380,
67+
'feed' => 395,
6868
'font' => 'bold',
6969
'align' => 'right',
7070
],
@@ -78,7 +78,7 @@ public function getData(): array
7878
[
7979
[
8080
'text' => 'Incl. Tax:',
81-
'feed' => 380,
81+
'feed' => 395,
8282
'align' => 'right',
8383
],
8484
[
@@ -90,7 +90,7 @@ public function getData(): array
9090
[
9191
[
9292
'text' => '10.83',
93-
'feed' => 380,
93+
'feed' => 395,
9494
'font' => 'bold',
9595
'align' => 'right',
9696
],
@@ -119,7 +119,7 @@ public function getData(): array
119119
],
120120
[
121121
'text' => 'Excl. Tax:',
122-
'feed' => 380,
122+
'feed' => 395,
123123
'align' => 'right',
124124
],
125125
[
@@ -131,7 +131,7 @@ public function getData(): array
131131
[
132132
[
133133
'text' => '5.00',
134-
'feed' => 380,
134+
'feed' => 395,
135135
'font' => 'bold',
136136
'align' => 'right',
137137
],
@@ -145,7 +145,7 @@ public function getData(): array
145145
[
146146
[
147147
'text' => 'Incl. Tax:',
148-
'feed' => 380,
148+
'feed' => 395,
149149
'align' => 'right',
150150
],
151151
[
@@ -157,7 +157,7 @@ public function getData(): array
157157
[
158158
[
159159
'text' => '5.41',
160-
'feed' => 380,
160+
'feed' => 395,
161161
'font' => 'bold',
162162
'align' => 'right',
163163
],
@@ -203,7 +203,7 @@ public function getData(): array
203203
],
204204
[
205205
'text' => '10.83',
206-
'feed' => 380,
206+
'feed' => 395,
207207
'font' => 'bold',
208208
'align' => 'right',
209209
],
@@ -232,7 +232,7 @@ public function getData(): array
232232
],
233233
[
234234
'text' => '5.41',
235-
'feed' => 380,
235+
'feed' => 395,
236236
'font' => 'bold',
237237
'align' => 'right',
238238
],
@@ -279,7 +279,7 @@ public function getData(): array
279279
],
280280
[
281281
'text' => '10.00',
282-
'feed' => 380,
282+
'feed' => 395,
283283
'font' => 'bold',
284284
'align' => 'right',
285285
],
@@ -308,7 +308,7 @@ public function getData(): array
308308
],
309309
[
310310
'text' => '5.00',
311-
'feed' => 380,
311+
'feed' => 395,
312312
'font' => 'bold',
313313
'align' => 'right',
314314
],

app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -195,17 +195,6 @@ protected function _formatPrice($value, $flag = true)
195195
$customOptionPrice = $this->getProduct()->getPriceInfo()->getPrice('custom_option_price');
196196
$isPercent = (bool) $value['is_percent'];
197197

198-
if (!$isPercent) {
199-
$catalogPriceValue = $this->calculateCustomOptionCatalogRule->execute(
200-
$this->getProduct(),
201-
(float)$value['pricing_value'],
202-
$isPercent
203-
);
204-
if ($catalogPriceValue !== null) {
205-
$value['pricing_value'] = $catalogPriceValue;
206-
}
207-
}
208-
209198
$context = [CustomOptionPriceInterface::CONFIGURATION_OPTION_FLAG => true];
210199
$optionAmount = $isPercent
211200
? $this->calculator->getAmount(

0 commit comments

Comments
 (0)