diff --git a/Readme.md b/Readme.md
index abb8ccd30..fe90c50cc 100755
--- a/Readme.md
+++ b/Readme.md
@@ -22,7 +22,7 @@ Requirements
* gd
* curl
* safe_mode off
- * memory_limit at least 128M, preferably 256.
+ * memory_limit at least 150M, preferably 256.
* post_max_size 20M
* upload_max_filesize 2M
* apache 2
@@ -44,8 +44,10 @@ Installation
------------
``` bash
+$ git clone https://github.com/thelia/thelia.git
+$ cd thelia
$ curl -sS https://getcomposer.org/installer | php
-$ php composer.phar create-project thelia/thelia path/ dev-master
+$ php composer.phar install --prefer-dist --optimize-autoloader
```
Finish the installation using cli tools :
@@ -56,14 +58,6 @@ $ php Thelia thelia:install
You just have to follow all instructions.
-Documentation
--------------
-
-Thelia documentation is available at http://doc.thelia.net
-
-The documentation is also in beta version and some part can be obsolete cause to some refactor.
-
-
Contribute
----------
diff --git a/core/lib/Thelia/Action/BaseAction.php b/core/lib/Thelia/Action/BaseAction.php
index c376a78b7..1f04e12f6 100755
--- a/core/lib/Thelia/Action/BaseAction.php
+++ b/core/lib/Thelia/Action/BaseAction.php
@@ -30,6 +30,7 @@ use Thelia\Core\Event\UpdateSeoEvent;
use Thelia\Exception\UrlRewritingException;
use Thelia\Form\Exception\FormValidationException;
+use \Thelia\Model\Tools\UrlRewritingTrait;
class BaseAction
{
@@ -81,8 +82,8 @@ class BaseAction
/**
* Changes SEO Fields for an object.
*
- * @param ModelCriteria $query
- * @param UpdateSeoEvent $event
+ * @param ModelCriteria $query
+ * @param UpdateSeoEvent $event
*
* @return mixed
*/
@@ -104,7 +105,7 @@ class BaseAction
// Update the rewritten URL, if required
try {
$object->setRewrittenUrl($event->getLocale(), $event->getUrl());
- } catch (UrlRewritingException $e) {
+ } catch(UrlRewritingException $e) {
throw new FormValidationException($e->getMessage(), $e->getCode());
}
diff --git a/core/lib/Thelia/Action/Coupon.php b/core/lib/Thelia/Action/Coupon.php
index 4c76002ac..1b77eb488 100755
--- a/core/lib/Thelia/Action/Coupon.php
+++ b/core/lib/Thelia/Action/Coupon.php
@@ -28,7 +28,6 @@ use Thelia\Condition\ConditionFactory;
use Thelia\Condition\Implementation\ConditionInterface;
use Thelia\Core\Event\Coupon\CouponConsumeEvent;
use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent;
-use Thelia\Core\Event\Order\OrderEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Coupon\CouponFactory;
@@ -37,7 +36,6 @@ use Thelia\Condition\ConditionCollection;
use Thelia\Coupon\Type\CouponInterface;
use Thelia\Model\Coupon as CouponModel;
use Thelia\Model\CouponQuery;
-use Thelia\Model\OrderCoupon;
/**
* Created by JetBrains PhpStorm.
@@ -124,20 +122,23 @@ class Coupon extends BaseAction implements EventSubscriberInterface
$request->getSession()->setConsumedCoupons($consumedCoupons);
$totalDiscount = $couponManager->getDiscount();
+ // @todo insert false product in cart with the name of the coupon and the discount as negative price
+
+ // Decrement coupon quantity
+ // @todo move this part in after order event
+ $couponQuery = CouponQuery::create();
+ $couponModel = $couponQuery->findOneByCode($coupon->getCode());
+ $couponManager->decrementQuantity($couponModel);
$request
->getSession()
->getCart()
->setDiscount($totalDiscount)
->save();
- $request
- ->getSession()
- ->getOrder()
- ->setDiscount($totalDiscount)
- ->save();
}
}
+
$event->setIsValid($isValid);
$event->setDiscount($totalDiscount);
}
@@ -206,68 +207,6 @@ class Coupon extends BaseAction implements EventSubscriberInterface
$event->setCouponModel($coupon);
}
- /**
- * @param \Thelia\Core\Event\Order\OrderEvent $event
- */
- public function testFreePostage(OrderEvent $event)
- {
- /** @var CouponManager $couponManager */
- $couponManager = $this->container->get('thelia.coupon.manager');
-
- if($couponManager->isCouponRemovingPostage()) {
- $order = $event->getOrder();
-
- $order->setPostage(0);
-
- $event->setOrder($order);
-
- $event->stopPropagation();
- }
- }
-
- /**
- * @param \Thelia\Core\Event\Order\OrderEvent $event
- */
- public function afterOrder(OrderEvent $event)
- {
- $request = $this->container->get('request');
-
- /** @var CouponManager $couponManager */
- $couponManager = $this->container->get('thelia.coupon.manager');
-
- $consumedCoupons = $request->getSession()->getConsumedCoupons();
-
- if (is_array($consumedCoupons)) {
- foreach($consumedCoupons as $couponCode) {
- $couponQuery = CouponQuery::create();
- $couponModel = $couponQuery->findOneByCode($couponCode);
- $couponModel->setLocale($request->getSession()->getLang()->getLocale());
-
- /* decrease coupon quantity */
- $couponManager->decrementQuantity($couponModel);
-
- /* memorize coupon */
- $orderCoupon = new OrderCoupon();
- $orderCoupon->setOrder($event->getOrder())
- ->setCode($couponModel->getCode())
- ->setType($couponModel->getType())
- ->setAmount($couponModel->getAmount())
-
- ->setTitle($couponModel->getTitle())
- ->setShortDescription($couponModel->getShortDescription())
- ->setDescription($couponModel->getDescription())
-
- ->setExpirationDate($couponModel->getExpirationDate())
- ->setIsCumulative($couponModel->getIsCumulative())
- ->setIsRemovingPostage($couponModel->getIsRemovingPostage())
- ->setIsAvailableOnSpecialOffers($couponModel->getIsAvailableOnSpecialOffers())
- ->setSerializedConditions($couponModel->getSerializedConditions())
- ;
- $orderCoupon->save();
- }
- }
- }
-
/**
* Returns an array of event names this subscriber listens to.
*
@@ -294,9 +233,7 @@ class Coupon extends BaseAction implements EventSubscriberInterface
TheliaEvents::COUPON_CREATE => array("create", 128),
TheliaEvents::COUPON_UPDATE => array("update", 128),
TheliaEvents::COUPON_CONSUME => array("consume", 128),
- TheliaEvents::COUPON_CONDITION_UPDATE => array("updateCondition", 128),
- TheliaEvents::ORDER_SET_POSTAGE => array("testFreePostage", 256),
- TheliaEvents::ORDER_BEFORE_PAYMENT => array("afterOrder", 128),
+ TheliaEvents::COUPON_CONDITION_UPDATE => array("updateCondition", 128)
);
}
}
diff --git a/core/lib/Thelia/Action/HttpException.php b/core/lib/Thelia/Action/HttpException.php
index 6448f5b2d..b875eb49b 100755
--- a/core/lib/Thelia/Action/HttpException.php
+++ b/core/lib/Thelia/Action/HttpException.php
@@ -56,7 +56,7 @@ class HttpException extends BaseAction implements EventSubscriberInterface
$parser = $this->container->get("thelia.parser");
// Define the template thant shoud be used
- $parser->setTemplate(TemplateHelper::getInstance()->getActiveFrontTemplate());
+ $parser->setTemplateDefinition(TemplateHelper::getInstance()->getActiveFrontTemplate());
//$event->getRequest()->attributes->set('_view', ConfigQuery::getPageNotFoundView());
diff --git a/core/lib/Thelia/Action/MailingSystem.php b/core/lib/Thelia/Action/MailingSystem.php
index 2f62d749b..f46352d53 100644
--- a/core/lib/Thelia/Action/MailingSystem.php
+++ b/core/lib/Thelia/Action/MailingSystem.php
@@ -35,7 +35,7 @@ class MailingSystem extends BaseAction implements EventSubscriberInterface
*/
public function update(MailingSystemEvent $event)
{
- if ($event->getEnabled()) {
+ if($event->getEnabled()) {
ConfigQuery::enableSmtp();
} else {
ConfigQuery::disableSmtp();
diff --git a/core/lib/Thelia/Action/Module.php b/core/lib/Thelia/Action/Module.php
index d27bedd1f..286779667 100644
--- a/core/lib/Thelia/Action/Module.php
+++ b/core/lib/Thelia/Action/Module.php
@@ -33,6 +33,7 @@ use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\Map\ModuleTableMap;
use Thelia\Model\ModuleQuery;
use Thelia\Module\BaseModule;
+use Thelia\Core\Event\UpdatePositionEvent;
/**
* Class Module
@@ -122,6 +123,16 @@ class Module extends BaseAction implements EventSubscriberInterface
}
}
+ /**
+ * Changes position, selecting absolute ou relative change.
+ *
+ * @param CategoryChangePositionEvent $event
+ */
+ public function updatePosition(UpdatePositionEvent $event)
+ {
+ return $this->genericUpdatePosition(ModuleQuery::create(), $event);
+ }
+
protected function cacheClear()
{
$cacheEvent = new CacheEvent($this->container->getParameter('kernel.cache_dir'));
@@ -153,6 +164,7 @@ class Module extends BaseAction implements EventSubscriberInterface
{
return array(
TheliaEvents::MODULE_TOGGLE_ACTIVATION => array('toggleActivation', 128),
+ TheliaEvents::MODULE_UPDATE_POSITION => array('updatePosition', 128),
TheliaEvents::MODULE_DELETE => array('delete', 128),
TheliaEvents::MODULE_UPDATE => array('update', 128),
);
diff --git a/core/lib/Thelia/Action/Order.php b/core/lib/Thelia/Action/Order.php
index 9d7daaba7..0699c14d1 100755
--- a/core/lib/Thelia/Action/Order.php
+++ b/core/lib/Thelia/Action/Order.php
@@ -30,7 +30,6 @@ use Thelia\Core\Event\Cart\CartEvent;
use Thelia\Core\Event\Order\OrderAddressEvent;
use Thelia\Core\Event\Order\OrderEvent;
use Thelia\Core\Event\TheliaEvents;
-use Thelia\Coupon\CouponManager;
use Thelia\Exception\TheliaProcessException;
use Thelia\Model\AddressQuery;
use Thelia\Model\ConfigQuery;
@@ -74,17 +73,6 @@ class Order extends BaseAction implements EventSubscriberInterface
$order = $event->getOrder();
$order->setDeliveryModuleId($event->getDeliveryModule());
-
- $event->setOrder($order);
- }
-
- /**
- * @param \Thelia\Core\Event\Order\OrderEvent $event
- */
- public function setPostage(OrderEvent $event)
- {
- $order = $event->getOrder();
-
$order->setPostage($event->getPostage());
$event->setOrder($order);
@@ -190,11 +178,6 @@ class Order extends BaseAction implements EventSubscriberInterface
OrderStatusQuery::create()->findOneByCode(OrderStatus::CODE_NOT_PAID)->getId()
);
- /* memorize discount */
- $placedOrder->setDiscount(
- $cart->getDiscount()
- );
-
$placedOrder->save($con);
/* fulfill order_products and decrease stock */
@@ -279,6 +262,8 @@ class Order extends BaseAction implements EventSubscriberInterface
}
}
+ /* discount @todo */
+
$con->commit();
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_BEFORE_PAYMENT, new OrderEvent($placedOrder));
@@ -288,7 +273,7 @@ class Order extends BaseAction implements EventSubscriberInterface
$sessionOrder = new \Thelia\Model\Order();
$event->setOrder($sessionOrder);
$event->setPlacedOrder($placedOrder);
- $this->getSession()->setOrder($placedOrder);
+ $this->getSession()->setOrder($sessionOrder);
/* empty cart */
$this->getDispatcher()->dispatch(TheliaEvents::CART_CLEAR, new CartEvent($this->getCart($this->getRequest())));
@@ -305,7 +290,7 @@ class Order extends BaseAction implements EventSubscriberInterface
{
$contact_email = ConfigQuery::read('contact_email');
- if ($contact_email) {
+ if($contact_email) {
$message = MessageQuery::create()
->filterByName('order_confirmation')
@@ -427,7 +412,6 @@ class Order extends BaseAction implements EventSubscriberInterface
return array(
TheliaEvents::ORDER_SET_DELIVERY_ADDRESS => array("setDeliveryAddress", 128),
TheliaEvents::ORDER_SET_DELIVERY_MODULE => array("setDeliveryModule", 128),
- TheliaEvents::ORDER_SET_POSTAGE => array("setPostage", 128),
TheliaEvents::ORDER_SET_INVOICE_ADDRESS => array("setInvoiceAddress", 128),
TheliaEvents::ORDER_SET_PAYMENT_MODULE => array("setPaymentModule", 128),
TheliaEvents::ORDER_PAY => array("create", 128),
diff --git a/core/lib/Thelia/Action/Product.php b/core/lib/Thelia/Action/Product.php
index a5defe5cb..6d477855b 100644
--- a/core/lib/Thelia/Action/Product.php
+++ b/core/lib/Thelia/Action/Product.php
@@ -131,6 +131,7 @@ class Product extends BaseAction implements EventSubscriberInterface
return $this->genericUpdateSeo(ProductQuery::create(), $event);
}
+
/**
* Delete a product entry
*
diff --git a/core/lib/Thelia/Action/ProductSaleElement.php b/core/lib/Thelia/Action/ProductSaleElement.php
index 875dbcc1d..cad3be374 100644
--- a/core/lib/Thelia/Action/ProductSaleElement.php
+++ b/core/lib/Thelia/Action/ProductSaleElement.php
@@ -209,7 +209,8 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
if ($product->countSaleElements() <= 0) {
// If we just deleted the last PSE, create a default one
$product->createProductSaleElement($con, 0, 0, 0, $event->getCurrencyId(), true);
- } elseif ($pse->getIsDefault()) {
+ }
+ elseif ($pse->getIsDefault()) {
// If we deleted the default PSE, make the last created one the default
$pse = ProductSaleElementsQuery::create()
@@ -237,8 +238,8 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
*
* @param ProductCombinationGenerationEvent $event
*/
- public function generateCombinations(ProductCombinationGenerationEvent $event)
- {
+ public function generateCombinations(ProductCombinationGenerationEvent $event) {
+
$con = Propel::getWriteConnection(ProductSaleElementsTableMap::DATABASE_NAME);
$con->beginTransaction();
@@ -251,7 +252,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
$isDefault = true;
// Create all combinations
- foreach ($event->getCombinations() as $combinationAttributesAvIds) {
+ foreach($event->getCombinations() as $combinationAttributesAvIds) {
// Create the PSE
$saleElement = $event->getProduct()->createProductSaleElement(
@@ -275,7 +276,8 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
// Store all the stuff !
$con->commit();
- } catch (\Exception $ex) {
+ }
+ catch (\Exception $ex) {
$con->rollback();
@@ -286,9 +288,9 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
/**
* Create a combination for a given product sale element
*
- * @param ConnectionInterface $con the Propel connection
- * @param ProductSaleElement $salesElement the product sale element
- * @param unknown $combinationAttributes an array oif attributes av IDs
+ * @param ConnectionInterface $con the Propel connection
+ * @param ProductSaleElement $salesElement the product sale element
+ * @param unknown $combinationAttributes an array oif attributes av IDs
*/
protected function createCombination(ConnectionInterface $con, ProductSaleElements $salesElement, $combinationAttributes)
{
diff --git a/core/lib/Thelia/Command/AdminUpdatePasswordCommand.php b/core/lib/Thelia/Command/AdminUpdatePasswordCommand.php
index 690f4362b..cab25d13f 100644
--- a/core/lib/Thelia/Command/AdminUpdatePasswordCommand.php
+++ b/core/lib/Thelia/Command/AdminUpdatePasswordCommand.php
@@ -32,6 +32,7 @@ use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\AdminQuery;
use Thelia\Tools\Password;
+
/**
* command line for updating admin password
*
@@ -71,15 +72,18 @@ class AdminUpdatePasswordCommand extends ContainerAwareCommand
{
$login = $input->getArgument('login');
+
if (null === $admin = AdminQuery::create()->filterByLogin($login)->findOne()) {
throw new \RuntimeException(sprintf('Admin with login %s does not exists', $login));
}
+
$password = $input->getOption('password') ?: Password::generateRandom();
$event = new AdministratorUpdatePasswordEvent($admin);
$event->setPassword($password);
+
$this->
getContainer()
->get('event_dispatcher')
@@ -95,3 +99,4 @@ class AdminUpdatePasswordCommand extends ContainerAwareCommand
}
}
+
diff --git a/core/lib/Thelia/Config/I18n/en_US.php b/core/lib/Thelia/Config/I18n/en_US.php
index 2b8b661c2..ce333ddb4 100644
--- a/core/lib/Thelia/Config/I18n/en_US.php
+++ b/core/lib/Thelia/Config/I18n/en_US.php
@@ -1,14 +1,14 @@
'Delivery module',
- 'Quantity' => 'Quantity',
- 'Product' => 'Product',
- 'Unit. price' => 'Unit. price',
- 'Tax' => 'Tax',
- 'Unit taxed price' => 'Unit taxed price',
- 'Taxed total' => 'Taxed total',
- 'Payment module' => 'Payment module',
- 'Postage' => 'Postage',
- 'Total' => 'Total',
+ 'Delivery module' => 'Delivery module',
+ 'Quantity' => 'Quantity',
+ 'Product' => 'Product',
+ 'Unit. price' => 'Unit. price',
+ 'Tax' => 'Tax',
+ 'Unit taxed price' => 'Unit taxed price',
+ 'Taxed total' => 'Taxed total',
+ 'Payment module' => 'Payment module',
+ 'Postage' => 'Postage',
+ 'Total' => 'Total',
);
diff --git a/core/lib/Thelia/Config/I18n/es_ES.php b/core/lib/Thelia/Config/I18n/es_ES.php
index 0a749d4c1..f1a85bd6a 100644
--- a/core/lib/Thelia/Config/I18n/es_ES.php
+++ b/core/lib/Thelia/Config/I18n/es_ES.php
@@ -1,36 +1,36 @@
'Combination builder',
- 'Title' => 'Title',
- 'City' => 'City',
- 'Zip code' => 'Zip code',
- 'Country' => 'Country',
- 'Phone' => 'Phone',
- 'Login' => 'Login',
- 'Password' => 'Password',
- 'Profile' => 'Profile',
- 'Postage' => 'Postage',
- 'Add to all product templates' => 'Add to all product templates',
- 'Quantity' => 'Quantity',
- 'Name' => 'Name',
- 'Value' => 'Value',
- 'Subject' => 'Subject',
- 'Company' => 'Company',
- 'Description' => 'Description',
- 'Language name' => 'Language name',
- 'ISO 639 Code' => 'ISO 639 Code',
- 'If a translation is missing or incomplete :' => 'If a translation is missing or incomplete :',
- 'Host' => 'Host',
- 'Port' => 'Port',
- 'Encryption' => 'Encryption',
- 'Username' => 'Username',
- 'Timeout' => 'Timeout',
- 'Source IP' => 'Source IP',
- 'Email address' => 'Email address',
- 'Firstname' => 'Firstname',
- 'Lastname' => 'Lastname',
- 'Additional address' => 'Additional address',
- 'Reference' => 'Reference',
- 'EAN Code' => 'EAN Code',
+ 'Combination builder' => 'Combination builder',
+ 'Title' => 'Title',
+ 'City' => 'City',
+ 'Zip code' => 'Zip code',
+ 'Country' => 'Country',
+ 'Phone' => 'Phone',
+ 'Login' => 'Login',
+ 'Password' => 'Password',
+ 'Profile' => 'Profile',
+ 'Postage' => 'Postage',
+ 'Add to all product templates' => 'Add to all product templates',
+ 'Quantity' => 'Quantity',
+ 'Name' => 'Name',
+ 'Value' => 'Value',
+ 'Subject' => 'Subject',
+ 'Company' => 'Company',
+ 'Description' => 'Description',
+ 'Language name' => 'Language name',
+ 'ISO 639 Code' => 'ISO 639 Code',
+ 'If a translation is missing or incomplete :' => 'If a translation is missing or incomplete :',
+ 'Host' => 'Host',
+ 'Port' => 'Port',
+ 'Encryption' => 'Encryption',
+ 'Username' => 'Username',
+ 'Timeout' => 'Timeout',
+ 'Source IP' => 'Source IP',
+ 'Email address' => 'Email address',
+ 'Firstname' => 'Firstname',
+ 'Lastname' => 'Lastname',
+ 'Additional address' => 'Additional address',
+ 'Reference' => 'Reference',
+ 'EAN Code' => 'EAN Code',
);
diff --git a/core/lib/Thelia/Config/I18n/fr_FR.php b/core/lib/Thelia/Config/I18n/fr_FR.php
index 188d6f90a..7eb24949a 100644
--- a/core/lib/Thelia/Config/I18n/fr_FR.php
+++ b/core/lib/Thelia/Config/I18n/fr_FR.php
@@ -23,4 +23,4 @@
return array(
-);
+);
\ No newline at end of file
diff --git a/core/lib/Thelia/Config/I18n/it_IT.php b/core/lib/Thelia/Config/I18n/it_IT.php
index 188d6f90a..7eb24949a 100644
--- a/core/lib/Thelia/Config/I18n/it_IT.php
+++ b/core/lib/Thelia/Config/I18n/it_IT.php
@@ -23,4 +23,4 @@
return array(
-);
+);
\ No newline at end of file
diff --git a/core/lib/Thelia/Config/Resources/loop.xml b/core/lib/Thelia/Config/Resources/loop.xml
index 0e5414ad8..c253b5fb4 100644
--- a/core/lib/Thelia/Config/Resources/loop.xml
+++ b/core/lib/Thelia/Config/Resources/loop.xml
@@ -28,7 +28,6 @@
Here is a general asset :
+
+ {images file='assets/img/logo-thelia-34px.png'}
+
+ {/images}
+
Here is a module asset :
+
+ {images source="TheliaDebugBar" file='assets/img/db-loader.gif'}
+
+ {/images}
+