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

# By Manuel Raynaud (68) and others
# Via Manuel Raynaud (12) and others
* 'master' of https://github.com/thelia/thelia: (119 commits)
  order tests
  action order tests
  cache dataccessfunctions
  order action test
  fire event on insert content in createmethod
  fix issue, default foler is set on content creation
  allow to create new content
  update default param of content model
  create content listener for crud management
  dispatch event in pre/post crud method for content model
  display content modification page
  create contentUpdateEvent
  create contentCreateEvent
  create ContentEvent
  create contentModificationForm
  create content controller
  change folder_id parm by parent in list folder view
  use placeholder in folder update route
  implement process for changing folder position
  allow possibility to change folder visibility
  ...

Conflicts:
	core/lib/Thelia/Coupon/CouponBaseAdapter.php
	templates/admin/default/coupon-list.html
	templates/admin/default/coupon-read.html
This commit is contained in:
gmorel
2013-09-23 21:03:26 +02:00
643 changed files with 38690 additions and 4156 deletions

View File

@@ -161,6 +161,24 @@ try {
"test@thelia.net",
"azerty"
);
for ($j = 0; $j <= 3; $j++) {
$address = new Thelia\Model\Address();
$address->setLabel($faker->text(20))
->setTitleId(rand(1,3))
->setFirstname($faker->firstname)
->setLastname($faker->lastname)
->setAddress1($faker->streetAddress)
->setAddress2($faker->streetAddress)
->setAddress3($faker->streetAddress)
->setCellphone($faker->phoneNumber)
->setPhone($faker->phoneNumber)
->setZipcode($faker->postcode)
->setCity($faker->city)
->setCountryId(64)
->setCustomer($customer)
->save()
;
}
for($i = 0; $i < 50; $i++) {
$customer = new Thelia\Model\Customer();

379
install/import.php Normal file
View File

@@ -0,0 +1,379 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
use Thelia\Constraint\ConstraintFactory;
use Thelia\Constraint\Rule\AvailableForTotalAmountManager;
use Thelia\Constraint\Rule\AvailableForXArticlesManager;
use Thelia\Constraint\Rule\Operators;
use Thelia\Coupon\CouponRuleCollection;
require __DIR__ . '/../core/bootstrap.php';
$thelia = new Thelia\Core\Thelia("dev", true);
$thelia->boot();
$faker = Faker\Factory::create();
// Intialize URL management
$url = new Thelia\Tools\URL();
$con = \Propel\Runtime\Propel::getConnection(
Thelia\Model\Map\ProductTableMap::DATABASE_NAME
);
$con->beginTransaction();
try {
$stmt = $con->prepare("SET foreign_key_checks = 0");
$stmt->execute();
clearTables();
$stmt = $con->prepare("SET foreign_key_checks = 1");
$stmt->execute();
$categories = createCategories();
$color = createColors();
$brand = createBrand();
echo "creating templates\n";
$template = new \Thelia\Model\Template();
$template
->setLocale('fr_FR')
->setName('template de démo')
->setLocale('en_US')
->setName('demo template')
->save();
$at = new Thelia\Model\AttributeTemplate();
$at
->setTemplate($template)
->setAttribute($color)
->save();
$ft = new Thelia\Model\FeatureTemplate();
$ft
->setTemplate($template)
->setFeature($brand)
->save();
echo "end creating templates\n";
createProduct($faker, $categories, $template, $color, $brand);
$con->commit();
} catch (Exception $e) {
echo "error : ".$e->getMessage()."\n";
$con->rollBack();
}
function createProduct($faker, $categories, $template, $attribute, $feature)
{
echo "start creating products\n";
$fileSystem = new \Symfony\Component\Filesystem\Filesystem();
if (($handle = fopen(THELIA_ROOT . '/install/import/products.csv', "r")) !== FALSE) {
$row=0;
while (($data = fgetcsv($handle, 100000, ";")) !== FALSE) {
$row++;
if($row == 1) continue;
$product = new \Thelia\Model\Product();
$productCategories = explode(';', $data[13]);
$product
->setRef($data[0])
->setVisible(1)
->setTaxRuleId(1)
->setTemplate($template)
;
foreach($productCategories as $productCategory) {
$productCategory = trim($productCategory);
if(array_key_exists($productCategory, $categories)) {
$product->addCategory($categories[$productCategory]);
}
}
$product
->setLocale('en_US')
->setTitle($data[1])
->setChapo($data[2])
->setDescription($data[4])
->setPostscriptum($data[6])
->setLocale('fr_Fr')
->setTitle($data[1])
->setChapo($data[3])
->setDescription($data[5])
->setPostscriptum($data[7])
->save();
$productCategories = $product->getProductCategories()->getFirst();
$productCategories->setDefaultCategory(true)
->save();
// Set the position
$product->setPosition($product->getNextPosition())->save();
$images = explode(';', $data[10]);
foreach ($images as $image) {
$image = trim($image);
if(empty($image)) continue;
$productImage = new \Thelia\Model\ProductImage();
$productImage
->setProduct($product)
->setFile($image)
->save();
$fileSystem->copy(THELIA_ROOT . 'install/import/images/'.$image, THELIA_ROOT . 'local/media/images/product/'.$image, true);
}
$pses = explode(";", $data[12]);
foreach ($pses as $pse) {
if(empty($pse)) continue;
$stock = new \Thelia\Model\ProductSaleElements();
$stock->setProduct($product);
$stock->setRef($product->getId() . '_' . uniqid('', true));
$stock->setQuantity($faker->randomNumber(1,50));
if(!empty($data[9])) {
$stock->setPromo(1);
} else {
$stock->setPromo(0);
}
$stock->setNewness($faker->randomNumber(0,1));
$stock->setWeight($faker->randomFloat(2, 100,10000));
$stock->save();
$productPrice = new \Thelia\Model\ProductPrice();
$productPrice->setProductSaleElements($stock);
$productPrice->setCurrencyId(1);
$productPrice->setPrice($data[8]);
$productPrice->setPromoPrice($data[9]);
$productPrice->save();
$attributeAv = \Thelia\Model\AttributeAvI18nQuery::create()
->filterByLocale('en_US')
->filterByTitle($pse)
->findOne();
$attributeCombination = new \Thelia\Model\AttributeCombination();
$attributeCombination
->setAttributeId($attribute->getId())
->setAttributeAvId($attributeAv->getId())
->setProductSaleElements($stock)
->save();
}
$brand = $data[11];
$featurAv = \Thelia\Model\FeatureAvI18nQuery::create()
->filterByLocale('en_US')
->filterByTitle($brand)
->findOne();
$featureProduct = new Thelia\Model\FeatureProduct();
$featureProduct->setProduct($product)
->setFeatureId($feature->getId())
->setFeatureAvId($featurAv->getId())
->save()
;
}
}
echo "end creating products\n";
}
function createBrand()
{
echo "start creating brands feature\n";
if (($handle = fopen(THELIA_ROOT . '/install/import/brand.csv', "r")) !== FALSE) {
$row=0;
$feature = new \Thelia\Model\Feature();
$feature
->setPosition(1)
->setLocale('fr_FR')
->setTitle('Marque')
->setLocale('en_US')
->setTitle('Brand');
while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
$row++;
$featureAv = new \Thelia\Model\FeatureAv();
$featureAv
->setPosition($row)
->setLocale('fr_FR')
->setTitle($data[0])
->setLocale('en_US')
->setTitle($data[0]);
$feature->addFeatureAv($featureAv);
}
$feature->save();
fclose($handle);
}
echo "brands feature created successfully\n";
return $feature;
}
function createCategories()
{
echo "start creating categories\n";
$categories = array();
if (($handle = fopen(THELIA_ROOT . '/install/import/categories.csv', "r")) !== FALSE) {
$row=0;
while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
$row++;
if($row==1) continue;
$category = new \Thelia\Model\Category();
$category
->setVisible(1)
->setPosition($row-1)
->setParent(0)
->setLocale('fr_FR')
->setTitle(trim($data[0]))
->setLocale('en_US')
->setTitle(trim($data[1]))
->save();
$categories[trim($data[1])] = $category;
}
fclose($handle);
}
echo "categories created successfully\n";
return $categories;
}
function createColors()
{
echo "start creating colors attributes\n";
if (($handle = fopen(THELIA_ROOT . '/install/import/colors.csv', "r")) !== FALSE) {
$row=0;
$attribute = new \Thelia\Model\Attribute();
$attribute
->setPosition(1)
->setLocale('fr_FR')
->setTitle('Couleur')
->setLocale('en_US')
->setTitle('Colors');
while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
$row++;
$attributeAv = new \Thelia\Model\AttributeAv();
$attributeAv
->setPosition($row)
->setLocale('fr_FR')
->setTitle($data[0])
->setLocale('en_US')
->setTitle($data[1]);
$attribute->addAttributeAv($attributeAv);
}
$attribute->save();
fclose($handle);
}
echo "colors attributes created with success\n";
return $attribute;
}
function clearTables()
{
$productAssociatedContent = Thelia\Model\ProductAssociatedContentQuery::create()
->find();
$productAssociatedContent->delete();
$categoryAssociatedContent = Thelia\Model\CategoryAssociatedContentQuery::create()
->find();
$categoryAssociatedContent->delete();
$featureProduct = Thelia\Model\FeatureProductQuery::create()
->find();
$featureProduct->delete();
$attributeCombination = Thelia\Model\AttributeCombinationQuery::create()
->find();
$attributeCombination->delete();
$feature = Thelia\Model\FeatureQuery::create()
->find();
$feature->delete();
$feature = Thelia\Model\FeatureI18nQuery::create()
->find();
$feature->delete();
$featureAv = Thelia\Model\FeatureAvQuery::create()
->find();
$featureAv->delete();
$featureAv = Thelia\Model\FeatureAvI18nQuery::create()
->find();
$featureAv->delete();
$attribute = Thelia\Model\AttributeQuery::create()
->find();
$attribute->delete();
$attribute = Thelia\Model\AttributeI18nQuery::create()
->find();
$attribute->delete();
$attributeAv = Thelia\Model\AttributeAvQuery::create()
->find();
$attributeAv->delete();
$attributeAv = Thelia\Model\AttributeAvI18nQuery::create()
->find();
$attributeAv->delete();
$category = Thelia\Model\CategoryQuery::create()
->find();
$category->delete();
$category = Thelia\Model\CategoryI18nQuery::create()
->find();
$category->delete();
$product = Thelia\Model\ProductQuery::create()
->find();
$product->delete();
$product = Thelia\Model\ProductI18nQuery::create()
->find();
$product->delete();
$accessory = Thelia\Model\AccessoryQuery::create()
->find();
$accessory->delete();
$stock = \Thelia\Model\ProductSaleElementsQuery::create()
->find();
$stock->delete();
$productPrice = \Thelia\Model\ProductPriceQuery::create()
->find();
$productPrice->delete();
\Thelia\Model\ProductImageQuery::create()->find()->delete();
}

