fix cs
This commit is contained in:
@@ -86,14 +86,14 @@ class Address extends BaseAction implements EventSubscriberInterface
|
||||
->save()
|
||||
;
|
||||
|
||||
if($event->getIsDefault()) {
|
||||
if ($event->getIsDefault()) {
|
||||
$addressModel->makeItDefault();
|
||||
}
|
||||
|
||||
$event->setAddress($addressModel);
|
||||
$con->commit();
|
||||
|
||||
} catch(PropelException $e) {
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
@@ -33,11 +33,7 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Attribute\AttributeUpdateEvent;
|
||||
use Thelia\Core\Event\Attribute\AttributeCreateEvent;
|
||||
use Thelia\Core\Event\Attribute\AttributeDeleteEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\AttributeAv;
|
||||
use Thelia\Model\AttributeAvQuery;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Core\Event\Category\CategoryEvent;
|
||||
use Thelia\Core\Event\Attribute\AttributeEvent;
|
||||
use Thelia\Model\AttributeTemplate;
|
||||
use Thelia\Model\AttributeTemplateQuery;
|
||||
@@ -130,7 +126,7 @@ class Attribute extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
$templates = TemplateQuery::create()->find();
|
||||
|
||||
foreach($templates as $template) {
|
||||
foreach ($templates as $template) {
|
||||
|
||||
$attribute_template = new AttributeTemplate();
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Attribute\AttributeAvUpdateEvent;
|
||||
use Thelia\Core\Event\Attribute\AttributeAvCreateEvent;
|
||||
use Thelia\Core\Event\Attribute\AttributeAvDeleteEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
|
||||
class AttributeAv extends BaseAction implements EventSubscriberInterface
|
||||
@@ -115,7 +114,6 @@ class AttributeAv extends BaseAction implements EventSubscriberInterface
|
||||
return $this->genericUpdatePosition(AttributeAvQuery::create(), $event);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace Thelia\Action;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Thelia\Model\AdminLog;
|
||||
use Propel\Runtime\ActiveQuery\PropelQuery;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
|
||||
@@ -50,7 +49,6 @@ class BaseAction
|
||||
return $this->container->get('event_dispatcher');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Changes object position, selecting absolute ou relative change.
|
||||
*
|
||||
|
||||
@@ -23,10 +23,7 @@
|
||||
|
||||
namespace Thelia\Action;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
use Thelia\Core\Event\CachedFileEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
/**
|
||||
@@ -50,7 +47,7 @@ abstract class BaseCachedFile extends BaseAction
|
||||
/**
|
||||
* @return string root of the file cache directory in web space
|
||||
*/
|
||||
protected abstract function getCacheDirFromWebRoot();
|
||||
abstract protected function getCacheDirFromWebRoot();
|
||||
|
||||
/**
|
||||
* Clear the file cache. Is a subdirectory is specified, only this directory is cleared.
|
||||
|
||||
@@ -33,7 +33,6 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Category\CategoryUpdateEvent;
|
||||
use Thelia\Core\Event\Category\CategoryCreateEvent;
|
||||
use Thelia\Core\Event\Category\CategoryDeleteEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Core\Event\Category\CategoryToggleVisibilityEvent;
|
||||
use Thelia\Core\Event\Category\CategoryAddContentEvent;
|
||||
@@ -139,8 +138,8 @@ class Category extends BaseAction implements EventSubscriberInterface
|
||||
return $this->genericUpdatePosition(CategoryQuery::create(), $event);
|
||||
}
|
||||
|
||||
public function addContent(CategoryAddContentEvent $event) {
|
||||
|
||||
public function addContent(CategoryAddContentEvent $event)
|
||||
{
|
||||
if (CategoryAssociatedContentQuery::create()
|
||||
->filterByContentId($event->getContentId())
|
||||
->filterByCategory($event->getCategory())->count() <= 0) {
|
||||
@@ -156,8 +155,8 @@ class Category extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function removeContent(CategoryDeleteContentEvent $event) {
|
||||
|
||||
public function removeContent(CategoryDeleteContentEvent $event)
|
||||
{
|
||||
$content = CategoryAssociatedContentQuery::create()
|
||||
->filterByContentId($event->getContentId())
|
||||
->filterByCategory($event->getCategory())->findOne()
|
||||
@@ -170,7 +169,6 @@ class Category extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
||||
@@ -31,8 +31,6 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Model\ContentQuery;
|
||||
use Thelia\Model\Content as ContentModel;
|
||||
use Thelia\Model\FolderQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Class Content
|
||||
@@ -82,11 +80,10 @@ class Content extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
public function updatePosition(UpdatePositionEvent $event)
|
||||
{
|
||||
if(null !== $content = ContentQuery::create()->findPk($event->getObjectId())) {
|
||||
if (null !== $content = ContentQuery::create()->findPk($event->getObjectId())) {
|
||||
$content->setDispatcher($this->getDispatcher());
|
||||
|
||||
switch($event->getMode())
|
||||
{
|
||||
switch ($event->getMode()) {
|
||||
case UpdatePositionEvent::POSITION_ABSOLUTE:
|
||||
$content->changeAbsolutePosition($event->getPosition());
|
||||
break;
|
||||
@@ -124,7 +121,6 @@ class Content extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array of event names this subscriber wants to listen to.
|
||||
*
|
||||
|
||||
@@ -33,11 +33,7 @@ use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Tools\FileManager;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
use Imagine\Document\ImagineInterface;
|
||||
use Imagine\Document\DocumentInterface;
|
||||
use Imagine\Document\Box;
|
||||
use Imagine\Document\Color;
|
||||
use Imagine\Document\Point;
|
||||
use Thelia\Exception\DocumentException;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
|
||||
@@ -80,7 +76,8 @@ class Document extends BaseCachedFile implements EventSubscriberInterface
|
||||
/**
|
||||
* @return string root of the document cache directory in web space
|
||||
*/
|
||||
protected function getCacheDirFromWebRoot() {
|
||||
protected function getCacheDirFromWebRoot()
|
||||
{
|
||||
return ConfigQuery::read('document_cache_dir_from_web_root', 'cache');
|
||||
}
|
||||
|
||||
@@ -247,7 +244,7 @@ class Document extends BaseCachedFile implements EventSubscriberInterface
|
||||
'document'
|
||||
)
|
||||
);
|
||||
} catch(\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->adminLogAppend(
|
||||
$this->container->get('thelia.translator')->trans(
|
||||
'Fail to delete document for %id% with parent id %parentId% (Exception : %e%)',
|
||||
|
||||
@@ -33,11 +33,7 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Feature\FeatureUpdateEvent;
|
||||
use Thelia\Core\Event\Feature\FeatureCreateEvent;
|
||||
use Thelia\Core\Event\Feature\FeatureDeleteEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\FeatureAv;
|
||||
use Thelia\Model\FeatureAvQuery;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Core\Event\Category\CategoryEvent;
|
||||
use Thelia\Core\Event\Feature\FeatureEvent;
|
||||
use Thelia\Model\FeatureTemplate;
|
||||
use Thelia\Model\FeatureTemplateQuery;
|
||||
@@ -130,7 +126,7 @@ class Feature extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
$templates = TemplateQuery::create()->find();
|
||||
|
||||
foreach($templates as $template) {
|
||||
foreach ($templates as $template) {
|
||||
|
||||
$feature_template = new FeatureTemplate();
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Feature\FeatureAvUpdateEvent;
|
||||
use Thelia\Core\Event\Feature\FeatureAvCreateEvent;
|
||||
use Thelia\Core\Event\Feature\FeatureAvDeleteEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
|
||||
class FeatureAv extends BaseAction implements EventSubscriberInterface
|
||||
@@ -115,7 +114,6 @@ class FeatureAv extends BaseAction implements EventSubscriberInterface
|
||||
return $this->genericUpdatePosition(FeatureAvQuery::create(), $event);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
||||
@@ -32,15 +32,13 @@ use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Model\FolderQuery;
|
||||
use Thelia\Model\Folder as FolderModel;
|
||||
|
||||
|
||||
/**
|
||||
* Class Folder
|
||||
* @package Thelia\Action
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class Folder extends BaseAction implements EventSubscriberInterface {
|
||||
|
||||
|
||||
class Folder extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
public function update(FolderUpdateEvent $event)
|
||||
{
|
||||
|
||||
@@ -103,11 +101,10 @@ class Folder extends BaseAction implements EventSubscriberInterface {
|
||||
|
||||
public function updatePosition(UpdatePositionEvent $event)
|
||||
{
|
||||
if(null !== $folder = FolderQuery::create()->findPk($event->getObjectId())) {
|
||||
if (null !== $folder = FolderQuery::create()->findPk($event->getObjectId())) {
|
||||
$folder->setDispatcher($this->getDispatcher());
|
||||
|
||||
switch($event->getMode())
|
||||
{
|
||||
switch ($event->getMode()) {
|
||||
case UpdatePositionEvent::POSITION_ABSOLUTE:
|
||||
$folder->changeAbsolutePosition($event->getPosition());
|
||||
break;
|
||||
|
||||
@@ -45,7 +45,7 @@ class HttpException extends BaseAction implements EventSubscriberInterface
|
||||
$this->display404($event);
|
||||
}
|
||||
|
||||
if($event->getException() instanceof AccessDeniedHttpException) {
|
||||
if ($event->getException() instanceof AccessDeniedHttpException) {
|
||||
$this->display403($event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,19 +23,12 @@
|
||||
|
||||
namespace Thelia\Action;
|
||||
|
||||
use Propel\Runtime\ActiveRecord\ActiveRecordInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Thelia\Core\Event\Image\ImageCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\ImagesCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Image\ImageDeleteEvent;
|
||||
use Thelia\Core\Event\Image\ImageEvent;
|
||||
use Thelia\Model\CategoryImage;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\ContentImage;
|
||||
use Thelia\Model\FolderImage;
|
||||
use Thelia\Model\ProductImage;
|
||||
use Thelia\Tools\FileManager;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
@@ -88,12 +81,11 @@ class Image extends BaseCachedFile implements EventSubscriberInterface
|
||||
const EXACT_RATIO_WITH_CROP = 2;
|
||||
const KEEP_IMAGE_RATIO = 3;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return string root of the image cache directory in web space
|
||||
*/
|
||||
protected function getCacheDirFromWebRoot() {
|
||||
protected function getCacheDirFromWebRoot()
|
||||
{
|
||||
return ConfigQuery::read('image_cache_dir_from_web_root', 'cache');
|
||||
}
|
||||
|
||||
@@ -358,7 +350,7 @@ class Image extends BaseCachedFile implements EventSubscriberInterface
|
||||
'image'
|
||||
)
|
||||
);
|
||||
} catch(\Exception $e){
|
||||
} catch (\Exception $e) {
|
||||
$this->adminLogAppend(
|
||||
$this->container->get('thelia.translator')->trans(
|
||||
'Fail to delete image for %id% with parent id %parentId% (Exception : %e%)',
|
||||
|
||||
@@ -23,13 +23,11 @@
|
||||
|
||||
namespace Thelia\Action;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\Order\OrderAddressEvent;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Exception\OrderException;
|
||||
use Thelia\Exception\TheliaProcessException;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\OrderProductAttributeCombination;
|
||||
@@ -39,7 +37,6 @@ use Thelia\Model\OrderStatus;
|
||||
use Thelia\Model\Map\OrderTableMap;
|
||||
use Thelia\Model\OrderAddress;
|
||||
use Thelia\Model\OrderStatusQuery;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Tools\I18n;
|
||||
|
||||
/**
|
||||
@@ -177,7 +174,7 @@ class Order extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
/* fulfill order_products and decrease stock */
|
||||
|
||||
foreach($cartItems as $cartItem) {
|
||||
foreach ($cartItems as $cartItem) {
|
||||
$product = $cartItem->getProduct();
|
||||
|
||||
/* get translation */
|
||||
@@ -186,7 +183,7 @@ class Order extends BaseAction implements EventSubscriberInterface
|
||||
$pse = $cartItem->getProductSaleElements();
|
||||
|
||||
/* check still in stock */
|
||||
if($cartItem->getQuantity() > $pse->getQuantity()) {
|
||||
if ($cartItem->getQuantity() > $pse->getQuantity()) {
|
||||
throw new TheliaProcessException("Not enough stock", TheliaProcessException::CART_ITEM_NOT_ENOUGH_STOCK, $cartItem);
|
||||
}
|
||||
|
||||
@@ -228,13 +225,13 @@ class Order extends BaseAction implements EventSubscriberInterface
|
||||
$orderProduct->save($con);
|
||||
|
||||
/* fulfill order_product_tax */
|
||||
foreach($taxDetail as $tax) {
|
||||
foreach ($taxDetail as $tax) {
|
||||
$tax->setOrderProductId($orderProduct->getId());
|
||||
$tax->save($con);
|
||||
}
|
||||
|
||||
/* fulfill order_attribute_combination and decrease stock */
|
||||
foreach($pse->getAttributeCombinations() as $attributeCombination) {
|
||||
foreach ($pse->getAttributeCombinations() as $attributeCombination) {
|
||||
$attribute = I18n::forceI18nRetrieving($this->getSession()->getLang()->getLocale(), 'Attribute', $attributeCombination->getAttributeId());
|
||||
$attributeAv = I18n::forceI18nRetrieving($this->getSession()->getLang()->getLocale(), 'AttributeAv', $attributeCombination->getAttributeAvId());
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Product\ProductUpdateEvent;
|
||||
use Thelia\Core\Event\Product\ProductCreateEvent;
|
||||
use Thelia\Core\Event\Product\ProductDeleteEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Core\Event\Product\ProductToggleVisibilityEvent;
|
||||
use Thelia\Core\Event\Product\ProductAddContentEvent;
|
||||
@@ -41,21 +40,16 @@ use Thelia\Core\Event\Product\ProductDeleteContentEvent;
|
||||
use Thelia\Model\ProductAssociatedContent;
|
||||
use Thelia\Model\ProductAssociatedContentQuery;
|
||||
use Thelia\Model\ProductCategory;
|
||||
use Thelia\Model\TaxRule;
|
||||
use Thelia\Model\TaxRuleQuery;
|
||||
use Thelia\Model\TaxQuery;
|
||||
use Thelia\Model\AccessoryQuery;
|
||||
use Thelia\Model\Accessory;
|
||||
use Thelia\Core\Event\FeatureProduct\FeatureProductUpdateEvent;
|
||||
use Thelia\Model\FeatureProduct;
|
||||
use Thelia\Model\FeatureQuery;
|
||||
use Thelia\Core\Event\FeatureProduct\FeatureProductDeleteEvent;
|
||||
use Thelia\Model\FeatureProductQuery;
|
||||
use Thelia\Model\ProductCategoryQuery;
|
||||
use Thelia\Core\Event\Product\ProductSetTemplateEvent;
|
||||
use Thelia\Model\AttributeCombinationQuery;
|
||||
use Thelia\Model\ProductSaleElementsQuery;
|
||||
use Propel\Runtime\ActiveQuery\PropelQuery;
|
||||
use Thelia\Core\Event\Product\ProductDeleteCategoryEvent;
|
||||
use Thelia\Core\Event\Product\ProductAddCategoryEvent;
|
||||
use Thelia\Model\AttributeAvQuery;
|
||||
@@ -181,8 +175,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
return $this->genericUpdatePosition(ProductQuery::create(), $event);
|
||||
}
|
||||
|
||||
public function addContent(ProductAddContentEvent $event) {
|
||||
|
||||
public function addContent(ProductAddContentEvent $event)
|
||||
{
|
||||
if (ProductAssociatedContentQuery::create()
|
||||
->filterByContentId($event->getContentId())
|
||||
->filterByProduct($event->getProduct())->count() <= 0) {
|
||||
@@ -198,8 +192,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function removeContent(ProductDeleteContentEvent $event) {
|
||||
|
||||
public function removeContent(ProductDeleteContentEvent $event)
|
||||
{
|
||||
$content = ProductAssociatedContentQuery::create()
|
||||
->filterByContentId($event->getContentId())
|
||||
->filterByProduct($event->getProduct())->findOne()
|
||||
@@ -212,8 +206,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
;
|
||||
}
|
||||
|
||||
public function addCategory(ProductAddCategoryEvent $event) {
|
||||
|
||||
public function addCategory(ProductAddCategoryEvent $event)
|
||||
{
|
||||
if (ProductCategoryQuery::create()
|
||||
->filterByProduct($event->getProduct())
|
||||
->filterByCategoryId($event->getCategoryId())
|
||||
@@ -230,8 +224,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function removeCategory(ProductDeleteCategoryEvent $event) {
|
||||
|
||||
public function removeCategory(ProductDeleteCategoryEvent $event)
|
||||
{
|
||||
$productCategory = ProductCategoryQuery::create()
|
||||
->filterByProduct($event->getProduct())
|
||||
->filterByCategoryId($event->getCategoryId())
|
||||
@@ -240,8 +234,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
if ($productCategory != null) $productCategory->delete();
|
||||
}
|
||||
|
||||
public function addAccessory(ProductAddAccessoryEvent $event) {
|
||||
|
||||
public function addAccessory(ProductAddAccessoryEvent $event)
|
||||
{
|
||||
if (AccessoryQuery::create()
|
||||
->filterByAccessory($event->getAccessoryId())
|
||||
->filterByProductId($event->getProduct()->getId())->count() <= 0) {
|
||||
@@ -257,8 +251,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function removeAccessory(ProductDeleteAccessoryEvent $event) {
|
||||
|
||||
public function removeAccessory(ProductDeleteAccessoryEvent $event)
|
||||
{
|
||||
$accessory = AccessoryQuery::create()
|
||||
->filterByAccessory($event->getAccessoryId())
|
||||
->filterByProductId($event->getProduct()->getId())->findOne()
|
||||
@@ -271,8 +265,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
;
|
||||
}
|
||||
|
||||
public function setProductTemplate(ProductSetTemplateEvent $event) {
|
||||
|
||||
public function setProductTemplate(ProductSetTemplateEvent $event)
|
||||
{
|
||||
$product = $event->getProduct();
|
||||
|
||||
// Delete all product feature relations
|
||||
@@ -310,8 +304,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
return $this->genericUpdatePosition(ProductAssociatedContentQuery::create(), $event);
|
||||
}
|
||||
|
||||
public function updateFeatureProductValue(FeatureProductUpdateEvent $event) {
|
||||
|
||||
public function updateFeatureProductValue(FeatureProductUpdateEvent $event)
|
||||
{
|
||||
// If the feature is not free text, it may have one ore more values.
|
||||
// If the value exists, we do not change it
|
||||
// If the value does not exists, we create it.
|
||||
@@ -343,8 +337,7 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
if ($event->getIsTextValue() == true) {
|
||||
$featureProduct->setFreeTextValue($event->getFeatureValue());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$featureProduct->setFeatureAvId($event->getFeatureValue());
|
||||
}
|
||||
|
||||
@@ -353,8 +346,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
$event->setFeatureProduct($featureProduct);
|
||||
}
|
||||
|
||||
public function deleteFeatureProductValue(FeatureProductDeleteEvent $event) {
|
||||
|
||||
public function deleteFeatureProductValue(FeatureProductDeleteEvent $event)
|
||||
{
|
||||
$featureProduct = FeatureProductQuery::create()
|
||||
->filterByProductId($event->getProductId())
|
||||
->filterByFeatureId($event->getFeatureId())
|
||||
@@ -362,8 +355,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
;
|
||||
}
|
||||
|
||||
public function createProductCombination(ProductCreateCombinationEvent $event) {
|
||||
|
||||
public function createProductCombination(ProductCreateCombinationEvent $event)
|
||||
{
|
||||
$con = Propel::getWriteConnection(ProductTableMap::DATABASE_NAME);
|
||||
|
||||
$con->beginTransaction();
|
||||
@@ -399,7 +392,7 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
if (count($combinationAttributes) > 0) {
|
||||
|
||||
foreach($combinationAttributes as $attributeAvId) {
|
||||
foreach ($combinationAttributes as $attributeAvId) {
|
||||
|
||||
$attributeAv = AttributeAvQuery::create()->findPk($attributeAvId);
|
||||
|
||||
@@ -417,8 +410,7 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
// Store all the stuff !
|
||||
$con->commit();
|
||||
}
|
||||
catch(\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
|
||||
$con->rollback();
|
||||
|
||||
@@ -426,8 +418,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteProductCombination(ProductDeleteCombinationEvent $event) {
|
||||
|
||||
public function deleteProductCombination(ProductDeleteCombinationEvent $event)
|
||||
{
|
||||
if (null !== $pse = ProductSaleElementsQuery::create()->findPk($event->getProductSaleElementId())) {
|
||||
$pse->delete();
|
||||
}
|
||||
|
||||
@@ -33,14 +33,7 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Template\TemplateUpdateEvent;
|
||||
use Thelia\Core\Event\Template\TemplateCreateEvent;
|
||||
use Thelia\Core\Event\Template\TemplateDeleteEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\TemplateAv;
|
||||
use Thelia\Model\TemplateAvQuery;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Core\Event\Category\CategoryEvent;
|
||||
use Thelia\Core\Event\Template\TemplateEvent;
|
||||
use Thelia\Model\TemplateTemplate;
|
||||
use Thelia\Model\TemplateTemplateQuery;
|
||||
use Thelia\Model\ProductQuery;
|
||||
use Thelia\Core\Event\Template\TemplateAddAttributeEvent;
|
||||
use Thelia\Core\Event\Template\TemplateDeleteAttributeEvent;
|
||||
@@ -121,8 +114,8 @@ class Template extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function addAttribute(TemplateAddAttributeEvent $event) {
|
||||
|
||||
public function addAttribute(TemplateAddAttributeEvent $event)
|
||||
{
|
||||
if (null === AttributeTemplateQuery::create()->filterByAttributeId($event->getAttributeId())->filterByTemplate($event->getTemplate())->findOne()) {
|
||||
|
||||
$attribute_template = new AttributeTemplate();
|
||||
@@ -155,8 +148,8 @@ class Template extends BaseAction implements EventSubscriberInterface
|
||||
return $this->genericUpdatePosition(FeatureTemplateQuery::create(), $event);
|
||||
}
|
||||
|
||||
public function deleteAttribute(TemplateDeleteAttributeEvent $event) {
|
||||
|
||||
public function deleteAttribute(TemplateDeleteAttributeEvent $event)
|
||||
{
|
||||
$attribute_template = AttributeTemplateQuery::create()
|
||||
->filterByAttributeId($event->getAttributeId())
|
||||
->filterByTemplate($event->getTemplate())->findOne()
|
||||
@@ -165,8 +158,8 @@ class Template extends BaseAction implements EventSubscriberInterface
|
||||
if ($attribute_template !== null) $attribute_template->delete();
|
||||
}
|
||||
|
||||
public function addFeature(TemplateAddFeatureEvent $event) {
|
||||
|
||||
public function addFeature(TemplateAddFeatureEvent $event)
|
||||
{
|
||||
if (null === FeatureTemplateQuery::create()->filterByFeatureId($event->getFeatureId())->filterByTemplate($event->getTemplate())->findOne()) {
|
||||
|
||||
$feature_template = new FeatureTemplate();
|
||||
@@ -179,8 +172,8 @@ class Template extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteFeature(TemplateDeleteFeatureEvent $event) {
|
||||
|
||||
public function deleteFeature(TemplateDeleteFeatureEvent $event)
|
||||
{
|
||||
$feature_template = FeatureTemplateQuery::create()
|
||||
->filterByFeatureId($event->getFeatureId())
|
||||
->filterByTemplate($event->getTemplate())->findOne()
|
||||
|
||||
@@ -73,10 +73,11 @@ class CacheClear extends ContainerAwareCommand
|
||||
|
||||
try {
|
||||
$directoryBrowser = new \DirectoryIterator($dir);
|
||||
} catch(\UnexpectedValueException $e) {
|
||||
} catch (\UnexpectedValueException $e) {
|
||||
// throws same exception code for does not exist and permission denied ...
|
||||
if(!file_exists($dir)) {
|
||||
if (!file_exists($dir)) {
|
||||
$output->writeln(sprintf("<info>%s cache dir already clear</info>", $dir));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,12 +25,9 @@ namespace Thelia\Command;
|
||||
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\Filesystem\Exception\IOException;
|
||||
|
||||
use Thelia\Command\ContainerAwareCommand;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
|
||||
/**
|
||||
@@ -62,7 +59,7 @@ class ModuleActivateCommand extends BaseModuleGenerate
|
||||
|
||||
$module = ModuleQuery::create()->findOneByCode($moduleCode);
|
||||
|
||||
if(null === $module) {
|
||||
if (null === $module) {
|
||||
throw new \RuntimeException(sprintf("module %s not found", $moduleCode));
|
||||
}
|
||||
|
||||
@@ -74,7 +71,7 @@ class ModuleActivateCommand extends BaseModuleGenerate
|
||||
$moduleInstance = $moduleReflection->newInstance();
|
||||
|
||||
$moduleInstance->activate();
|
||||
} catch(\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
throw new \RuntimeException(sprintf("Activation fail with Exception : [%d] %s", $e->getCode(), $e->getMessage()));
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class ReloadDatabaseCommand extends BaseModuleGenerate
|
||||
|
||||
$tables = $connection->query("SHOW TABLES");
|
||||
$connection->query("SET FOREIGN_KEY_CHECKS = 0");
|
||||
foreach($tables as $table) {
|
||||
foreach ($tables as $table) {
|
||||
$connection->query(sprintf("DROP TABLE `%s`", $table[0]));
|
||||
}
|
||||
$connection->query("SET FOREIGN_KEY_CHECKS = 1");
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Core\Event\ToggleVisibilityEvent;
|
||||
|
||||
/**
|
||||
* An abstract CRUD controller for Thelia ADMIN, to manage basic CRUD operations on a givent object.
|
||||
@@ -53,7 +52,6 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
protected $visibilityToggleEventIdentifier;
|
||||
protected $changePositionEventIdentifier;
|
||||
|
||||
|
||||
/**
|
||||
* @param string $objectName the lower case object name. Example. "message"
|
||||
*
|
||||
@@ -109,94 +107,93 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
/**
|
||||
* Return the creation form for this object
|
||||
*/
|
||||
protected abstract function getCreationForm();
|
||||
abstract protected function getCreationForm();
|
||||
|
||||
/**
|
||||
* Return the update form for this object
|
||||
*/
|
||||
protected abstract function getUpdateForm();
|
||||
abstract protected function getUpdateForm();
|
||||
|
||||
/**
|
||||
* Hydrate the update form for this object, before passing it to the update template
|
||||
*
|
||||
* @param unknown $object
|
||||
*/
|
||||
protected abstract function hydrateObjectForm($object);
|
||||
abstract protected function hydrateObjectForm($object);
|
||||
|
||||
/**
|
||||
* Creates the creation event with the provided form data
|
||||
*
|
||||
* @param unknown $formData
|
||||
*/
|
||||
protected abstract function getCreationEvent($formData);
|
||||
abstract protected function getCreationEvent($formData);
|
||||
|
||||
/**
|
||||
* Creates the update event with the provided form data
|
||||
*
|
||||
* @param unknown $formData
|
||||
*/
|
||||
protected abstract function getUpdateEvent($formData);
|
||||
abstract protected function getUpdateEvent($formData);
|
||||
|
||||
/**
|
||||
* Creates the delete event with the provided form data
|
||||
*/
|
||||
protected abstract function getDeleteEvent();
|
||||
abstract protected function getDeleteEvent();
|
||||
|
||||
/**
|
||||
* Return true if the event contains the object, e.g. the action has updated the object in the event.
|
||||
*
|
||||
* @param unknown $event
|
||||
*/
|
||||
protected abstract function eventContainsObject($event);
|
||||
abstract protected function eventContainsObject($event);
|
||||
|
||||
/**
|
||||
* Get the created object from an event.
|
||||
*
|
||||
* @param unknown $createEvent
|
||||
*/
|
||||
protected abstract function getObjectFromEvent($event);
|
||||
abstract protected function getObjectFromEvent($event);
|
||||
|
||||
/**
|
||||
* Load an existing object from the database
|
||||
*/
|
||||
protected abstract function getExistingObject();
|
||||
abstract protected function getExistingObject();
|
||||
|
||||
/**
|
||||
* Returns the object label form the object event (name, title, etc.)
|
||||
*
|
||||
* @param unknown $object
|
||||
*/
|
||||
protected abstract function getObjectLabel($object);
|
||||
abstract protected function getObjectLabel($object);
|
||||
|
||||
/**
|
||||
* Returns the object ID from the object
|
||||
*
|
||||
* @param unknown $object
|
||||
*/
|
||||
protected abstract function getObjectId($object);
|
||||
abstract protected function getObjectId($object);
|
||||
|
||||
/**
|
||||
* Render the main list template
|
||||
*
|
||||
* @param unknown $currentOrder, if any, null otherwise.
|
||||
*/
|
||||
protected abstract function renderListTemplate($currentOrder);
|
||||
abstract protected function renderListTemplate($currentOrder);
|
||||
|
||||
/**
|
||||
* Render the edition template
|
||||
*/
|
||||
protected abstract function renderEditionTemplate();
|
||||
abstract protected function renderEditionTemplate();
|
||||
|
||||
/**
|
||||
* Redirect to the edition template
|
||||
*/
|
||||
protected abstract function redirectToEditionTemplate();
|
||||
abstract protected function redirectToEditionTemplate();
|
||||
|
||||
/**
|
||||
* Redirect to the list template
|
||||
*/
|
||||
protected abstract function redirectToListTemplate();
|
||||
|
||||
abstract protected function redirectToListTemplate();
|
||||
|
||||
protected function createUpdatePositionEvent($positionChangeMode, $positionValue)
|
||||
{
|
||||
@@ -282,7 +279,6 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth($this->viewPermissionIdentifier)) return $response;
|
||||
|
||||
return $this->renderList();
|
||||
}
|
||||
|
||||
@@ -329,16 +325,13 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($successUrl);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
catch (FormValidationException $ex) {
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$error_msg = $ex->getMessage();
|
||||
}
|
||||
@@ -423,16 +416,13 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($changeForm->getSuccessUrl());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
catch (FormValidationException $ex) {
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$error_msg = $ex->getMessage();
|
||||
}
|
||||
@@ -469,8 +459,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
$event = $this->createUpdatePositionEvent($mode, $position);
|
||||
|
||||
$this->dispatch($this->changePositionEventIdentifier, $event);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
@@ -479,14 +468,13 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
|
||||
if ($response == null) {
|
||||
$this->redirectToListTemplate();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
protected function genericUpdatePositionAction($object, $eventName, $doFinalRedirect = true) {
|
||||
|
||||
protected function genericUpdatePositionAction($object, $eventName, $doFinalRedirect = true)
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
@@ -507,8 +495,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
$event = new UpdatePositionEvent($object->getId(), $mode, $position);
|
||||
|
||||
$this->dispatch($eventName, $event);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
|
||||
@@ -23,10 +23,6 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Security\Authentication\AdminTokenAuthenticator;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Core\Security\Exception\TokenAuthenticationException;
|
||||
|
||||
class AdminController extends BaseAdminController
|
||||
{
|
||||
public function indexAction()
|
||||
|
||||
@@ -113,7 +113,7 @@ class AttributeController extends AbstractCrudController
|
||||
|
||||
if ($attr_values !== null) {
|
||||
|
||||
foreach($attr_values as $id => $value) {
|
||||
foreach ($attr_values as $id => $value) {
|
||||
|
||||
$event = new AttributeAvUpdateEvent($id);
|
||||
|
||||
@@ -168,7 +168,7 @@ class AttributeController extends AbstractCrudController
|
||||
|
||||
$attr_array = array();
|
||||
|
||||
foreach($attr_av_list as $attr_av) {
|
||||
foreach ($attr_av_list as $attr_av) {
|
||||
$attr_array[$attr_av->getId()] = $attr_av->getTitle();
|
||||
}
|
||||
|
||||
@@ -262,8 +262,7 @@ class AttributeController extends AbstractCrudController
|
||||
|
||||
$this->dispatch($eventType, $event);
|
||||
}
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
|
||||
@@ -293,7 +293,6 @@ class BaseAdminController extends BaseController
|
||||
return $this->getCurrentEditionLang()->getLocale();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the current list order identifier for a given object name,
|
||||
* updating in using the current request.
|
||||
@@ -305,8 +304,8 @@ class BaseAdminController extends BaseController
|
||||
*
|
||||
* @return String the current liste order.
|
||||
*/
|
||||
protected function getListOrderFromSession($objectName, $requestParameterName, $defaultListOrder, $updateSession = true) {
|
||||
|
||||
protected function getListOrderFromSession($objectName, $requestParameterName, $defaultListOrder, $updateSession = true)
|
||||
{
|
||||
$order = $defaultListOrder;
|
||||
|
||||
$orderSessionIdentifier = sprintf("admin.%s.currentListOrder", $objectName);
|
||||
@@ -318,7 +317,6 @@ class BaseAdminController extends BaseController
|
||||
);
|
||||
|
||||
if ($updateSession) $this->getSession()->set($orderSessionIdentifier, $order);
|
||||
|
||||
return $order;
|
||||
}
|
||||
|
||||
@@ -353,8 +351,8 @@ class BaseAdminController extends BaseController
|
||||
/** Clear the remember me cookie.
|
||||
*
|
||||
*/
|
||||
protected function clearRememberMeCookie() {
|
||||
|
||||
protected function clearRememberMeCookie()
|
||||
{
|
||||
$ctp = new CookieTokenProvider();
|
||||
|
||||
$cookieName = ConfigQuery::read('admin_remember_me_cookie_name', 'armcn');
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Core\Event\Category\CategoryDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Category\CategoryUpdateEvent;
|
||||
@@ -36,7 +35,6 @@ use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Core\Event\Category\CategoryToggleVisibilityEvent;
|
||||
use Thelia\Core\Event\Category\CategoryDeleteContentEvent;
|
||||
use Thelia\Core\Event\Category\CategoryAddContentEvent;
|
||||
use Thelia\Model\CategoryAssociatedContent;
|
||||
use Thelia\Model\FolderQuery;
|
||||
use Thelia\Model\ContentQuery;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
@@ -49,7 +47,8 @@ use Thelia\Model\CategoryAssociatedContentQuery;
|
||||
*/
|
||||
class CategoryController extends AbstractCrudController
|
||||
{
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
'category',
|
||||
'manual',
|
||||
@@ -68,15 +67,18 @@ class CategoryController extends AbstractCrudController
|
||||
);
|
||||
}
|
||||
|
||||
protected function getCreationForm() {
|
||||
protected function getCreationForm()
|
||||
{
|
||||
return new CategoryCreationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getUpdateForm() {
|
||||
protected function getUpdateForm()
|
||||
{
|
||||
return new CategoryModificationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getCreationEvent($formData) {
|
||||
protected function getCreationEvent($formData)
|
||||
{
|
||||
$createEvent = new CategoryCreateEvent();
|
||||
|
||||
$createEvent
|
||||
@@ -89,7 +91,8 @@ class CategoryController extends AbstractCrudController
|
||||
return $createEvent;
|
||||
}
|
||||
|
||||
protected function getUpdateEvent($formData) {
|
||||
protected function getUpdateEvent($formData)
|
||||
{
|
||||
$changeEvent = new CategoryUpdateEvent($formData['id']);
|
||||
|
||||
// Create and dispatch the change event
|
||||
@@ -107,8 +110,8 @@ class CategoryController extends AbstractCrudController
|
||||
return $changeEvent;
|
||||
}
|
||||
|
||||
protected function createUpdatePositionEvent($positionChangeMode, $positionValue) {
|
||||
|
||||
protected function createUpdatePositionEvent($positionChangeMode, $positionValue)
|
||||
{
|
||||
return new UpdatePositionEvent(
|
||||
$this->getRequest()->get('category_id', null),
|
||||
$positionChangeMode,
|
||||
@@ -116,16 +119,18 @@ class CategoryController extends AbstractCrudController
|
||||
);
|
||||
}
|
||||
|
||||
protected function getDeleteEvent() {
|
||||
protected function getDeleteEvent()
|
||||
{
|
||||
return new CategoryDeleteEvent($this->getRequest()->get('category_id', 0));
|
||||
}
|
||||
|
||||
protected function eventContainsObject($event) {
|
||||
protected function eventContainsObject($event)
|
||||
{
|
||||
return $event->hasCategory();
|
||||
}
|
||||
|
||||
protected function hydrateObjectForm($object) {
|
||||
|
||||
protected function hydrateObjectForm($object)
|
||||
{
|
||||
// Prepare the data that will hydrate the form
|
||||
$data = array(
|
||||
'id' => $object->getId(),
|
||||
@@ -143,21 +148,25 @@ class CategoryController extends AbstractCrudController
|
||||
return new CategoryModificationForm($this->getRequest(), "form", $data);
|
||||
}
|
||||
|
||||
protected function getObjectFromEvent($event) {
|
||||
protected function getObjectFromEvent($event)
|
||||
{
|
||||
return $event->hasCategory() ? $event->getCategory() : null;
|
||||
}
|
||||
|
||||
protected function getExistingObject() {
|
||||
protected function getExistingObject()
|
||||
{
|
||||
return CategoryQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->findOneById($this->getRequest()->get('category_id', 0));
|
||||
}
|
||||
|
||||
protected function getObjectLabel($object) {
|
||||
protected function getObjectLabel($object)
|
||||
{
|
||||
return $object->getTitle();
|
||||
}
|
||||
|
||||
protected function getObjectId($object) {
|
||||
protected function getObjectId($object)
|
||||
{
|
||||
return $object->getId();
|
||||
}
|
||||
|
||||
@@ -170,8 +179,8 @@ class CategoryController extends AbstractCrudController
|
||||
);
|
||||
}
|
||||
|
||||
protected function renderListTemplate($currentOrder) {
|
||||
|
||||
protected function renderListTemplate($currentOrder)
|
||||
{
|
||||
// Get product order
|
||||
$product_order = $this->getListOrderFromSession('product', 'product_order', 'manual');
|
||||
|
||||
@@ -183,19 +192,21 @@ class CategoryController extends AbstractCrudController
|
||||
));
|
||||
}
|
||||
|
||||
protected function redirectToListTemplate() {
|
||||
protected function redirectToListTemplate()
|
||||
{
|
||||
$this->redirectToRoute(
|
||||
'admin.categories.default',
|
||||
array('category_id' => $this->getRequest()->get('category_id', 0))
|
||||
);
|
||||
}
|
||||
|
||||
protected function renderEditionTemplate() {
|
||||
|
||||
protected function renderEditionTemplate()
|
||||
{
|
||||
return $this->render('category-edit', $this->getEditionArguments());
|
||||
}
|
||||
|
||||
protected function redirectToEditionTemplate() {
|
||||
protected function redirectToEditionTemplate()
|
||||
{
|
||||
$this->redirectToRoute("admin.categories.update", $this->getEditionArguments());
|
||||
}
|
||||
|
||||
@@ -257,8 +268,8 @@ class CategoryController extends AbstractCrudController
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getAvailableRelatedContentAction($categoryId, $folderId) {
|
||||
|
||||
public function getAvailableRelatedContentAction($categoryId, $folderId)
|
||||
{
|
||||
$result = array();
|
||||
|
||||
$folders = FolderQuery::create()->filterById($folderId)->find();
|
||||
@@ -273,7 +284,7 @@ class CategoryController extends AbstractCrudController
|
||||
;
|
||||
|
||||
if ($list !== null) {
|
||||
foreach($list as $item) {
|
||||
foreach ($list as $item) {
|
||||
$result[] = array('id' => $item->getId(), 'title' => $item->getTitle());
|
||||
}
|
||||
}
|
||||
@@ -282,8 +293,8 @@ class CategoryController extends AbstractCrudController
|
||||
return $this->jsonResponse(json_encode($result));
|
||||
}
|
||||
|
||||
public function addRelatedContentAction() {
|
||||
|
||||
public function addRelatedContentAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
||||
|
||||
@@ -298,8 +309,7 @@ class CategoryController extends AbstractCrudController
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::CATEGORY_ADD_CONTENT, $event);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
@@ -341,8 +351,8 @@ class CategoryController extends AbstractCrudController
|
||||
$this->redirectToEditionTemplate();
|
||||
}
|
||||
|
||||
public function deleteRelatedContentAction() {
|
||||
|
||||
public function deleteRelatedContentAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
||||
|
||||
@@ -357,8 +367,7 @@ class CategoryController extends AbstractCrudController
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::CATEGORY_REMOVE_CONTENT, $event);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ use Thelia\Core\Event\Config\ConfigCreateEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Form\ConfigModificationForm;
|
||||
use Thelia\Form\ConfigCreationForm;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
|
||||
/**
|
||||
* Manages variables
|
||||
@@ -39,7 +38,8 @@ use Thelia\Core\Event\UpdatePositionEvent;
|
||||
*/
|
||||
class ConfigController extends AbstractCrudController
|
||||
{
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
'variable',
|
||||
'name',
|
||||
@@ -58,15 +58,18 @@ class ConfigController extends AbstractCrudController
|
||||
);
|
||||
}
|
||||
|
||||
protected function getCreationForm() {
|
||||
protected function getCreationForm()
|
||||
{
|
||||
return new ConfigCreationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getUpdateForm() {
|
||||
protected function getUpdateForm()
|
||||
{
|
||||
return new ConfigModificationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getCreationEvent($data) {
|
||||
protected function getCreationEvent($data)
|
||||
{
|
||||
$createEvent = new ConfigCreateEvent();
|
||||
|
||||
$createEvent
|
||||
@@ -78,11 +81,11 @@ class ConfigController extends AbstractCrudController
|
||||
->setSecured($data['secured'])
|
||||
;
|
||||
|
||||
|
||||
return $createEvent;
|
||||
}
|
||||
|
||||
protected function getUpdateEvent($data) {
|
||||
protected function getUpdateEvent($data)
|
||||
{
|
||||
$changeEvent = new ConfigUpdateEvent($data['id']);
|
||||
|
||||
// Create and dispatch the change event
|
||||
@@ -101,16 +104,18 @@ class ConfigController extends AbstractCrudController
|
||||
return $changeEvent;
|
||||
}
|
||||
|
||||
protected function getDeleteEvent() {
|
||||
protected function getDeleteEvent()
|
||||
{
|
||||
return new ConfigDeleteEvent($this->getRequest()->get('variable_id'));
|
||||
}
|
||||
|
||||
protected function eventContainsObject($event) {
|
||||
protected function eventContainsObject($event)
|
||||
{
|
||||
return $event->hasConfig();
|
||||
}
|
||||
|
||||
protected function hydrateObjectForm($object) {
|
||||
|
||||
protected function hydrateObjectForm($object)
|
||||
{
|
||||
// Prepare the data that will hydrate the form
|
||||
$data = array(
|
||||
'id' => $object->getId(),
|
||||
@@ -129,40 +134,48 @@ class ConfigController extends AbstractCrudController
|
||||
return new ConfigModificationForm($this->getRequest(), "form", $data);
|
||||
}
|
||||
|
||||
protected function getObjectFromEvent($event) {
|
||||
protected function getObjectFromEvent($event)
|
||||
{
|
||||
return $event->hasConfig() ? $event->getConfig() : null;
|
||||
}
|
||||
|
||||
protected function getExistingObject() {
|
||||
protected function getExistingObject()
|
||||
{
|
||||
return ConfigQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->findOneById($this->getRequest()->get('variable_id'));
|
||||
}
|
||||
|
||||
protected function getObjectLabel($object) {
|
||||
protected function getObjectLabel($object)
|
||||
{
|
||||
return $object->getName();
|
||||
}
|
||||
|
||||
protected function getObjectId($object) {
|
||||
protected function getObjectId($object)
|
||||
{
|
||||
return $object->getId();
|
||||
}
|
||||
|
||||
protected function renderListTemplate($currentOrder) {
|
||||
protected function renderListTemplate($currentOrder)
|
||||
{
|
||||
return $this->render('variables', array('order' => $currentOrder));
|
||||
}
|
||||
|
||||
protected function renderEditionTemplate() {
|
||||
protected function renderEditionTemplate()
|
||||
{
|
||||
return $this->render('variable-edit', array('variable_id' => $this->getRequest()->get('variable_id')));
|
||||
}
|
||||
|
||||
protected function redirectToEditionTemplate() {
|
||||
protected function redirectToEditionTemplate()
|
||||
{
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.variables.update",
|
||||
array('variable_id' => $this->getRequest()->get('variable_id'))
|
||||
);
|
||||
}
|
||||
|
||||
protected function redirectToListTemplate() {
|
||||
protected function redirectToListTemplate()
|
||||
{
|
||||
$this->redirectToRoute('admin.configuration.variables.default');
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ use Thelia\Form\ContentCreationForm;
|
||||
use Thelia\Form\ContentModificationForm;
|
||||
use Thelia\Model\ContentQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Class ContentController
|
||||
* @package Thelia\Controller\Admin
|
||||
@@ -212,10 +211,10 @@ class ContentController extends AbstractCrudController
|
||||
{
|
||||
$folderId = $this->getRequest()->get('folder_id', null);
|
||||
|
||||
if(null === $folderId) {
|
||||
if (null === $folderId) {
|
||||
$content = $this->getExistingObject();
|
||||
|
||||
if($content) {
|
||||
if ($content) {
|
||||
$folderId = $content->getDefaultFolderId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ use Thelia\Core\Event\Condition\ConditionCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Coupon\CouponConsumeEvent;
|
||||
use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Coupon\CouponManager;
|
||||
use Thelia\Coupon\ConditionCollection;
|
||||
use Thelia\Coupon\Type\CouponInterface;
|
||||
@@ -299,7 +298,6 @@ var_dump($coupon->getIsRemovingPostage());;
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Manage Coupons read display
|
||||
*
|
||||
@@ -613,6 +611,4 @@ var_dump($coupon->getIsRemovingPostage());;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,8 @@ use Thelia\Core\Event\UpdatePositionEvent;
|
||||
*/
|
||||
class CurrencyController extends AbstractCrudController
|
||||
{
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
'currency',
|
||||
'manual',
|
||||
@@ -58,15 +59,18 @@ class CurrencyController extends AbstractCrudController
|
||||
);
|
||||
}
|
||||
|
||||
protected function getCreationForm() {
|
||||
protected function getCreationForm()
|
||||
{
|
||||
return new CurrencyCreationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getUpdateForm() {
|
||||
protected function getUpdateForm()
|
||||
{
|
||||
return new CurrencyModificationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getCreationEvent($formData) {
|
||||
protected function getCreationEvent($formData)
|
||||
{
|
||||
$createEvent = new CurrencyCreateEvent();
|
||||
|
||||
$createEvent
|
||||
@@ -80,7 +84,8 @@ class CurrencyController extends AbstractCrudController
|
||||
return $createEvent;
|
||||
}
|
||||
|
||||
protected function getUpdateEvent($formData) {
|
||||
protected function getUpdateEvent($formData)
|
||||
{
|
||||
$changeEvent = new CurrencyUpdateEvent($formData['id']);
|
||||
|
||||
// Create and dispatch the change event
|
||||
@@ -95,8 +100,8 @@ class CurrencyController extends AbstractCrudController
|
||||
return $changeEvent;
|
||||
}
|
||||
|
||||
protected function createUpdatePositionEvent($positionChangeMode, $positionValue) {
|
||||
|
||||
protected function createUpdatePositionEvent($positionChangeMode, $positionValue)
|
||||
{
|
||||
return new UpdatePositionEvent(
|
||||
$this->getRequest()->get('currency_id', null),
|
||||
$positionChangeMode,
|
||||
@@ -104,16 +109,18 @@ class CurrencyController extends AbstractCrudController
|
||||
);
|
||||
}
|
||||
|
||||
protected function getDeleteEvent() {
|
||||
protected function getDeleteEvent()
|
||||
{
|
||||
return new CurrencyDeleteEvent($this->getRequest()->get('currency_id'));
|
||||
}
|
||||
|
||||
protected function eventContainsObject($event) {
|
||||
protected function eventContainsObject($event)
|
||||
{
|
||||
return $event->hasCurrency();
|
||||
}
|
||||
|
||||
protected function hydrateObjectForm($object) {
|
||||
|
||||
protected function hydrateObjectForm($object)
|
||||
{
|
||||
// Prepare the data that will hydrate the form
|
||||
$data = array(
|
||||
'id' => $object->getId(),
|
||||
@@ -128,44 +135,51 @@ class CurrencyController extends AbstractCrudController
|
||||
return new CurrencyModificationForm($this->getRequest(), "form", $data);
|
||||
}
|
||||
|
||||
protected function getObjectFromEvent($event) {
|
||||
protected function getObjectFromEvent($event)
|
||||
{
|
||||
return $event->hasCurrency() ? $event->getCurrency() : null;
|
||||
}
|
||||
|
||||
protected function getExistingObject() {
|
||||
protected function getExistingObject()
|
||||
{
|
||||
return CurrencyQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->findOneById($this->getRequest()->get('currency_id'));
|
||||
}
|
||||
|
||||
protected function getObjectLabel($object) {
|
||||
protected function getObjectLabel($object)
|
||||
{
|
||||
return $object->getName();
|
||||
}
|
||||
|
||||
protected function getObjectId($object) {
|
||||
protected function getObjectId($object)
|
||||
{
|
||||
return $object->getId();
|
||||
}
|
||||
|
||||
protected function renderListTemplate($currentOrder) {
|
||||
protected function renderListTemplate($currentOrder)
|
||||
{
|
||||
return $this->render('currencies', array('order' => $currentOrder));
|
||||
}
|
||||
|
||||
protected function renderEditionTemplate() {
|
||||
protected function renderEditionTemplate()
|
||||
{
|
||||
return $this->render('currency-edit', array('currency_id' => $this->getRequest()->get('currency_id')));
|
||||
}
|
||||
|
||||
protected function redirectToEditionTemplate() {
|
||||
protected function redirectToEditionTemplate()
|
||||
{
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.currencies.update",
|
||||
array('currency_id' => $this->getRequest()->get('currency_id'))
|
||||
);
|
||||
}
|
||||
|
||||
protected function redirectToListTemplate() {
|
||||
protected function redirectToListTemplate()
|
||||
{
|
||||
$this->redirectToRoute('admin.configuration.currencies.default');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update currencies rates
|
||||
*/
|
||||
|
||||
@@ -48,7 +48,6 @@ class CustomerController extends BaseAdminController
|
||||
public function viewAction($customer_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.customer.view")) return $response;
|
||||
|
||||
return $this->render("customer-edit", array(
|
||||
"customer_id" => $customer_id
|
||||
));
|
||||
@@ -71,7 +70,7 @@ class CustomerController extends BaseAdminController
|
||||
try {
|
||||
$customer = CustomerQuery::create()->findPk($customer_id);
|
||||
|
||||
if(null === $customer) {
|
||||
if (null === $customer) {
|
||||
throw new \InvalidArgumentException(sprintf("%d customer id does not exist", $customer_id));
|
||||
}
|
||||
|
||||
@@ -86,7 +85,7 @@ class CustomerController extends BaseAdminController
|
||||
|
||||
$this->adminLogAppend(sprintf("Customer with Ref %s (ID %d) modified", $customerUpdated->getRef() , $customerUpdated->getId()));
|
||||
|
||||
if($this->getRequest()->get("save_mode") == "close") {
|
||||
if ($this->getRequest()->get("save_mode") == "close") {
|
||||
$this->redirectToRoute("admin.customers");
|
||||
} else {
|
||||
$this->redirectSuccess($customerModification);
|
||||
@@ -126,14 +125,14 @@ class CustomerController extends BaseAdminController
|
||||
$customer_id = $this->getRequest()->get("customer_id");
|
||||
$customer = CustomerQuery::create()->findPk($customer_id);
|
||||
|
||||
if(null === $customer) {
|
||||
if (null === $customer) {
|
||||
throw new \InvalidArgumentException(Translator::getInstance("The customer you want to delete does not exist"));
|
||||
}
|
||||
|
||||
$event = new CustomerEvent($customer);
|
||||
|
||||
$this->dispatch(TheliaEvents::CUSTOMER_DELETEACCOUNT, $event);
|
||||
} catch(\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$message = $e->getMessage();
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ class FeatureController extends AbstractCrudController
|
||||
|
||||
if ($attr_values !== null) {
|
||||
|
||||
foreach($attr_values as $id => $value) {
|
||||
foreach ($attr_values as $id => $value) {
|
||||
|
||||
$event = new FeatureAvUpdateEvent($id);
|
||||
|
||||
@@ -168,7 +168,7 @@ class FeatureController extends AbstractCrudController
|
||||
|
||||
$attr_array = array();
|
||||
|
||||
foreach($attr_av_list as $attr_av) {
|
||||
foreach ($attr_av_list as $attr_av) {
|
||||
$attr_array[$attr_av->getId()] = $attr_av->getTitle();
|
||||
}
|
||||
|
||||
@@ -262,8 +262,7 @@ class FeatureController extends AbstractCrudController
|
||||
|
||||
$this->dispatch($eventType, $event);
|
||||
}
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
|
||||
@@ -25,15 +25,12 @@ namespace Thelia\Controller\Admin;
|
||||
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Thelia\Core\Event\Document\DocumentCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Document\DocumentDeleteEvent;
|
||||
use Thelia\Core\Event\Image\ImageCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Image\ImageDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Model\CategoryDocument;
|
||||
@@ -62,7 +59,6 @@ use Thelia\Tools\Rest\ResponseRest;
|
||||
class FileController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Manage how a image collection has to be saved
|
||||
*
|
||||
@@ -126,14 +122,12 @@ class FileController extends BaseAdminController
|
||||
$imageCreateOrUpdateEvent->setUploadedFile($fileBeingUploaded);
|
||||
$imageCreateOrUpdateEvent->setParentName($parentModel->getTitle());
|
||||
|
||||
|
||||
// Dispatch Event to the Action
|
||||
$this->dispatch(
|
||||
TheliaEvents::IMAGE_SAVE,
|
||||
$imageCreateOrUpdateEvent
|
||||
);
|
||||
|
||||
|
||||
return new ResponseRest(array('status' => true, 'message' => ''));
|
||||
}
|
||||
}
|
||||
@@ -192,14 +186,12 @@ class FileController extends BaseAdminController
|
||||
$documentCreateOrUpdateEvent->setUploadedFile($fileBeingUploaded);
|
||||
$documentCreateOrUpdateEvent->setParentName($parentModel->getTitle());
|
||||
|
||||
|
||||
// Dispatch Event to the Action
|
||||
$this->dispatch(
|
||||
TheliaEvents::DOCUMENT_SAVE,
|
||||
$documentCreateOrUpdateEvent
|
||||
);
|
||||
|
||||
|
||||
return new ResponseRest(array('status' => true, 'message' => ''));
|
||||
}
|
||||
}
|
||||
@@ -676,5 +668,4 @@ class FileController extends BaseAdminController
|
||||
return $documentCreateEvent;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -81,8 +81,8 @@ class FolderController extends AbstractCrudController
|
||||
*
|
||||
* @param \Thelia\Model\Folder $object
|
||||
*/
|
||||
protected function hydrateObjectForm($object) {
|
||||
|
||||
protected function hydrateObjectForm($object)
|
||||
{
|
||||
// Prepare the data that will hydrate the form
|
||||
$data = array(
|
||||
'id' => $object->getId(),
|
||||
@@ -162,8 +162,8 @@ class FolderController extends AbstractCrudController
|
||||
* @param $positionValue
|
||||
* @return UpdatePositionEvent|void
|
||||
*/
|
||||
protected function createUpdatePositionEvent($positionChangeMode, $positionValue) {
|
||||
|
||||
protected function createUpdatePositionEvent($positionChangeMode, $positionValue)
|
||||
{
|
||||
return new UpdatePositionEvent(
|
||||
$this->getRequest()->get('folder_id', null),
|
||||
$positionChangeMode,
|
||||
@@ -196,7 +196,8 @@ class FolderController extends AbstractCrudController
|
||||
/**
|
||||
* Load an existing object from the database
|
||||
*/
|
||||
protected function getExistingObject() {
|
||||
protected function getExistingObject()
|
||||
{
|
||||
return FolderQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->findOneById($this->getRequest()->get('folder_id', 0));
|
||||
@@ -207,7 +208,8 @@ class FolderController extends AbstractCrudController
|
||||
*
|
||||
* @param unknown $object
|
||||
*/
|
||||
protected function getObjectLabel($object) {
|
||||
protected function getObjectLabel($object)
|
||||
{
|
||||
return $object->getTitle();
|
||||
}
|
||||
|
||||
@@ -226,8 +228,8 @@ class FolderController extends AbstractCrudController
|
||||
*
|
||||
* @param unknown $currentOrder, if any, null otherwise.
|
||||
*/
|
||||
protected function renderListTemplate($currentOrder) {
|
||||
|
||||
protected function renderListTemplate($currentOrder)
|
||||
{
|
||||
// Get content order
|
||||
$content_order = $this->getListOrderFromSession('content', 'content_order', 'manual');
|
||||
|
||||
@@ -239,12 +241,11 @@ class FolderController extends AbstractCrudController
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render the edition template
|
||||
*/
|
||||
protected function renderEditionTemplate() {
|
||||
|
||||
protected function renderEditionTemplate()
|
||||
{
|
||||
return $this->render('folder-edit', $this->getEditionArguments());
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ class ModuleController extends BaseAdminController
|
||||
|
||||
public function updateAction($module_id)
|
||||
{
|
||||
|
||||
return $this->render("module-edit", array(
|
||||
"module_id" => $module_id
|
||||
));
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace Thelia\Controller\Admin;
|
||||
use Thelia\Core\Event\Order\OrderAddressEvent;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Form\OrderUpdateAddress;
|
||||
use Thelia\Model\Base\OrderAddressQuery;
|
||||
use Thelia\Model\OrderQuery;
|
||||
@@ -48,7 +47,6 @@ class OrderController extends BaseAdminController
|
||||
|
||||
public function viewAction($order_id)
|
||||
{
|
||||
|
||||
return $this->render("order-edit", array(
|
||||
"order_id" => $order_id
|
||||
));
|
||||
@@ -61,7 +59,7 @@ class OrderController extends BaseAdminController
|
||||
$message = null;
|
||||
|
||||
try {
|
||||
if($order_id !== null) {
|
||||
if ($order_id !== null) {
|
||||
$order_id = $order_id;
|
||||
} else {
|
||||
$order_id = $this->getRequest()->get("order_id");
|
||||
@@ -72,10 +70,10 @@ class OrderController extends BaseAdminController
|
||||
$statusId = $this->getRequest()->request->get("status_id");
|
||||
$status = OrderStatusQuery::create()->findPk($statusId);
|
||||
|
||||
if(null === $order) {
|
||||
if (null === $order) {
|
||||
throw new \InvalidArgumentException("The order you want to update status does not exist");
|
||||
}
|
||||
if(null === $status) {
|
||||
if (null === $status) {
|
||||
throw new \InvalidArgumentException("The status you want to set to the order does not exist");
|
||||
}
|
||||
|
||||
@@ -83,7 +81,7 @@ class OrderController extends BaseAdminController
|
||||
$event->setStatus($statusId);
|
||||
|
||||
$this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
|
||||
} catch(\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$message = $e->getMessage();
|
||||
}
|
||||
|
||||
@@ -95,7 +93,7 @@ class OrderController extends BaseAdminController
|
||||
|
||||
$browsedPage = $this->getRequest()->get("order_page");
|
||||
|
||||
if($browsedPage) {
|
||||
if ($browsedPage) {
|
||||
$params["order_page"] = $browsedPage;
|
||||
$this->redirectToRoute("admin.order.list", $params);
|
||||
} else {
|
||||
@@ -116,7 +114,7 @@ class OrderController extends BaseAdminController
|
||||
|
||||
$deliveryRef = $this->getRequest()->get("delivery_ref");
|
||||
|
||||
if(null === $order) {
|
||||
if (null === $order) {
|
||||
throw new \InvalidArgumentException("The order you want to update status does not exist");
|
||||
}
|
||||
|
||||
@@ -124,7 +122,7 @@ class OrderController extends BaseAdminController
|
||||
$event->setDeliveryRef($deliveryRef);
|
||||
|
||||
$this->dispatch(TheliaEvents::ORDER_UPDATE_DELIVERY_REF, $event);
|
||||
} catch(\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$message = $e->getMessage();
|
||||
}
|
||||
|
||||
@@ -151,7 +149,7 @@ class OrderController extends BaseAdminController
|
||||
try {
|
||||
$order = OrderQuery::create()->findPk($order_id);
|
||||
|
||||
if(null === $order) {
|
||||
if (null === $order) {
|
||||
throw new \InvalidArgumentException("The order you want to update does not exist");
|
||||
}
|
||||
|
||||
@@ -159,7 +157,7 @@ class OrderController extends BaseAdminController
|
||||
|
||||
$orderAddress = OrderAddressQuery::create()->findPk($form->get("id")->getData());
|
||||
|
||||
if($orderAddress->getId() !== $order->getInvoiceOrderAddressId() && $orderAddress->getId() !== $order->getDeliveryOrderAddressId()) {
|
||||
if ($orderAddress->getId() !== $order->getInvoiceOrderAddressId() && $orderAddress->getId() !== $order->getDeliveryOrderAddressId()) {
|
||||
throw new \InvalidArgumentException("The order address you want to update does not belong to the current order not exist");
|
||||
}
|
||||
|
||||
@@ -180,7 +178,7 @@ class OrderController extends BaseAdminController
|
||||
$event->setOrder($order);
|
||||
|
||||
$this->dispatch(TheliaEvents::ORDER_UPDATE_ADDRESS, $event);
|
||||
} catch(\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$message = $e->getMessage();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Core\Event\Product\ProductToggleVisibilityEvent;
|
||||
use Thelia\Core\Event\Product\ProductDeleteContentEvent;
|
||||
use Thelia\Core\Event\Product\ProductAddContentEvent;
|
||||
use Thelia\Model\ProductAssociatedContent;
|
||||
use Thelia\Model\FolderQuery;
|
||||
use Thelia\Model\ContentQuery;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
@@ -76,8 +75,8 @@ class ProductController extends AbstractCrudController
|
||||
/**
|
||||
* Attributes ajax tab loading
|
||||
*/
|
||||
public function loadAttributesAjaxTabAction() {
|
||||
|
||||
public function loadAttributesAjaxTabAction()
|
||||
{
|
||||
return $this->render(
|
||||
'ajax/product-attributes-tab',
|
||||
array(
|
||||
@@ -89,8 +88,8 @@ class ProductController extends AbstractCrudController
|
||||
/**
|
||||
* Related information ajax tab loading
|
||||
*/
|
||||
public function loadRelatedAjaxTabAction() {
|
||||
|
||||
public function loadRelatedAjaxTabAction()
|
||||
{
|
||||
return $this->render(
|
||||
'ajax/product-related-tab',
|
||||
array(
|
||||
@@ -229,7 +228,8 @@ class ProductController extends AbstractCrudController
|
||||
);
|
||||
}
|
||||
|
||||
protected function getCategoryId() {
|
||||
protected function getCategoryId()
|
||||
{
|
||||
// Trouver le category_id, soit depuis la reques, souit depuis le produit courant
|
||||
$category_id = $this->getRequest()->get('category_id', null);
|
||||
|
||||
@@ -340,7 +340,7 @@ class ProductController extends AbstractCrudController
|
||||
;
|
||||
|
||||
if ($list !== null) {
|
||||
foreach($list as $item) {
|
||||
foreach ($list as $item) {
|
||||
$result[] = array('id' => $item->getId(), 'title' => $item->getTitle());
|
||||
}
|
||||
}
|
||||
@@ -366,8 +366,7 @@ class ProductController extends AbstractCrudController
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::PRODUCT_ADD_CONTENT, $event);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
@@ -393,8 +392,7 @@ class ProductController extends AbstractCrudController
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::PRODUCT_REMOVE_CONTENT, $event);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
@@ -403,7 +401,6 @@ class ProductController extends AbstractCrudController
|
||||
$this->redirectToEditionTemplate();
|
||||
}
|
||||
|
||||
|
||||
// -- Accessories management ----------------------------------------------
|
||||
|
||||
public function getAvailableAccessoriesAction($productId, $categoryId)
|
||||
@@ -422,7 +419,7 @@ class ProductController extends AbstractCrudController
|
||||
;
|
||||
|
||||
if ($list !== null) {
|
||||
foreach($list as $item) {
|
||||
foreach ($list as $item) {
|
||||
$result[] = array('id' => $item->getId(), 'title' => $item->getTitle());
|
||||
}
|
||||
}
|
||||
@@ -447,8 +444,7 @@ class ProductController extends AbstractCrudController
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::PRODUCT_ADD_ACCESSORY, $event);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
@@ -473,8 +469,7 @@ class ProductController extends AbstractCrudController
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::PRODUCT_REMOVE_ACCESSORY, $event);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
@@ -514,7 +509,8 @@ class ProductController extends AbstractCrudController
|
||||
*
|
||||
* @param unknown $productId
|
||||
*/
|
||||
public function setProductTemplateAction($productId) {
|
||||
public function setProductTemplateAction($productId)
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth('admin.products.update')) return $response;
|
||||
|
||||
@@ -536,8 +532,8 @@ class ProductController extends AbstractCrudController
|
||||
/**
|
||||
* Update product attributes and features
|
||||
*/
|
||||
public function updateAttributesAndFeaturesAction($productId) {
|
||||
|
||||
public function updateAttributesAndFeaturesAction($productId)
|
||||
{
|
||||
$product = ProductQuery::create()->findPk($productId);
|
||||
|
||||
if ($product != null) {
|
||||
@@ -556,7 +552,7 @@ class ProductController extends AbstractCrudController
|
||||
// Update all features values, starting with feature av. values
|
||||
$featureValues = $this->getRequest()->get('feature_value', array());
|
||||
|
||||
foreach($featureValues as $featureId => $featureValueList) {
|
||||
foreach ($featureValues as $featureId => $featureValueList) {
|
||||
|
||||
// Delete all features av. for this feature.
|
||||
$event = new FeatureProductDeleteEvent($productId, $featureId);
|
||||
@@ -564,7 +560,7 @@ class ProductController extends AbstractCrudController
|
||||
$this->dispatch(TheliaEvents::PRODUCT_FEATURE_DELETE_VALUE, $event);
|
||||
|
||||
// Add then all selected values
|
||||
foreach($featureValueList as $featureValue) {
|
||||
foreach ($featureValueList as $featureValue) {
|
||||
$event = new FeatureProductUpdateEvent($productId, $featureId, $featureValue);
|
||||
|
||||
$this->dispatch(TheliaEvents::PRODUCT_FEATURE_UPDATE_VALUE, $event);
|
||||
@@ -576,7 +572,7 @@ class ProductController extends AbstractCrudController
|
||||
// Update then features text values
|
||||
$featureTextValues = $this->getRequest()->get('feature_text_value', array());
|
||||
|
||||
foreach($featureTextValues as $featureId => $featureValue) {
|
||||
foreach ($featureTextValues as $featureId => $featureValue) {
|
||||
|
||||
// considere empty text as empty feature value (e.g., we will delete it)
|
||||
if (empty($featureValue)) continue;
|
||||
@@ -589,7 +585,7 @@ class ProductController extends AbstractCrudController
|
||||
}
|
||||
|
||||
// Delete features which don't have any values
|
||||
foreach($allFeatures as $feature) {
|
||||
foreach ($allFeatures as $feature) {
|
||||
|
||||
if (! in_array($feature->getId(), $updatedFeatures)) {
|
||||
$event = new FeatureProductDeleteEvent($productId, $feature->getId());
|
||||
@@ -610,8 +606,8 @@ class ProductController extends AbstractCrudController
|
||||
$this->redirectToListTemplate();
|
||||
}
|
||||
|
||||
public function addAdditionalCategoryAction() {
|
||||
|
||||
public function addAdditionalCategoryAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
|
||||
|
||||
@@ -626,8 +622,7 @@ class ProductController extends AbstractCrudController
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::PRODUCT_ADD_CATEGORY, $event);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
@@ -636,8 +631,8 @@ class ProductController extends AbstractCrudController
|
||||
$this->redirectToEditionTemplate();
|
||||
}
|
||||
|
||||
public function deleteAdditionalCategoryAction() {
|
||||
|
||||
public function deleteAdditionalCategoryAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
|
||||
|
||||
@@ -652,8 +647,7 @@ class ProductController extends AbstractCrudController
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::PRODUCT_REMOVE_CATEGORY, $event);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
@@ -664,8 +658,8 @@ class ProductController extends AbstractCrudController
|
||||
|
||||
// -- Product combination management ---------------------------------------
|
||||
|
||||
public function getAttributeValuesAction($productId, $attributeId) {
|
||||
|
||||
public function getAttributeValuesAction($productId, $attributeId)
|
||||
{
|
||||
$result = array();
|
||||
|
||||
// Get attribute for this product
|
||||
@@ -680,7 +674,7 @@ class ProductController extends AbstractCrudController
|
||||
;
|
||||
|
||||
if ($values !== null) {
|
||||
foreach($values as $value) {
|
||||
foreach ($values as $value) {
|
||||
$result[] = array('id' => $value->getId(), 'title' => $value->getTitle());
|
||||
}
|
||||
}
|
||||
@@ -689,8 +683,8 @@ class ProductController extends AbstractCrudController
|
||||
return $this->jsonResponse(json_encode($result));
|
||||
}
|
||||
|
||||
public function addAttributeValueToCombinationAction($productId, $attributeAvId, $combination) {
|
||||
|
||||
public function addAttributeValueToCombinationAction($productId, $attributeAvId, $combination)
|
||||
{
|
||||
$result = array();
|
||||
|
||||
// Get attribute for this product
|
||||
@@ -734,8 +728,8 @@ class ProductController extends AbstractCrudController
|
||||
/**
|
||||
* A a new combination to a product
|
||||
*/
|
||||
public function addCombinationAction() {
|
||||
|
||||
public function addCombinationAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
|
||||
|
||||
@@ -747,8 +741,7 @@ class ProductController extends AbstractCrudController
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::PRODUCT_ADD_COMBINATION, $event);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
@@ -760,8 +753,8 @@ class ProductController extends AbstractCrudController
|
||||
/**
|
||||
* A a new combination to a product
|
||||
*/
|
||||
public function deleteCombinationAction() {
|
||||
|
||||
public function deleteCombinationAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
|
||||
|
||||
@@ -772,8 +765,7 @@ class ProductController extends AbstractCrudController
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::PRODUCT_DELETE_COMBINATION, $event);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
|
||||
@@ -31,9 +31,7 @@ use Thelia\Tools\URL;
|
||||
use Thelia\Tools\Redirect;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Security\Authentication\AdminTokenAuthenticator;
|
||||
use Thelia\Core\Security\UserProvider\TokenProvider;
|
||||
use Symfony\Component\HttpFoundation\Cookie;
|
||||
use Thelia\Core\Security\UserProvider\CookieTokenProvider;
|
||||
use Thelia\Core\Security\Exception\TokenAuthenticationException;
|
||||
|
||||
class SessionController extends BaseAdminController
|
||||
@@ -59,8 +57,7 @@ class SessionController extends BaseAdminController
|
||||
|
||||
// Render the home page
|
||||
return $this->render("home");
|
||||
}
|
||||
catch (TokenAuthenticationException $ex) {
|
||||
} catch (TokenAuthenticationException $ex) {
|
||||
$this->adminLogAppend("Token based authentication failed.");
|
||||
|
||||
// Clear the cookie
|
||||
|
||||
@@ -38,7 +38,6 @@ class ShippingConfigurationController extends BaseAdminController
|
||||
|
||||
public function updateAction($shipping_configuration_id)
|
||||
{
|
||||
|
||||
return $this->render("shipping-configuration-edit", array(
|
||||
"shipping_configuration_id" => $shipping_configuration_id
|
||||
));
|
||||
|
||||
@@ -38,7 +38,6 @@ class ShippingZoneController extends BaseAdminController
|
||||
|
||||
public function updateAction($shipping_zones_id)
|
||||
{
|
||||
|
||||
return $this->render("shipping-zones-edit", array(
|
||||
"shipping_zones_id" => $shipping_zones_id
|
||||
));
|
||||
|
||||
@@ -30,10 +30,6 @@ use Thelia\Core\Event\Template\TemplateCreateEvent;
|
||||
use Thelia\Model\TemplateQuery;
|
||||
use Thelia\Form\TemplateModificationForm;
|
||||
use Thelia\Form\TemplateCreationForm;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Model\TemplateAv;
|
||||
use Thelia\Model\TemplateAvQuery;
|
||||
use Thelia\Core\Event\Template\TemplateEvent;
|
||||
use Thelia\Core\Event\Template\TemplateDeleteAttributeEvent;
|
||||
use Thelia\Core\Event\Template\TemplateAddAttributeEvent;
|
||||
use Thelia\Core\Event\Template\TemplateAddFeatureEvent;
|
||||
@@ -41,7 +37,6 @@ use Thelia\Core\Event\Template\TemplateDeleteFeatureEvent;
|
||||
use Thelia\Model\FeatureTemplateQuery;
|
||||
use Thelia\Model\AttributeTemplateQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Manages product templates
|
||||
*
|
||||
@@ -102,7 +97,6 @@ class TemplateController extends AbstractCrudController
|
||||
;
|
||||
|
||||
// Add feature and attributes list
|
||||
|
||||
return $changeEvent;
|
||||
}
|
||||
|
||||
@@ -199,22 +193,24 @@ class TemplateController extends AbstractCrudController
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getAjaxFeaturesAction() {
|
||||
public function getAjaxFeaturesAction()
|
||||
{
|
||||
return $this->render(
|
||||
'ajax/template-feature-list',
|
||||
array('template_id' => $this->getRequest()->get('template_id'))
|
||||
);
|
||||
}
|
||||
|
||||
public function getAjaxAttributesAction() {
|
||||
public function getAjaxAttributesAction()
|
||||
{
|
||||
return $this->render(
|
||||
'ajax/template-attribute-list',
|
||||
array('template_id' => $this->getRequest()->get('template_id'))
|
||||
);
|
||||
}
|
||||
|
||||
public function addAttributeAction() {
|
||||
|
||||
public function addAttributeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.template.attribute.add")) return $response;
|
||||
|
||||
@@ -237,8 +233,8 @@ class TemplateController extends AbstractCrudController
|
||||
$this->redirectToEditionTemplate();
|
||||
}
|
||||
|
||||
public function deleteAttributeAction() {
|
||||
|
||||
public function deleteAttributeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.template.attribute.delete")) return $response;
|
||||
|
||||
@@ -257,8 +253,8 @@ class TemplateController extends AbstractCrudController
|
||||
$this->redirectToEditionTemplate();
|
||||
}
|
||||
|
||||
public function updateAttributePositionAction() {
|
||||
|
||||
public function updateAttributePositionAction()
|
||||
{
|
||||
// Find attribute_template
|
||||
$attributeTemplate = AttributeTemplateQuery::create()
|
||||
->filterByTemplateId($this->getRequest()->get('template_id', null))
|
||||
@@ -272,8 +268,8 @@ class TemplateController extends AbstractCrudController
|
||||
);
|
||||
}
|
||||
|
||||
public function addFeatureAction() {
|
||||
|
||||
public function addFeatureAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.template.feature.add")) return $response;
|
||||
|
||||
@@ -296,8 +292,8 @@ class TemplateController extends AbstractCrudController
|
||||
$this->redirectToEditionTemplate();
|
||||
}
|
||||
|
||||
public function deleteFeatureAction() {
|
||||
|
||||
public function deleteFeatureAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.template.feature.delete")) return $response;
|
||||
|
||||
@@ -316,8 +312,8 @@ class TemplateController extends AbstractCrudController
|
||||
$this->redirectToEditionTemplate();
|
||||
}
|
||||
|
||||
public function updateFeaturePositionAction() {
|
||||
|
||||
public function updateFeaturePositionAction()
|
||||
{
|
||||
// Find feature_template
|
||||
$featureTemplate = FeatureTemplateQuery::create()
|
||||
->filterByTemplateId($this->getRequest()->get('template_id', null))
|
||||
|
||||
@@ -286,7 +286,7 @@ class BaseController extends ContainerAware
|
||||
*/
|
||||
protected function checkXmlHttpRequest()
|
||||
{
|
||||
if(false === $this->getRequest()->isXmlHttpRequest() && false === $this->isDebug()) {
|
||||
if (false === $this->getRequest()->isXmlHttpRequest() && false === $this->isDebug()) {
|
||||
$this->accessDenied();
|
||||
}
|
||||
}
|
||||
@@ -300,6 +300,7 @@ class BaseController extends ContainerAware
|
||||
public function getMailer()
|
||||
{
|
||||
$mailer = $this->container->get('mailer');
|
||||
|
||||
return $mailer->getSwiftMailer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ use Thelia\Form\AddressUpdateForm;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\Customer;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
/**
|
||||
* Class AddressController
|
||||
@@ -51,10 +50,8 @@ class AddressController extends BaseFrontController
|
||||
$this->checkAuth();
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create controller.
|
||||
* Check if customer is logged in
|
||||
@@ -103,7 +100,7 @@ class AddressController extends BaseFrontController
|
||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||
$address = AddressQuery::create()->findPk($address_id);
|
||||
|
||||
if(!$address || $customer->getId() != $address->getCustomerId()) {
|
||||
if (!$address || $customer->getId() != $address->getCustomerId()) {
|
||||
$this->redirectToRoute("home");
|
||||
}
|
||||
|
||||
@@ -117,7 +114,6 @@ class AddressController extends BaseFrontController
|
||||
|
||||
$addressUpdate = new AddressUpdateForm($request);
|
||||
|
||||
|
||||
try {
|
||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||
|
||||
@@ -164,7 +160,7 @@ class AddressController extends BaseFrontController
|
||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||
$address = AddressQuery::create()->findPk($address_id);
|
||||
|
||||
if(!$address || $customer->getId() != $address->getCustomerId()) {
|
||||
if (!$address || $customer->getId() != $address->getCustomerId()) {
|
||||
$this->redirectToRoute("home");
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ class BaseFrontController extends BaseController
|
||||
|
||||
public function checkAuth()
|
||||
{
|
||||
if($this->getSecurityContext()->hasCustomerUser() === false) {
|
||||
if ($this->getSecurityContext()->hasCustomerUser() === false) {
|
||||
$this->redirectToRoute("customer.login.view");
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@ class BaseFrontController extends BaseController
|
||||
protected function checkCartNotEmpty()
|
||||
{
|
||||
$cart = $this->getSession()->getCart();
|
||||
if($cart===null || $cart->countCartItems() == 0) {
|
||||
if ($cart===null || $cart->countCartItems() == 0) {
|
||||
$this->redirectToRoute("cart.view");
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ class BaseFrontController extends BaseController
|
||||
protected function checkValidDelivery()
|
||||
{
|
||||
$order = $this->getSession()->getOrder();
|
||||
if(null === $order || null === $order->chosenDeliveryAddress || null === $order->getDeliveryModuleId() || null === AddressQuery::create()->findPk($order->chosenDeliveryAddress) || null === ModuleQuery::create()->findPk($order->getDeliveryModuleId())) {
|
||||
if (null === $order || null === $order->chosenDeliveryAddress || null === $order->getDeliveryModuleId() || null === AddressQuery::create()->findPk($order->chosenDeliveryAddress) || null === ModuleQuery::create()->findPk($order->getDeliveryModuleId())) {
|
||||
$this->redirectToRoute("order.delivery");
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@ class BaseFrontController extends BaseController
|
||||
protected function checkValidInvoice()
|
||||
{
|
||||
$order = $this->getSession()->getOrder();
|
||||
if(null === $order || null === $order->chosenInvoiceAddress || null === $order->getPaymentModuleId() || null === AddressQuery::create()->findPk($order->chosenInvoiceAddress) || null === ModuleQuery::create()->findPk($order->getPaymentModuleId())) {
|
||||
if (null === $order || null === $order->chosenInvoiceAddress || null === $order->getPaymentModuleId() || null === AddressQuery::create()->findPk($order->chosenInvoiceAddress) || null === ModuleQuery::create()->findPk($order->getPaymentModuleId())) {
|
||||
$this->redirectToRoute("order.invoice");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ class CustomerController extends BaseFrontController
|
||||
$this->processLogin($customerCreateEvent->getCustomer());
|
||||
|
||||
$cart = $this->getCart($this->getRequest());
|
||||
if($cart->getCartItems()->count() > 0) {
|
||||
if ($cart->getCartItems()->count() > 0) {
|
||||
$this->redirectToRoute("cart.view");
|
||||
} else {
|
||||
$this->redirectSuccess($customerCreation);
|
||||
|
||||
@@ -34,7 +34,6 @@ use Thelia\Log\Tlog;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\AreaDeliveryModuleQuery;
|
||||
use Thelia\Model\Base\OrderQuery;
|
||||
use Thelia\Model\CountryQuery;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
use Thelia\Model\Order;
|
||||
use Thelia\Tools\URL;
|
||||
@@ -69,7 +68,7 @@ class OrderController extends BaseFrontController
|
||||
|
||||
/* check that the delivery address belongs to the current customer */
|
||||
$deliveryAddress = AddressQuery::create()->findPk($deliveryAddressId);
|
||||
if($deliveryAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) {
|
||||
if ($deliveryAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) {
|
||||
throw new \Exception("Delivery address does not belong to the current customer");
|
||||
}
|
||||
|
||||
@@ -139,7 +138,7 @@ class OrderController extends BaseFrontController
|
||||
|
||||
/* check that the invoice address belongs to the current customer */
|
||||
$invoiceAddress = AddressQuery::create()->findPk($invoiceAddressId);
|
||||
if($invoiceAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) {
|
||||
if ($invoiceAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) {
|
||||
throw new \Exception("Invoice address does not belong to the current customer");
|
||||
}
|
||||
|
||||
@@ -193,7 +192,7 @@ class OrderController extends BaseFrontController
|
||||
|
||||
$placedOrder = $orderEvent->getPlacedOrder();
|
||||
|
||||
if(null !== $placedOrder && null !== $placedOrder->getId()) {
|
||||
if (null !== $placedOrder && null !== $placedOrder->getId()) {
|
||||
/* order has been placed */
|
||||
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute('order.placed', array('order_id' => $orderEvent->getPlacedOrder()->getId()))));
|
||||
} else {
|
||||
@@ -209,13 +208,13 @@ class OrderController extends BaseFrontController
|
||||
$this->getRequest()->attributes->get('order_id')
|
||||
);
|
||||
|
||||
if(null === $placedOrder) {
|
||||
if (null === $placedOrder) {
|
||||
throw new TheliaProcessException("No placed order", TheliaProcessException::NO_PLACED_ORDER, $placedOrder);
|
||||
}
|
||||
|
||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||
|
||||
if(null === $customer || $placedOrder->getCustomerId() !== $customer->getId()) {
|
||||
if (null === $customer || $placedOrder->getCustomerId() !== $customer->getId()) {
|
||||
throw new TheliaProcessException("Received placed order id does not belong to the current customer", TheliaProcessException::PLACED_ORDER_ID_BAD_CURRENT_CUSTOMER, $placedOrder);
|
||||
}
|
||||
|
||||
|
||||
@@ -244,8 +244,6 @@ class AddressCreateOrUpdateEvent extends ActionEvent
|
||||
return $this->isDefault;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param \Thelia\Model\Customer $customer
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Core\Event\Content;
|
||||
|
||||
|
||||
/**
|
||||
* Class ContentCreateEvent
|
||||
* @package Thelia\Core\Event\Content
|
||||
@@ -76,9 +75,6 @@ class ContentCreateEvent extends ContentEvent
|
||||
return $this->default_folder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param mixed $visible
|
||||
*
|
||||
@@ -119,6 +115,4 @@ class ContentCreateEvent extends ContentEvent
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Core\Event\Content;
|
||||
|
||||
|
||||
/**
|
||||
* Class ContentDeleteEvent
|
||||
* @package Thelia\Core\Event\Content
|
||||
@@ -35,7 +34,7 @@ class ContentDeleteEvent extends ContentEvent
|
||||
|
||||
protected $folder_id;
|
||||
|
||||
function __construct($content_id)
|
||||
public function __construct($content_id)
|
||||
{
|
||||
$this->content_id = $content_id;
|
||||
}
|
||||
@@ -70,5 +69,4 @@ class ContentDeleteEvent extends ContentEvent
|
||||
return $this->folder_id;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -25,7 +25,6 @@ namespace Thelia\Core\Event\Content;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
use Thelia\Model\Content;
|
||||
|
||||
|
||||
/**
|
||||
* Class ContentEvent
|
||||
* @package Thelia\Core\Event\Content
|
||||
@@ -38,7 +37,7 @@ class ContentEvent extends ActionEvent
|
||||
*/
|
||||
protected $content;
|
||||
|
||||
function __construct(Content $content = null)
|
||||
public function __construct(Content $content = null)
|
||||
{
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Core\Event\Content;
|
||||
|
||||
|
||||
/**
|
||||
* Class ContentToggleVisibilityEvent
|
||||
* @package Thelia\Core\Event\Content
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Core\Event\Content;
|
||||
|
||||
|
||||
/**
|
||||
* Class ContentUpdateEvent
|
||||
* @package Thelia\Core\Event\Content
|
||||
@@ -39,7 +38,7 @@ class ContentUpdateEvent extends ContentCreateEvent
|
||||
|
||||
protected $url;
|
||||
|
||||
function __construct($content_id)
|
||||
public function __construct($content_id)
|
||||
{
|
||||
$this->content_id = $content_id;
|
||||
}
|
||||
@@ -144,7 +143,4 @@ class ContentUpdateEvent extends ContentCreateEvent
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -214,5 +214,4 @@ class DocumentCreateOrUpdateEvent extends ActionEvent
|
||||
return $this->oldModelDocument;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -109,5 +109,4 @@ class DocumentDeleteEvent extends ActionEvent
|
||||
return $this->documentToDelete;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -24,13 +24,13 @@
|
||||
namespace Thelia\Core\Event\Folder;
|
||||
use Thelia\Core\Event\Folder\FolderEvent;
|
||||
|
||||
|
||||
/**
|
||||
* Class FolderCreateEvent
|
||||
* @package Thelia\Core\Event
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class FolderCreateEvent extends FolderEvent {
|
||||
class FolderCreateEvent extends FolderEvent
|
||||
{
|
||||
protected $title;
|
||||
protected $parent;
|
||||
protected $locale;
|
||||
@@ -117,5 +117,4 @@ class FolderCreateEvent extends FolderEvent {
|
||||
return $this->visible;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -24,14 +24,13 @@
|
||||
namespace Thelia\Core\Event\Folder;
|
||||
use Thelia\Core\Event\Folder\FolderEvent;
|
||||
|
||||
|
||||
/**
|
||||
* Class FolderDeleteEvent
|
||||
* @package Thelia\Core\Event
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class FolderDeleteEvent extends FolderEvent{
|
||||
|
||||
class FolderDeleteEvent extends FolderEvent
|
||||
{
|
||||
/**
|
||||
* @var int folder id
|
||||
*/
|
||||
@@ -40,7 +39,7 @@ class FolderDeleteEvent extends FolderEvent{
|
||||
/**
|
||||
* @param int $folder_id
|
||||
*/
|
||||
function __construct($folder_id)
|
||||
public function __construct($folder_id)
|
||||
{
|
||||
$this->folder_id = $folder_id;
|
||||
}
|
||||
@@ -61,5 +60,4 @@ class FolderDeleteEvent extends FolderEvent{
|
||||
return $this->folder_id;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -25,20 +25,19 @@ namespace Thelia\Core\Event\Folder;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
use Thelia\Model\Folder;
|
||||
|
||||
|
||||
/**
|
||||
* Class FolderEvent
|
||||
* @package Thelia\Core\Event
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class FolderEvent extends ActionEvent {
|
||||
|
||||
class FolderEvent extends ActionEvent
|
||||
{
|
||||
/**
|
||||
* @var \Thelia\Model\Folder
|
||||
*/
|
||||
protected $folder;
|
||||
|
||||
function __construct(Folder $folder = null)
|
||||
public function __construct(Folder $folder = null)
|
||||
{
|
||||
$this->folder = $folder;
|
||||
}
|
||||
|
||||
@@ -24,12 +24,11 @@
|
||||
namespace Thelia\Core\Event\Folder;
|
||||
use Thelia\Core\Event\Folder\FolderEvent;
|
||||
|
||||
|
||||
/**
|
||||
* Class FolderToggleVisibilityEvent
|
||||
* @package Thelia\Core\Event
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class FolderToggleVisibilityEvent extends FolderEvent {
|
||||
|
||||
class FolderToggleVisibilityEvent extends FolderEvent
|
||||
{
|
||||
}
|
||||
@@ -24,13 +24,13 @@
|
||||
namespace Thelia\Core\Event\Folder;
|
||||
use Thelia\Core\Event\Folder\FolderCreateEvent;
|
||||
|
||||
|
||||
/**
|
||||
* Class FolderUpdateEvent
|
||||
* @package Thelia\Core\Event
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class FolderUpdateEvent extends FolderCreateEvent {
|
||||
class FolderUpdateEvent extends FolderCreateEvent
|
||||
{
|
||||
protected $folder_id;
|
||||
|
||||
protected $chapo;
|
||||
@@ -39,7 +39,7 @@ class FolderUpdateEvent extends FolderCreateEvent {
|
||||
|
||||
protected $url;
|
||||
|
||||
function __construct($folder_id)
|
||||
public function __construct($folder_id)
|
||||
{
|
||||
$this->folder_id = $folder_id;
|
||||
}
|
||||
|
||||
@@ -23,14 +23,13 @@
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
|
||||
/**
|
||||
* Class GenerateRewrittenUrlEvent
|
||||
* @package Thelia\Core\Event
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class GenerateRewrittenUrlEvent extends ActionEvent {
|
||||
|
||||
class GenerateRewrittenUrlEvent extends ActionEvent
|
||||
{
|
||||
protected $object;
|
||||
protected $locale;
|
||||
|
||||
|
||||
@@ -210,5 +210,4 @@ class ImageCreateOrUpdateEvent extends ActionEvent
|
||||
return $this->oldModelImage;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -109,5 +109,4 @@ class ImageDeleteEvent extends ActionEvent
|
||||
return $this->imageToDelete;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -23,14 +23,13 @@
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
|
||||
/**
|
||||
* Class LostPasswordEvent
|
||||
* @package Thelia\Core\Event
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class LostPasswordEvent extends ActionEvent {
|
||||
|
||||
class LostPasswordEvent extends ActionEvent
|
||||
{
|
||||
protected $email;
|
||||
|
||||
public function __construct($email)
|
||||
@@ -46,6 +45,4 @@ class LostPasswordEvent extends ActionEvent {
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -23,13 +23,13 @@
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
|
||||
/**
|
||||
* Class MailTransporterEvent
|
||||
* @package Thelia\Core\Event
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class MailTransporterEvent extends ActionEvent {
|
||||
class MailTransporterEvent extends ActionEvent
|
||||
{
|
||||
/**
|
||||
* @var \Swift_Transport
|
||||
*/
|
||||
|
||||
@@ -46,6 +46,7 @@ class ProductCreateEvent extends ProductEvent
|
||||
public function setRef($ref)
|
||||
{
|
||||
$this->ref = $ref;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -57,6 +58,7 @@ class ProductCreateEvent extends ProductEvent
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -68,6 +70,7 @@ class ProductCreateEvent extends ProductEvent
|
||||
public function setLocale($locale)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -79,6 +82,7 @@ class ProductCreateEvent extends ProductEvent
|
||||
public function setDefaultCategory($default_category)
|
||||
{
|
||||
$this->default_category = $default_category;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -90,6 +94,7 @@ class ProductCreateEvent extends ProductEvent
|
||||
public function setVisible($visible)
|
||||
{
|
||||
$this->visible = $visible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -101,6 +106,7 @@ class ProductCreateEvent extends ProductEvent
|
||||
public function setBasePrice($basePrice)
|
||||
{
|
||||
$this->basePrice = $basePrice;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -112,6 +118,7 @@ class ProductCreateEvent extends ProductEvent
|
||||
public function setBaseWeight($baseWeight)
|
||||
{
|
||||
$this->baseWeight = $baseWeight;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -123,6 +130,7 @@ class ProductCreateEvent extends ProductEvent
|
||||
public function setTaxRuleId($taxRuleId)
|
||||
{
|
||||
$this->taxRuleId = $taxRuleId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -134,6 +142,7 @@ class ProductCreateEvent extends ProductEvent
|
||||
public function setCurrencyId($currencyId)
|
||||
{
|
||||
$this->currencyId = $currencyId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
namespace Thelia\Core\Event\Product;
|
||||
use Thelia\Core\Event\ProductEvent;
|
||||
use Thelia\Model\Product;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
|
||||
class ProductSetTemplateEvent extends ProductEvent
|
||||
{
|
||||
|
||||
@@ -57,6 +57,7 @@ class TemplateUpdateEvent extends TemplateCreateEvent
|
||||
public function setFeatureList($feature_list)
|
||||
{
|
||||
$this->feature_list = $feature_list;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -68,6 +69,7 @@ class TemplateUpdateEvent extends TemplateCreateEvent
|
||||
public function setAttributeList($attribute_list)
|
||||
{
|
||||
$this->attribute_list = $attribute_list;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +331,6 @@ final class TheliaEvents
|
||||
const ORDER_PRODUCT_BEFORE_CREATE = "action.orderProduct.beforeCreate";
|
||||
const ORDER_PRODUCT_AFTER_CREATE = "action.orderProduct.afterCreate";
|
||||
|
||||
|
||||
/**
|
||||
* Sent on image processing
|
||||
*/
|
||||
@@ -571,7 +570,6 @@ final class TheliaEvents
|
||||
const BEFORE_DELETEATTRIBUTE_AV = "action.before_deleteAttributeAv";
|
||||
const AFTER_DELETEATTRIBUTE_AV = "action.after_deleteAttributeAv";
|
||||
|
||||
|
||||
// -- Features values management ----------------------------------------
|
||||
|
||||
const FEATURE_AV_CREATE = "action.createFeatureAv";
|
||||
|
||||
@@ -100,7 +100,7 @@ class ViewListener implements EventSubscriberInterface
|
||||
// Redirect to the login template
|
||||
Redirect::exec($this->container->get('thelia.url.manager')->viewUrl($ex->getLoginTemplate()));
|
||||
} catch (OrderException $e) {
|
||||
switch($e->getCode()) {
|
||||
switch ($e->getCode()) {
|
||||
case OrderException::CART_EMPTY:
|
||||
// Redirect to the cart template
|
||||
Redirect::exec($this->container->get('router.chainRequest')->generate($e->cartRoute, $e->arguments, Router::ABSOLUTE_URL));
|
||||
|
||||
@@ -51,10 +51,10 @@ class Session extends BaseSession
|
||||
public function getLang($forceDefault = true)
|
||||
{
|
||||
$lang = $this->get("thelia.current.lang");
|
||||
if(null === $lang && $forceDefault)
|
||||
{
|
||||
if (null === $lang && $forceDefault) {
|
||||
$lang = Lang::getDefaultLanguage();
|
||||
}
|
||||
|
||||
return $lang;
|
||||
}
|
||||
|
||||
@@ -74,10 +74,10 @@ class Session extends BaseSession
|
||||
{
|
||||
$currency = $this->get("thelia.current.currency");
|
||||
|
||||
if(null === $currency && $forceDefault)
|
||||
{
|
||||
if (null === $currency && $forceDefault) {
|
||||
$currency = Currency::getDefaultCurrency();
|
||||
}
|
||||
|
||||
return $currency;
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ class Session extends BaseSession
|
||||
if (null === $lang) {
|
||||
$lang = Lang::getDefaultLanguage();
|
||||
}
|
||||
|
||||
return $lang;
|
||||
}
|
||||
|
||||
@@ -187,7 +188,7 @@ class Session extends BaseSession
|
||||
$cart = null;
|
||||
if ($cart_id) {
|
||||
$cart = CartQuery::create()->findPk($cart_id);
|
||||
if($cart) {
|
||||
if ($cart) {
|
||||
try {
|
||||
$this->verifyValidCart($cart);
|
||||
} catch (InvalidCartException $e) {
|
||||
@@ -230,7 +231,6 @@ class Session extends BaseSession
|
||||
|
||||
// -- Order ------------------------------------------------------------------
|
||||
|
||||
|
||||
public function setOrder(Order $order)
|
||||
{
|
||||
$this->set("thelia.order", $order);
|
||||
@@ -246,7 +246,6 @@ class Session extends BaseSession
|
||||
return $this->get("thelia.order");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set consumed coupons by the Customer
|
||||
*
|
||||
|
||||
@@ -20,15 +20,15 @@
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Core\HttpKernel\Exceptions;
|
||||
namespace Thelia\Core\HttpKernel\Exception;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException as BaseNotFountHttpException;
|
||||
/**
|
||||
* Class NotFountHttpException
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class NotFountHttpException extends BaseNotFountHttpException {
|
||||
|
||||
class NotFountHttpException extends BaseNotFountHttpException
|
||||
{
|
||||
protected $adminContext = false;
|
||||
|
||||
public function __construct($message = null, \Exception $previous = null, $code = 0, $adminContext = false)
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
namespace Thelia\Core\Security\Authentication;
|
||||
|
||||
use Thelia\Core\Security\Authentication\AuthenticatorInterface;
|
||||
use Thelia\Core\Security\UserProvider\UserProviderInterface;
|
||||
use Thelia\Core\Security\UserProvider\TokenUserProvider;
|
||||
use Thelia\Core\Security\Exception\TokenAuthenticationException;
|
||||
|
||||
@@ -51,7 +50,6 @@ class TokenAuthenticator implements AuthenticatorInterface
|
||||
$user = $this->userProvider->getUser($keyData);
|
||||
|
||||
if ($user === null) throw new TokenAuthenticationException("No user matches the provided token");
|
||||
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ use Thelia\Core\Security\User\UserInterface;
|
||||
|
||||
class TokenProvider
|
||||
{
|
||||
public function encodeKey(UserInterface $user) {
|
||||
|
||||
public function encodeKey(UserInterface $user)
|
||||
{
|
||||
// Always set a new token in the user environment
|
||||
$user->setToken(uniqid());
|
||||
|
||||
@@ -15,7 +15,8 @@ class TokenProvider
|
||||
array($user->getUsername(), $user->getToken(), $user->getSerial())));
|
||||
}
|
||||
|
||||
public function decodeKey($key) {
|
||||
public function decodeKey($key)
|
||||
{
|
||||
$data = unserialize(base64_decode($key));
|
||||
|
||||
return array(
|
||||
|
||||
@@ -23,13 +23,12 @@
|
||||
|
||||
namespace Thelia\Core\Security\UserProvider;
|
||||
|
||||
use Thelia\Model\Admin;
|
||||
use Thelia\Model\AdminQuery;
|
||||
|
||||
class AdminTokenUserProvider extends TokenUserProvider
|
||||
{
|
||||
public function getUser($dataArray) {
|
||||
|
||||
public function getUser($dataArray)
|
||||
{
|
||||
return AdminQuery::create()
|
||||
->filterByLogin($dataArray['username'])
|
||||
->filterByRememberMeSerial($dataArray['serial'])
|
||||
|
||||
@@ -23,13 +23,12 @@
|
||||
|
||||
namespace Thelia\Core\Security\UserProvider;
|
||||
|
||||
use Thelia\Action\Customer;
|
||||
use Thelia\Model\CustomerQuery;
|
||||
|
||||
class CustomerTokenUserProvider extends TokenUserProvider
|
||||
{
|
||||
public function getUser($dataArray) {
|
||||
|
||||
public function getUser($dataArray)
|
||||
{
|
||||
return CustomerQuery::create()
|
||||
->filterByEmail($dataArray['username'])
|
||||
->filterByRememberMeSerial($dataArray['serial'])
|
||||
|
||||
@@ -23,10 +23,9 @@
|
||||
|
||||
namespace Thelia\Core\Security\UserProvider;
|
||||
|
||||
use Thelia\Core\Security\User\UserInterface;
|
||||
use Thelia\Core\Security\Token\TokenProvider;
|
||||
|
||||
abstract class TokenUserProvider extends TokenProvider implements UserProviderInterface
|
||||
{
|
||||
public abstract function getUser($key);
|
||||
abstract public function getUser($key);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ class Accessory extends Product
|
||||
|
||||
$loopResult = parent::exec($pagination);
|
||||
|
||||
foreach($loopResult as $loopResultRow) {
|
||||
foreach ($loopResult as $loopResultRow) {
|
||||
|
||||
$accessoryProductId = $loopResultRow->get('ID');
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ class Address extends BaseLoop
|
||||
|
||||
if ($default === true) {
|
||||
$search->filterByIsDefault(1, Criteria::EQUAL);
|
||||
} else if($default === false) {
|
||||
} elseif ($default === false) {
|
||||
$search->filterByIsDefault(0, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,10 +60,10 @@ class Argument
|
||||
{
|
||||
$x = $value === null;
|
||||
|
||||
if($value === null) {
|
||||
if ($value === null) {
|
||||
$this->value = null;
|
||||
} else {
|
||||
if(false === $value) {
|
||||
if (false === $value) {
|
||||
/* (string) $value = "" */
|
||||
$this->value = 0;
|
||||
} else {
|
||||
|
||||
@@ -159,7 +159,7 @@ class AssociatedContent extends Content
|
||||
|
||||
$loopResult = parent::exec($pagination);
|
||||
|
||||
foreach($loopResult as $loopResultRow) {
|
||||
foreach ($loopResult as $loopResultRow) {
|
||||
|
||||
$relatedContentId = $loopResultRow->get('ID');
|
||||
|
||||
|
||||
@@ -31,17 +31,12 @@ use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Model\Base\CategoryQuery;
|
||||
use Thelia\Model\Base\ProductCategoryQuery;
|
||||
use Thelia\Model\Base\AttributeQuery;
|
||||
use Thelia\Model\Map\ProductCategoryTableMap;
|
||||
use Thelia\Type\TypeCollection;
|
||||
use Thelia\Type;
|
||||
use Thelia\Type\BooleanOrBothType;
|
||||
use Thelia\Model\ProductQuery;
|
||||
use Thelia\Model\TemplateQuery;
|
||||
use Thelia\Model\AttributeTemplateQuery;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Model\Map\AttributeTemplateTableMap;
|
||||
/**
|
||||
*
|
||||
@@ -121,7 +116,7 @@ class Attribute extends BaseI18nLoop
|
||||
// Create template array
|
||||
if ($template == null) $template = array();
|
||||
|
||||
foreach($products as $product) {
|
||||
foreach ($products as $product) {
|
||||
$tpl_id = $product->getTemplateId();
|
||||
|
||||
if (! is_null($tpl_id)) $template[] = $tpl_id;
|
||||
@@ -138,8 +133,7 @@ class Attribute extends BaseI18nLoop
|
||||
;
|
||||
|
||||
$use_attribute_pos = false;
|
||||
}
|
||||
else if (null !== $exclude_template) {
|
||||
} elseif (null !== $exclude_template) {
|
||||
|
||||
// Join with attribute_template table to get position
|
||||
$exclude_attributes = AttributeTemplateQuery::create()->filterByTemplateId($exclude_template)->select('attribute_id')->find();
|
||||
|
||||
@@ -37,7 +37,6 @@ use Thelia\Coupon\Type\CouponInterface;
|
||||
use Thelia\Model\Coupon as MCoupon;
|
||||
use Thelia\Model\CouponQuery;
|
||||
use Thelia\Type;
|
||||
use Thelia\Type\BooleanOrBothType;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
|
||||
@@ -57,9 +57,9 @@ class Delivery extends BaseSpecificModule
|
||||
$search->filterByType(BaseModule::DELIVERY_MODULE_TYPE, Criteria::EQUAL);
|
||||
|
||||
$countryId = $this->getCountry();
|
||||
if(null !== $countryId) {
|
||||
if (null !== $countryId) {
|
||||
$country = CountryQuery::create()->findPk($countryId);
|
||||
if(null === $country) {
|
||||
if (null === $country) {
|
||||
throw new \InvalidArgumentException('Cannot found country id: `' . $countryId . '` in delivery loop');
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -265,8 +265,7 @@ class Document extends BaseI18nLoop
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Ignore the result and log an error
|
||||
Tlog::getInstance()->addError("Failed to process document in document loop: ", $this->args);
|
||||
}
|
||||
|
||||
@@ -31,11 +31,8 @@ use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Model\CategoryQuery;
|
||||
use Thelia\Model\FeatureI18nQuery;
|
||||
use Thelia\Model\ProductCategoryQuery;
|
||||
use Thelia\Model\FeatureQuery;
|
||||
use Thelia\Model\Map\ProductCategoryTableMap;
|
||||
use Thelia\Model\ProductQuery;
|
||||
use Thelia\Type\TypeCollection;
|
||||
use Thelia\Type;
|
||||
@@ -124,7 +121,7 @@ class Feature extends BaseI18nLoop
|
||||
// Create template array
|
||||
if ($template == null) $template = array();
|
||||
|
||||
foreach($products as $product) {
|
||||
foreach ($products as $product) {
|
||||
$tpl_id = $product->getTemplateId();
|
||||
|
||||
if (! is_null($tpl_id)) $template[] = $tpl_id;
|
||||
@@ -164,7 +161,7 @@ class Feature extends BaseI18nLoop
|
||||
->select('id')
|
||||
->find();
|
||||
|
||||
if($features) {
|
||||
if ($features) {
|
||||
$search->filterById(
|
||||
$features,
|
||||
Criteria::IN
|
||||
@@ -204,7 +201,6 @@ class Feature extends BaseI18nLoop
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* perform search */
|
||||
$features = $this->search($search, $pagination);
|
||||
|
||||
|
||||
@@ -318,8 +318,7 @@ class Image extends BaseI18nLoop
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Ignore the result and log an error
|
||||
Tlog::getInstance()->addError("Failed to process image in image loop: ", $this->args);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ class Module extends BaseI18nLoop
|
||||
|
||||
$active = $this->getActive();
|
||||
|
||||
if($active !== Type\BooleanOrBothType::ANY) {
|
||||
if ($active !== Type\BooleanOrBothType::ANY) {
|
||||
$search->filterByActivate($active ? 1 : 0, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,10 +31,7 @@ use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\OrderAddressQuery;
|
||||
use Thelia\Type\TypeCollection;
|
||||
use Thelia\Type;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -31,13 +31,7 @@ use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Exception\TaxEngineException;
|
||||
use Thelia\Model\Base\OrderProductQuery;
|
||||
use Thelia\Model\CountryQuery;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
use Thelia\Model\Map\OrderProductTableMap;
|
||||
use Thelia\Type\TypeCollection;
|
||||
use Thelia\Type;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -76,7 +70,6 @@ class OrderProduct extends BaseLoop
|
||||
->withColumn('SUM(`opt`.PROMO_AMOUNT)', 'TOTAL_PROMO_TAX')
|
||||
->groupById();
|
||||
|
||||
|
||||
$order = $this->getOrder();
|
||||
|
||||
$search->filterByOrderId($order, Criteria::EQUAL);
|
||||
|
||||
@@ -32,8 +32,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Model\Base\OrderProductAttributeCombinationQuery;
|
||||
use Thelia\Model\Map\AttributeAvTableMap;
|
||||
use Thelia\Model\Map\AttributeTableMap;
|
||||
use Thelia\Type\TypeCollection;
|
||||
use Thelia\Type;
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace Thelia\Core\Template\Loop;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Module\BaseModule;
|
||||
|
||||
/**
|
||||
|
||||
@@ -138,9 +138,9 @@ class Product extends BaseI18nLoop
|
||||
public function exec(&$pagination)
|
||||
{
|
||||
$currencyId = $this->getCurrency();
|
||||
if(null !== $currencyId) {
|
||||
if (null !== $currencyId) {
|
||||
$currency = CurrencyQuery::create()->findOneById($currencyId);
|
||||
if(null === $currency) {
|
||||
if (null === $currency) {
|
||||
throw new \InvalidArgumentException('Cannot found currency id: `' . $currency . '` in product_sale_elements loop');
|
||||
}
|
||||
} else {
|
||||
@@ -610,7 +610,7 @@ class Product extends BaseI18nLoop
|
||||
$taxedPrice = $product->getTaxedPrice(
|
||||
$taxCountry
|
||||
);
|
||||
} catch(TaxEngineException $e) {
|
||||
} catch (TaxEngineException $e) {
|
||||
$taxedPrice = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ class ProductSaleElements extends BaseLoop
|
||||
$taxedPrice = $PSEValue->getTaxedPrice(
|
||||
$taxCountry
|
||||
);
|
||||
} catch(TaxEngineException $e) {
|
||||
} catch (TaxEngineException $e) {
|
||||
$taxedPrice = null;
|
||||
}
|
||||
$promoPrice = $PSEValue->getPromoPrice();
|
||||
@@ -166,7 +166,7 @@ class ProductSaleElements extends BaseLoop
|
||||
$taxedPromoPrice = $PSEValue->getTaxedPromoPrice(
|
||||
$taxCountry
|
||||
);
|
||||
} catch(TaxEngineException $e) {
|
||||
} catch (TaxEngineException $e) {
|
||||
$taxedPromoPrice = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,13 +31,8 @@ use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Model\Base\CategoryQuery;
|
||||
use Thelia\Model\Base\ProductCategoryQuery;
|
||||
use Thelia\Model\Base\TemplateQuery;
|
||||
use Thelia\Model\Map\ProductCategoryTableMap;
|
||||
use Thelia\Type\TypeCollection;
|
||||
use Thelia\Type;
|
||||
use Thelia\Type\BooleanOrBothType;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -162,14 +162,14 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
||||
|
||||
public function countryDataAccess($params, $smarty)
|
||||
{
|
||||
if(array_key_exists('defaultCountry', self::$dataAccessCache)) {
|
||||
if (array_key_exists('defaultCountry', self::$dataAccessCache)) {
|
||||
$defaultCountry = self::$dataAccessCache['defaultCountry'];
|
||||
} else {
|
||||
$defaultCountry = CountryQuery::create()->findOneByByDefault(1);
|
||||
self::$dataAccessCache['defaultCountry'] = $defaultCountry;
|
||||
}
|
||||
|
||||
switch($params["attr"]) {
|
||||
switch ($params["attr"]) {
|
||||
case "default":
|
||||
return $defaultCountry->getId();
|
||||
}
|
||||
@@ -177,7 +177,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
||||
|
||||
public function cartDataAccess($params, $smarty)
|
||||
{
|
||||
if(array_key_exists('currentCountry', self::$dataAccessCache)) {
|
||||
if (array_key_exists('currentCountry', self::$dataAccessCache)) {
|
||||
$currentCountry = self::$dataAccessCache['currentCountry'];
|
||||
} else {
|
||||
$currentCountry = CountryQuery::create()->findOneById(64); // @TODO : make it magic
|
||||
@@ -186,7 +186,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
||||
|
||||
$cart = $this->getCart($this->request);
|
||||
$result = "";
|
||||
switch($params["attr"]) {
|
||||
switch ($params["attr"]) {
|
||||
case "count_item":
|
||||
$result = $cart->getCartItems()->count();
|
||||
break;
|
||||
@@ -205,7 +205,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
||||
{
|
||||
$order = $this->request->getSession()->getOrder();
|
||||
$attribute = $this->getNormalizedParam($params, array('attribute', 'attrib', 'attr'));
|
||||
switch($attribute) {
|
||||
switch ($attribute) {
|
||||
case 'postage':
|
||||
return $order->getPostage();
|
||||
case 'delivery_address':
|
||||
@@ -246,7 +246,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
||||
*/
|
||||
protected function dataAccessWithI18n($objectLabel, $params, ModelCriteria $search, $columns = array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), $foreignTable = null, $foreignKey = 'ID')
|
||||
{
|
||||
if(array_key_exists('data_' . $objectLabel, self::$dataAccessCache)) {
|
||||
if (array_key_exists('data_' . $objectLabel, self::$dataAccessCache)) {
|
||||
$data = self::$dataAccessCache['data_' . $objectLabel];
|
||||
} else {
|
||||
$lang = $this->getNormalizedParam($params, array('lang'));
|
||||
@@ -332,7 +332,6 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
||||
*/
|
||||
public function getPluginDescriptors()
|
||||
{
|
||||
|
||||
return array(
|
||||
new SmartyPluginDescriptor('function', 'admin', $this, 'adminDataAccess'),
|
||||
new SmartyPluginDescriptor('function', 'customer', $this, 'customerDataAccess'),
|
||||
|
||||
@@ -22,13 +22,9 @@
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Core\Template\Smarty\Plugins;
|
||||
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Thelia\Core\Template\Element\Exception\ElementNotFoundException;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
|
||||
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
||||
use Thelia\Core\Template\ParserContext;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
|
||||
@@ -168,8 +168,7 @@ $val = $value[$key];
|
||||
$this->assignFieldValues($template, $name, $val, $formFieldView->vars);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->assignFieldValues($template, $formFieldView->vars["full_name"], $fieldVars["value"], $formFieldView->vars);
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -79,7 +79,7 @@ class Security extends AbstractSmartyPlugin
|
||||
public function checkCartNotEmptyFunction($params, &$smarty)
|
||||
{
|
||||
$cart = $this->request->getSession()->getCart();
|
||||
if($cart===null || $cart->countCartItems() == 0) {
|
||||
if ($cart===null || $cart->countCartItems() == 0) {
|
||||
throw new OrderException('Cart must not be empty', OrderException::CART_EMPTY, array('empty' => 1));
|
||||
}
|
||||
|
||||
@@ -90,11 +90,11 @@ class Security extends AbstractSmartyPlugin
|
||||
{
|
||||
$order = $this->request->getSession()->getOrder();
|
||||
/* Does address and module still exists ? We assume address owner can't change neither module type */
|
||||
if($order !== null) {
|
||||
if ($order !== null) {
|
||||
$checkAddress = AddressQuery::create()->findPk($order->chosenDeliveryAddress);
|
||||
$checkModule = ModuleQuery::create()->findPk($order->getDeliveryModuleId());
|
||||
}
|
||||
if(null === $order || null == $checkAddress || null === $checkModule) {
|
||||
if (null === $order || null == $checkAddress || null === $checkModule) {
|
||||
throw new OrderException('Delivery must be defined', OrderException::UNDEFINED_DELIVERY, array('missing' => 1));
|
||||
}
|
||||
|
||||
|
||||
@@ -247,6 +247,7 @@ class TheliaLoop extends AbstractSmartyPlugin
|
||||
// Find pagination
|
||||
$pagination = self::getPagination($loopName);
|
||||
if ($pagination === null) { // loop gas no result
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
@@ -23,26 +23,20 @@
|
||||
|
||||
namespace Thelia\Core\Template\Smarty\Plugins;
|
||||
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
|
||||
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
||||
use Thelia\Core\Security\SecurityContext;
|
||||
use Thelia\Core\Security\Exception\AuthenticationException;
|
||||
use Thelia\Exception\OrderException;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
|
||||
class Type extends AbstractSmartyPlugin
|
||||
{
|
||||
public function assertTypeModifier($value, $option)
|
||||
{
|
||||
$typeClass = "\\Thelia\\Type\\$option";
|
||||
if(!class_exists($typeClass)) {
|
||||
if (!class_exists($typeClass)) {
|
||||
throw new \InvalidArgumentException(sprintf("Invalid type name `%s` in `assertType` modifier", $option));
|
||||
}
|
||||
|
||||
$typeInstance = new $typeClass();
|
||||
if(!$typeInstance->isValid($value)) {
|
||||
if (!$typeInstance->isValid($value)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
@@ -55,11 +55,9 @@ class UrlGenerator extends AbstractSmartyPlugin
|
||||
if ($file !== null) {
|
||||
$path = $file;
|
||||
$mode = URL::PATH_TO_FILE;
|
||||
}
|
||||
else if ($path !== null) {
|
||||
} elseif ($path !== null) {
|
||||
$mode = URL::WITH_INDEX_PAGE;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw \InvalidArgumentException(Translator::getInstance()->trans("Please specify either 'path' or 'file' parameter in {url} function."));
|
||||
}
|
||||
|
||||
@@ -74,7 +72,6 @@ class UrlGenerator extends AbstractSmartyPlugin
|
||||
if ($noamp == null) $url = str_replace('&', '&', $url);
|
||||
|
||||
if ($target != null) $url .= '#'.$target;
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,6 @@ class Thelia extends Kernel
|
||||
$con->useDebug(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user