Merge branch 'tax'

This commit is contained in:
Etienne Roudeix
2013-09-09 16:28:32 +02:00
31 changed files with 882 additions and 622 deletions

View File

@@ -380,6 +380,7 @@ function createProduct($faker, $category, $position, &$productIdList)
$product->addCategory($category);
$product->setVisible(rand(1, 10)>7 ? 0 : 1);
$product->setPosition($position);
$product->setTaxRuleId(1);
setI18n($faker, $product);
$product->save();

View File

@@ -1109,3 +1109,25 @@ INSERT INTO `country_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `po
(268, 'en_UK', 'USA - Alabama', '', '', ''),
(268, 'es_ES', 'USA - Alabama', '', '', ''),
(268, 'fr_FR', 'USA - Alabama', '', '', '');
INSERT INTO `tax` (`id`, `rate`, `created_at`, `updated_at`)
VALUES
(1, '19.6', NOW(), NOW());
INSERT INTO `tax_i18n` (`id`, `locale`, `title`)
VALUES
(1, 'fr_FR', 'TVA française à 19.6%'),
(1, 'en_UK', 'french 19.6% tax');
INSERT INTO `tax_rule` (`id`, `created_at`, `updated_at`)
VALUES
(1, NOW(), NOW());
INSERT INTO `tax_rule_i18n` (`id`, `locale`, `title`)
VALUES
(1, 'fr_FR', 'TVA française à 19.6%'),
(1, 'en_UK', 'french 19.6% tax');
INSERT INTO `tax_rule_country` (`tax_rule_id`, `country_id`, `tax_id`, `position`, `created_at`, `updated_at`)
VALUES
(1, 64, 1, 1, NOW(), NOW());

View File

@@ -126,9 +126,6 @@ DROP TABLE IF EXISTS `tax_rule`;
CREATE TABLE `tax_rule`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`code` VARCHAR(45),
`title` VARCHAR(255),
`description` TEXT,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)
@@ -142,14 +139,13 @@ DROP TABLE IF EXISTS `tax_rule_country`;
CREATE TABLE `tax_rule_country`
(
`id` INTEGER NOT NULL,
`tax_rule_id` INTEGER,
`country_id` INTEGER,
`tax_id` INTEGER,
`none` TINYINT,
`tax_rule_id` INTEGER NOT NULL,
`country_id` INTEGER NOT NULL,
`tax_id` INTEGER NOT NULL,
`position` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
PRIMARY KEY (`tax_rule_id`,`country_id`,`tax_id`),
INDEX `idx_tax_rule_country_tax_id` (`tax_id`),
INDEX `idx_tax_rule_country_tax_rule_id` (`tax_rule_id`),
INDEX `idx_tax_rule_country_country_id` (`country_id`),
@@ -157,7 +153,7 @@ CREATE TABLE `tax_rule_country`
FOREIGN KEY (`tax_id`)
REFERENCES `tax` (`id`)
ON UPDATE RESTRICT
ON DELETE SET NULL,
ON DELETE CASCADE,
CONSTRAINT `fk_tax_rule_country_tax_rule_id`
FOREIGN KEY (`tax_rule_id`)
REFERENCES `tax_rule` (`id`)
@@ -1574,6 +1570,8 @@ CREATE TABLE `tax_rule_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255),
`description` TEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `tax_rule_i18n_FK_1`
FOREIGN KEY (`id`)