-
-
Notifications
You must be signed in to change notification settings - Fork 157
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 #2341 from dpfaffenbauer/tax-rule-stores
[Core] add tax-rule per store
- Loading branch information
Showing
27 changed files
with
208 additions
and
81 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
@domain @cache | ||
@domain @cache @wip | ||
Feature: Adding a new Product and adding it to the cache | ||
|
||
Background: | ||
|
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
34 changes: 34 additions & 0 deletions
34
src/CoreShop/Bundle/CoreBundle/Migrations/Version20230711143927.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,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CoreShop\Bundle\CoreBundle\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
/** | ||
* Auto-generated Migration: Please modify to your needs! | ||
*/ | ||
final class Version20230711143927 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return ''; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
$this->addSql(" | ||
ALTER TABLE coreshop_product_store_values ADD taxRuleId INT DEFAULT NULL; | ||
ALTER TABLE coreshop_product_store_values ADD CONSTRAINT FK_9EED0E97AC7C6E20 FOREIGN KEY (taxRuleId) REFERENCES coreshop_tax_rule_group (id); | ||
CREATE INDEX IDX_9EED0E97AC7C6E20 ON coreshop_product_store_values (taxRuleId); | ||
"); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
// this down() migration is auto-generated, please modify it to your needs | ||
|
||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/CoreShop/Bundle/CoreBundle/Migrations/Version20230711144054.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,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CoreShop\Bundle\CoreBundle\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
use Symfony\Component\DependencyInjection\ContainerAwareInterface; | ||
use Symfony\Component\DependencyInjection\ContainerAwareTrait; | ||
|
||
final class Version20230711144054 extends AbstractMigration implements ContainerAwareInterface | ||
{ | ||
use ContainerAwareTrait; | ||
|
||
public function getDescription(): string | ||
{ | ||
return ''; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
$productClass = $this->container->getParameter('coreshop.model.product.class'); | ||
$tmpProduct = new $productClass(); | ||
$productClassId = $tmpProduct->getClassId(); | ||
|
||
$productIds = $this->connection->fetchAllAssociative('SELECT oo_id, taxRule FROM object_query_' . $productClassId); | ||
|
||
foreach ($productIds as $id) { | ||
$this->addSql('UPDATE coreshop_product_store_values SET taxRuleId = :taxRuleId WHERE product = :product', ['product' => $id['oo_id'], 'taxRuleId' => $id['taxRule']]); | ||
} | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
// this down() migration is auto-generated, please modify it to your needs | ||
|
||
} | ||
} |
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
45 changes: 45 additions & 0 deletions
45
...reShop/Bundle/CoreBundle/Resources/public/pimcore/js/product/storevalues/items/taxRule.js
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,45 @@ | ||
/* | ||
* CoreShop | ||
* | ||
* This source file is available under two different licenses: | ||
* - GNU General Public License version 3 (GPLv3) | ||
* - CoreShop Commercial License (CCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) CoreShop GmbH (https://www.coreshop.org) | ||
* @license https://www.coreshop.org/license GPLv3 and CCL | ||
* | ||
*/ | ||
|
||
pimcore.registerNS('coreshop.product.storeValues.items.tax_rule'); | ||
coreshop.product.storeValues.items.tax_rule = Class.create(coreshop.product.storeValues.items.abstract, { | ||
|
||
getForm: function () { | ||
|
||
var taxRule = this.getDataValue('taxRule'), | ||
taxRuleField = new CoreShop.taxation.TaxRuleGroup({ | ||
fieldLabel: t('coreshop_store_values_store_tax_rule'), | ||
name: 'taxRule', | ||
componentCls: 'object_field', | ||
labelWidth: 250, | ||
}); | ||
|
||
// do not fire dirty flag on initial data setup | ||
taxRuleField.suspendEvents(); | ||
|
||
if (taxRule !== null) { | ||
taxRuleField.setValue(taxRule); | ||
} | ||
|
||
if (this.builder.fieldConfig.width) { | ||
taxRuleField.setWidth(this.builder.fieldConfig.width + taxRuleField.labelWidth); | ||
} else { | ||
taxRuleField.setWidth(350 + taxRuleField.labelWidth); | ||
} | ||
|
||
taxRuleField.resumeEvents(true); | ||
|
||
return taxRuleField; | ||
} | ||
}); |
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.