-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1401 from magento-tsg/2.2-develop-pr8
Fixed issues: - MAGETWO-70663 Impossible to assign products to category using Match products by rule with price attribute - MAGETWO-67283 quote_address.free_shipping is different depending on whether Magento was upgraded vs installed - MAGETWO-70642 Magento broken after changing transactional email
- Loading branch information
Showing
10 changed files
with
375 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\OfflineShipping\Setup; | ||
|
||
use Magento\Framework\Setup\ModuleContextInterface; | ||
use Magento\Framework\Setup\ModuleDataSetupInterface; | ||
use Magento\Framework\Setup\UpgradeDataInterface; | ||
|
||
/** | ||
* Upgrade Data script. | ||
*/ | ||
class UpgradeData implements UpgradeDataInterface | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $quoteConnectionName = 'checkout'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $salesConnectionName = 'sales'; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) | ||
{ | ||
$setup->startSetup(); | ||
if ($context->getVersion() && version_compare($context->getVersion(), '2.0.1') < 0) { | ||
$this->updateQuoteShippingAddresses($setup); | ||
} | ||
$setup->endSetup(); | ||
} | ||
|
||
/** | ||
* Replace Null with '0' for 'free_shipping' and 'simple_free_shipping' accordingly to upgraded schema. | ||
* | ||
* @param ModuleDataSetupInterface $setup | ||
* @return void | ||
*/ | ||
private function updateQuoteShippingAddresses(ModuleDataSetupInterface $setup) | ||
{ | ||
$setup->getConnection()->update( | ||
$setup->getTable('salesrule'), | ||
['simple_free_shipping' => 0], | ||
[new \Zend_Db_Expr('simple_free_shipping IS NULL')] | ||
); | ||
$setup->getConnection($this->salesConnectionName)->update( | ||
$setup->getTable('sales_order_item'), | ||
['free_shipping' => 0], | ||
[new \Zend_Db_Expr('free_shipping IS NULL')] | ||
); | ||
$setup->getConnection($this->quoteConnectionName)->update( | ||
$setup->getTable('quote_address'), | ||
['free_shipping' => 0], | ||
[new \Zend_Db_Expr('free_shipping IS NULL')] | ||
); | ||
$setup->getConnection($this->quoteConnectionName)->update( | ||
$setup->getTable('quote_item'), | ||
['free_shipping' => 0], | ||
[new \Zend_Db_Expr('free_shipping IS NULL')] | ||
); | ||
} | ||
} |
104 changes: 104 additions & 0 deletions
104
app/code/Magento/OfflineShipping/Setup/UpgradeSchema.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\OfflineShipping\Setup; | ||
|
||
use Magento\Framework\Setup\ModuleContextInterface; | ||
use Magento\Framework\Setup\SchemaSetupInterface; | ||
use Magento\Framework\Setup\UpgradeSchemaInterface; | ||
|
||
/** | ||
* Upgrade schema DB for OfflineShipping module. | ||
*/ | ||
class UpgradeSchema implements UpgradeSchemaInterface | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $quoteConnectionName = 'checkout'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $salesConnectionName = 'sales'; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) | ||
{ | ||
$setup->startSetup(); | ||
|
||
if (version_compare($context->getVersion(), '2.0.1', '<')) { | ||
$this->updateFreeShippingColumns($setup); | ||
} | ||
|
||
$setup->endSetup(); | ||
} | ||
|
||
/** | ||
* Modify 'free_shipping' and 'simple_free_shipping' columns added incorrectly in InstallSchema. | ||
* | ||
* @param SchemaSetupInterface $setup | ||
* @return void | ||
*/ | ||
private function updateFreeShippingColumns(SchemaSetupInterface $setup) | ||
{ | ||
$setup->getConnection()->modifyColumn( | ||
$setup->getTable('salesrule'), | ||
'simple_free_shipping', | ||
[ | ||
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, | ||
'unsigned' => true, | ||
'nullable' => false, | ||
'default' => '0', | ||
'comment' => 'Simple Free Shipping', | ||
] | ||
); | ||
$setup->getConnection($this->salesConnectionName)->modifyColumn( | ||
$setup->getTable('sales_order_item', $this->salesConnectionName), | ||
'free_shipping', | ||
[ | ||
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, | ||
'unsigned' => true, | ||
'nullable' => false, | ||
'default' => '0', | ||
'comment' => 'Free Shipping', | ||
] | ||
); | ||
$setup->getConnection($this->quoteConnectionName)->modifyColumn( | ||
$setup->getTable('quote_address', $this->quoteConnectionName), | ||
'free_shipping', | ||
[ | ||
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, | ||
'unsigned' => true, | ||
'nullable' => false, | ||
'default' => '0', | ||
'comment' => 'Free Shipping', | ||
] | ||
); | ||
$setup->getConnection($this->quoteConnectionName)->modifyColumn( | ||
$setup->getTable('quote_item', $this->quoteConnectionName), | ||
'free_shipping', | ||
[ | ||
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, | ||
'unsigned' => true, | ||
'nullable' => false, | ||
'default' => '0', | ||
'comment' => 'Free Shipping', | ||
] | ||
); | ||
$setup->getConnection($this->quoteConnectionName)->modifyColumn( | ||
$setup->getTable('quote_address_item', $this->quoteConnectionName), | ||
'free_shipping', | ||
[ | ||
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, | ||
'unsigned' => true, | ||
'comment' => 'Free Shipping', | ||
] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.