Merge branch 'master' of https://github.com/thelia/thelia into coupon

# By franck (6) and others
# Via franck (3) and others
* 'master' of https://github.com/thelia/thelia:
  Implemented "Remember Me" feature on admin. Started template management
  Added Templates events
  First version of installation wizard
  tax engine retriever
  allow address removal from front
  Insert pagination inside tfoot
  allow update customer address in front tempalte
  allow to create a new address
  allow to make an address as default on update action
  Finished attributes management
  Fixed action column alignment
  Fixed duplication parameter check regexp
  absoluteUrl prevetn duplicate parameters in generated URL
This commit is contained in:
gmorel
2013-09-16 10:01:34 +02:00
140 changed files with 18725 additions and 3379 deletions

View File

@@ -240,6 +240,28 @@ try {
}
}
$template = new Thelia\Model\Template();
setI18n($faker, $template, array("Name" => 20));
$template->save();
foreach($attributeList as $attributeId => $attributeAvId) {
$at = new Thelia\Model\AttributeTemplate();
$at
->setTemplate($template)
->setAttributeId($attributeId)
->save();
}
foreach($featureList as $featureId => $featureAvId) {
$ft = new Thelia\Model\FeatureTemplate();
$ft
->setTemplate($template)
->setFeatureId($featureId)
->save();
}
//folders and contents
$contentIdList = array();
for($i=0; $i<4; $i++) {
@@ -296,12 +318,12 @@ try {
$subcategory = createCategory($faker, $category->getId(), $j, $categoryIdList, $contentIdList);
for($k=0; $k<rand(0, 5); $k++) {
createProduct($faker, $subcategory, $k, $productIdList);
createProduct($faker, $subcategory, $k, $template, $productIdList);
}
}
for($k=1; $k<rand(1, 6); $k++) {
createProduct($faker, $category, $k, $productIdList);
createProduct($faker, $category, $k, $template, $productIdList);
}
}
@@ -416,7 +438,7 @@ try {
$con->rollBack();
}
function createProduct($faker, $category, $position, &$productIdList)
function createProduct($faker, $category, $position, $template, &$productIdList)
{
$product = new Thelia\Model\Product();
$product->setRef($category->getId() . '_' . $position . '_' . $faker->randomNumber(8));
@@ -424,6 +446,8 @@ function createProduct($faker, $category, $position, &$productIdList)
$product->setVisible(rand(1, 10)>7 ? 0 : 1);
$product->setPosition($position);
$product->setTaxRuleId(1);
$product->setTemplate($template);
setI18n($faker, $product);
$product->save();
@@ -521,18 +545,18 @@ function generate_image($image, $position, $typeobj, $id) {
$image->save($image_file);
}
function setI18n($faker, &$object)
function setI18n($faker, &$object, $fields = array('Title' => 20, 'Description' => 50) )
{
$localeList = array('fr_FR', 'en_EN');
$title = $faker->text(20);
$description = $faker->text(50);
$localeList = $localeList = array('fr_FR', 'en_US', 'es_ES', 'it_IT');
foreach($localeList as $locale) {
$object->setLocale($locale);
$object->setTitle($locale . ' : ' . $title);
$object->setDescription($locale . ' : ' . $description);
foreach($fields as $name => $length) {
$func = "set".ucfirst(strtolower($name));
$object->$func($locale . ' : ' . $faker->text($length));
}
}
}
/**

View File

@@ -156,18 +156,18 @@ try {
$con->rollBack();
}
function setI18n($faker, &$object)
function setI18n($faker, &$object, $fields = array('Title' => 20, 'Description' => 50) )
{
$localeList = array('fr_FR', 'en_EN', 'es_ES', 'it_IT');
$title = $faker->text(20);
$description = $faker->text(50);
$localeList = array('fr_FR', 'en_US', 'es_ES', 'it_IT');
foreach($localeList as $locale) {
$object->setLocale($locale);
$object->setTitle($locale . ' : ' . $title);
$object->setDescription($locale . ' : ' . $description);
foreach($fields as $name => $length) {
$func = "set$name";
$object->$func($locale . ' : ' . $faker->text($length));
}
}
}

View File

@@ -17,8 +17,14 @@ INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updat
('image_cache_dir_from_web_root', 'cache/images', 0, 0, NOW(), NOW()),
('currency_rate_update_url', 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml', 0, 0, NOW(), NOW()),
('page_not_found_view', '404.html', 0, 0, NOW(), NOW()),
('use_tax_free_amounts', 0, 1, 0, NOW(), NOW()),
('process_assets', '1', 0, 0, NOW(), NOW());
('use_tax_free_amounts', 0, 0, 0, NOW(), NOW()),
('process_assets', '1', 0, 0, NOW(), NOW()),
('thelia_admin_remember_me_cookie_name', 'tarmcn', 0, 0, NOW(), NOW()),
('thelia_admin_remember_me_cookie_expiration', 2592000, 0, 0, NOW(), NOW()),
('thelia_customer_remember_me_cookie_name', 'tcrmcn', 0, 0, NOW(), NOW()),
('thelia_customer_remember_me_cookie_expiration', 31536000, 0, 0, NOW(), NOW()),
('session_config.handlers', 'Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler', 0, 0, NOW(), NOW())
;
INSERT INTO `module` (`id`, `code`, `type`, `activate`, `position`, `full_namespace`, `created_at`, `updated_at`) VALUES

View File

@@ -36,6 +36,7 @@ CREATE TABLE `product`
`ref` VARCHAR(255) NOT NULL,
`visible` TINYINT DEFAULT 0 NOT NULL,
`position` INTEGER NOT NULL,
`template_id` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
`version` INTEGER DEFAULT 0,
@@ -44,11 +45,15 @@ CREATE TABLE `product`
PRIMARY KEY (`id`),
UNIQUE INDEX `ref_UNIQUE` (`ref`),
INDEX `idx_product_tax_rule_id` (`tax_rule_id`),
INDEX `fk_product_template1_idx` (`template_id`),
CONSTRAINT `fk_product_tax_rule_id`
FOREIGN KEY (`tax_rule_id`)
REFERENCES `tax_rule` (`id`)
ON UPDATE RESTRICT
ON DELETE SET NULL
ON DELETE SET NULL,
CONSTRAINT `fk_product_template1`
FOREIGN KEY (`template_id`)
REFERENCES `template` (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
@@ -243,31 +248,29 @@ CREATE TABLE `feature_product`
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- feature_category
-- feature_template
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `feature_category`;
DROP TABLE IF EXISTS `feature_template`;
CREATE TABLE `feature_category`
CREATE TABLE `feature_template`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`feature_id` INTEGER NOT NULL,
`category_id` INTEGER NOT NULL,
`template_id` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `idx_feature_category_category_id` (`category_id`),
INDEX `idx_feature_category_feature_id` (`feature_id`),
CONSTRAINT `fk_feature_category_category_id`
FOREIGN KEY (`category_id`)
REFERENCES `category` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `fk_feature_category_feature_id`
INDEX `idx_feature_template_id` (`feature_id`),
INDEX `fk_feature_template_idx` (`template_id`),
CONSTRAINT `fk_feature_template_id`
FOREIGN KEY (`feature_id`)
REFERENCES `feature` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
ON DELETE CASCADE,
CONSTRAINT `fk_feature_template`
FOREIGN KEY (`template_id`)
REFERENCES `template` (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
@@ -367,31 +370,29 @@ CREATE TABLE `product_sale_elements`
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- attribute_category
-- attribute_template
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `attribute_category`;
DROP TABLE IF EXISTS `attribute_template`;
CREATE TABLE `attribute_category`
CREATE TABLE `attribute_template`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`category_id` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`template_id` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `idx_attribute_category_category_id` (`category_id`),
INDEX `idx_attribute_category_attribute_id` (`attribute_id`),
CONSTRAINT `fk_attribute_category_category_id`
FOREIGN KEY (`category_id`)
REFERENCES `category` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `fk_attribute_category_attribute_id`
INDEX `idx_attribute_template_id` (`attribute_id`),
INDEX `fk_attribute_template_idx` (`template_id`),
CONSTRAINT `fk_attribute_template_id`
FOREIGN KEY (`attribute_id`)
REFERENCES `attribute` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
ON DELETE CASCADE,
CONSTRAINT `fk_attribute_template`
FOREIGN KEY (`template_id`)
REFERENCES `template` (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
@@ -433,6 +434,8 @@ CREATE TABLE `customer`
`lang` VARCHAR(10),
`sponsor` VARCHAR(50),
`discount` FLOAT,
`remember_me_token` VARCHAR(255),
`remember_me_serial` VARCHAR(255),
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
@@ -923,6 +926,8 @@ CREATE TABLE `admin`
`password` VARCHAR(128) NOT NULL,
`algo` VARCHAR(128),
`salt` VARCHAR(128),
`remember_me_token` VARCHAR(255),
`remember_me_serial` VARCHAR(255),
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)
@@ -1482,6 +1487,20 @@ CREATE TABLE `rewriting_argument`
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- template
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `template`;
CREATE TABLE `template`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- category_i18n
-- ---------------------------------------------------------------------
@@ -2060,6 +2079,24 @@ CREATE TABLE `folder_document_i18n`
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- template_i18n
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `template_i18n`;
CREATE TABLE `template_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`name` VARCHAR(255),
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `template_i18n_FK_1`
FOREIGN KEY (`id`)
REFERENCES `template` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- category_version
-- ---------------------------------------------------------------------
@@ -2097,6 +2134,7 @@ CREATE TABLE `product_version`
`ref` VARCHAR(255) NOT NULL,
`visible` TINYINT DEFAULT 0 NOT NULL,
`position` INTEGER NOT NULL,
`template_id` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
`version` INTEGER DEFAULT 0 NOT NULL,