7
install/import/brand.csv Normal file
View File

@@ -0,0 +1,7 @@
"MILAN"
"MAGIS"
"OXYO"
"OFFUS"
"PLINK"
"PARRY"
"TOKO"
1 MILAN
2 MAGIS
3 OXYO
4 OFFUS
5 PLINK
6 PARRY
7 TOKO

View File

@@ -0,0 +1,5 @@
"CATEGORIES FR";"CATEGORIES UK"
"Chaises";"Chairs"
"Tabourets";"Stools"
"Fauteuils";"Armchairs"
"Canapés";"Sofas"
1 CATEGORIES FR CATEGORIES UK
2 Chaises Chairs
3 Tabourets Stools
4 Fauteuils Armchairs
5 Canapés Sofas

13
install/import/colors.csv Normal file
View File

@@ -0,0 +1,13 @@
"Bleu";"Blue"
"Jaune";"Yellow"
"Orange";"Orange"
"Rose";"Pink"
"Vert";"Green"
"Violet";"Purple"
"Rouge";"Red"
"Gris";"Gray"
"Noir";"Black"
"Beige";"Beige"
"Turquoise";"Turquoise"
"Marron";"Brown"
"Blanc";"White"
1 Bleu Blue
2 Jaune Yellow
3 Orange Orange
4 Rose Pink
5 Vert Green
6 Violet Purple
7 Rouge Red
8 Gris Gray
9 Noir Black
10 Beige Beige
11 Turquoise Turquoise
12 Marron Brown
13 Blanc White

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Some files were not shown because too many files have changed in this diff Show More