Merge branch 'coupon' of https://github.com/thelia/thelia
# By Manuel Raynaud (19) and others # Via Manuel Raynaud (8) and others * 'coupon' of https://github.com/thelia/thelia: (55 commits) Working - add ajax loader WIP - add tests casper JS on coupon WIP - add tests casper JS on coupon tax engine tax engine Working - add tests casper JS - Add orders view route - Add view & action for orders index Removed a redondant "use" WIP - Coupon Add/Edit/Delete rule AJAX - add tests casper JS WIP - Coupon Add/Edit/Delete rule AJAX - add tests casper JS Add tooltip - Add creation address form - Add addresses list - Add update address form Added process_assets config variable Change breadcrumb separator color Add breadcrumb to customers view - Change boolean type to integer type for update_logged_in_user field - Create view for customer modification syntax use ROUTER::ABSOLUTE_URL by default PSE loop todo currency management in PSE loop ...
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -22,6 +22,6 @@ web/cache/*
|
|||||||
web/.htaccess
|
web/.htaccess
|
||||||
phpdoc*.log
|
phpdoc*.log
|
||||||
php-cs
|
php-cs
|
||||||
xhprof
|
xhprof/
|
||||||
phpunit.phar
|
phpunit.phar
|
||||||
.DS_Store
|
.DS_Store
|
||||||
@@ -27,7 +27,6 @@ use Thelia\Core\Event\AddressCreateOrUpdateEvent;
|
|||||||
use Thelia\Core\Event\TheliaEvents;
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
use Thelia\Model\Address as AddressModel;
|
use Thelia\Model\Address as AddressModel;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Address
|
* Class Address
|
||||||
* @package Thelia\Action
|
* @package Thelia\Action
|
||||||
@@ -50,7 +49,6 @@ class Address extends BaseAction implements EventSubscriberInterface
|
|||||||
$this->createOrUpdate($addressModel, $event);
|
$this->createOrUpdate($addressModel, $event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function createOrUpdate(AddressModel $addressModel, AddressCreateOrUpdateEvent $event)
|
protected function createOrUpdate(AddressModel $addressModel, AddressCreateOrUpdateEvent $event)
|
||||||
{
|
{
|
||||||
$addressModel->setDispatcher($this->getDispatcher());
|
$addressModel->setDispatcher($this->getDispatcher());
|
||||||
|
|||||||
@@ -22,10 +22,6 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
namespace Thelia\Action;
|
namespace Thelia\Action;
|
||||||
|
|
||||||
use Thelia\Form\BaseForm;
|
|
||||||
use Thelia\Action\Exception\FormValidationException;
|
|
||||||
use Thelia\Core\Event\ActionEvent;
|
|
||||||
use Symfony\Component\Form\Form;
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
|
|
||||||
class BaseAction
|
class BaseAction
|
||||||
|
|||||||
@@ -23,12 +23,9 @@
|
|||||||
|
|
||||||
namespace Thelia\Action;
|
namespace Thelia\Action;
|
||||||
|
|
||||||
use Propel\Runtime\Exception\PropelException;
|
|
||||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use Thelia\Core\Event\CartEvent;
|
use Thelia\Core\Event\CartEvent;
|
||||||
use Thelia\Form\CartAdd;
|
|
||||||
use Thelia\Model\ProductPrice;
|
use Thelia\Model\ProductPrice;
|
||||||
use Thelia\Model\ProductPriceQuery;
|
use Thelia\Model\ProductPriceQuery;
|
||||||
use Thelia\Model\CartItem;
|
use Thelia\Model\CartItem;
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ use Thelia\Model\CategoryQuery;
|
|||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
use Propel\Runtime\Propel;
|
use Propel\Runtime\Propel;
|
||||||
use Thelia\Model\Map\CategoryTableMap;
|
use Thelia\Model\Map\CategoryTableMap;
|
||||||
use Propel\Runtime\Exception\PropelException;
|
|
||||||
|
|
||||||
use Thelia\Core\Event\CategoryCreateEvent;
|
use Thelia\Core\Event\CategoryCreateEvent;
|
||||||
use Thelia\Core\Event\CategoryDeleteEvent;
|
use Thelia\Core\Event\CategoryDeleteEvent;
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
namespace Thelia\Action;
|
namespace Thelia\Action;
|
||||||
|
|
||||||
|
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
|
||||||
use Thelia\Model\ConfigQuery;
|
use Thelia\Model\ConfigQuery;
|
||||||
|
|||||||
@@ -24,12 +24,10 @@
|
|||||||
namespace Thelia\Action;
|
namespace Thelia\Action;
|
||||||
|
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
use Thelia\Constraint\ConstraintFactory;
|
||||||
use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent;
|
use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent;
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
use Thelia\Model\Coupon as CouponModel;
|
use Thelia\Model\Coupon as CouponModel;
|
||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
|
||||||
use Propel\Runtime\Propel;
|
|
||||||
use Thelia\Model\Map\CategoryTableMap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by JetBrains PhpStorm.
|
* Created by JetBrains PhpStorm.
|
||||||
@@ -68,18 +66,6 @@ class Coupon extends BaseAction implements EventSubscriberInterface
|
|||||||
$this->createOrUpdate($coupon, $event);
|
$this->createOrUpdate($coupon, $event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Occurring when a Coupon rule is about to be created
|
|
||||||
*
|
|
||||||
* @param CouponCreateOrUpdateEvent $event Event creation or update Event
|
|
||||||
*/
|
|
||||||
public function createRule(CouponCreateOrUpdateEvent $event)
|
|
||||||
{
|
|
||||||
$coupon = $event->getCoupon();
|
|
||||||
|
|
||||||
$this->createOrUpdate($coupon, $event);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Occurring when a Coupon rule is about to be updated
|
* Occurring when a Coupon rule is about to be updated
|
||||||
*
|
*
|
||||||
@@ -89,19 +75,7 @@ class Coupon extends BaseAction implements EventSubscriberInterface
|
|||||||
{
|
{
|
||||||
$coupon = $event->getCoupon();
|
$coupon = $event->getCoupon();
|
||||||
|
|
||||||
$this->createOrUpdate($coupon, $event);
|
$this->createOrUpdateRule($coupon, $event);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Occurring when a Coupon rule is about to be deleted
|
|
||||||
*
|
|
||||||
* @param CouponCreateOrUpdateEvent $event Event creation or update Event
|
|
||||||
*/
|
|
||||||
public function deleteRule(CouponCreateOrUpdateEvent $event)
|
|
||||||
{
|
|
||||||
$coupon = $event->getCoupon();
|
|
||||||
|
|
||||||
$this->createOrUpdate($coupon, $event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -130,6 +104,7 @@ class Coupon extends BaseAction implements EventSubscriberInterface
|
|||||||
$event->getTitle(),
|
$event->getTitle(),
|
||||||
$event->getAmount(),
|
$event->getAmount(),
|
||||||
$event->getEffect(),
|
$event->getEffect(),
|
||||||
|
$event->isRemovingPostage(),
|
||||||
$event->getShortDescription(),
|
$event->getShortDescription(),
|
||||||
$event->getDescription(),
|
$event->getDescription(),
|
||||||
$event->isEnabled(),
|
$event->isEnabled(),
|
||||||
@@ -137,7 +112,28 @@ class Coupon extends BaseAction implements EventSubscriberInterface
|
|||||||
$event->isAvailableOnSpecialOffers(),
|
$event->isAvailableOnSpecialOffers(),
|
||||||
$event->isCumulative(),
|
$event->isCumulative(),
|
||||||
$event->getMaxUsage(),
|
$event->getMaxUsage(),
|
||||||
$event->getRules(),
|
$event->getLocale()
|
||||||
|
);
|
||||||
|
|
||||||
|
$event->setCoupon($coupon);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call the Model and delegate the create or delete action
|
||||||
|
* Feed the Event with the updated model
|
||||||
|
*
|
||||||
|
* @param CouponModel $coupon Model to save
|
||||||
|
* @param CouponCreateOrUpdateEvent $event Event containing data
|
||||||
|
*/
|
||||||
|
protected function createOrUpdateRule(CouponModel $coupon, CouponCreateOrUpdateEvent $event)
|
||||||
|
{
|
||||||
|
$coupon->setDispatcher($this->getDispatcher());
|
||||||
|
|
||||||
|
/** @var ConstraintFactory $constraintFactory */
|
||||||
|
$constraintFactory = $this->container->get('thelia.constraint.factory');
|
||||||
|
|
||||||
|
$coupon->createOrUpdateRules(
|
||||||
|
$constraintFactory->serializeCouponRuleCollection($event->getRules()),
|
||||||
$event->getLocale()
|
$event->getLocale()
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -172,8 +168,7 @@ class Coupon extends BaseAction implements EventSubscriberInterface
|
|||||||
TheliaEvents::COUPON_DISABLE => array("disable", 128),
|
TheliaEvents::COUPON_DISABLE => array("disable", 128),
|
||||||
TheliaEvents::COUPON_ENABLE => array("enable", 128),
|
TheliaEvents::COUPON_ENABLE => array("enable", 128),
|
||||||
TheliaEvents::COUPON_CONSUME => array("consume", 128),
|
TheliaEvents::COUPON_CONSUME => array("consume", 128),
|
||||||
TheliaEvents::COUPON_RULE_UPDATE => array("updateRule", 128),
|
TheliaEvents::COUPON_RULE_UPDATE => array("updateRule", 128)
|
||||||
TheliaEvents::COUPON_RULE_DELETE => array("deleteRule", 128)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
namespace Thelia\Action;
|
namespace Thelia\Action;
|
||||||
|
|
||||||
|
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
|
||||||
use Thelia\Model\CurrencyQuery;
|
use Thelia\Model\CurrencyQuery;
|
||||||
@@ -60,7 +59,6 @@ class Currency extends BaseAction implements EventSubscriberInterface
|
|||||||
->save()
|
->save()
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
$event->setCurrency($currency);
|
$event->setCurrency($currency);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,16 +134,15 @@ class Currency extends BaseAction implements EventSubscriberInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateRates() {
|
public function updateRates()
|
||||||
|
{
|
||||||
$rates_url = ConfigQuery::read('currency_rate_update_url', 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml');
|
$rates_url = ConfigQuery::read('currency_rate_update_url', 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml');
|
||||||
|
|
||||||
$rate_data = @file_get_contents($rates_url);
|
$rate_data = @file_get_contents($rates_url);
|
||||||
|
|
||||||
if ($rate_data && $sxe = new \SimpleXMLElement($rate_data)) {
|
if ($rate_data && $sxe = new \SimpleXMLElement($rate_data)) {
|
||||||
|
|
||||||
foreach ($sxe->Cube[0]->Cube[0]->Cube as $last)
|
foreach ($sxe->Cube[0]->Cube[0]->Cube as $last) {
|
||||||
{
|
|
||||||
$code = strtoupper($last["currency"]);
|
$code = strtoupper($last["currency"]);
|
||||||
$rate = floatval($last['rate']);
|
$rate = floatval($last['rate']);
|
||||||
|
|
||||||
@@ -157,8 +154,7 @@ class Currency extends BaseAction implements EventSubscriberInterface
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw new \RuntimeException(sprintf("Failed to get currency rates data from URL %s", $rates_url));
|
throw new \RuntimeException(sprintf("Failed to get currency rates data from URL %s", $rates_url));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,17 +27,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|||||||
use Thelia\Core\Event\ActionEvent;
|
use Thelia\Core\Event\ActionEvent;
|
||||||
use Thelia\Core\Event\CustomerCreateOrUpdateEvent;
|
use Thelia\Core\Event\CustomerCreateOrUpdateEvent;
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
use Thelia\Form\CustomerCreation;
|
|
||||||
use Thelia\Form\CustomerModification;
|
|
||||||
use Thelia\Model\Customer as CustomerModel;
|
use Thelia\Model\Customer as CustomerModel;
|
||||||
use Thelia\Log\Tlog;
|
|
||||||
use Thelia\Model\CustomerQuery;
|
|
||||||
use Thelia\Form\CustomerLogin;
|
|
||||||
use Thelia\Core\Security\Authentication\CustomerUsernamePasswordFormAuthenticator;
|
|
||||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
|
||||||
use Thelia\Core\Security\Exception\AuthenticationException;
|
|
||||||
use Thelia\Core\Security\Exception\UsernameNotFoundException;
|
|
||||||
use Propel\Runtime\Exception\PropelException;
|
|
||||||
use Thelia\Core\Event\CustomerLoginEvent;
|
use Thelia\Core\Event\CustomerLoginEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,7 +86,6 @@ class Customer extends BaseAction implements EventSubscriberInterface
|
|||||||
$event->setCustomer($customer);
|
$event->setCustomer($customer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function login(CustomerLoginEvent $event)
|
public function login(CustomerLoginEvent $event)
|
||||||
{
|
{
|
||||||
$this->getSecurityContext()->setCustomerUser($event->getCustomer());
|
$this->getSecurityContext()->setCustomerUser($event->getCustomer());
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ namespace Thelia\Action;
|
|||||||
|
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
|
||||||
use Thelia\Core\Event\ActionEvent;
|
|
||||||
use Thelia\Core\Event\ImageEvent;
|
use Thelia\Core\Event\ImageEvent;
|
||||||
use Thelia\Model\ConfigQuery;
|
use Thelia\Model\ConfigQuery;
|
||||||
use Thelia\Tools\URL;
|
use Thelia\Tools\URL;
|
||||||
@@ -86,8 +85,8 @@ class Image extends BaseAction implements EventSubscriberInterface
|
|||||||
*
|
*
|
||||||
* @param ImageEvent $event
|
* @param ImageEvent $event
|
||||||
*/
|
*/
|
||||||
public function clearCache(ImageEvent $event) {
|
public function clearCache(ImageEvent $event)
|
||||||
|
{
|
||||||
$path = $this->getCachePath($event->getCacheSubdirectory(), false);
|
$path = $this->getCachePath($event->getCacheSubdirectory(), false);
|
||||||
|
|
||||||
$this->clearDirectory($path);
|
$this->clearDirectory($path);
|
||||||
@@ -98,8 +97,8 @@ class Image extends BaseAction implements EventSubscriberInterface
|
|||||||
*
|
*
|
||||||
* @param string $path the directory path
|
* @param string $path the directory path
|
||||||
*/
|
*/
|
||||||
protected function clearDirectory($path) {
|
protected function clearDirectory($path)
|
||||||
|
{
|
||||||
$iterator = new \DirectoryIterator($path);
|
$iterator = new \DirectoryIterator($path);
|
||||||
|
|
||||||
foreach ($iterator as $fileinfo) {
|
foreach ($iterator as $fileinfo) {
|
||||||
@@ -108,8 +107,7 @@ class Image extends BaseAction implements EventSubscriberInterface
|
|||||||
|
|
||||||
if ($fileinfo->isFile() || $fileinfo->isLink()) {
|
if ($fileinfo->isFile() || $fileinfo->isLink()) {
|
||||||
@unlink($fileinfo->getPathname());
|
@unlink($fileinfo->getPathname());
|
||||||
}
|
} elseif ($fileinfo->isDir()) {
|
||||||
else if ($fileinfo->isDir()) {
|
|
||||||
$this->clearDirectory($fileinfo->getPathname());
|
$this->clearDirectory($fileinfo->getPathname());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -160,8 +158,7 @@ class Image extends BaseAction implements EventSubscriberInterface
|
|||||||
if (false == symlink($source_file, $originalImagePathInCache)) {
|
if (false == symlink($source_file, $originalImagePathInCache)) {
|
||||||
throw new ImageException(sprintf("Failed to create symbolic link for %s in %s image cache directory", basename($source_file), $subdir));
|
throw new ImageException(sprintf("Failed to create symbolic link for %s in %s image cache directory", basename($source_file), $subdir));
|
||||||
}
|
}
|
||||||
}
|
} else {// mode = 'copy'
|
||||||
else {// mode = 'copy'
|
|
||||||
if (false == @copy($source_file, $originalImagePathInCache)) {
|
if (false == @copy($source_file, $originalImagePathInCache)) {
|
||||||
throw new ImageException(sprintf("Failed to copy %s in %s image cache directory", basename($source_file), $subdir));
|
throw new ImageException(sprintf("Failed to copy %s in %s image cache directory", basename($source_file), $subdir));
|
||||||
}
|
}
|
||||||
@@ -182,8 +179,7 @@ class Image extends BaseAction implements EventSubscriberInterface
|
|||||||
|
|
||||||
if ($background_color != null) {
|
if ($background_color != null) {
|
||||||
$bg_color = new Color($background_color);
|
$bg_color = new Color($background_color);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
$bg_color = null;
|
$bg_color = null;
|
||||||
|
|
||||||
// Apply resize
|
// Apply resize
|
||||||
@@ -252,8 +248,7 @@ class Image extends BaseAction implements EventSubscriberInterface
|
|||||||
$cacheFilePath,
|
$cacheFilePath,
|
||||||
array('quality' => $quality)
|
array('quality' => $quality)
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw new ImageException(sprintf("Source file %s cannot be opened.", basename($source_file)));
|
throw new ImageException(sprintf("Source file %s cannot be opened.", basename($source_file)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -313,8 +308,7 @@ class Image extends BaseAction implements EventSubscriberInterface
|
|||||||
|
|
||||||
$dest_width = ($resize_mode == self::EXACT_RATIO_WITH_BORDERS ? $dest_width : $next_width);
|
$dest_width = ($resize_mode == self::EXACT_RATIO_WITH_BORDERS ? $dest_width : $next_width);
|
||||||
$dest_height = ($resize_mode == self::EXACT_RATIO_WITH_BORDERS ? $dest_height : $next_height);
|
$dest_height = ($resize_mode == self::EXACT_RATIO_WITH_BORDERS ? $dest_height : $next_height);
|
||||||
}
|
} elseif ($width_diff > $height_diff) {
|
||||||
else if ($width_diff > $height_diff) {
|
|
||||||
// Image height > image width
|
// Image height > image width
|
||||||
|
|
||||||
$next_height = $dest_height;
|
$next_height = $dest_height;
|
||||||
@@ -324,12 +318,10 @@ class Image extends BaseAction implements EventSubscriberInterface
|
|||||||
$next_width = $dest_width;
|
$next_width = $dest_width;
|
||||||
$next_height = intval($height_orig * $dest_width / $width_orig);
|
$next_height = intval($height_orig * $dest_width / $width_orig);
|
||||||
$delta_y = ($next_height - $dest_height) / 2;
|
$delta_y = ($next_height - $dest_height) / 2;
|
||||||
}
|
} elseif ($resize_mode != self::EXACT_RATIO_WITH_BORDERS) {
|
||||||
else if ($resize_mode != self::EXACT_RATIO_WITH_BORDERS) {
|
|
||||||
$dest_width = $next_width;
|
$dest_width = $next_width;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Image width > image height
|
// Image width > image height
|
||||||
$next_width = $dest_width;
|
$next_width = $dest_width;
|
||||||
$next_height = intval($height_orig * $dest_width / $width_orig);
|
$next_height = intval($height_orig * $dest_width / $width_orig);
|
||||||
@@ -338,8 +330,7 @@ class Image extends BaseAction implements EventSubscriberInterface
|
|||||||
$next_height = $dest_height;
|
$next_height = $dest_height;
|
||||||
$next_width = intval(($width_orig * $next_height) / $height_orig);
|
$next_width = intval(($width_orig * $next_height) / $height_orig);
|
||||||
$delta_x = ($next_width - $dest_width) / 2;
|
$delta_x = ($next_width - $dest_width) / 2;
|
||||||
}
|
} elseif ($resize_mode != self::EXACT_RATIO_WITH_BORDERS) {
|
||||||
else if ($resize_mode != self::EXACT_RATIO_WITH_BORDERS) {
|
|
||||||
$dest_height = $next_height;
|
$dest_height = $next_height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -357,9 +348,7 @@ class Image extends BaseAction implements EventSubscriberInterface
|
|||||||
|
|
||||||
return $imagine->create($canvas, $bg_color)
|
return $imagine->create($canvas, $bg_color)
|
||||||
->paste($image, new Point($border_width, $border_height));
|
->paste($image, new Point($border_width, $border_height));
|
||||||
}
|
} elseif ($resize_mode == self::EXACT_RATIO_WITH_CROP) {
|
||||||
|
|
||||||
else if ($resize_mode == self::EXACT_RATIO_WITH_CROP) {
|
|
||||||
$image->crop(
|
$image->crop(
|
||||||
new Point($delta_x, $delta_y),
|
new Point($delta_x, $delta_y),
|
||||||
new Box($dest_width, $dest_height)
|
new Box($dest_width, $dest_height)
|
||||||
@@ -370,7 +359,6 @@ class Image extends BaseAction implements EventSubscriberInterface
|
|||||||
return $image;
|
return $image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the absolute URL to the cached image
|
* Return the absolute URL to the cached image
|
||||||
*
|
*
|
||||||
@@ -420,12 +408,10 @@ class Image extends BaseAction implements EventSubscriberInterface
|
|||||||
$safe_subdir = basename($subdir);
|
$safe_subdir = basename($subdir);
|
||||||
|
|
||||||
$path = sprintf("%s/%s", $cache_dir_from_web_root, $safe_subdir);
|
$path = sprintf("%s/%s", $cache_dir_from_web_root, $safe_subdir);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
$path = $cache_dir_from_web_root;
|
$path = $cache_dir_from_web_root;
|
||||||
|
|
||||||
// Check if path is valid, e.g. in the cache dir
|
// Check if path is valid, e.g. in the cache dir
|
||||||
|
|
||||||
return $path;
|
return $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
namespace Thelia\Action;
|
namespace Thelia\Action;
|
||||||
|
|
||||||
|
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
|
||||||
use Thelia\Model\MessageQuery;
|
use Thelia\Model\MessageQuery;
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
namespace Thelia\Action;
|
namespace Thelia\Action;
|
||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ namespace Thelia\Action;
|
|||||||
|
|
||||||
use Thelia\Core\Event\BaseChangePositionEvent;
|
use Thelia\Core\Event\BaseChangePositionEvent;
|
||||||
|
|
||||||
trait PositionManagementTrait {
|
trait PositionManagementTrait
|
||||||
|
{
|
||||||
const POSITION_UP
|
const POSITION_UP
|
||||||
/**
|
/**
|
||||||
* Changes object position, selecting absolute ou relative change.
|
* Changes object position, selecting absolute ou relative change.
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ use Thelia\Core\HttpFoundation\Request;
|
|||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
|
|
||||||
|
|
||||||
class ClearImageCache extends ContainerAwareCommand
|
class ClearImageCache extends ContainerAwareCommand
|
||||||
{
|
{
|
||||||
protected function configure()
|
protected function configure()
|
||||||
@@ -60,8 +59,7 @@ class ClearImageCache extends ContainerAwareCommand
|
|||||||
$dispatcher->dispatch(TheliaEvents::IMAGE_CLEAR_CACHE, $event);
|
$dispatcher->dispatch(TheliaEvents::IMAGE_CLEAR_CACHE, $event);
|
||||||
|
|
||||||
$output->writeln(sprintf('%s image cache successfully cleared.', is_null($subdir) ? 'Entire' : ucfirst($subdir)));
|
$output->writeln(sprintf('%s image cache successfully cleared.', is_null($subdir) ? 'Entire' : ucfirst($subdir)));
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch(\Exception $ex) {
|
|
||||||
$output->writeln(sprintf("Failed to clear image cache: %s", $ex->getMessage()));
|
$output->writeln(sprintf("Failed to clear image cache: %s", $ex->getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,8 +133,7 @@ class CreateAdminUser extends ContainerAwareCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
$output->writeln("Passwords are different, please try again.");
|
$output->writeln("Passwords are different, please try again.");
|
||||||
}
|
} while (true);
|
||||||
while (true);
|
|
||||||
|
|
||||||
return $admin;
|
return $admin;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ use Symfony\Component\Console\Input\InputOption;
|
|||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Thelia\Install\Database;
|
use Thelia\Install\Database;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ReloadDatabasesCommand
|
* Class ReloadDatabasesCommand
|
||||||
* @package Thelia\Command
|
* @package Thelia\Command
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace %%NAMESPACE%%;
|
|||||||
|
|
||||||
use Thelia\Module\BaseModule;
|
use Thelia\Module\BaseModule;
|
||||||
|
|
||||||
class %%CLASSNAME%% extends BaseModule
|
class Class extends BaseModule
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class
|
* YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class
|
||||||
|
|||||||
@@ -37,6 +37,19 @@
|
|||||||
<default key="_controller">Thelia\Controller\Admin\CustomerController::indexAction</default>
|
<default key="_controller">Thelia\Controller\Admin\CustomerController::indexAction</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
<route id="admin.customer.update.view" path="/admin/customer/update/{customer_id}">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\CustomerController::viewAction</default>
|
||||||
|
<requirement key="customer_id">\d+</requirement>
|
||||||
|
</route>
|
||||||
|
|
||||||
|
<!-- end Customer rule management -->
|
||||||
|
|
||||||
|
<!-- Order rule management -->
|
||||||
|
|
||||||
|
<route id="admin.order" path="/admin/order">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\OrderController::indexAction</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
<!-- end Customer rule management -->
|
<!-- end Customer rule management -->
|
||||||
|
|
||||||
<!-- Categories management -->
|
<!-- Categories management -->
|
||||||
@@ -192,11 +205,11 @@
|
|||||||
|
|
||||||
<!-- attribute and feature routes management -->
|
<!-- attribute and feature routes management -->
|
||||||
|
|
||||||
<route id="admin.configuration.attribute" path="/admin/configuration/product_attributes">
|
<route id="admin.configuration.product-attribute.default" path="/admin/configuration/product-attributes">
|
||||||
<default key="_controller">Thelia\Controller\Admin\AttributeController::defaultAction</default>
|
<default key="_controller">Thelia\Controller\Admin\AttributeController::defaultAction</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
<route id="admin.configuration.attribute.edit" path="/admin/configuration/product_attributes/update">
|
<route id="admin.configuration.product-attribute.edit" path="/admin/configuration/product-attributes/update">
|
||||||
<default key="_controller">Thelia\Controller\Admin\AttributeController::updateAction</default>
|
<default key="_controller">Thelia\Controller\Admin\AttributeController::updateAction</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
|||||||
@@ -73,70 +73,6 @@ class AvailableForTotalAmountManager extends CouponRuleAbstract
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// /** @var RuleValidator Price Validator */
|
|
||||||
// protected $priceValidator = null;
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Check if backoffice inputs are relevant or not
|
|
||||||
// *
|
|
||||||
// * @throws InvalidRuleOperatorException if Operator is not allowed
|
|
||||||
// * @throws InvalidRuleValueException if Value is not allowed
|
|
||||||
// * @return bool
|
|
||||||
// */
|
|
||||||
// public function checkBackOfficeInput()
|
|
||||||
// {
|
|
||||||
// if (!isset($this->validators)
|
|
||||||
// || empty($this->validators)
|
|
||||||
// ||!isset($this->validators[self::PARAM1_PRICE])
|
|
||||||
// ||!isset($this->validators[self::PARAM1_PRICE])
|
|
||||||
// ) {
|
|
||||||
// throw new InvalidRuleValueException(get_class(), self::PARAM1_PRICE);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /** @var RuleValidator $ruleValidator */
|
|
||||||
// $ruleValidator = $this->validators[self::PARAM1_PRICE];
|
|
||||||
// /** @var PriceParam $price */
|
|
||||||
// $price = $ruleValidator->getParam();
|
|
||||||
//
|
|
||||||
// if (!$price instanceof PriceParam) {
|
|
||||||
// throw new InvalidRuleValueException(get_class(), self::PARAM1_PRICE);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// $this->checkBackOfficeInputsOperators();
|
|
||||||
//
|
|
||||||
// return $this->isPriceValid($price->getPrice(), $price->getCurrency());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Check if Checkout inputs are relevant or not
|
|
||||||
// *
|
|
||||||
// * @throws InvalidRuleValueException if Value is not allowed
|
|
||||||
// * @return bool
|
|
||||||
// */
|
|
||||||
// public function checkCheckoutInput()
|
|
||||||
// {
|
|
||||||
// $currency = $this->adapter->getCheckoutCurrency();
|
|
||||||
// if (empty($currency)) {
|
|
||||||
// throw new InvalidRuleValueException(
|
|
||||||
// get_class(), self::PARAM1_CURRENCY
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// $price = $this->adapter->getCartTotalPrice();
|
|
||||||
// if (empty($price)) {
|
|
||||||
// throw new InvalidRuleValueException(
|
|
||||||
// get_class(), self::PARAM1_PRICE
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// $this->paramsToValidate = array(
|
|
||||||
// self::PARAM1_PRICE => $this->adapter->getCartTotalPrice(),
|
|
||||||
// self::PARAM1_CURRENCY => $this->adapter->getCheckoutCurrency()
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// return $this->isPriceValid($price, $currency);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check validators relevancy and store them
|
* Check validators relevancy and store them
|
||||||
*
|
*
|
||||||
@@ -249,49 +185,6 @@ class AvailableForTotalAmountManager extends CouponRuleAbstract
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Check if a price is valid
|
|
||||||
// *
|
|
||||||
// * @param float $price Price to check
|
|
||||||
// * @param string $currency Price currency
|
|
||||||
// *
|
|
||||||
// * @throws InvalidRuleValueException if Value is not allowed
|
|
||||||
// * @return bool
|
|
||||||
// */
|
|
||||||
// protected function isPriceValid($price, $currency)
|
|
||||||
// {
|
|
||||||
// $priceValidator = $this->priceValidator;
|
|
||||||
//
|
|
||||||
// /** @var PriceParam $param */
|
|
||||||
// $param = $priceValidator->getParam();
|
|
||||||
// if ($currency == $param->getCurrency()) {
|
|
||||||
// try {
|
|
||||||
// $priceValidator->getParam()->compareTo($price);
|
|
||||||
// } catch(\InvalidArgumentException $e) {
|
|
||||||
// throw new InvalidRuleValueException(get_class(), self::PARAM1_PRICE);
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// throw new InvalidRuleValueException(get_class(), self::PARAM1_CURRENCY);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Generate current Rule param to be validated from adapter
|
|
||||||
// *
|
|
||||||
// * @return $this
|
|
||||||
// */
|
|
||||||
// protected function setParametersToValidate()
|
|
||||||
// {
|
|
||||||
// $this->paramsToValidate = array(
|
|
||||||
// self::PARAM1_PRICE => $this->adapter->getCartTotalPrice(),
|
|
||||||
// self::PARAM1_CURRENCY => $this->adapter->getCheckoutCurrency()
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// return $this;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get I18n name
|
* Get I18n name
|
||||||
*
|
*
|
||||||
@@ -377,41 +270,4 @@ class AvailableForTotalAmountManager extends CouponRuleAbstract
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Populate a Rule from a form admin
|
|
||||||
// *
|
|
||||||
// * @param array $operators Rule Operator set by the Admin
|
|
||||||
// * @param array $values Rule Values set by the Admin
|
|
||||||
// *
|
|
||||||
// * @throws \InvalidArgumentException
|
|
||||||
// * @return $this
|
|
||||||
// */
|
|
||||||
// public function populateFromForm(array $operators, array $values)
|
|
||||||
// {
|
|
||||||
// if ($values[self::PARAM1_PRICE] === null
|
|
||||||
// || $values[self::PARAM1_CURRENCY] === null
|
|
||||||
// ) {
|
|
||||||
// throw new \InvalidArgumentException(
|
|
||||||
// 'The Rule ' . get_class() . 'needs at least a quantity set (' . self::PARAM1_PRICE . ', ' . self::PARAM1_CURRENCY . ')'
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// $this->priceValidator = new RuleValidator(
|
|
||||||
// $operators[self::PARAM1_PRICE],
|
|
||||||
// new PriceParam(
|
|
||||||
// $this->translator,
|
|
||||||
// $values[self::PARAM1_PRICE],
|
|
||||||
// $values[self::PARAM1_CURRENCY]
|
|
||||||
// )
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// $this->validators = array(self::PARAM1_PRICE => $this->priceValidator);
|
|
||||||
//
|
|
||||||
// return $this;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -63,77 +63,6 @@ class AvailableForXArticlesManager extends CouponRuleAbstract
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// /** @var QuantityParam Quantity Validator */
|
|
||||||
// protected $quantityValidator = null;
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Check if backoffice inputs are relevant or not
|
|
||||||
// *
|
|
||||||
// * @throws InvalidRuleOperatorException if Operator is not allowed
|
|
||||||
// * @throws InvalidRuleValueException if Value is not allowed
|
|
||||||
// * @return bool
|
|
||||||
// */
|
|
||||||
// public function checkBackOfficeInput()
|
|
||||||
// {
|
|
||||||
// if (!isset($this->validators)
|
|
||||||
// || empty($this->validators)
|
|
||||||
// ||!isset($this->validators[self::PARAM1_QUANTITY])
|
|
||||||
// ||!isset($this->validators[self::PARAM1_QUANTITY])
|
|
||||||
// ) {
|
|
||||||
// throw new InvalidRuleValueException(get_class(), self::PARAM1_QUANTITY);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /** @var RuleValidator $ruleValidator */
|
|
||||||
// $ruleValidator = $this->validators[self::PARAM1_QUANTITY];
|
|
||||||
// /** @var QuantityParam $quantity */
|
|
||||||
// $quantity = $ruleValidator->getParam();
|
|
||||||
//
|
|
||||||
// if (!$quantity instanceof QuantityParam) {
|
|
||||||
// throw new InvalidRuleValueException(get_class(), self::PARAM1_QUANTITY);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// $this->checkBackOfficeInputsOperators();
|
|
||||||
//
|
|
||||||
// return $this->isQuantityValid($quantity->getInteger());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Generate current Rule param to be validated from adapter
|
|
||||||
// *
|
|
||||||
// * @param CouponAdapterInterface $adapter allowing to gather
|
|
||||||
// * all necessary Thelia variables
|
|
||||||
// *
|
|
||||||
// * @return $this
|
|
||||||
// */
|
|
||||||
// protected function setParametersToValidate()
|
|
||||||
// {
|
|
||||||
// $this->paramsToValidate = array(
|
|
||||||
// self::PARAM1_QUANTITY => $this->adapter->getNbArticlesInCart()
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// return $this;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Check if Checkout inputs are relevant or not
|
|
||||||
// *
|
|
||||||
// * @throws \Thelia\Exception\InvalidRuleValueException
|
|
||||||
// * @return bool
|
|
||||||
// */
|
|
||||||
// public function checkCheckoutInput()
|
|
||||||
// {
|
|
||||||
// if (!isset($this->paramsToValidate)
|
|
||||||
// || empty($this->paramsToValidate)
|
|
||||||
// ||!isset($this->paramsToValidate[self::PARAM1_QUANTITY])
|
|
||||||
// ) {
|
|
||||||
// throw new InvalidRuleValueException(get_class(), self::PARAM1_QUANTITY);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// $price = $this->paramsToValidate[self::PARAM1_QUANTITY];
|
|
||||||
//
|
|
||||||
// return $this->isQuantityValid($price);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check validators relevancy and store them
|
* Check validators relevancy and store them
|
||||||
*
|
*
|
||||||
@@ -174,7 +103,7 @@ class AvailableForXArticlesManager extends CouponRuleAbstract
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_int($quantityValue) || $quantityValue <= 0) {
|
if ((int) $quantityValue <= 0) {
|
||||||
throw new \InvalidArgumentException(
|
throw new \InvalidArgumentException(
|
||||||
'Value for quantity field is not legit'
|
'Value for quantity field is not legit'
|
||||||
);
|
);
|
||||||
@@ -210,26 +139,6 @@ class AvailableForXArticlesManager extends CouponRuleAbstract
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Check if a quantity is valid
|
|
||||||
// *
|
|
||||||
// * @param int $quantity Quantity to check
|
|
||||||
// *
|
|
||||||
// * @throws InvalidRuleValueException if Value is not allowed
|
|
||||||
// * @return bool
|
|
||||||
// */
|
|
||||||
// protected function isQuantityValid($quantity)
|
|
||||||
// {
|
|
||||||
// $quantityValidator = $this->quantityValidator;
|
|
||||||
// try {
|
|
||||||
// $quantityValidator->getParam()->compareTo($quantity);
|
|
||||||
// } catch(InvalidArgumentException $e) {
|
|
||||||
// throw new InvalidRuleValueException(get_class(), self::PARAM1_QUANTITY);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get I18n name
|
* Get I18n name
|
||||||
*
|
*
|
||||||
@@ -267,36 +176,6 @@ class AvailableForXArticlesManager extends CouponRuleAbstract
|
|||||||
return $toolTip;
|
return $toolTip;
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Populate a Rule from a form admin
|
|
||||||
// *
|
|
||||||
// * @param array $operators Rule Operator set by the Admin
|
|
||||||
// * @param array $values Rule Values set by the Admin
|
|
||||||
// *
|
|
||||||
// * @throws InvalidArgumentException
|
|
||||||
// * @return $this
|
|
||||||
// */
|
|
||||||
// public function populateFromForm(array $operators, array $values)
|
|
||||||
// {
|
|
||||||
// if ($values[self::PARAM1_QUANTITY] === null) {
|
|
||||||
// throw new InvalidArgumentException(
|
|
||||||
// 'The Rule ' . get_class() . 'needs at least a quantity set (' . self::PARAM1_QUANTITY. ')'
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// $this->quantityValidator = new RuleValidator(
|
|
||||||
// $operators[self::PARAM1_QUANTITY],
|
|
||||||
// new QuantityParam(
|
|
||||||
// $this->adapter,
|
|
||||||
// $values[self::PARAM1_QUANTITY]
|
|
||||||
// )
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// $this->validators = array(self::PARAM1_QUANTITY => $this->quantityValidator);
|
|
||||||
//
|
|
||||||
// return $this;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate inputs ready to be drawn
|
* Generate inputs ready to be drawn
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -23,18 +23,6 @@
|
|||||||
|
|
||||||
namespace Thelia\Controller\Admin;
|
namespace Thelia\Controller\Admin;
|
||||||
|
|
||||||
use Thelia\Core\Event\MessageDeleteEvent;
|
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
|
||||||
use Thelia\Tools\URL;
|
|
||||||
use Thelia\Core\Event\MessageUpdateEvent;
|
|
||||||
use Thelia\Core\Event\MessageCreateEvent;
|
|
||||||
use Thelia\Log\Tlog;
|
|
||||||
use Thelia\Form\Exception\FormValidationException;
|
|
||||||
use Thelia\Core\Security\Exception\AuthorizationException;
|
|
||||||
use Thelia\Model\MessageQuery;
|
|
||||||
use Thelia\Form\MessageModificationForm;
|
|
||||||
use Thelia\Form\MessageCreationForm;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages messages sent by mail
|
* Manages messages sent by mail
|
||||||
*
|
*
|
||||||
@@ -47,17 +35,15 @@ class AttributeController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function defaultAction() {
|
public function defaultAction()
|
||||||
|
{
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.attributes.view")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.attributes.view")) return $response;
|
||||||
|
|
||||||
return $this->render('product-attributes');
|
return $this->render('product-attributes');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateAction() {
|
public function updateAction()
|
||||||
|
{
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.attributes.update")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.attributes.update")) return $response;
|
||||||
|
|
||||||
return $this->render('product-attributes-edit');
|
return $this->render('product-attributes-edit');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,13 +33,13 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
|
|||||||
use Thelia\Core\Security\Exception\AuthenticationException;
|
use Thelia\Core\Security\Exception\AuthenticationException;
|
||||||
use Thelia\Tools\URL;
|
use Thelia\Tools\URL;
|
||||||
use Thelia\Tools\Redirect;
|
use Thelia\Tools\Redirect;
|
||||||
use Thelia\Core\Security\SecurityContext;
|
|
||||||
use Thelia\Model\AdminLog;
|
use Thelia\Model\AdminLog;
|
||||||
use Thelia\Model\Lang;
|
use Thelia\Model\Lang;
|
||||||
use Thelia\Model\LangQuery;
|
use Thelia\Model\LangQuery;
|
||||||
use Thelia\Form\BaseForm;
|
use Thelia\Form\BaseForm;
|
||||||
use Thelia\Form\Exception\FormValidationException;
|
use Thelia\Form\Exception\FormValidationException;
|
||||||
use Thelia\Log\Tlog;
|
use Thelia\Log\Tlog;
|
||||||
|
use Symfony\Component\Routing\Router;
|
||||||
|
|
||||||
class BaseAdminController extends BaseController
|
class BaseAdminController extends BaseController
|
||||||
{
|
{
|
||||||
@@ -50,7 +50,8 @@ class BaseAdminController extends BaseController
|
|||||||
*
|
*
|
||||||
* @param unknown $message
|
* @param unknown $message
|
||||||
*/
|
*/
|
||||||
public function adminLogAppend($message) {
|
public function adminLogAppend($message)
|
||||||
|
{
|
||||||
AdminLog::append($message, $this->getRequest(), $this->getSecurityContext()->getAdminUser());
|
AdminLog::append($message, $this->getRequest(), $this->getSecurityContext()->getAdminUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,12 +67,10 @@ class BaseAdminController extends BaseController
|
|||||||
if (! empty($template)) {
|
if (! empty($template)) {
|
||||||
// If we have a view in the URL, render this view
|
// If we have a view in the URL, render this view
|
||||||
return $this->render($template);
|
return $this->render($template);
|
||||||
}
|
} elseif (null != $view = $this->getRequest()->get('view')) {
|
||||||
elseif (null != $view = $this->getRequest()->get('view')) {
|
|
||||||
return $this->render($view);
|
return $this->render($view);
|
||||||
}
|
}
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex) {
|
|
||||||
return $this->errorPage($ex->getMessage());
|
return $this->errorPage($ex->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +134,8 @@ class BaseAdminController extends BaseController
|
|||||||
/*
|
/*
|
||||||
* Create the standard message displayed to the user when the form cannot be validated.
|
* Create the standard message displayed to the user when the form cannot be validated.
|
||||||
*/
|
*/
|
||||||
protected function createStandardFormValidationErrorMessage(FormValidationException $exception) {
|
protected function createStandardFormValidationErrorMessage(FormValidationException $exception)
|
||||||
|
{
|
||||||
return $this->getTranslator()->trans(
|
return $this->getTranslator()->trans(
|
||||||
"Please check your input: %error",
|
"Please check your input: %error",
|
||||||
array(
|
array(
|
||||||
@@ -152,8 +152,8 @@ class BaseAdminController extends BaseController
|
|||||||
* @param string $error_message the error message
|
* @param string $error_message the error message
|
||||||
* @param Exception $exception the exception or null if no exception
|
* @param Exception $exception the exception or null if no exception
|
||||||
*/
|
*/
|
||||||
protected function setupFormErrorContext($action, $error_message, BaseForm $form = null, \Exception $exception = null) {
|
protected function setupFormErrorContext($action, $error_message, BaseForm $form = null, \Exception $exception = null)
|
||||||
|
{
|
||||||
if ($error_message !== false) {
|
if ($error_message !== false) {
|
||||||
|
|
||||||
// Log the error message
|
// Log the error message
|
||||||
@@ -227,7 +227,8 @@ class BaseAdminController extends BaseController
|
|||||||
*
|
*
|
||||||
* @see \Thelia\Controller\BaseController::getRouteFromRouter()
|
* @see \Thelia\Controller\BaseController::getRouteFromRouter()
|
||||||
*/
|
*/
|
||||||
protected function getRoute($routeId, $parameters = array(), $referenceType = Router::ABSOLUTE_PATH) {
|
protected function getRoute($routeId, $parameters = array(), $referenceType = Router::ABSOLUTE_URL)
|
||||||
|
{
|
||||||
return $this->getRouteFromRouter(
|
return $this->getRouteFromRouter(
|
||||||
'router.admin',
|
'router.admin',
|
||||||
$routeId,
|
$routeId,
|
||||||
@@ -242,15 +243,16 @@ class BaseAdminController extends BaseController
|
|||||||
* @param unknown $routeId the route ID, as found in Config/Resources/routing/admin.xml
|
* @param unknown $routeId the route ID, as found in Config/Resources/routing/admin.xml
|
||||||
* @param unknown $urlParameters the URL parametrs, as a var/value pair array
|
* @param unknown $urlParameters the URL parametrs, as a var/value pair array
|
||||||
*/
|
*/
|
||||||
public function redirectToRoute($routeId, $urlParameters = array()) {
|
public function redirectToRoute($routeId, $urlParameters = array())
|
||||||
|
{
|
||||||
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute($routeId), $urlParameters));
|
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute($routeId), $urlParameters));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current edition lang ID, checking if a change was requested in the current request.
|
* Get the current edition lang ID, checking if a change was requested in the current request.
|
||||||
*/
|
*/
|
||||||
protected function getCurrentEditionLang() {
|
protected function getCurrentEditionLang()
|
||||||
|
{
|
||||||
// Return the new language if a change is required.
|
// Return the new language if a change is required.
|
||||||
if (null !== $edit_language_id = $this->getRequest()->get('edit_language_id', null)) {
|
if (null !== $edit_language_id = $this->getRequest()->get('edit_language_id', null)) {
|
||||||
|
|
||||||
@@ -266,7 +268,8 @@ class BaseAdminController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* A simple helper to get the current edition locale.
|
* A simple helper to get the current edition locale.
|
||||||
*/
|
*/
|
||||||
protected function getCurrentEditionLocale() {
|
protected function getCurrentEditionLocale()
|
||||||
|
{
|
||||||
return $this->getCurrentEditionLang()->getLocale();
|
return $this->getCurrentEditionLang()->getLocale();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,13 +325,11 @@ class BaseAdminController extends BaseController
|
|||||||
$data = $this->getParser()->render($templateName, $args);
|
$data = $this->getParser()->render($templateName, $args);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
} catch (AuthenticationException $ex) {
|
||||||
catch (AuthenticationException $ex) {
|
|
||||||
// User is not authenticated, and templates requires authentication -> redirect to login page
|
// User is not authenticated, and templates requires authentication -> redirect to login page
|
||||||
// We user login_tpl as a path, not a template.
|
// We user login_tpl as a path, not a template.
|
||||||
Redirect::exec(URL::getInstance()->absoluteUrl($ex->getLoginTemplate()));
|
Redirect::exec(URL::getInstance()->absoluteUrl($ex->getLoginTemplate()));
|
||||||
}
|
} catch (AuthorizationException $ex) {
|
||||||
catch (AuthorizationException $ex) {
|
|
||||||
// User is not allowed to perform the required action. Return the error page instead of the requested page.
|
// User is not allowed to perform the required action. Return the error page instead of the requested page.
|
||||||
return $this->errorPage($this->getTranslator()->trans("Sorry, you are not allowed to perform this action."));
|
return $this->errorPage($this->getTranslator()->trans("Sorry, you are not allowed to perform this action."));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,18 +23,10 @@
|
|||||||
|
|
||||||
namespace Thelia\Controller\Admin;
|
namespace Thelia\Controller\Admin;
|
||||||
|
|
||||||
use Thelia\Core\Security\Exception\AuthenticationException;
|
|
||||||
use Thelia\Core\Security\Exception\AuthorizationException;
|
|
||||||
use Thelia\Log\Tlog;
|
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
use Thelia\Core\Event\CategoryCreateEvent;
|
use Thelia\Core\Event\CategoryCreateEvent;
|
||||||
use Thelia\Form\CategoryCreationForm;
|
use Thelia\Form\CategoryCreationForm;
|
||||||
use Thelia\Core\Event\CategoryDeleteEvent;
|
use Thelia\Core\Event\CategoryDeleteEvent;
|
||||||
use Thelia\Core\Event\CategoryToggleVisibilityEvent;
|
|
||||||
use Thelia\Core\Event\CategoryChangePositionEvent;
|
|
||||||
use Thelia\Form\CategoryDeletionForm;
|
|
||||||
use Thelia\Model\Lang;
|
|
||||||
use Thelia\Core\Translation\Translator;
|
|
||||||
use Thelia\Core\Event\CategoryUpdatePositionEvent;
|
use Thelia\Core\Event\CategoryUpdatePositionEvent;
|
||||||
use Thelia\Model\CategoryQuery;
|
use Thelia\Model\CategoryQuery;
|
||||||
use Thelia\Form\CategoryModificationForm;
|
use Thelia\Form\CategoryModificationForm;
|
||||||
@@ -46,12 +38,13 @@ class CategoryController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
protected function renderList() {
|
protected function renderList()
|
||||||
|
{
|
||||||
return $this->render('categories', $this->getTemplateArgs());
|
return $this->render('categories', $this->getTemplateArgs());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getTemplateArgs() {
|
protected function getTemplateArgs()
|
||||||
|
{
|
||||||
// Get the category ID
|
// Get the category ID
|
||||||
$category_id = $this->getRequest()->get('category_id', 0);
|
$category_id = $this->getRequest()->get('category_id', 0);
|
||||||
|
|
||||||
@@ -77,10 +70,9 @@ class CategoryController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function defaultAction() {
|
public function defaultAction()
|
||||||
|
{
|
||||||
if (null !== $response = $this->checkAuth("admin.categories.view")) return $response;
|
if (null !== $response = $this->checkAuth("admin.categories.view")) return $response;
|
||||||
|
|
||||||
return $this->renderList();
|
return $this->renderList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,8 +81,8 @@ class CategoryController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function createAction() {
|
public function createAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.categories.create")) return $response;
|
if (null !== $response = $this->checkAuth("admin.categories.create")) return $response;
|
||||||
|
|
||||||
@@ -126,12 +118,10 @@ class CategoryController extends BaseAdminController
|
|||||||
|
|
||||||
// Redirect to the success URL
|
// Redirect to the success URL
|
||||||
$this->redirect($successUrl);
|
$this->redirect($successUrl);
|
||||||
}
|
} catch (FormValidationException $ex) {
|
||||||
catch (FormValidationException $ex) {
|
|
||||||
// Form cannot be validated
|
// Form cannot be validated
|
||||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex) {
|
|
||||||
// Any other error
|
// Any other error
|
||||||
$error_msg = $ex->getMessage();
|
$error_msg = $ex->getMessage();
|
||||||
}
|
}
|
||||||
@@ -147,8 +137,8 @@ class CategoryController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function changeAction() {
|
public function changeAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
||||||
|
|
||||||
@@ -189,8 +179,8 @@ class CategoryController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function saveChangeAction() {
|
public function saveChangeAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
||||||
|
|
||||||
@@ -241,12 +231,10 @@ class CategoryController extends BaseAdminController
|
|||||||
|
|
||||||
// Redirect to the success URL
|
// Redirect to the success URL
|
||||||
$this->redirect($changeForm->getSuccessUrl());
|
$this->redirect($changeForm->getSuccessUrl());
|
||||||
}
|
} catch (FormValidationException $ex) {
|
||||||
catch (FormValidationException $ex) {
|
|
||||||
// Form cannot be validated
|
// Form cannot be validated
|
||||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex) {
|
|
||||||
// Any other error
|
// Any other error
|
||||||
$error_msg = $ex->getMessage();
|
$error_msg = $ex->getMessage();
|
||||||
}
|
}
|
||||||
@@ -260,7 +248,8 @@ class CategoryController extends BaseAdminController
|
|||||||
/**
|
/**
|
||||||
* Online status toggle category
|
* Online status toggle category
|
||||||
*/
|
*/
|
||||||
public function setToggleVisibilityAction() {
|
public function setToggleVisibilityAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
||||||
|
|
||||||
@@ -271,8 +260,7 @@ class CategoryController extends BaseAdminController
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->dispatch(TheliaEvents::CATEGORY_SET_DEFAULT, $changeEvent);
|
$this->dispatch(TheliaEvents::CATEGORY_SET_DEFAULT, $changeEvent);
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex) {
|
|
||||||
// Any error
|
// Any error
|
||||||
return $this->errorPage($ex);
|
return $this->errorPage($ex);
|
||||||
}
|
}
|
||||||
@@ -283,7 +271,8 @@ class CategoryController extends BaseAdminController
|
|||||||
/**
|
/**
|
||||||
* Update categoryposition
|
* Update categoryposition
|
||||||
*/
|
*/
|
||||||
public function updatePositionAction() {
|
public function updatePositionAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
||||||
|
|
||||||
@@ -306,8 +295,7 @@ class CategoryController extends BaseAdminController
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->dispatch(TheliaEvents::CATEGORY_UPDATE_POSITION, $event);
|
$this->dispatch(TheliaEvents::CATEGORY_UPDATE_POSITION, $event);
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex) {
|
|
||||||
// Any error
|
// Any error
|
||||||
return $this->errorPage($ex);
|
return $this->errorPage($ex);
|
||||||
}
|
}
|
||||||
@@ -320,8 +308,8 @@ class CategoryController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function deleteAction() {
|
public function deleteAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.categories.delete")) return $response;
|
if (null !== $response = $this->checkAuth("admin.categories.delete")) return $response;
|
||||||
|
|
||||||
|
|||||||
@@ -28,9 +28,7 @@ use Thelia\Core\Event\TheliaEvents;
|
|||||||
use Thelia\Tools\URL;
|
use Thelia\Tools\URL;
|
||||||
use Thelia\Core\Event\ConfigUpdateEvent;
|
use Thelia\Core\Event\ConfigUpdateEvent;
|
||||||
use Thelia\Core\Event\ConfigCreateEvent;
|
use Thelia\Core\Event\ConfigCreateEvent;
|
||||||
use Thelia\Log\Tlog;
|
|
||||||
use Thelia\Form\Exception\FormValidationException;
|
use Thelia\Form\Exception\FormValidationException;
|
||||||
use Thelia\Core\Security\Exception\AuthorizationException;
|
|
||||||
use Thelia\Model\ConfigQuery;
|
use Thelia\Model\ConfigQuery;
|
||||||
use Thelia\Form\ConfigModificationForm;
|
use Thelia\Form\ConfigModificationForm;
|
||||||
use Thelia\Form\ConfigCreationForm;
|
use Thelia\Form\ConfigCreationForm;
|
||||||
@@ -47,8 +45,8 @@ class ConfigController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
protected function renderList() {
|
protected function renderList()
|
||||||
|
{
|
||||||
// Find the current order
|
// Find the current order
|
||||||
$order = $this->getRequest()->get(
|
$order = $this->getRequest()->get(
|
||||||
'order',
|
'order',
|
||||||
@@ -66,10 +64,9 @@ class ConfigController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function defaultAction() {
|
public function defaultAction()
|
||||||
|
{
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.view")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.variables.view")) return $response;
|
||||||
|
|
||||||
return $this->renderList();
|
return $this->renderList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,8 +75,8 @@ class ConfigController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function createAction() {
|
public function createAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.create")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.variables.create")) return $response;
|
||||||
|
|
||||||
@@ -120,12 +117,10 @@ class ConfigController extends BaseAdminController
|
|||||||
|
|
||||||
// Redirect to the success URL
|
// Redirect to the success URL
|
||||||
$this->redirect($successUrl);
|
$this->redirect($successUrl);
|
||||||
}
|
} catch (FormValidationException $ex) {
|
||||||
catch (FormValidationException $ex) {
|
|
||||||
// Form cannot be validated
|
// Form cannot be validated
|
||||||
$message = $this->createStandardFormValidationErrorMessage($ex);
|
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex) {
|
|
||||||
// Any other error
|
// Any other error
|
||||||
$message = $ex->getMessage();
|
$message = $ex->getMessage();
|
||||||
}
|
}
|
||||||
@@ -141,8 +136,8 @@ class ConfigController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function changeAction() {
|
public function changeAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response;
|
||||||
|
|
||||||
@@ -183,8 +178,8 @@ class ConfigController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function saveChangeAction() {
|
public function saveChangeAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response;
|
||||||
|
|
||||||
@@ -240,12 +235,10 @@ class ConfigController extends BaseAdminController
|
|||||||
|
|
||||||
// Redirect to the success URL
|
// Redirect to the success URL
|
||||||
$this->redirect($changeForm->getSuccessUrl());
|
$this->redirect($changeForm->getSuccessUrl());
|
||||||
}
|
} catch (FormValidationException $ex) {
|
||||||
catch (FormValidationException $ex) {
|
|
||||||
// Form cannot be validated
|
// Form cannot be validated
|
||||||
$message = $this->createStandardFormValidationErrorMessage($ex);
|
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex) {
|
|
||||||
// Any other error
|
// Any other error
|
||||||
$message = $ex->getMessage();
|
$message = $ex->getMessage();
|
||||||
}
|
}
|
||||||
@@ -261,8 +254,8 @@ class ConfigController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function changeValuesAction() {
|
public function changeValuesAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response;
|
||||||
|
|
||||||
@@ -284,8 +277,8 @@ class ConfigController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function deleteAction() {
|
public function deleteAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.delete")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.variables.delete")) return $response;
|
||||||
|
|
||||||
|
|||||||
@@ -158,6 +158,13 @@ class CouponController extends BaseAdminController
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// Prepare the data that will hydrate the form
|
// Prepare the data that will hydrate the form
|
||||||
|
|
||||||
|
/** @var ConstraintFactory $constraintFactory */
|
||||||
|
$constraintFactory = $this->container->get('thelia.constraint.factory');
|
||||||
|
$rules = $constraintFactory->unserializeCouponRuleCollection(
|
||||||
|
$coupon->getSerializedRules()
|
||||||
|
);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'code' => $coupon->getCode(),
|
'code' => $coupon->getCode(),
|
||||||
'title' => $coupon->getTitle(),
|
'title' => $coupon->getTitle(),
|
||||||
@@ -171,18 +178,12 @@ class CouponController extends BaseAdminController
|
|||||||
'isCumulative' => ($coupon->getIsCumulative() == 1),
|
'isCumulative' => ($coupon->getIsCumulative() == 1),
|
||||||
'isRemovingPostage' => ($coupon->getIsRemovingPostage() == 1),
|
'isRemovingPostage' => ($coupon->getIsRemovingPostage() == 1),
|
||||||
'maxUsage' => $coupon->getMaxUsage(),
|
'maxUsage' => $coupon->getMaxUsage(),
|
||||||
'rules' => new CouponRuleCollection(array()),
|
'rules' => $rules,
|
||||||
'locale' => $coupon->getLocale(),
|
'locale' => $coupon->getLocale(),
|
||||||
);
|
);
|
||||||
|
|
||||||
$args['rulesObject'] = array();
|
$args['rulesObject'] = array();
|
||||||
|
|
||||||
/** @var ConstraintFactory $constraintFactory */
|
|
||||||
$constraintFactory = $this->container->get('thelia.constraint.factory');
|
|
||||||
$rules = $constraintFactory->unserializeCouponRuleCollection(
|
|
||||||
$coupon->getSerializedRules()
|
|
||||||
);
|
|
||||||
|
|
||||||
/** @var CouponRuleInterface $rule */
|
/** @var CouponRuleInterface $rule */
|
||||||
foreach ($rules->getRules() as $rule) {
|
foreach ($rules->getRules() as $rule) {
|
||||||
$args['rulesObject'][] = array(
|
$args['rulesObject'][] = array(
|
||||||
@@ -193,6 +194,8 @@ class CouponController extends BaseAdminController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$args['rules'] = $this->cleanRuleForTemplate($rules);
|
||||||
|
|
||||||
// Setup the object form
|
// Setup the object form
|
||||||
$changeForm = new CouponCreationForm($this->getRequest(), 'form', $data);
|
$changeForm = new CouponCreationForm($this->getRequest(), 'form', $data);
|
||||||
|
|
||||||
@@ -216,100 +219,101 @@ class CouponController extends BaseAdminController
|
|||||||
|
|
||||||
$args['formAction'] = 'admin/coupon/update/' . $couponId;
|
$args['formAction'] = 'admin/coupon/update/' . $couponId;
|
||||||
|
|
||||||
return $this->render(
|
return $this->render('coupon-update', $args);
|
||||||
'coupon-update',
|
|
||||||
$args
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Manage Coupons Rule creation display
|
// * Manage Coupons Rule creation display
|
||||||
*
|
// *
|
||||||
* @param int $couponId Coupon id
|
// * @param int $couponId Coupon id
|
||||||
*
|
// *
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
// * @return \Symfony\Component\HttpFoundation\Response
|
||||||
*/
|
// */
|
||||||
public function createRuleAction($couponId)
|
// public function createRuleAction($couponId)
|
||||||
{
|
// {
|
||||||
// Check current user authorization
|
// // Check current user authorization
|
||||||
$response = $this->checkAuth('admin.coupon.update');
|
// $response = $this->checkAuth('admin.coupon.update');
|
||||||
if ($response !== null) {
|
// if ($response !== null) {
|
||||||
return $response;
|
// return $response;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/** @var Coupon $coupon */
|
// /** @var Coupon $coupon */
|
||||||
$coupon = CouponQuery::create()->findOneById($couponId);
|
// $coupon = CouponQuery::create()->findOneById($couponId);
|
||||||
if (!$coupon) {
|
// if (!$coupon) {
|
||||||
$this->pageNotFound();
|
// $this->pageNotFound();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// Parameters given to the template
|
// // Parameters given to the template
|
||||||
$args = array();
|
// $args = array();
|
||||||
|
//
|
||||||
$i18n = new I18n();
|
// $i18n = new I18n();
|
||||||
/** @var Lang $lang */
|
// /** @var Lang $lang */
|
||||||
$lang = $this->getSession()->get('lang');
|
// $lang = $this->getSession()->get('lang');
|
||||||
$eventToDispatch = TheliaEvents::COUPON_RULE_CREATE;
|
// $eventToDispatch = TheliaEvents::COUPON_RULE_CREATE;
|
||||||
|
//
|
||||||
if ($this->getRequest()->isMethod('POST')) {
|
// if ($this->getRequest()->isMethod('POST')) {
|
||||||
$this->validateCreateOrUpdateForm(
|
// $this->validateCreateOrUpdateForm(
|
||||||
$i18n,
|
// $i18n,
|
||||||
$lang,
|
// $lang,
|
||||||
$eventToDispatch,
|
// $eventToDispatch,
|
||||||
'updated',
|
// 'updated',
|
||||||
'update'
|
// 'update'
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
// Prepare the data that will hydrate the form
|
// // Prepare the data that will hydrate the form
|
||||||
$data = array(
|
//
|
||||||
'code' => $coupon->getCode(),
|
// /** @var ConstraintFactory $constraintFactory */
|
||||||
'title' => $coupon->getTitle(),
|
// $constraintFactory = $this->container->get('thelia.constraint.factory');
|
||||||
'amount' => $coupon->getAmount(),
|
//
|
||||||
'effect' => $coupon->getType(),
|
// $data = array(
|
||||||
'shortDescription' => $coupon->getShortDescription(),
|
// 'code' => $coupon->getCode(),
|
||||||
'description' => $coupon->getDescription(),
|
// 'title' => $coupon->getTitle(),
|
||||||
'isEnabled' => ($coupon->getIsEnabled() == 1),
|
// 'amount' => $coupon->getAmount(),
|
||||||
'expirationDate' => $coupon->getExpirationDate($lang->getDateFormat()),
|
// 'effect' => $coupon->getType(),
|
||||||
'isAvailableOnSpecialOffers' => ($coupon->getIsAvailableOnSpecialOffers() == 1),
|
// 'shortDescription' => $coupon->getShortDescription(),
|
||||||
'isCumulative' => ($coupon->getIsCumulative() == 1),
|
// 'description' => $coupon->getDescription(),
|
||||||
'isRemovingPostage' => ($coupon->getIsRemovingPostage() == 1),
|
// 'isEnabled' => ($coupon->getIsEnabled() == 1),
|
||||||
'maxUsage' => $coupon->getMaxUsage(),
|
// 'expirationDate' => $coupon->getExpirationDate($lang->getDateFormat()),
|
||||||
'rules' => new CouponRuleCollection(array()),
|
// 'isAvailableOnSpecialOffers' => ($coupon->getIsAvailableOnSpecialOffers() == 1),
|
||||||
'locale' => $coupon->getLocale(),
|
// 'isCumulative' => ($coupon->getIsCumulative() == 1),
|
||||||
);
|
// 'isRemovingPostage' => ($coupon->getIsRemovingPostage() == 1),
|
||||||
|
// 'maxUsage' => $coupon->getMaxUsage(),
|
||||||
/** @var CouponAdapterInterface $adapter */
|
// 'rules' => $constraintFactory->unserializeCouponRuleCollection($coupon->getSerializedRules()),
|
||||||
$adapter = $this->container->get('thelia.adapter');
|
// 'locale' => $coupon->getLocale(),
|
||||||
/** @var Translator $translator */
|
// );
|
||||||
$translator = $this->container->get('thelia.translator');
|
//
|
||||||
|
// /** @var CouponAdapterInterface $adapter */
|
||||||
$args['rulesObject'] = array();
|
// $adapter = $this->container->get('thelia.adapter');
|
||||||
/** @var CouponRuleInterface $rule */
|
// /** @var Translator $translator */
|
||||||
foreach ($coupon->getRules()->getRules() as $rule) {
|
// $translator = $this->container->get('thelia.translator');
|
||||||
$args['rulesObject'][] = array(
|
//
|
||||||
'name' => $rule->getName($translator),
|
// $args['rulesObject'] = array();
|
||||||
'tooltip' => $rule->getToolTip($translator),
|
// /** @var CouponRuleInterface $rule */
|
||||||
'validators' => $rule->getValidators()
|
// foreach ($coupon->getRules()->getRules() as $rule) {
|
||||||
);
|
// $args['rulesObject'][] = array(
|
||||||
}
|
// 'name' => $rule->getName($translator),
|
||||||
|
// 'tooltip' => $rule->getToolTip($translator),
|
||||||
|
// 'validators' => $rule->getValidators()
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
//
|
||||||
// $args['rules'] = $this->cleanRuleForTemplate($coupon->getRules()->getRules());
|
// $args['rules'] = $this->cleanRuleForTemplate($coupon->getRules()->getRules());
|
||||||
|
//
|
||||||
// Setup the object form
|
// // Setup the object form
|
||||||
$changeForm = new CouponCreationForm($this->getRequest(), 'form', $data);
|
// $changeForm = new CouponCreationForm($this->getRequest(), 'form', $data);
|
||||||
|
//
|
||||||
// Pass it to the parser
|
// // Pass it to the parser
|
||||||
$this->getParserContext()->addForm($changeForm);
|
// $this->getParserContext()->addForm($changeForm);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
$args['formAction'] = 'admin/coupon/update/' . $couponId;
|
// $args['formAction'] = 'admin/coupon/update/' . $couponId;
|
||||||
|
//
|
||||||
return $this->render(
|
// return $this->render(
|
||||||
'coupon-update',
|
// 'coupon-update',
|
||||||
$args
|
// $args
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -413,7 +417,6 @@ class CouponController extends BaseAdminController
|
|||||||
$constraintFactory = $this->container->get('thelia.constraint.factory');
|
$constraintFactory = $this->container->get('thelia.constraint.factory');
|
||||||
$rulesReceived = json_decode($this->getRequest()->get('rules'));
|
$rulesReceived = json_decode($this->getRequest()->get('rules'));
|
||||||
foreach ($rulesReceived as $ruleReceived) {
|
foreach ($rulesReceived as $ruleReceived) {
|
||||||
var_dump('building ', $ruleReceived->values);
|
|
||||||
$rule = $constraintFactory->build(
|
$rule = $constraintFactory->build(
|
||||||
$ruleReceived->serviceId,
|
$ruleReceived->serviceId,
|
||||||
(array) $ruleReceived->operators,
|
(array) $ruleReceived->operators,
|
||||||
@@ -442,6 +445,7 @@ class CouponController extends BaseAdminController
|
|||||||
$rules,
|
$rules,
|
||||||
$coupon->getLocale()
|
$coupon->getLocale()
|
||||||
);
|
);
|
||||||
|
$couponEvent->setCoupon($coupon);
|
||||||
|
|
||||||
$eventToDispatch = TheliaEvents::COUPON_RULE_UPDATE;
|
$eventToDispatch = TheliaEvents::COUPON_RULE_UPDATE;
|
||||||
// Dispatch Event to the Action
|
// Dispatch Event to the Action
|
||||||
|
|||||||
@@ -28,9 +28,7 @@ use Thelia\Core\Event\TheliaEvents;
|
|||||||
use Thelia\Tools\URL;
|
use Thelia\Tools\URL;
|
||||||
use Thelia\Core\Event\CurrencyUpdateEvent;
|
use Thelia\Core\Event\CurrencyUpdateEvent;
|
||||||
use Thelia\Core\Event\CurrencyCreateEvent;
|
use Thelia\Core\Event\CurrencyCreateEvent;
|
||||||
use Thelia\Log\Tlog;
|
|
||||||
use Thelia\Form\Exception\FormValidationException;
|
use Thelia\Form\Exception\FormValidationException;
|
||||||
use Thelia\Core\Security\Exception\AuthorizationException;
|
|
||||||
use Thelia\Model\CurrencyQuery;
|
use Thelia\Model\CurrencyQuery;
|
||||||
use Thelia\Form\CurrencyModificationForm;
|
use Thelia\Form\CurrencyModificationForm;
|
||||||
use Thelia\Form\CurrencyCreationForm;
|
use Thelia\Form\CurrencyCreationForm;
|
||||||
@@ -48,8 +46,8 @@ class CurrencyController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
protected function renderList() {
|
protected function renderList()
|
||||||
|
{
|
||||||
// Find the current order
|
// Find the current order
|
||||||
$order = $this->getRequest()->get(
|
$order = $this->getRequest()->get(
|
||||||
'order',
|
'order',
|
||||||
@@ -67,10 +65,9 @@ class CurrencyController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function defaultAction() {
|
public function defaultAction()
|
||||||
|
{
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.view")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.currencies.view")) return $response;
|
||||||
|
|
||||||
return $this->renderList();
|
return $this->renderList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,8 +76,8 @@ class CurrencyController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function createAction() {
|
public function createAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.create")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.currencies.create")) return $response;
|
||||||
|
|
||||||
@@ -120,12 +117,10 @@ class CurrencyController extends BaseAdminController
|
|||||||
|
|
||||||
// Redirect to the success URL
|
// Redirect to the success URL
|
||||||
$this->redirect($successUrl);
|
$this->redirect($successUrl);
|
||||||
}
|
} catch (FormValidationException $ex) {
|
||||||
catch (FormValidationException $ex) {
|
|
||||||
// Form cannot be validated
|
// Form cannot be validated
|
||||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex) {
|
|
||||||
// Any other error
|
// Any other error
|
||||||
$error_msg = $ex->getMessage();
|
$error_msg = $ex->getMessage();
|
||||||
}
|
}
|
||||||
@@ -141,8 +136,8 @@ class CurrencyController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function changeAction() {
|
public function changeAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||||
|
|
||||||
@@ -179,8 +174,8 @@ class CurrencyController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function saveChangeAction() {
|
public function saveChangeAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||||
|
|
||||||
@@ -231,12 +226,10 @@ class CurrencyController extends BaseAdminController
|
|||||||
|
|
||||||
// Redirect to the success URL
|
// Redirect to the success URL
|
||||||
$this->redirect($changeForm->getSuccessUrl());
|
$this->redirect($changeForm->getSuccessUrl());
|
||||||
}
|
} catch (FormValidationException $ex) {
|
||||||
catch (FormValidationException $ex) {
|
|
||||||
// Form cannot be validated
|
// Form cannot be validated
|
||||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex) {
|
|
||||||
// Any other error
|
// Any other error
|
||||||
$error_msg = $ex->getMessage();
|
$error_msg = $ex->getMessage();
|
||||||
}
|
}
|
||||||
@@ -250,7 +243,8 @@ class CurrencyController extends BaseAdminController
|
|||||||
/**
|
/**
|
||||||
* Sets the default currency
|
* Sets the default currency
|
||||||
*/
|
*/
|
||||||
public function setDefaultAction() {
|
public function setDefaultAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||||
|
|
||||||
@@ -261,8 +255,7 @@ class CurrencyController extends BaseAdminController
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->dispatch(TheliaEvents::CURRENCY_SET_DEFAULT, $changeEvent);
|
$this->dispatch(TheliaEvents::CURRENCY_SET_DEFAULT, $changeEvent);
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex) {
|
|
||||||
// Any error
|
// Any error
|
||||||
return $this->errorPage($ex);
|
return $this->errorPage($ex);
|
||||||
}
|
}
|
||||||
@@ -273,14 +266,14 @@ class CurrencyController extends BaseAdminController
|
|||||||
/**
|
/**
|
||||||
* Update currencies rates
|
* Update currencies rates
|
||||||
*/
|
*/
|
||||||
public function updateRatesAction() {
|
public function updateRatesAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->dispatch(TheliaEvents::CURRENCY_UPDATE_RATES);
|
$this->dispatch(TheliaEvents::CURRENCY_UPDATE_RATES);
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex) {
|
|
||||||
// Any error
|
// Any error
|
||||||
return $this->errorPage($ex);
|
return $this->errorPage($ex);
|
||||||
}
|
}
|
||||||
@@ -291,7 +284,8 @@ class CurrencyController extends BaseAdminController
|
|||||||
/**
|
/**
|
||||||
* Update currencyposition
|
* Update currencyposition
|
||||||
*/
|
*/
|
||||||
public function updatePositionAction() {
|
public function updatePositionAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||||
|
|
||||||
@@ -314,8 +308,7 @@ class CurrencyController extends BaseAdminController
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->dispatch(TheliaEvents::CURRENCY_UPDATE_POSITION, $event);
|
$this->dispatch(TheliaEvents::CURRENCY_UPDATE_POSITION, $event);
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex) {
|
|
||||||
// Any error
|
// Any error
|
||||||
return $this->errorPage($ex);
|
return $this->errorPage($ex);
|
||||||
}
|
}
|
||||||
@@ -323,14 +316,13 @@ class CurrencyController extends BaseAdminController
|
|||||||
$this->redirectToRoute('admin.configuration.currencies.default');
|
$this->redirectToRoute('admin.configuration.currencies.default');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a currency object
|
* Delete a currency object
|
||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function deleteAction() {
|
public function deleteAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.delete")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.currencies.delete")) return $response;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
namespace Thelia\Controller\Admin;
|
namespace Thelia\Controller\Admin;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CustomerController
|
* Class CustomerController
|
||||||
* @package Thelia\Controller\Admin
|
* @package Thelia\Controller\Admin
|
||||||
@@ -34,7 +33,14 @@ class CustomerController extends BaseAdminController
|
|||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
if (null !== $response = $this->checkAuth("admin.customers.view")) return $response;
|
if (null !== $response = $this->checkAuth("admin.customers.view")) return $response;
|
||||||
|
|
||||||
return $this->render("customers", array("display_customer" => 20));
|
return $this->render("customers", array("display_customer" => 20));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function viewAction($customer_id)
|
||||||
|
{
|
||||||
|
|
||||||
|
return $this->render("customer-edit", array(
|
||||||
|
"customer_id" => $customer_id
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -28,9 +28,7 @@ use Thelia\Core\Event\TheliaEvents;
|
|||||||
use Thelia\Tools\URL;
|
use Thelia\Tools\URL;
|
||||||
use Thelia\Core\Event\MessageUpdateEvent;
|
use Thelia\Core\Event\MessageUpdateEvent;
|
||||||
use Thelia\Core\Event\MessageCreateEvent;
|
use Thelia\Core\Event\MessageCreateEvent;
|
||||||
use Thelia\Log\Tlog;
|
|
||||||
use Thelia\Form\Exception\FormValidationException;
|
use Thelia\Form\Exception\FormValidationException;
|
||||||
use Thelia\Core\Security\Exception\AuthorizationException;
|
|
||||||
use Thelia\Model\MessageQuery;
|
use Thelia\Model\MessageQuery;
|
||||||
use Thelia\Form\MessageModificationForm;
|
use Thelia\Form\MessageModificationForm;
|
||||||
use Thelia\Form\MessageCreationForm;
|
use Thelia\Form\MessageCreationForm;
|
||||||
@@ -47,7 +45,8 @@ class MessageController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
protected function renderList() {
|
protected function renderList()
|
||||||
|
{
|
||||||
return $this->render('messages');
|
return $this->render('messages');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,10 +55,9 @@ class MessageController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function defaultAction() {
|
public function defaultAction()
|
||||||
|
{
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.view")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.messages.view")) return $response;
|
||||||
|
|
||||||
return $this->renderList();
|
return $this->renderList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,8 +66,8 @@ class MessageController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function createAction() {
|
public function createAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.create")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.messages.create")) return $response;
|
||||||
|
|
||||||
@@ -107,12 +105,10 @@ class MessageController extends BaseAdminController
|
|||||||
|
|
||||||
// Redirect to the success URL
|
// Redirect to the success URL
|
||||||
$this->redirect($successUrl);
|
$this->redirect($successUrl);
|
||||||
}
|
} catch (FormValidationException $ex) {
|
||||||
catch (FormValidationException $ex) {
|
|
||||||
// Form cannot be validated
|
// Form cannot be validated
|
||||||
$message = $this->createStandardFormValidationErrorMessage($ex);
|
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex) {
|
|
||||||
// Any other error
|
// Any other error
|
||||||
$message = $ex->getMessage();
|
$message = $ex->getMessage();
|
||||||
}
|
}
|
||||||
@@ -128,8 +124,8 @@ class MessageController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function changeAction() {
|
public function changeAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.update")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.messages.update")) return $response;
|
||||||
|
|
||||||
@@ -168,8 +164,8 @@ class MessageController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function saveChangeAction() {
|
public function saveChangeAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.update")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.messages.update")) return $response;
|
||||||
|
|
||||||
@@ -221,12 +217,10 @@ class MessageController extends BaseAdminController
|
|||||||
|
|
||||||
// Redirect to the success URL
|
// Redirect to the success URL
|
||||||
$this->redirect($changeForm->getSuccessUrl());
|
$this->redirect($changeForm->getSuccessUrl());
|
||||||
}
|
} catch (FormValidationException $ex) {
|
||||||
catch (FormValidationException $ex) {
|
|
||||||
// Form cannot be validated
|
// Form cannot be validated
|
||||||
$message = $this->createStandardFormValidationErrorMessage($ex);
|
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex) {
|
|
||||||
// Any other error
|
// Any other error
|
||||||
$message = $ex->getMessage();
|
$message = $ex->getMessage();
|
||||||
}
|
}
|
||||||
@@ -242,8 +236,8 @@ class MessageController extends BaseAdminController
|
|||||||
*
|
*
|
||||||
* @return Symfony\Component\HttpFoundation\Response the response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function deleteAction() {
|
public function deleteAction()
|
||||||
|
{
|
||||||
// Check current user authorization
|
// Check current user authorization
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.delete")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.messages.delete")) return $response;
|
||||||
|
|
||||||
|
|||||||
39
core/lib/Thelia/Controller/Admin/OrderController.php
Normal file
39
core/lib/Thelia/Controller/Admin/OrderController.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* Thelia */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : info@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* This program is free software; you can redistribute it and/or modify */
|
||||||
|
/* it under the terms of the GNU General Public License as published by */
|
||||||
|
/* the Free Software Foundation; either version 3 of the License */
|
||||||
|
/* */
|
||||||
|
/* This program is distributed in the hope that it will be useful, */
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||||
|
/* GNU General Public License for more details. */
|
||||||
|
/* */
|
||||||
|
/* You should have received a copy of the GNU General Public License */
|
||||||
|
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
/* */
|
||||||
|
/*************************************************************************************/
|
||||||
|
|
||||||
|
namespace Thelia\Controller\Admin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class OrderController
|
||||||
|
* @package Thelia\Controller\Admin
|
||||||
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class OrderController extends BaseAdminController
|
||||||
|
{
|
||||||
|
public function indexAction()
|
||||||
|
{
|
||||||
|
if (null !== $response = $this->checkAuth("admin.orders.view")) return $response;
|
||||||
|
return $this->render("orders", array("display_order" => 20));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -27,7 +27,6 @@ use Thelia\Form\AdminLogin;
|
|||||||
use Thelia\Core\Security\Authentication\AdminUsernamePasswordFormAuthenticator;
|
use Thelia\Core\Security\Authentication\AdminUsernamePasswordFormAuthenticator;
|
||||||
use Thelia\Model\AdminLog;
|
use Thelia\Model\AdminLog;
|
||||||
use Thelia\Core\Security\Exception\AuthenticationException;
|
use Thelia\Core\Security\Exception\AuthenticationException;
|
||||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
|
||||||
use Thelia\Tools\URL;
|
use Thelia\Tools\URL;
|
||||||
use Thelia\Tools\Redirect;
|
use Thelia\Tools\Redirect;
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
@@ -74,20 +73,17 @@ class SessionController extends BaseAdminController
|
|||||||
// Redirect to the success URL
|
// Redirect to the success URL
|
||||||
return Redirect::exec($adminLoginForm->getSuccessUrl());
|
return Redirect::exec($adminLoginForm->getSuccessUrl());
|
||||||
|
|
||||||
}
|
} catch (FormValidationException $ex) {
|
||||||
catch (FormValidationException $ex) {
|
|
||||||
|
|
||||||
// Validation problem
|
// Validation problem
|
||||||
$message = $this->createStandardFormValidationErrorMessage($ex);
|
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
}
|
} catch (AuthenticationException $ex) {
|
||||||
catch (AuthenticationException $ex) {
|
|
||||||
|
|
||||||
// Log authentication failure
|
// Log authentication failure
|
||||||
AdminLog::append(sprintf("Authentication failure for username '%s'", $authenticator->getUsername()), $request);
|
AdminLog::append(sprintf("Authentication failure for username '%s'", $authenticator->getUsername()), $request);
|
||||||
|
|
||||||
$message = $this->getTranslator()->trans("Login failed. Please check your username and password.");
|
$message = $this->getTranslator()->trans("Login failed. Please check your username and password.");
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex) {
|
|
||||||
|
|
||||||
// Log authentication failure
|
// Log authentication failure
|
||||||
AdminLog::append(sprintf("Undefined error: %s", $ex->getMessage()), $request);
|
AdminLog::append(sprintf("Undefined error: %s", $ex->getMessage()), $request);
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ use Thelia\Form\BaseForm;
|
|||||||
use Thelia\Form\Exception\FormValidationException;
|
use Thelia\Form\Exception\FormValidationException;
|
||||||
use Symfony\Component\EventDispatcher\Event;
|
use Symfony\Component\EventDispatcher\Event;
|
||||||
use Thelia\Core\Event\DefaultActionEvent;
|
use Thelia\Core\Event\DefaultActionEvent;
|
||||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -142,8 +141,8 @@ class BaseController extends ContainerAware
|
|||||||
* @param \Symfony\Component\Form\Form $form
|
* @param \Symfony\Component\Form\Form $form
|
||||||
* @return string the error string
|
* @return string the error string
|
||||||
*/
|
*/
|
||||||
private function getErrorMessages(\Symfony\Component\Form\Form $form) {
|
private function getErrorMessages(\Symfony\Component\Form\Form $form)
|
||||||
|
{
|
||||||
$errors = '';
|
$errors = '';
|
||||||
|
|
||||||
foreach ($form->getErrors() as $key => $error) {
|
foreach ($form->getErrors() as $key => $error) {
|
||||||
@@ -177,8 +176,7 @@ class BaseController extends ContainerAware
|
|||||||
|
|
||||||
if ($form->isValid()) {
|
if ($form->isValid()) {
|
||||||
return $form;
|
return $form;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$errorMessage = null;
|
$errorMessage = null;
|
||||||
if ($form->get("error_message")->getData() != null) {
|
if ($form->get("error_message")->getData() != null) {
|
||||||
$errorMessage = $form->get("error_message")->getData();
|
$errorMessage = $form->get("error_message")->getData();
|
||||||
@@ -188,8 +186,7 @@ class BaseController extends ContainerAware
|
|||||||
|
|
||||||
throw new FormValidationException($errorMessage);
|
throw new FormValidationException($errorMessage);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw new FormValidationException(sprintf("Wrong form method, %s expected.", $expectedMethod));
|
throw new FormValidationException(sprintf("Wrong form method, %s expected.", $expectedMethod));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -214,8 +211,7 @@ class BaseController extends ContainerAware
|
|||||||
{
|
{
|
||||||
if ($form != null) {
|
if ($form != null) {
|
||||||
$url = $form->getSuccessUrl();
|
$url = $form->getSuccessUrl();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$url = $this->getRequest()->get("success_url");
|
$url = $this->getRequest()->get("success_url");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,7 +235,8 @@ class BaseController extends ContainerAware
|
|||||||
* @throws \InvalidArgumentException When the router doesn't exist
|
* @throws \InvalidArgumentException When the router doesn't exist
|
||||||
* @return string The generated URL
|
* @return string The generated URL
|
||||||
*/
|
*/
|
||||||
protected function getRouteFromRouter($routerName, $routeId, $parameters = array(), $referenceType = Router::ABSOLUTE_PATH) {
|
protected function getRouteFromRouter($routerName, $routeId, $parameters = array(), $referenceType = Router::ABSOLUTE_URL)
|
||||||
|
{
|
||||||
/** @var Router $router */
|
/** @var Router $router */
|
||||||
$router = $this->container->get($routerName);
|
$router = $this->container->get($routerName);
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ use Thelia\Model\Base\AddressQuery;
|
|||||||
use Thelia\Model\Customer;
|
use Thelia\Model\Customer;
|
||||||
use Thelia\Tools\URL;
|
use Thelia\Tools\URL;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AddressController
|
* Class AddressController
|
||||||
* @package Thelia\Controller\Front
|
* @package Thelia\Controller\Front
|
||||||
@@ -66,8 +65,7 @@ class AddressController extends BaseFrontController
|
|||||||
|
|
||||||
} catch (FormValidationException $e) {
|
} catch (FormValidationException $e) {
|
||||||
$message = sprintf("Please check your input: %s", $e->getMessage());
|
$message = sprintf("Please check your input: %s", $e->getMessage());
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e) {
|
|
||||||
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
|
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,8 +118,7 @@ class AddressController extends BaseFrontController
|
|||||||
$this->redirectSuccess($addressUpdate);
|
$this->redirectSuccess($addressUpdate);
|
||||||
} catch (FormValidationException $e) {
|
} catch (FormValidationException $e) {
|
||||||
$message = sprintf("Please check your input: %s", $e->getMessage());
|
$message = sprintf("Please check your input: %s", $e->getMessage());
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e) {
|
|
||||||
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
|
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ class BaseFrontController extends BaseController
|
|||||||
*
|
*
|
||||||
* @see \Thelia\Controller\BaseController::getRouteFromRouter()
|
* @see \Thelia\Controller\BaseController::getRouteFromRouter()
|
||||||
*/
|
*/
|
||||||
protected function getRoute($routeId, $parameters = array(), $referenceType = Router::ABSOLUTE_PATH) {
|
protected function getRoute($routeId, $parameters = array(), $referenceType = Router::ABSOLUTE_PATH)
|
||||||
|
{
|
||||||
return $this->getRouteFromRouter('router.front', $routeId, $parameters, $referenceType);
|
return $this->getRouteFromRouter('router.front', $routeId, $parameters, $referenceType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +46,8 @@ class BaseFrontController extends BaseController
|
|||||||
* @param unknown $routeId the route ID, as found in Config/Resources/routing/admin.xml
|
* @param unknown $routeId the route ID, as found in Config/Resources/routing/admin.xml
|
||||||
* @param unknown $urlParameters the URL parametrs, as a var/value pair array
|
* @param unknown $urlParameters the URL parametrs, as a var/value pair array
|
||||||
*/
|
*/
|
||||||
public function redirectToRoute($routeId, $urlParameters = array(), $referenceType = Router::ABSOLUTE_PATH) {
|
public function redirectToRoute($routeId, $urlParameters = array(), $referenceType = Router::ABSOLUTE_PATH)
|
||||||
|
{
|
||||||
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute($routeId, array(), $referenceType), $urlParameters));
|
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute($routeId, array(), $referenceType), $urlParameters));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ class CartController extends BaseFrontController
|
|||||||
$this->getParserContext()->setGeneralError($e->getMessage());
|
$this->getParserContext()->setGeneralError($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -27,19 +27,15 @@ use Thelia\Core\Event\CustomerLoginEvent;
|
|||||||
use Thelia\Core\Security\Authentication\CustomerUsernamePasswordFormAuthenticator;
|
use Thelia\Core\Security\Authentication\CustomerUsernamePasswordFormAuthenticator;
|
||||||
use Thelia\Core\Security\Exception\AuthenticationException;
|
use Thelia\Core\Security\Exception\AuthenticationException;
|
||||||
use Thelia\Core\Security\Exception\UsernameNotFoundException;
|
use Thelia\Core\Security\Exception\UsernameNotFoundException;
|
||||||
use Thelia\Core\Security\SecurityContext;
|
|
||||||
use Thelia\Form\CustomerCreation;
|
use Thelia\Form\CustomerCreation;
|
||||||
use Thelia\Form\CustomerLogin;
|
use Thelia\Form\CustomerLogin;
|
||||||
use Thelia\Form\CustomerModification;
|
use Thelia\Form\CustomerModification;
|
||||||
use Thelia\Form\Exception\FormValidationException;
|
use Thelia\Form\Exception\FormValidationException;
|
||||||
use Thelia\Model\Customer;
|
use Thelia\Model\Customer;
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
use Thelia\Core\Event\CustomerEvent;
|
|
||||||
use Thelia\Core\Factory\ActionEventFactory;
|
|
||||||
use Thelia\Tools\URL;
|
use Thelia\Tools\URL;
|
||||||
use Thelia\Log\Tlog;
|
use Thelia\Log\Tlog;
|
||||||
use Thelia\Core\Security\Exception\WrongPasswordException;
|
use Thelia\Core\Security\Exception\WrongPasswordException;
|
||||||
use Symfony\Component\Routing\Router;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CustomerController
|
* Class CustomerController
|
||||||
@@ -70,11 +66,9 @@ class CustomerController extends BaseFrontController
|
|||||||
$this->processLogin($customerCreateEvent->getCustomer());
|
$this->processLogin($customerCreateEvent->getCustomer());
|
||||||
|
|
||||||
$this->redirectSuccess($customerCreation);
|
$this->redirectSuccess($customerCreation);
|
||||||
}
|
} catch (FormValidationException $e) {
|
||||||
catch (FormValidationException $e) {
|
|
||||||
$message = sprintf("Please check your input: %s", $e->getMessage());
|
$message = sprintf("Please check your input: %s", $e->getMessage());
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e) {
|
|
||||||
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
|
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,11 +112,9 @@ class CustomerController extends BaseFrontController
|
|||||||
|
|
||||||
$this->redirectSuccess($customerModification);
|
$this->redirectSuccess($customerModification);
|
||||||
|
|
||||||
}
|
} catch (FormValidationException $e) {
|
||||||
catch (FormValidationException $e) {
|
|
||||||
$message = sprintf("Please check your input: %s", $e->getMessage());
|
$message = sprintf("Please check your input: %s", $e->getMessage());
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e) {
|
|
||||||
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
|
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,8 +158,7 @@ class CustomerController extends BaseFrontController
|
|||||||
|
|
||||||
$this->redirectSuccess($customerLoginForm);
|
$this->redirectSuccess($customerLoginForm);
|
||||||
|
|
||||||
}
|
} catch (FormValidationException $e) {
|
||||||
catch (FormValidationException $e) {
|
|
||||||
|
|
||||||
if ($request->request->has("account")) {
|
if ($request->request->has("account")) {
|
||||||
$account = $request->request->get("account");
|
$account = $request->request->get("account");
|
||||||
@@ -178,17 +169,13 @@ class CustomerController extends BaseFrontController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$message = sprintf("Please check your input: %s", $e->getMessage());
|
$message = sprintf("Please check your input: %s", $e->getMessage());
|
||||||
}
|
} catch (UsernameNotFoundException $e) {
|
||||||
catch(UsernameNotFoundException $e) {
|
|
||||||
$message = "Wrong email or password. Please try again";
|
$message = "Wrong email or password. Please try again";
|
||||||
}
|
} catch (WrongPasswordException $e) {
|
||||||
catch (WrongPasswordException $e) {
|
|
||||||
$message = "Wrong email or password. Please try again";
|
$message = "Wrong email or password. Please try again";
|
||||||
}
|
} catch (AuthenticationException $e) {
|
||||||
catch(AuthenticationException $e) {
|
|
||||||
$message = "Wrong email or password. Please try again";
|
$message = "Wrong email or password. Please try again";
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e) {
|
|
||||||
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
|
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ namespace Thelia\Controller\Front;
|
|||||||
use Thelia\Model\ModuleQuery;
|
use Thelia\Model\ModuleQuery;
|
||||||
use Thelia\Tools\URL;
|
use Thelia\Tools\URL;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DeliveryController
|
* Class DeliveryController
|
||||||
* @package Thelia\Controller\Front
|
* @package Thelia\Controller\Front
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ namespace Thelia\Controller\Install;
|
|||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Thelia\Controller\BaseController;
|
use Thelia\Controller\BaseController;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BaseInstallController
|
* Class BaseInstallController
|
||||||
* @package Thelia\Controller\Install
|
* @package Thelia\Controller\Install
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
namespace Thelia\Controller\Install;
|
namespace Thelia\Controller\Install;
|
||||||
use Thelia\Install\BaseInstall;
|
|
||||||
use Thelia\Install\CheckPermission;
|
use Thelia\Install\CheckPermission;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,8 +29,8 @@ use Thelia\Install\CheckPermission;
|
|||||||
* @package Thelia\Controller\Install
|
* @package Thelia\Controller\Install
|
||||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
*/
|
*/
|
||||||
class InstallController extends BaseInstallController {
|
class InstallController extends BaseInstallController
|
||||||
|
{
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$this->verifyStep(1);
|
$this->verifyStep(1);
|
||||||
|
|||||||
@@ -24,8 +24,6 @@
|
|||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
|
|
||||||
use Symfony\Component\EventDispatcher\Event;
|
use Symfony\Component\EventDispatcher\Event;
|
||||||
use Thelia\Core\HttpFoundation\Request;
|
|
||||||
use Thelia\Form\BaseForm;
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Class thrown on Thelia.action event
|
* Class thrown on Thelia.action event
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ use Symfony\Component\EventDispatcher\Event;
|
|||||||
use Thelia\Model\Address;
|
use Thelia\Model\Address;
|
||||||
use Thelia\Model\Customer;
|
use Thelia\Model\Customer;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AddressCreateOrUpdateEvent
|
* Class AddressCreateOrUpdateEvent
|
||||||
* @package Thelia\Core\Event
|
* @package Thelia\Core\Event
|
||||||
@@ -109,7 +108,7 @@ class AddressCreateOrUpdateEvent extends ActionEvent
|
|||||||
*/
|
*/
|
||||||
protected $address;
|
protected $address;
|
||||||
|
|
||||||
function __construct($label, $title, $firstname, $lastname, $address1, $address2, $address3, $zipcode, $city, $country, $cellphone, $phone, $company)
|
public function __construct($label, $title, $firstname, $lastname, $address1, $address2, $address3, $zipcode, $city, $country, $cellphone, $phone, $company)
|
||||||
{
|
{
|
||||||
$this->address1 = $address1;
|
$this->address1 = $address1;
|
||||||
$this->address2 = $address2;
|
$this->address2 = $address2;
|
||||||
@@ -263,5 +262,4 @@ class AddressCreateOrUpdateEvent extends ActionEvent
|
|||||||
return $this->address;
|
return $this->address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -25,7 +25,6 @@ namespace Thelia\Core\Event;
|
|||||||
use Symfony\Component\EventDispatcher\Event;
|
use Symfony\Component\EventDispatcher\Event;
|
||||||
use Thelia\Model\Address;
|
use Thelia\Model\Address;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AddressEvent
|
* Class AddressEvent
|
||||||
* @package Thelia\Core\Event
|
* @package Thelia\Core\Event
|
||||||
@@ -38,12 +37,11 @@ class AddressEvent extends ActionEvent
|
|||||||
*/
|
*/
|
||||||
protected $address;
|
protected $address;
|
||||||
|
|
||||||
function __construct(Address $address)
|
public function __construct(Address $address)
|
||||||
{
|
{
|
||||||
$this->address = $address;
|
$this->address = $address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Thelia\Model\Address
|
* @return \Thelia\Model\Address
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
|
|
||||||
|
|
||||||
class BaseToggleVisibilityEvent extends ActionEvent
|
class BaseToggleVisibilityEvent extends ActionEvent
|
||||||
{
|
{
|
||||||
protected $object_id;
|
protected $object_id;
|
||||||
@@ -43,6 +42,7 @@ class BaseToggleVisibilityEvent extends ActionEvent
|
|||||||
public function setObjectId($object_id)
|
public function setObjectId($object_id)
|
||||||
{
|
{
|
||||||
$this->object_id = $object_id;
|
$this->object_id = $object_id;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,6 +50,7 @@ class BaseUpdatePositionEvent extends ActionEvent
|
|||||||
public function setMode($mode)
|
public function setMode($mode)
|
||||||
{
|
{
|
||||||
$this->mode = $mode;
|
$this->mode = $mode;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,6 +62,7 @@ class BaseUpdatePositionEvent extends ActionEvent
|
|||||||
public function setPosition($position)
|
public function setPosition($position)
|
||||||
{
|
{
|
||||||
$this->position = $position;
|
$this->position = $position;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,6 +74,7 @@ class BaseUpdatePositionEvent extends ActionEvent
|
|||||||
public function setObjectId($object_id)
|
public function setObjectId($object_id)
|
||||||
{
|
{
|
||||||
$this->object_id = $object_id;
|
$this->object_id = $object_id;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,5 +145,4 @@ class CartEvent extends ActionEvent
|
|||||||
return $this->cart;
|
return $this->cart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,8 +23,6 @@
|
|||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
|
|
||||||
use Thelia\Model\Category;
|
|
||||||
|
|
||||||
class CategoryCreateEvent extends CategoryEvent
|
class CategoryCreateEvent extends CategoryEvent
|
||||||
{
|
{
|
||||||
protected $title;
|
protected $title;
|
||||||
@@ -46,6 +44,7 @@ class CategoryCreateEvent extends CategoryEvent
|
|||||||
public function setTitle($title)
|
public function setTitle($title)
|
||||||
{
|
{
|
||||||
$this->title = $title;
|
$this->title = $title;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,6 +56,7 @@ class CategoryCreateEvent extends CategoryEvent
|
|||||||
public function setParent($parent)
|
public function setParent($parent)
|
||||||
{
|
{
|
||||||
$this->parent = $parent;
|
$this->parent = $parent;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +68,7 @@ class CategoryCreateEvent extends CategoryEvent
|
|||||||
public function setLocale($locale)
|
public function setLocale($locale)
|
||||||
{
|
{
|
||||||
$this->locale = $locale;
|
$this->locale = $locale;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,8 +23,6 @@
|
|||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
|
|
||||||
use Thelia\Model\Category;
|
|
||||||
|
|
||||||
class CategoryDeleteEvent extends CategoryEvent
|
class CategoryDeleteEvent extends CategoryEvent
|
||||||
{
|
{
|
||||||
public function __construct($category_id)
|
public function __construct($category_id)
|
||||||
@@ -40,6 +38,7 @@ class CategoryDeleteEvent extends CategoryEvent
|
|||||||
public function setCategoryId($category_id)
|
public function setCategoryId($category_id)
|
||||||
{
|
{
|
||||||
$this->category_id = $category_id;
|
$this->category_id = $category_id;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,8 @@ class CategoryEvent extends ActionEvent
|
|||||||
$this->category = $category;
|
$this->category = $category;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasCategory() {
|
public function hasCategory()
|
||||||
|
{
|
||||||
return ! is_null($this->category);
|
return ! is_null($this->category);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
use Thelia\Model\Category;
|
|
||||||
|
|
||||||
class CategoryUpdateEvent extends CategoryCreateEvent
|
class CategoryUpdateEvent extends CategoryCreateEvent
|
||||||
{
|
{
|
||||||
@@ -49,6 +48,7 @@ class CategoryUpdateEvent extends CategoryCreateEvent
|
|||||||
public function setCategoryId($category_id)
|
public function setCategoryId($category_id)
|
||||||
{
|
{
|
||||||
$this->category_id = $category_id;
|
$this->category_id = $category_id;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,6 +60,7 @@ class CategoryUpdateEvent extends CategoryCreateEvent
|
|||||||
public function setChapo($chapo)
|
public function setChapo($chapo)
|
||||||
{
|
{
|
||||||
$this->chapo = $chapo;
|
$this->chapo = $chapo;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,6 +72,7 @@ class CategoryUpdateEvent extends CategoryCreateEvent
|
|||||||
public function setDescription($description)
|
public function setDescription($description)
|
||||||
{
|
{
|
||||||
$this->description = $description;
|
$this->description = $description;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,6 +84,7 @@ class CategoryUpdateEvent extends CategoryCreateEvent
|
|||||||
public function setPostscriptum($postscriptum)
|
public function setPostscriptum($postscriptum)
|
||||||
{
|
{
|
||||||
$this->postscriptum = $postscriptum;
|
$this->postscriptum = $postscriptum;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,6 +96,7 @@ class CategoryUpdateEvent extends CategoryCreateEvent
|
|||||||
public function setUrl($url)
|
public function setUrl($url)
|
||||||
{
|
{
|
||||||
$this->url = $url;
|
$this->url = $url;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,6 +108,7 @@ class CategoryUpdateEvent extends CategoryCreateEvent
|
|||||||
public function setVisibility($visibility)
|
public function setVisibility($visibility)
|
||||||
{
|
{
|
||||||
$this->visibility = $visibility;
|
$this->visibility = $visibility;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,6 +120,7 @@ class CategoryUpdateEvent extends CategoryCreateEvent
|
|||||||
public function setParent($parent)
|
public function setParent($parent)
|
||||||
{
|
{
|
||||||
$this->parent = $parent;
|
$this->parent = $parent;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
use Thelia\Model\Config;
|
|
||||||
|
|
||||||
class ConfigCreateEvent extends ConfigEvent
|
class ConfigCreateEvent extends ConfigEvent
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,8 +23,6 @@
|
|||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
|
|
||||||
use Thelia\Model\Config;
|
|
||||||
|
|
||||||
class ConfigDeleteEvent extends ConfigEvent
|
class ConfigDeleteEvent extends ConfigEvent
|
||||||
{
|
{
|
||||||
protected $config_id;
|
protected $config_id;
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ class ConfigEvent extends ActionEvent
|
|||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasConfig() {
|
public function hasConfig()
|
||||||
|
{
|
||||||
return ! is_null($this->config);
|
return ! is_null($this->config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,6 @@
|
|||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
|
|
||||||
use Thelia\Model\Config;
|
|
||||||
|
|
||||||
class ConfigUpdateEvent extends ConfigCreateEvent
|
class ConfigUpdateEvent extends ConfigCreateEvent
|
||||||
{
|
{
|
||||||
protected $config_id;
|
protected $config_id;
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ class CouponCreateOrUpdateEvent extends ActionEvent
|
|||||||
* @param CouponRuleCollection $rules CouponRuleInterface to add
|
* @param CouponRuleCollection $rules CouponRuleInterface to add
|
||||||
* @param string $locale Coupon Language code ISO (ex: fr_FR)
|
* @param string $locale Coupon Language code ISO (ex: fr_FR)
|
||||||
*/
|
*/
|
||||||
function __construct(
|
public function __construct(
|
||||||
$code,
|
$code,
|
||||||
$title,
|
$title,
|
||||||
$amount,
|
$amount,
|
||||||
@@ -307,6 +307,4 @@ class CouponCreateOrUpdateEvent extends ActionEvent
|
|||||||
return $this->coupon;
|
return $this->coupon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
use Thelia\Model\Currency;
|
|
||||||
|
|
||||||
class CurrencyCreateEvent extends CurrencyEvent
|
class CurrencyCreateEvent extends CurrencyEvent
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,8 +23,6 @@
|
|||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
|
|
||||||
use Thelia\Model\Currency;
|
|
||||||
|
|
||||||
class CurrencyDeleteEvent extends CurrencyEvent
|
class CurrencyDeleteEvent extends CurrencyEvent
|
||||||
{
|
{
|
||||||
protected $currency_id;
|
protected $currency_id;
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ class CurrencyEvent extends ActionEvent
|
|||||||
$this->currency = $currency;
|
$this->currency = $currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasCurrency() {
|
public function hasCurrency()
|
||||||
|
{
|
||||||
return ! is_null($this->currency);
|
return ! is_null($this->currency);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
use Thelia\Model\Currency;
|
|
||||||
|
|
||||||
class CurrencyUpdateEvent extends CurrencyCreateEvent
|
class CurrencyUpdateEvent extends CurrencyCreateEvent
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,12 +9,11 @@
|
|||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
|
|
||||||
|
|
||||||
use Symfony\Component\EventDispatcher\Event;
|
use Symfony\Component\EventDispatcher\Event;
|
||||||
use Thelia\Model\Customer;
|
use Thelia\Model\Customer;
|
||||||
|
|
||||||
class CustomerCreateOrUpdateEvent extends ActionEvent {
|
class CustomerCreateOrUpdateEvent extends ActionEvent
|
||||||
|
{
|
||||||
//base parameters for creating new customer
|
//base parameters for creating new customer
|
||||||
protected $title;
|
protected $title;
|
||||||
protected $firstname;
|
protected $firstname;
|
||||||
@@ -39,7 +38,6 @@ class CustomerCreateOrUpdateEvent extends ActionEvent {
|
|||||||
*/
|
*/
|
||||||
protected $customer;
|
protected $customer;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $title the title customer id
|
* @param int $title the title customer id
|
||||||
* @param string $firstname
|
* @param string $firstname
|
||||||
@@ -59,7 +57,7 @@ class CustomerCreateOrUpdateEvent extends ActionEvent {
|
|||||||
* @param int $sponsor customer's id sponsor
|
* @param int $sponsor customer's id sponsor
|
||||||
* @param float $discount
|
* @param float $discount
|
||||||
*/
|
*/
|
||||||
function __construct($title, $firstname, $lastname, $address1, $address2, $address3, $phone, $cellphone, $zipcode, $city, $country, $email, $password, $lang, $reseller, $sponsor, $discount)
|
public function __construct($title, $firstname, $lastname, $address1, $address2, $address3, $phone, $cellphone, $zipcode, $city, $country, $email, $password, $lang, $reseller, $sponsor, $discount)
|
||||||
{
|
{
|
||||||
$this->address1 = $address1;
|
$this->address1 = $address1;
|
||||||
$this->address2 = $address2;
|
$this->address2 = $address2;
|
||||||
@@ -231,7 +229,4 @@ class CustomerCreateOrUpdateEvent extends ActionEvent {
|
|||||||
return $this->customer;
|
return $this->customer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -43,5 +43,4 @@ class CustomerEvent extends ActionEvent
|
|||||||
return $this->customer;
|
return $this->customer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,11 +23,10 @@
|
|||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
|
|
||||||
|
|
||||||
use Thelia\Model\Customer;
|
use Thelia\Model\Customer;
|
||||||
|
|
||||||
class CustomerLoginEvent extends ActionEvent {
|
class CustomerLoginEvent extends ActionEvent
|
||||||
|
{
|
||||||
protected $customer;
|
protected $customer;
|
||||||
|
|
||||||
public function __construct(Customer $customer)
|
public function __construct(Customer $customer)
|
||||||
|
|||||||
@@ -22,8 +22,6 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
use Thelia\Core\HttpFoundation\Request;
|
|
||||||
use Thelia\Model\Cart;
|
|
||||||
|
|
||||||
class ImageEvent extends ActionEvent
|
class ImageEvent extends ActionEvent
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
use Thelia\Model\Message;
|
|
||||||
|
|
||||||
class MessageCreateEvent extends MessageEvent
|
class MessageCreateEvent extends MessageEvent
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,8 +23,6 @@
|
|||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
|
|
||||||
use Thelia\Model\Message;
|
|
||||||
|
|
||||||
class MessageDeleteEvent extends MessageEvent
|
class MessageDeleteEvent extends MessageEvent
|
||||||
{
|
{
|
||||||
protected $message_id;
|
protected $message_id;
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ class MessageEvent extends ActionEvent
|
|||||||
$this->message = $message;
|
$this->message = $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasMessage() {
|
public function hasMessage()
|
||||||
|
{
|
||||||
return ! is_null($this->message);
|
return ! is_null($this->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,6 @@
|
|||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
|
|
||||||
use Thelia\Model\Message;
|
|
||||||
|
|
||||||
class MessageUpdateEvent extends MessageCreateEvent
|
class MessageUpdateEvent extends MessageCreateEvent
|
||||||
{
|
{
|
||||||
protected $message_id;
|
protected $message_id;
|
||||||
|
|||||||
@@ -204,8 +204,6 @@ final class TheliaEvents
|
|||||||
*/
|
*/
|
||||||
const IMAGE_CLEAR_CACHE = "action.clearImageCache";
|
const IMAGE_CLEAR_CACHE = "action.clearImageCache";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sent when creating a Coupon
|
* Sent when creating a Coupon
|
||||||
*/
|
*/
|
||||||
@@ -296,22 +294,6 @@ final class TheliaEvents
|
|||||||
*/
|
*/
|
||||||
const AFTER_COUPON_RULE_UPDATE = "action.after_update_coupon_rule";
|
const AFTER_COUPON_RULE_UPDATE = "action.after_update_coupon_rule";
|
||||||
|
|
||||||
/**
|
|
||||||
* Sent when attempting to delete Coupon Rule
|
|
||||||
*/
|
|
||||||
const COUPON_RULE_DELETE = "action.delete_coupon_rule";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sent just before an attempt to delete a Coupon Rule
|
|
||||||
*/
|
|
||||||
const BEFORE_COUPON_RULE_DELETE = "action.before_delete_coupon_rule";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sent just after an attempt to delete a Coupon Rule
|
|
||||||
*/
|
|
||||||
const AFTER_COUPON_RULE_DELETE = "action.after_delete_coupon_rule";
|
|
||||||
|
|
||||||
|
|
||||||
// -- Configuration management ---------------------------------------------
|
// -- Configuration management ---------------------------------------------
|
||||||
|
|
||||||
const CONFIG_CREATE = "action.createConfig";
|
const CONFIG_CREATE = "action.createConfig";
|
||||||
|
|||||||
@@ -47,7 +47,12 @@ class Session extends BaseSession
|
|||||||
*/
|
*/
|
||||||
public function getLang($forceDefault = true)
|
public function getLang($forceDefault = true)
|
||||||
{
|
{
|
||||||
return $this->get("thelia.current.lang", $forceDefault ? Lang::getDefaultLanguage():null);
|
$lang = $this->get("thelia.current.lang");
|
||||||
|
if(null === $lang && $forceDefault)
|
||||||
|
{
|
||||||
|
$lang = Lang::getDefaultLanguage();
|
||||||
|
}
|
||||||
|
return $lang;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setLang(Lang $lang)
|
public function setLang(Lang $lang)
|
||||||
@@ -59,7 +64,12 @@ class Session extends BaseSession
|
|||||||
|
|
||||||
public function getAdminEditionLang()
|
public function getAdminEditionLang()
|
||||||
{
|
{
|
||||||
return $this->get('thelia.admin.edition.lang', Lang::getDefaultLanguage());
|
$lang = $this->get('thelia.admin.edition.lang');
|
||||||
|
|
||||||
|
if (null === $lang) {
|
||||||
|
$lang = Lang::getDefaultLanguage();
|
||||||
|
}
|
||||||
|
return $lang;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setAdminEditionLang($langId)
|
public function setAdminEditionLang($langId)
|
||||||
@@ -76,7 +86,13 @@ class Session extends BaseSession
|
|||||||
|
|
||||||
public function getCurrency($forceDefault = true)
|
public function getCurrency($forceDefault = true)
|
||||||
{
|
{
|
||||||
return $this->get("thelia.current.currency", $forceDefault ? Currency::getDefaultCurrency():null);
|
$currency = $this->get("thelia.current.currency");
|
||||||
|
|
||||||
|
if(null === $currency && $forceDefault)
|
||||||
|
{
|
||||||
|
$currency = Currency::getDefaultCurrency();
|
||||||
|
}
|
||||||
|
return $currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- Customer user --------------------------------------------------------
|
// -- Customer user --------------------------------------------------------
|
||||||
@@ -84,6 +100,7 @@ class Session extends BaseSession
|
|||||||
public function setCustomerUser(UserInterface $user)
|
public function setCustomerUser(UserInterface $user)
|
||||||
{
|
{
|
||||||
$this->set('thelia.customer_user', $user);
|
$this->set('thelia.customer_user', $user);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,6 +119,7 @@ class Session extends BaseSession
|
|||||||
public function setAdminUser(UserInterface $user)
|
public function setAdminUser(UserInterface $user)
|
||||||
{
|
{
|
||||||
$this->set('thelia.admin_user', $user);
|
$this->set('thelia.admin_user', $user);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,6 +138,7 @@ class Session extends BaseSession
|
|||||||
public function setReturnToUrl($url)
|
public function setReturnToUrl($url)
|
||||||
{
|
{
|
||||||
$this->set('thelia.return_to_url', $url);
|
$this->set('thelia.return_to_url', $url);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,6 +199,7 @@ class Session extends BaseSession
|
|||||||
public function setCart($cart_id)
|
public function setCart($cart_id)
|
||||||
{
|
{
|
||||||
$this->set("thelia.cart_id", $cart_id);
|
$this->set("thelia.cart_id", $cart_id);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,6 +212,7 @@ class Session extends BaseSession
|
|||||||
public function setDelivery($delivery_id)
|
public function setDelivery($delivery_id)
|
||||||
{
|
{
|
||||||
$this->set("thelia.delivery_id", $delivery_id);
|
$this->set("thelia.delivery_id", $delivery_id);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ use Thelia\Model\ConfigQuery;
|
|||||||
use Thelia\Tools\Redirect;
|
use Thelia\Tools\Redirect;
|
||||||
use Thelia\Tools\URL;
|
use Thelia\Tools\URL;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class RewritingRouter
|
* Class RewritingRouter
|
||||||
* @package Thelia\Core\Routing
|
* @package Thelia\Core\Routing
|
||||||
|
|||||||
@@ -97,8 +97,8 @@ class SecurityContext
|
|||||||
* @param array $roles the roles
|
* @param array $roles the roles
|
||||||
* @return boolean true if the user has the required role, false otherwise
|
* @return boolean true if the user has the required role, false otherwise
|
||||||
*/
|
*/
|
||||||
final public function hasRequiredRole($user, array $roles) {
|
final public function hasRequiredRole($user, array $roles)
|
||||||
|
{
|
||||||
if ($user != null) {
|
if ($user != null) {
|
||||||
// Check if user's roles matches required roles
|
// Check if user's roles matches required roles
|
||||||
$userRoles = $user->getRoles();
|
$userRoles = $user->getRoles();
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ use Assetic\Filter;
|
|||||||
use Assetic\Factory\AssetFactory;
|
use Assetic\Factory\AssetFactory;
|
||||||
use Assetic\Factory\Worker\CacheBustingWorker;
|
use Assetic\Factory\Worker\CacheBustingWorker;
|
||||||
use Assetic\AssetWriter;
|
use Assetic\AssetWriter;
|
||||||
use Assetic\Asset\AssetCache;
|
use Thelia\Model\ConfigQuery;
|
||||||
use Assetic\Cache\FilesystemCache;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is a simple helper for generating assets using Assetic.
|
* This class is a simple helper for generating assets using Assetic.
|
||||||
@@ -128,6 +127,8 @@ class AsseticHelper
|
|||||||
//
|
//
|
||||||
if ($dev_mode == true || ! file_exists($target_file)) {
|
if ($dev_mode == true || ! file_exists($target_file)) {
|
||||||
|
|
||||||
|
if (ConfigQuery::read('process_assets', true)) {
|
||||||
|
|
||||||
// Delete previous version of the file
|
// Delete previous version of the file
|
||||||
list($commonPart, $dummy) = explode('-', $asset_target_path);
|
list($commonPart, $dummy) = explode('-', $asset_target_path);
|
||||||
|
|
||||||
@@ -139,8 +140,7 @@ class AsseticHelper
|
|||||||
foreach ($filter_list as $filter) {
|
foreach ($filter_list as $filter) {
|
||||||
if ('?' != $filter[0]) {
|
if ('?' != $filter[0]) {
|
||||||
$asset->ensureFilter($fm->get($filter));
|
$asset->ensureFilter($fm->get($filter));
|
||||||
}
|
} elseif (!$debug) {
|
||||||
elseif (!$debug) {
|
|
||||||
$asset->ensureFilter($fm->get(substr($filter, 1)));
|
$asset->ensureFilter($fm->get(substr($filter, 1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,6 +149,7 @@ class AsseticHelper
|
|||||||
|
|
||||||
$writer->writeAsset($asset);
|
$writer->writeAsset($asset);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return rtrim($output_url, '/').'/'.$asset_target_path;
|
return rtrim($output_url, '/').'/'.$asset_target_path;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,10 +24,8 @@
|
|||||||
namespace Thelia\Core\Template\Element;
|
namespace Thelia\Core\Template\Element;
|
||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
|
||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||||
use Thelia\Core\Security\SecurityContext;
|
|
||||||
use Thelia\Model\Tools\ModelCriteriaTools;
|
use Thelia\Model\Tools\ModelCriteriaTools;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,6 +64,7 @@ abstract class BaseI18nLoop extends BaseLoop
|
|||||||
protected function configureI18nProcessing(ModelCriteria $search, $columns = array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), $foreignTable = null, $foreignKey = 'ID', $forceReturn = false)
|
protected function configureI18nProcessing(ModelCriteria $search, $columns = array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), $foreignTable = null, $foreignKey = 'ID', $forceReturn = false)
|
||||||
{
|
{
|
||||||
/* manage translations */
|
/* manage translations */
|
||||||
|
|
||||||
return ModelCriteriaTools::getI18n(
|
return ModelCriteriaTools::getI18n(
|
||||||
$this->getBackend_context(),
|
$this->getBackend_context(),
|
||||||
$this->getLang(),
|
$this->getLang(),
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
|||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||||
use Thelia\Core\Security\SecurityContext;
|
use Thelia\Core\Security\SecurityContext;
|
||||||
use Thelia\Model\Tools\ModelCriteriaTools;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
namespace Thelia\Core\Template\Loop;
|
namespace Thelia\Core\Template\Loop;
|
||||||
|
|
||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
use Propel\Runtime\Collection\ObjectCollection;
|
|
||||||
use Thelia\Core\Template\Element\BaseLoop;
|
use Thelia\Core\Template\Element\BaseLoop;
|
||||||
use Thelia\Core\Template\Element\LoopResult;
|
use Thelia\Core\Template\Element\LoopResult;
|
||||||
use Thelia\Core\Template\Element\LoopResultRow;
|
use Thelia\Core\Template\Element\LoopResultRow;
|
||||||
@@ -99,7 +98,6 @@ class Address extends BaseLoop
|
|||||||
|
|
||||||
$default = $this->getDefault();
|
$default = $this->getDefault();
|
||||||
|
|
||||||
|
|
||||||
if ($default === true) {
|
if ($default === true) {
|
||||||
$search->filterByIsDefault(1, Criteria::EQUAL);
|
$search->filterByIsDefault(1, Criteria::EQUAL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,21 +24,16 @@
|
|||||||
namespace Thelia\Core\Template\Loop;
|
namespace Thelia\Core\Template\Loop;
|
||||||
|
|
||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
use Propel\Runtime\ActiveQuery\Join;
|
|
||||||
use Thelia\Core\Template\Element\BaseI18nLoop;
|
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||||
use Thelia\Core\Template\Element\LoopResult;
|
use Thelia\Core\Template\Element\LoopResult;
|
||||||
use Thelia\Core\Template\Element\LoopResultRow;
|
use Thelia\Core\Template\Element\LoopResultRow;
|
||||||
|
|
||||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
use Thelia\Log\Tlog;
|
|
||||||
|
|
||||||
use Thelia\Model\Base\LangQuery;
|
|
||||||
|
|
||||||
use Thelia\Model\Base\CategoryQuery;
|
use Thelia\Model\Base\CategoryQuery;
|
||||||
use Thelia\Model\Base\ProductCategoryQuery;
|
use Thelia\Model\Base\ProductCategoryQuery;
|
||||||
use Thelia\Model\Base\AttributeQuery;
|
use Thelia\Model\Base\AttributeQuery;
|
||||||
use Thelia\Model\ConfigQuery;
|
|
||||||
use Thelia\Model\Map\ProductCategoryTableMap;
|
use Thelia\Model\Map\ProductCategoryTableMap;
|
||||||
use Thelia\Type\TypeCollection;
|
use Thelia\Type\TypeCollection;
|
||||||
use Thelia\Type;
|
use Thelia\Type;
|
||||||
|
|||||||
@@ -24,17 +24,14 @@
|
|||||||
namespace Thelia\Core\Template\Loop;
|
namespace Thelia\Core\Template\Loop;
|
||||||
|
|
||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
use Propel\Runtime\ActiveQuery\Join;
|
|
||||||
use Thelia\Core\Template\Element\BaseI18nLoop;
|
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||||
use Thelia\Core\Template\Element\LoopResult;
|
use Thelia\Core\Template\Element\LoopResult;
|
||||||
use Thelia\Core\Template\Element\LoopResultRow;
|
use Thelia\Core\Template\Element\LoopResultRow;
|
||||||
|
|
||||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
use Thelia\Log\Tlog;
|
|
||||||
|
|
||||||
use Thelia\Model\Base\AttributeAvQuery;
|
use Thelia\Model\Base\AttributeAvQuery;
|
||||||
use Thelia\Model\ConfigQuery;
|
|
||||||
use Thelia\Type\TypeCollection;
|
use Thelia\Type\TypeCollection;
|
||||||
use Thelia\Type;
|
use Thelia\Type;
|
||||||
|
|
||||||
|
|||||||
@@ -24,19 +24,16 @@
|
|||||||
namespace Thelia\Core\Template\Loop;
|
namespace Thelia\Core\Template\Loop;
|
||||||
|
|
||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
use Propel\Runtime\ActiveQuery\Join;
|
|
||||||
use Thelia\Core\Template\Element\BaseI18nLoop;
|
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||||
use Thelia\Core\Template\Element\LoopResult;
|
use Thelia\Core\Template\Element\LoopResult;
|
||||||
use Thelia\Core\Template\Element\LoopResultRow;
|
use Thelia\Core\Template\Element\LoopResultRow;
|
||||||
|
|
||||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
use Thelia\Log\Tlog;
|
|
||||||
|
|
||||||
use Thelia\Model\Base\AttributeCombinationQuery;
|
use Thelia\Model\Base\AttributeCombinationQuery;
|
||||||
use Thelia\Model\Map\AttributeAvTableMap;
|
use Thelia\Model\Map\AttributeAvTableMap;
|
||||||
use Thelia\Model\Map\AttributeTableMap;
|
use Thelia\Model\Map\AttributeTableMap;
|
||||||
use Thelia\Model\ConfigQuery;
|
|
||||||
use Thelia\Type\TypeCollection;
|
use Thelia\Type\TypeCollection;
|
||||||
use Thelia\Type;
|
use Thelia\Type;
|
||||||
|
|
||||||
|
|||||||
@@ -28,13 +28,13 @@ use Thelia\Core\Template\Loop\Argument\Argument;
|
|||||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
use Thelia\Model\ModuleQuery;
|
use Thelia\Model\ModuleQuery;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Delivery
|
* Class Delivery
|
||||||
* @package Thelia\Core\Template\Loop
|
* @package Thelia\Core\Template\Loop
|
||||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
*/
|
*/
|
||||||
class BaseSpecificModule extends BaseI18nLoop {
|
class BaseSpecificModule extends BaseI18nLoop
|
||||||
|
{
|
||||||
public $timestampable = true;
|
public $timestampable = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,12 +93,10 @@ class BaseSpecificModule extends BaseI18nLoop {
|
|||||||
{
|
{
|
||||||
$search = ModuleQuery::create();
|
$search = ModuleQuery::create();
|
||||||
|
|
||||||
if(null !== $id = $this->getId())
|
if (null !== $id = $this->getId()) {
|
||||||
{
|
|
||||||
$search->filterById($id);
|
$search->filterById($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (null !== $exclude = $this->getExclude()) {
|
if (null !== $exclude = $this->getExclude()) {
|
||||||
$search->filterById($exclude, Criteria::NOT_IN);
|
$search->filterById($exclude, Criteria::NOT_IN);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,8 +72,6 @@ class Cart extends BaseLoop
|
|||||||
public function exec(&$pagination)
|
public function exec(&$pagination)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$cart = $this->getCart($this->request);
|
$cart = $this->getCart($this->request);
|
||||||
$cartItems = $cart->getCartItems();
|
$cartItems = $cart->getCartItems();
|
||||||
$result = new LoopResult($cartItems);
|
$result = new LoopResult($cartItems);
|
||||||
|
|||||||
@@ -30,10 +30,8 @@ use Thelia\Core\Template\Element\LoopResultRow;
|
|||||||
|
|
||||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
use Thelia\Log\Tlog;
|
|
||||||
|
|
||||||
use Thelia\Model\CategoryQuery;
|
use Thelia\Model\CategoryQuery;
|
||||||
use Thelia\Model\ConfigQuery;
|
|
||||||
use Thelia\Type\TypeCollection;
|
use Thelia\Type\TypeCollection;
|
||||||
use Thelia\Type;
|
use Thelia\Type;
|
||||||
use Thelia\Type\BooleanOrBothType;
|
use Thelia\Type\BooleanOrBothType;
|
||||||
@@ -113,7 +111,6 @@ class Category extends BaseI18nLoop
|
|||||||
$search->filterByParent($parent);
|
$search->filterByParent($parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$current = $this->getCurrent();
|
$current = $this->getCurrent();
|
||||||
|
|
||||||
if ($current === true) {
|
if ($current === true) {
|
||||||
@@ -122,7 +119,6 @@ class Category extends BaseI18nLoop
|
|||||||
$search->filterById($this->request->get("category_id"), Criteria::NOT_IN);
|
$search->filterById($this->request->get("category_id"), Criteria::NOT_IN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$exclude = $this->getExclude();
|
$exclude = $this->getExclude();
|
||||||
|
|
||||||
if (!is_null($exclude)) {
|
if (!is_null($exclude)) {
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ use Thelia\Core\Template\Element\LoopResultRow;
|
|||||||
|
|
||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
|
|
||||||
use Thelia\Model\LangQuery;
|
|
||||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
use Thelia\Model\ConfigQuery;
|
use Thelia\Model\ConfigQuery;
|
||||||
use Thelia\Type\BooleanOrBothType;
|
use Thelia\Type\BooleanOrBothType;
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ use Thelia\Model\FolderQuery;
|
|||||||
use Thelia\Model\Map\ContentTableMap;
|
use Thelia\Model\Map\ContentTableMap;
|
||||||
use Thelia\Model\ContentFolderQuery;
|
use Thelia\Model\ContentFolderQuery;
|
||||||
use Thelia\Model\ContentQuery;
|
use Thelia\Model\ContentQuery;
|
||||||
use Thelia\Model\ConfigQuery;
|
|
||||||
use Thelia\Type\TypeCollection;
|
use Thelia\Type\TypeCollection;
|
||||||
use Thelia\Type;
|
use Thelia\Type;
|
||||||
use Thelia\Type\BooleanOrBothType;
|
use Thelia\Type\BooleanOrBothType;
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
|||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
|
|
||||||
use Thelia\Model\CountryQuery;
|
use Thelia\Model\CountryQuery;
|
||||||
use Thelia\Model\ConfigQuery;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -34,13 +34,9 @@ use Thelia\Core\Template\Element\LoopResultRow;
|
|||||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
|
|
||||||
use Thelia\Model\Base\CategoryQuery;
|
|
||||||
use Thelia\Model\ConfigQuery;
|
|
||||||
use Thelia\Model\CouponQuery;
|
use Thelia\Model\CouponQuery;
|
||||||
use Thelia\Model\Coupon as MCoupon;
|
use Thelia\Model\Coupon as MCoupon;
|
||||||
use Thelia\Model\Map\ProductCategoryTableMap;
|
|
||||||
use Thelia\Type;
|
use Thelia\Type;
|
||||||
use Thelia\Type\BooleanOrBothType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by JetBrains PhpStorm.
|
* Created by JetBrains PhpStorm.
|
||||||
@@ -95,7 +91,6 @@ class Coupon extends BaseI18nLoop
|
|||||||
/** @var Lang $lang */
|
/** @var Lang $lang */
|
||||||
$lang = $request->getSession()->getLang();
|
$lang = $request->getSession()->getLang();
|
||||||
|
|
||||||
|
|
||||||
/** @var MCoupon $coupon */
|
/** @var MCoupon $coupon */
|
||||||
foreach ($coupons as $coupon) {
|
foreach ($coupons as $coupon) {
|
||||||
$loopResultRow = new LoopResultRow();
|
$loopResultRow = new LoopResultRow();
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
|||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
|
|
||||||
use Thelia\Model\CurrencyQuery;
|
use Thelia\Model\CurrencyQuery;
|
||||||
use Thelia\Model\ConfigQuery;
|
|
||||||
use Thelia\Type\TypeCollection;
|
use Thelia\Type\TypeCollection;
|
||||||
use Thelia\Type\EnumListType;
|
use Thelia\Type\EnumListType;
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
namespace Thelia\Core\Template\Loop;
|
namespace Thelia\Core\Template\Loop;
|
||||||
|
|
||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
use Propel\Runtime\Collection\ObjectCollection;
|
|
||||||
use Thelia\Core\Template\Element\BaseLoop;
|
use Thelia\Core\Template\Element\BaseLoop;
|
||||||
use Thelia\Core\Template\Element\LoopResult;
|
use Thelia\Core\Template\Element\LoopResult;
|
||||||
use Thelia\Core\Template\Element\LoopResultRow;
|
use Thelia\Core\Template\Element\LoopResultRow;
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ use Thelia\Core\Template\Element\LoopResult;
|
|||||||
use Thelia\Core\Template\Element\LoopResultRow;
|
use Thelia\Core\Template\Element\LoopResultRow;
|
||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Delivery
|
* Class Delivery
|
||||||
* @package Thelia\Core\Template\Loop
|
* @package Thelia\Core\Template\Loop
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ use Thelia\Core\Template\Loop\Argument\Argument;
|
|||||||
use Thelia\Model\Base\CategoryQuery;
|
use Thelia\Model\Base\CategoryQuery;
|
||||||
use Thelia\Model\Base\ProductCategoryQuery;
|
use Thelia\Model\Base\ProductCategoryQuery;
|
||||||
use Thelia\Model\Base\FeatureQuery;
|
use Thelia\Model\Base\FeatureQuery;
|
||||||
use Thelia\Model\ConfigQuery;
|
|
||||||
use Thelia\Model\Map\ProductCategoryTableMap;
|
use Thelia\Model\Map\ProductCategoryTableMap;
|
||||||
use Thelia\Type\TypeCollection;
|
use Thelia\Type\TypeCollection;
|
||||||
use Thelia\Type;
|
use Thelia\Type;
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
|||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
|
|
||||||
use Thelia\Model\Base\FeatureAvQuery;
|
use Thelia\Model\Base\FeatureAvQuery;
|
||||||
use Thelia\Model\ConfigQuery;
|
|
||||||
use Thelia\Type\TypeCollection;
|
use Thelia\Type\TypeCollection;
|
||||||
use Thelia\Type;
|
use Thelia\Type;
|
||||||
|
|
||||||
|
|||||||
@@ -24,19 +24,15 @@
|
|||||||
namespace Thelia\Core\Template\Loop;
|
namespace Thelia\Core\Template\Loop;
|
||||||
|
|
||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
use Propel\Runtime\ActiveQuery\Join;
|
|
||||||
use Thelia\Core\Template\Element\BaseI18nLoop;
|
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||||
use Thelia\Core\Template\Element\LoopResult;
|
use Thelia\Core\Template\Element\LoopResult;
|
||||||
use Thelia\Core\Template\Element\LoopResultRow;
|
use Thelia\Core\Template\Element\LoopResultRow;
|
||||||
|
|
||||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
use Thelia\Log\Tlog;
|
|
||||||
|
|
||||||
use Thelia\Model\Base\FeatureProductQuery;
|
use Thelia\Model\Base\FeatureProductQuery;
|
||||||
use Thelia\Model\ConfigQuery;
|
|
||||||
use Thelia\Model\Map\FeatureAvTableMap;
|
use Thelia\Model\Map\FeatureAvTableMap;
|
||||||
use Thelia\Model\Map\FeatureProductTableMap;
|
|
||||||
use Thelia\Type\TypeCollection;
|
use Thelia\Type\TypeCollection;
|
||||||
use Thelia\Type;
|
use Thelia\Type;
|
||||||
|
|
||||||
|
|||||||
@@ -30,10 +30,8 @@ use Thelia\Core\Template\Element\LoopResultRow;
|
|||||||
|
|
||||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
use Thelia\Log\Tlog;
|
|
||||||
|
|
||||||
use Thelia\Model\FolderQuery;
|
use Thelia\Model\FolderQuery;
|
||||||
use Thelia\Model\ConfigQuery;
|
|
||||||
use Thelia\Type\TypeCollection;
|
use Thelia\Type\TypeCollection;
|
||||||
use Thelia\Type;
|
use Thelia\Type;
|
||||||
use Thelia\Type\BooleanOrBothType;
|
use Thelia\Type\BooleanOrBothType;
|
||||||
@@ -95,7 +93,6 @@ class Folder extends BaseI18nLoop
|
|||||||
$search->filterByParent($parent);
|
$search->filterByParent($parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$current = $this->getCurrent();
|
$current = $this->getCurrent();
|
||||||
|
|
||||||
if ($current === true) {
|
if ($current === true) {
|
||||||
@@ -104,7 +101,6 @@ class Folder extends BaseI18nLoop
|
|||||||
$search->filterById($this->request->get("folder_id"), Criteria::NOT_IN);
|
$search->filterById($this->request->get("folder_id"), Criteria::NOT_IN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$exclude = $this->getExclude();
|
$exclude = $this->getExclude();
|
||||||
|
|
||||||
if (!is_null($exclude)) {
|
if (!is_null($exclude)) {
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ namespace Thelia\Core\Template\Loop;
|
|||||||
use Thelia\Core\Template\Element\BaseI18nLoop;
|
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
use Thelia\Core\Event\ImageEvent;
|
use Thelia\Core\Event\ImageEvent;
|
||||||
use Thelia\Model\CategoryImageQuery;
|
|
||||||
use Thelia\Model\ProductImageQuery;
|
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
use Thelia\Type\TypeCollection;
|
use Thelia\Type\TypeCollection;
|
||||||
@@ -113,8 +111,8 @@ class Image extends BaseI18nLoop
|
|||||||
* @param int $object_id the source object ID
|
* @param int $object_id the source object ID
|
||||||
* @return ModelCriteria the propel Query object
|
* @return ModelCriteria the propel Query object
|
||||||
*/
|
*/
|
||||||
protected function createSearchQuery($source, $object_id) {
|
protected function createSearchQuery($source, $object_id)
|
||||||
|
{
|
||||||
$object = ucfirst($source);
|
$object = ucfirst($source);
|
||||||
|
|
||||||
$queryClass = sprintf("\Thelia\Model\%sImageQuery", $object);
|
$queryClass = sprintf("\Thelia\Model\%sImageQuery", $object);
|
||||||
@@ -163,8 +161,8 @@ class Image extends BaseI18nLoop
|
|||||||
* @param string $object_id (returned) the ID of the source object
|
* @param string $object_id (returned) the ID of the source object
|
||||||
* @return ModelCriteria the propel Query object
|
* @return ModelCriteria the propel Query object
|
||||||
*/
|
*/
|
||||||
protected function getSearchQuery(&$object_type, &$object_id) {
|
protected function getSearchQuery(&$object_type, &$object_id)
|
||||||
|
{
|
||||||
$search = null;
|
$search = null;
|
||||||
|
|
||||||
// Check form source="product" source_id="123" style arguments
|
// Check form source="product" source_id="123" style arguments
|
||||||
@@ -184,8 +182,7 @@ class Image extends BaseI18nLoop
|
|||||||
|
|
||||||
$object_type = $source;
|
$object_type = $source;
|
||||||
$object_id = $source_id;
|
$object_id = $source_id;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Check for product="id" folder="id", etc. style arguments
|
// Check for product="id" folder="id", etc. style arguments
|
||||||
foreach ($this->possible_sources as $source) {
|
foreach ($this->possible_sources as $source) {
|
||||||
|
|
||||||
@@ -316,8 +313,7 @@ class Image extends BaseI18nLoop
|
|||||||
;
|
;
|
||||||
|
|
||||||
$loopResult->addRow($loopResultRow);
|
$loopResult->addRow($loopResultRow);
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex) {
|
|
||||||
// Ignore the result and log an error
|
// Ignore the result and log an error
|
||||||
Tlog::getInstance()->addError("Failed to process image in image loop: ", $this->args);
|
Tlog::getInstance()->addError("Failed to process image in image loop: ", $this->args);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ use Thelia\Core\Template\Element\LoopResultRow;
|
|||||||
|
|
||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
|
|
||||||
use Thelia\Model\LangQuery;
|
|
||||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
use Thelia\Model\MessageQuery;
|
use Thelia\Model\MessageQuery;
|
||||||
use Thelia\Type\BooleanOrBothType;
|
use Thelia\Type\BooleanOrBothType;
|
||||||
|
|||||||
@@ -31,11 +31,10 @@ use Thelia\Core\Template\Element\LoopResultRow;
|
|||||||
|
|
||||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
use Thelia\Log\Tlog;
|
|
||||||
|
|
||||||
use Thelia\Model\CategoryQuery;
|
use Thelia\Model\CategoryQuery;
|
||||||
use Thelia\Model\CountryQuery;
|
use Thelia\Model\CountryQuery;
|
||||||
use Thelia\Model\Map\FeatureProductTableMap;
|
use Thelia\Model\CurrencyQuery;
|
||||||
use Thelia\Model\Map\ProductPriceTableMap;
|
use Thelia\Model\Map\ProductPriceTableMap;
|
||||||
use Thelia\Model\Map\ProductSaleElementsTableMap;
|
use Thelia\Model\Map\ProductSaleElementsTableMap;
|
||||||
use Thelia\Model\Map\ProductTableMap;
|
use Thelia\Model\Map\ProductTableMap;
|
||||||
@@ -54,8 +53,6 @@ use Thelia\Type\BooleanOrBothType;
|
|||||||
* Class Product
|
* Class Product
|
||||||
* @package Thelia\Core\Template\Loop
|
* @package Thelia\Core\Template\Loop
|
||||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||||
*
|
|
||||||
* @todo : manage currency in price filter
|
|
||||||
*/
|
*/
|
||||||
class Product extends BaseI18nLoop
|
class Product extends BaseI18nLoop
|
||||||
{
|
{
|
||||||
@@ -87,6 +84,7 @@ class Product extends BaseI18nLoop
|
|||||||
Argument::createBooleanTypeArgument('current_category'),
|
Argument::createBooleanTypeArgument('current_category'),
|
||||||
Argument::createIntTypeArgument('depth', 1),
|
Argument::createIntTypeArgument('depth', 1),
|
||||||
Argument::createBooleanOrBothTypeArgument('visible', 1),
|
Argument::createBooleanOrBothTypeArgument('visible', 1),
|
||||||
|
Argument::createIntTypeArgument('currency'),
|
||||||
new Argument(
|
new Argument(
|
||||||
'order',
|
'order',
|
||||||
new TypeCollection(
|
new TypeCollection(
|
||||||
@@ -137,6 +135,19 @@ class Product extends BaseI18nLoop
|
|||||||
*/
|
*/
|
||||||
public function exec(&$pagination)
|
public function exec(&$pagination)
|
||||||
{
|
{
|
||||||
|
$currencyId = $this->getCurrency();
|
||||||
|
if(null !== $currencyId) {
|
||||||
|
$currency = CurrencyQuery::create()->findOneById($currencyId);
|
||||||
|
if(null === $currency) {
|
||||||
|
throw new \InvalidArgumentException('Cannot found currency id: `' . $currency . '` in product_sale_elements loop');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$currency = $this->request->getSession()->getCurrency();
|
||||||
|
}
|
||||||
|
|
||||||
|
$defaultCurrency = CurrencyQuery::create()->findOneByByDefault(1);
|
||||||
|
$defaultCurrencySuffix = '_default_currency';
|
||||||
|
|
||||||
$search = ProductQuery::create();
|
$search = ProductQuery::create();
|
||||||
|
|
||||||
/* manage translations */
|
/* manage translations */
|
||||||
@@ -144,7 +155,7 @@ class Product extends BaseI18nLoop
|
|||||||
|
|
||||||
$attributeNonStrictMatch = $this->getAttribute_non_strict_match();
|
$attributeNonStrictMatch = $this->getAttribute_non_strict_match();
|
||||||
$isPSELeftJoinList = array();
|
$isPSELeftJoinList = array();
|
||||||
$isProductPriceLeftJoinList = array();
|
$isProductPriceFirstLeftJoin = array();
|
||||||
|
|
||||||
$id = $this->getId();
|
$id = $this->getId();
|
||||||
|
|
||||||
@@ -232,46 +243,6 @@ class Product extends BaseI18nLoop
|
|||||||
->where('NOT ISNULL(`is_max_weight`.ID)');
|
->where('NOT ISNULL(`is_max_weight`.ID)');
|
||||||
}
|
}
|
||||||
|
|
||||||
$min_price = $this->getMin_price();
|
|
||||||
|
|
||||||
if(null !== $min_price) {
|
|
||||||
$isPSELeftJoinList[] = 'is_min_price';
|
|
||||||
$isProductPriceLeftJoinList['is_min_price'] = 'min_price_data';
|
|
||||||
$minPriceJoin = new Join();
|
|
||||||
$minPriceJoin->addExplicitCondition(ProductSaleElementsTableMap::TABLE_NAME, 'ID', 'is_min_price', ProductPriceTableMap::TABLE_NAME, 'PRODUCT_SALE_ELEMENTS_ID', 'min_price_data');
|
|
||||||
$minPriceJoin->setJoinType(Criteria::LEFT_JOIN);
|
|
||||||
|
|
||||||
$search->joinProductSaleElements('is_min_price', Criteria::LEFT_JOIN)
|
|
||||||
->addJoinObject($minPriceJoin)
|
|
||||||
->condition('in_promo', '`is_min_price`.promo'. Criteria::EQUAL .'1')
|
|
||||||
->condition('not_in_promo', '`is_min_price`.promo'. Criteria::NOT_EQUAL .'1')
|
|
||||||
->condition('min_promo_price', '`min_price_data`.promo_price' . Criteria::GREATER_EQUAL . '?', $min_price, \PDO::PARAM_STR)
|
|
||||||
->condition('min_price', '`min_price_data`.price' . Criteria::GREATER_EQUAL . '?', $min_price, \PDO::PARAM_STR)
|
|
||||||
->combine(array('in_promo', 'min_promo_price'), Criteria::LOGICAL_AND, 'in_promo_min_price')
|
|
||||||
->combine(array('not_in_promo', 'min_price'), Criteria::LOGICAL_AND, 'not_in_promo_min_price')
|
|
||||||
->where(array('not_in_promo_min_price', 'in_promo_min_price'), Criteria::LOGICAL_OR);
|
|
||||||
}
|
|
||||||
|
|
||||||
$max_price = $this->getMax_price();
|
|
||||||
|
|
||||||
if(null !== $max_price) {
|
|
||||||
$isPSELeftJoinList[] = 'is_max_price';
|
|
||||||
$isProductPriceLeftJoinList['is_max_price'] = 'max_price_data';
|
|
||||||
$minPriceJoin = new Join();
|
|
||||||
$minPriceJoin->addExplicitCondition(ProductSaleElementsTableMap::TABLE_NAME, 'ID', 'is_max_price', ProductPriceTableMap::TABLE_NAME, 'PRODUCT_SALE_ELEMENTS_ID', 'max_price_data');
|
|
||||||
$minPriceJoin->setJoinType(Criteria::LEFT_JOIN);
|
|
||||||
|
|
||||||
$search->joinProductSaleElements('is_max_price', Criteria::LEFT_JOIN)
|
|
||||||
->addJoinObject($minPriceJoin)
|
|
||||||
->condition('in_promo', '`is_max_price`.promo'. Criteria::EQUAL .'1')
|
|
||||||
->condition('not_in_promo', '`is_max_price`.promo'. Criteria::NOT_EQUAL .'1')
|
|
||||||
->condition('min_promo_price', '`max_price_data`.promo_price' . Criteria::LESS_EQUAL . '?', $max_price, \PDO::PARAM_STR)
|
|
||||||
->condition('max_price', '`max_price_data`.price' . Criteria::LESS_EQUAL . '?', $max_price, \PDO::PARAM_STR)
|
|
||||||
->combine(array('in_promo', 'min_promo_price'), Criteria::LOGICAL_AND, 'in_promo_max_price')
|
|
||||||
->combine(array('not_in_promo', 'max_price'), Criteria::LOGICAL_AND, 'not_in_promo_max_price')
|
|
||||||
->where(array('not_in_promo_max_price', 'in_promo_max_price'), Criteria::LOGICAL_OR);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($attributeNonStrictMatch != '*') {
|
if ($attributeNonStrictMatch != '*') {
|
||||||
if ($attributeNonStrictMatch == 'none') {
|
if ($attributeNonStrictMatch == 'none') {
|
||||||
$actuallyUsedAttributeNonStrictMatchList = $isPSELeftJoinList;
|
$actuallyUsedAttributeNonStrictMatchList = $isPSELeftJoinList;
|
||||||
@@ -286,13 +257,96 @@ class Product extends BaseI18nLoop
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$min_price = $this->getMin_price();
|
||||||
|
|
||||||
|
if (null !== $min_price) {
|
||||||
|
|
||||||
|
if (false === ConfigQuery::useTaxFreeAmounts()) {
|
||||||
|
// @todo
|
||||||
|
}
|
||||||
|
|
||||||
|
$isPSELeftJoinList[] = 'is_min_price';
|
||||||
|
$isProductPriceFirstLeftJoin = array('is_min_price', 'min_price_data');
|
||||||
|
|
||||||
|
$minPriceJoin = new Join();
|
||||||
|
$minPriceJoin->addExplicitCondition(ProductSaleElementsTableMap::TABLE_NAME, 'ID', 'is_min_price', ProductPriceTableMap::TABLE_NAME, 'PRODUCT_SALE_ELEMENTS_ID', 'min_price_data');
|
||||||
|
$minPriceJoin->setJoinType(Criteria::LEFT_JOIN);
|
||||||
|
|
||||||
|
$search->joinProductSaleElements('is_min_price', Criteria::LEFT_JOIN)
|
||||||
|
->addJoinObject($minPriceJoin, 'is_min_price_join')
|
||||||
|
->addJoinCondition('is_min_price_join', '`min_price_data`.`currency_id` = ?', $currency->getId(), null, \PDO::PARAM_INT);
|
||||||
|
|
||||||
|
if ($defaultCurrency->getId() != $currency->getId()) {
|
||||||
|
$minPriceJoinDefaultCurrency = new Join();
|
||||||
|
$minPriceJoinDefaultCurrency->addExplicitCondition(ProductSaleElementsTableMap::TABLE_NAME, 'ID', 'is_min_price', ProductPriceTableMap::TABLE_NAME, 'PRODUCT_SALE_ELEMENTS_ID', 'min_price_data' . $defaultCurrencySuffix);
|
||||||
|
$minPriceJoinDefaultCurrency->setJoinType(Criteria::LEFT_JOIN);
|
||||||
|
|
||||||
|
$search->addJoinObject($minPriceJoinDefaultCurrency, 'is_min_price_join' . $defaultCurrencySuffix)
|
||||||
|
->addJoinCondition('is_min_price_join' . $defaultCurrencySuffix, '`min_price_data' . $defaultCurrencySuffix . '`.`currency_id` = ?', $defaultCurrency->getId(), null, \PDO::PARAM_INT);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In propel we trust : $currency->getRate() always returns a float.
|
||||||
|
* Or maybe not : rate value is checked as a float in overloaded getRate method.
|
||||||
|
*/
|
||||||
|
$MinPriceToCompareAsSQL = 'CASE WHEN ISNULL(CASE WHEN `is_min_price`.PROMO=1 THEN `min_price_data`.PROMO_PRICE ELSE `min_price_data`.PRICE END) THEN
|
||||||
|
CASE WHEN `is_min_price`.PROMO=1 THEN `min_price_data' . $defaultCurrencySuffix . '`.PROMO_PRICE ELSE `min_price_data' . $defaultCurrencySuffix . '`.PRICE END * ' . $currency->getRate() . '
|
||||||
|
ELSE
|
||||||
|
CASE WHEN `is_min_price`.PROMO=1 THEN `min_price_data`.PROMO_PRICE ELSE `min_price_data`.PRICE END
|
||||||
|
END';
|
||||||
|
} else {
|
||||||
|
$MinPriceToCompareAsSQL = 'CASE WHEN `is_min_price`.PROMO=1 THEN `min_price_data`.PROMO_PRICE ELSE `min_price_data`.PRICE END';
|
||||||
|
}
|
||||||
|
|
||||||
|
$search->where('ROUND(' . $MinPriceToCompareAsSQL . ', 2)>=?', $min_price, \PDO::PARAM_STR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$max_price = $this->getMax_price();
|
||||||
|
|
||||||
|
if (null !== $max_price) {
|
||||||
|
$isPSELeftJoinList[] = 'is_max_price';
|
||||||
|
$isProductPriceFirstLeftJoin = array('is_max_price', 'max_price_data');
|
||||||
|
|
||||||
|
$maxPriceJoin = new Join();
|
||||||
|
$maxPriceJoin->addExplicitCondition(ProductSaleElementsTableMap::TABLE_NAME, 'ID', 'is_max_price', ProductPriceTableMap::TABLE_NAME, 'PRODUCT_SALE_ELEMENTS_ID', 'max_price_data');
|
||||||
|
$maxPriceJoin->setJoinType(Criteria::LEFT_JOIN);
|
||||||
|
|
||||||
|
$search->joinProductSaleElements('is_max_price', Criteria::LEFT_JOIN)
|
||||||
|
->addJoinObject($maxPriceJoin, 'is_max_price_join')
|
||||||
|
->addJoinCondition('is_max_price_join', '`max_price_data`.`currency_id` = ?', $currency->getId(), null, \PDO::PARAM_INT);
|
||||||
|
|
||||||
|
if ($defaultCurrency->getId() != $currency->getId()) {
|
||||||
|
$maxPriceJoinDefaultCurrency = new Join();
|
||||||
|
$maxPriceJoinDefaultCurrency->addExplicitCondition(ProductSaleElementsTableMap::TABLE_NAME, 'ID', 'is_max_price', ProductPriceTableMap::TABLE_NAME, 'PRODUCT_SALE_ELEMENTS_ID', 'max_price_data' . $defaultCurrencySuffix);
|
||||||
|
$maxPriceJoinDefaultCurrency->setJoinType(Criteria::LEFT_JOIN);
|
||||||
|
|
||||||
|
$search->addJoinObject($maxPriceJoinDefaultCurrency, 'is_max_price_join' . $defaultCurrencySuffix)
|
||||||
|
->addJoinCondition('is_max_price_join' . $defaultCurrencySuffix, '`max_price_data' . $defaultCurrencySuffix . '`.`currency_id` = ?', $defaultCurrency->getId(), null, \PDO::PARAM_INT);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In propel we trust : $currency->getRate() always returns a float.
|
||||||
|
* Or maybe not : rate value is checked as a float in overloaded getRate method.
|
||||||
|
*/
|
||||||
|
$MaxPriceToCompareAsSQL = 'CASE WHEN ISNULL(CASE WHEN `is_max_price`.PROMO=1 THEN `max_price_data`.PROMO_PRICE ELSE `max_price_data`.PRICE END) THEN
|
||||||
|
CASE WHEN `is_max_price`.PROMO=1 THEN `max_price_data' . $defaultCurrencySuffix . '`.PROMO_PRICE ELSE `max_price_data' . $defaultCurrencySuffix . '`.PRICE END * ' . $currency->getRate() . '
|
||||||
|
ELSE
|
||||||
|
CASE WHEN `is_max_price`.PROMO=1 THEN `max_price_data`.PROMO_PRICE ELSE `max_price_data`.PRICE END
|
||||||
|
END';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$MaxPriceToCompareAsSQL = 'CASE WHEN `is_max_price`.PROMO=1 THEN `max_price_data`.PROMO_PRICE ELSE `max_price_data`.PRICE END';
|
||||||
|
}
|
||||||
|
|
||||||
|
$search->where('ROUND(' . $MaxPriceToCompareAsSQL . ', 2)<=?', $max_price, \PDO::PARAM_STR);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* for ordering and outputs, the product will be :
|
* for ordering and outputs, the product will be :
|
||||||
* - new if at least one the criteria matching PSE is new
|
* - new if at least one the criteria matching PSE is new
|
||||||
* - in promo if at least one the criteria matching PSE is in promo
|
* - in promo if at least one the criteria matching PSE is in promo
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(count($isProductPriceLeftJoinList) == 0) {
|
/* if we don't have any join yet, let's make a global one */
|
||||||
|
if (empty($isProductPriceFirstLeftJoin)) {
|
||||||
if (count($isPSELeftJoinList) == 0) {
|
if (count($isPSELeftJoinList) == 0) {
|
||||||
$joiningTable = "global";
|
$joiningTable = "global";
|
||||||
$isPSELeftJoinList[] = $joiningTable;
|
$isPSELeftJoinList[] = $joiningTable;
|
||||||
@@ -301,13 +355,22 @@ class Product extends BaseI18nLoop
|
|||||||
$joiningTable = $isPSELeftJoinList[0];
|
$joiningTable = $isPSELeftJoinList[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
$isProductPriceLeftJoinList[$joiningTable] = 'global_price_data';
|
$isProductPriceFirstLeftJoin = array($joiningTable, 'global_price_data');
|
||||||
|
|
||||||
$minPriceJoin = new Join();
|
$globalPriceJoin = new Join();
|
||||||
$minPriceJoin->addExplicitCondition(ProductSaleElementsTableMap::TABLE_NAME, 'ID', $joiningTable, ProductPriceTableMap::TABLE_NAME, 'PRODUCT_SALE_ELEMENTS_ID', 'global_price_data');
|
$globalPriceJoin->addExplicitCondition(ProductSaleElementsTableMap::TABLE_NAME, 'ID', $joiningTable, ProductPriceTableMap::TABLE_NAME, 'PRODUCT_SALE_ELEMENTS_ID', 'global_price_data');
|
||||||
$minPriceJoin->setJoinType(Criteria::LEFT_JOIN);
|
$globalPriceJoin->setJoinType(Criteria::LEFT_JOIN);
|
||||||
|
|
||||||
$search->addJoinObject($minPriceJoin);
|
$search->addJoinObject($globalPriceJoin, 'global_price_join')
|
||||||
|
->addJoinCondition('global_price_join', '`global_price_data`.`currency_id` = ?', $currency->getId(), null, \PDO::PARAM_INT);
|
||||||
|
|
||||||
|
if ($defaultCurrency->getId() != $currency->getId()) {
|
||||||
|
$globalPriceJoinDefaultCurrency = new Join();
|
||||||
|
$globalPriceJoinDefaultCurrency->addExplicitCondition(ProductSaleElementsTableMap::TABLE_NAME, 'ID', $joiningTable, ProductPriceTableMap::TABLE_NAME, 'PRODUCT_SALE_ELEMENTS_ID', 'global_price_data' . $defaultCurrencySuffix);
|
||||||
|
$globalPriceJoinDefaultCurrency->setJoinType(Criteria::LEFT_JOIN);
|
||||||
|
$search->addJoinObject($globalPriceJoinDefaultCurrency, 'global_price_join' . $defaultCurrencySuffix)
|
||||||
|
->addJoinCondition('global_price_join' . $defaultCurrencySuffix, '`global_price_data' . $defaultCurrencySuffix . '`.`currency_id` = ?', $defaultCurrency->getId(), null, \PDO::PARAM_INT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -330,15 +393,24 @@ class Product extends BaseI18nLoop
|
|||||||
$booleanMatchedPromoList[] = '`' . $isPSELeftJoin . '`.PROMO';
|
$booleanMatchedPromoList[] = '`' . $isPSELeftJoin . '`.PROMO';
|
||||||
$booleanMatchedNewnessList[] = '`' . $isPSELeftJoin . '`.NEWNESS';
|
$booleanMatchedNewnessList[] = '`' . $isPSELeftJoin . '`.NEWNESS';
|
||||||
}
|
}
|
||||||
$booleanMatchedPriceList = array();
|
|
||||||
foreach($isProductPriceLeftJoinList as $pSE => $isProductPriceLeftJoin) {
|
|
||||||
$booleanMatchedPriceList[] = 'CASE WHEN `' . $pSE . '`.PROMO=1 THEN `' . $isProductPriceLeftJoin . '`.PROMO_PRICE ELSE `' . $isProductPriceLeftJoin . '`.PRICE END';
|
|
||||||
}
|
|
||||||
$search->withColumn('ROUND(MAX(' . implode(' OR ', $booleanMatchedPromoList) . '), 2)', 'main_product_is_promo');
|
$search->withColumn('ROUND(MAX(' . implode(' OR ', $booleanMatchedPromoList) . '), 2)', 'main_product_is_promo');
|
||||||
$search->withColumn('ROUND(MAX(' . implode(' OR ', $booleanMatchedNewnessList) . '), 2)', 'main_product_is_new');
|
$search->withColumn('ROUND(MAX(' . implode(' OR ', $booleanMatchedNewnessList) . '), 2)', 'main_product_is_new');
|
||||||
$search->withColumn('ROUND(MAX(' . implode(' OR ', $booleanMatchedPriceList) . '), 2)', 'real_highest_price');
|
|
||||||
$search->withColumn('ROUND(MIN(' . implode(' OR ', $booleanMatchedPriceList) . '), 2)', 'real_lowest_price');
|
|
||||||
|
|
||||||
|
$booleanMatchedPrice = 'CASE WHEN `' . $isProductPriceFirstLeftJoin[0] . '`.PROMO=1 THEN `' . $isProductPriceFirstLeftJoin[1] . '`.PROMO_PRICE ELSE `' . $isProductPriceFirstLeftJoin[1] . '`.PRICE END';
|
||||||
|
$booleanMatchedPriceDefaultCurrency = 'CASE WHEN `' . $isProductPriceFirstLeftJoin[0] . '`.PROMO=1 THEN `' . $isProductPriceFirstLeftJoin[1] . $defaultCurrencySuffix . '`.PROMO_PRICE ELSE `' . $isProductPriceFirstLeftJoin[1] . $defaultCurrencySuffix . '`.PRICE END';
|
||||||
|
|
||||||
|
if ($defaultCurrency->getId() != $currency->getId()) {
|
||||||
|
/**
|
||||||
|
* In propel we trust : $currency->getRate() always returns a float.
|
||||||
|
* Or maybe not : rate value is checked as a float in overloaded getRate method.
|
||||||
|
*/
|
||||||
|
$priceToCompareAsSQL = 'CASE WHEN ISNULL(' . $booleanMatchedPrice .') THEN ' . $booleanMatchedPriceDefaultCurrency . ' * ' . $currency->getRate() . ' ELSE ' . $booleanMatchedPrice . ' END';
|
||||||
|
} else {
|
||||||
|
$priceToCompareAsSQL = $booleanMatchedPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
$search->withColumn('ROUND(MAX(' . $priceToCompareAsSQL . '), 2)', 'real_highest_price');
|
||||||
|
$search->withColumn('ROUND(MIN(' . $priceToCompareAsSQL . '), 2)', 'real_lowest_price');
|
||||||
|
|
||||||
$current = $this->getCurrent();
|
$current = $this->getCurrent();
|
||||||
|
|
||||||
|
|||||||
@@ -24,18 +24,17 @@
|
|||||||
namespace Thelia\Core\Template\Loop;
|
namespace Thelia\Core\Template\Loop;
|
||||||
|
|
||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
use Propel\Runtime\ActiveQuery\Join;
|
|
||||||
use Thelia\Core\Template\Element\BaseLoop;
|
use Thelia\Core\Template\Element\BaseLoop;
|
||||||
use Thelia\Core\Template\Element\LoopResult;
|
use Thelia\Core\Template\Element\LoopResult;
|
||||||
use Thelia\Core\Template\Element\LoopResultRow;
|
use Thelia\Core\Template\Element\LoopResultRow;
|
||||||
|
|
||||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
use Thelia\Log\Tlog;
|
|
||||||
|
|
||||||
use Thelia\Model\Base\ProductSaleElementsQuery;
|
use Thelia\Model\Base\ProductSaleElementsQuery;
|
||||||
use Thelia\Model\ConfigQuery;
|
|
||||||
use Thelia\Model\CountryQuery;
|
use Thelia\Model\CountryQuery;
|
||||||
|
use Thelia\Model\CurrencyQuery;
|
||||||
|
use Thelia\Model\Map\ProductSaleElementsTableMap;
|
||||||
use Thelia\Type\TypeCollection;
|
use Thelia\Type\TypeCollection;
|
||||||
use Thelia\Type;
|
use Thelia\Type;
|
||||||
|
|
||||||
@@ -43,7 +42,7 @@ use Thelia\Type;
|
|||||||
*
|
*
|
||||||
* Product Sale Elements loop
|
* Product Sale Elements loop
|
||||||
*
|
*
|
||||||
* @todo : manage currency and attribute_availability
|
* @todo : manage attribute_availability ?
|
||||||
*
|
*
|
||||||
* Class ProductSaleElements
|
* Class ProductSaleElements
|
||||||
* @package Thelia\Core\Template\Loop
|
* @package Thelia\Core\Template\Loop
|
||||||
@@ -70,9 +69,9 @@ class ProductSaleElements extends BaseLoop
|
|||||||
new Argument(
|
new Argument(
|
||||||
'order',
|
'order',
|
||||||
new TypeCollection(
|
new TypeCollection(
|
||||||
new Type\EnumListType(array('alpha', 'alpha_reverse', 'attribute', 'attribute_reverse'))
|
new Type\EnumListType(array('min_price', 'max_price', 'promo', 'new', 'random'))
|
||||||
),
|
),
|
||||||
'attribute'
|
'random'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -81,6 +80,7 @@ class ProductSaleElements extends BaseLoop
|
|||||||
* @param $pagination
|
* @param $pagination
|
||||||
*
|
*
|
||||||
* @return \Thelia\Core\Template\Element\LoopResult
|
* @return \Thelia\Core\Template\Element\LoopResult
|
||||||
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function exec(&$pagination)
|
public function exec(&$pagination)
|
||||||
{
|
{
|
||||||
@@ -94,29 +94,54 @@ class ProductSaleElements extends BaseLoop
|
|||||||
|
|
||||||
foreach ($orders as $order) {
|
foreach ($orders as $order) {
|
||||||
switch ($order) {
|
switch ($order) {
|
||||||
case "alpha":
|
case "min_price":
|
||||||
//$search->addAscendingOrderByColumn(\Thelia\Model\Map\AttributeI18nTableMap::TITLE);
|
$search->addAscendingOrderByColumn('price_FINAL_PRICE', Criteria::ASC);
|
||||||
break;
|
break;
|
||||||
case "alpha_reverse":
|
case "max_price":
|
||||||
//$search->addDescendingOrderByColumn(\Thelia\Model\Map\AttributeI18nTableMap::TITLE);
|
$search->addDescendingOrderByColumn('price_FINAL_PRICE');
|
||||||
break;
|
break;
|
||||||
case "attribute":
|
case "promo":
|
||||||
//$search->orderByPosition(Criteria::ASC);
|
$search->orderByPromo(Criteria::DESC);
|
||||||
break;
|
break;
|
||||||
case "attribute_reverse":
|
case "new":
|
||||||
//$search->orderByPosition(Criteria::DESC);
|
$search->orderByNewness(Criteria::DESC);
|
||||||
break;
|
break;
|
||||||
|
case "random":
|
||||||
|
$search->clearOrderByColumns();
|
||||||
|
$search->addAscendingOrderByColumn('RAND()');
|
||||||
|
break(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$currency = $this->getCurrency();
|
$currencyId = $this->getCurrency();
|
||||||
|
if (null !== $currencyId) {
|
||||||
|
$currency = CurrencyQuery::create()->findOneById($currencyId);
|
||||||
|
if (null === $currency) {
|
||||||
|
throw new \InvalidArgumentException('Cannot found currency id: `' . $currency . '` in product_sale_elements loop');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$currency = $this->request->getSession()->getCurrency();
|
||||||
|
}
|
||||||
|
|
||||||
$search->joinProductPrice('price', Criteria::INNER_JOIN);
|
$defaultCurrency = CurrencyQuery::create()->findOneByByDefault(1);
|
||||||
//->addJoinCondition('price', '');
|
$defaultCurrencySuffix = '_default_currency';
|
||||||
|
|
||||||
$search->withColumn('`price`.CURRENCY_ID', 'price_CURRENCY_ID')
|
$search->joinProductPrice('price', Criteria::LEFT_JOIN)
|
||||||
->withColumn('`price`.PRICE', 'price_PRICE')
|
->addJoinCondition('price', '`price`.`currency_id` = ?', $currency->getId(), null, \PDO::PARAM_INT);
|
||||||
->withColumn('`price`.PROMO_PRICE', 'price_PROMO_PRICE');
|
|
||||||
|
$search->joinProductPrice('price' . $defaultCurrencySuffix, Criteria::LEFT_JOIN)
|
||||||
|
->addJoinCondition('price_default_currency', '`price' . $defaultCurrencySuffix . '`.`currency_id` = ?', $defaultCurrency->getId(), null, \PDO::PARAM_INT);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rate value is checked as a float in overloaded getRate method.
|
||||||
|
*/
|
||||||
|
$priceSelectorAsSQL = 'ROUND(CASE WHEN ISNULL(`price`.PRICE) THEN `price_default_currency`.PRICE * ' . $currency->getRate() . ' ELSE `price`.PRICE END, 2)';
|
||||||
|
$promoPriceSelectorAsSQL = 'ROUND(CASE WHEN ISNULL(`price`.PRICE) THEN `price_default_currency`.PROMO_PRICE * ' . $currency->getRate() . ' ELSE `price`.PROMO_PRICE END, 2)';
|
||||||
|
$search->withColumn($priceSelectorAsSQL, 'price_PRICE')
|
||||||
|
->withColumn($promoPriceSelectorAsSQL, 'price_PROMO_PRICE')
|
||||||
|
->withColumn('CASE WHEN ' . ProductSaleElementsTableMap::PROMO . ' = 1 THEN ' . $promoPriceSelectorAsSQL . ' ELSE ' . $priceSelectorAsSQL . ' END', 'price_FINAL_PRICE');
|
||||||
|
|
||||||
|
$search->groupById();
|
||||||
|
|
||||||
$PSEValues = $this->search($search, $pagination);
|
$PSEValues = $this->search($search, $pagination);
|
||||||
|
|
||||||
@@ -139,8 +164,6 @@ class ProductSaleElements extends BaseLoop
|
|||||||
->set("IS_PROMO", $PSEValue->getPromo() === 1 ? 1 : 0)
|
->set("IS_PROMO", $PSEValue->getPromo() === 1 ? 1 : 0)
|
||||||
->set("IS_NEW", $PSEValue->getNewness() === 1 ? 1 : 0)
|
->set("IS_NEW", $PSEValue->getNewness() === 1 ? 1 : 0)
|
||||||
->set("WEIGHT", $PSEValue->getWeight())
|
->set("WEIGHT", $PSEValue->getWeight())
|
||||||
|
|
||||||
->set("CURRENCY", $PSEValue->getVirtualColumn('price_CURRENCY_ID'))
|
|
||||||
->set("PRICE", $price)
|
->set("PRICE", $price)
|
||||||
->set("PRICE_TAX", $taxedPrice - $price)
|
->set("PRICE_TAX", $taxedPrice - $price)
|
||||||
->set("TAXED_PRICE", $taxedPrice)
|
->set("TAXED_PRICE", $taxedPrice)
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
|||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
|
|
||||||
use Thelia\Model\CustomerTitleQuery;
|
use Thelia\Model\CustomerTitleQuery;
|
||||||
use Thelia\Model\ConfigQuery;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ namespace Thelia\Core\Template;
|
|||||||
|
|
||||||
use Thelia\Model\ConfigQuery;
|
use Thelia\Model\ConfigQuery;
|
||||||
use Thelia\Core\HttpFoundation\Request;
|
use Thelia\Core\HttpFoundation\Request;
|
||||||
use Thelia\Tools\URL;
|
|
||||||
use Thelia\Form\BaseForm;
|
use Thelia\Form\BaseForm;
|
||||||
/**
|
/**
|
||||||
* The parser context is an application-wide context, which stores var-value pairs.
|
* The parser context is an application-wide context, which stores var-value pairs.
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
namespace Thelia\Core\Template\Smarty\Exception;
|
namespace Thelia\Core\Template\Smarty\Exception;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class SmartyPluginException
|
* Class SmartyPluginException
|
||||||
* @package Thelia\Core\Template\Smarty\Exception
|
* @package Thelia\Core\Template\Smarty\Exception
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ namespace Thelia\Core\Template\Smarty\Plugins;
|
|||||||
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
|
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
|
||||||
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
||||||
use Thelia\Tools\URL;
|
use Thelia\Tools\URL;
|
||||||
use Thelia\Core\HttpFoundation\Request;
|
|
||||||
use Thelia\Core\Security\SecurityContext;
|
use Thelia\Core\Security\SecurityContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,7 +42,8 @@ class AdminUtilities extends AbstractSmartyPlugin
|
|||||||
$this->securityContext = $securityContext;
|
$this->securityContext = $securityContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generatePositionChangeBlock($params, &$smarty) {
|
public function generatePositionChangeBlock($params, &$smarty)
|
||||||
|
{
|
||||||
// The required permissions
|
// The required permissions
|
||||||
$permission = $this->getParam($params, 'permission');
|
$permission = $this->getParam($params, 'permission');
|
||||||
|
|
||||||
@@ -77,13 +77,11 @@ class AdminUtilities extends AbstractSmartyPlugin
|
|||||||
$position,
|
$position,
|
||||||
URL::getInstance()->absoluteUrl($path, array('mode' => 'down', $url_parameter => $id))
|
URL::getInstance()->absoluteUrl($path, array('mode' => 'down', $url_parameter => $id))
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return $position;
|
return $position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates the link of a sortable column header
|
* Generates the link of a sortable column header
|
||||||
*
|
*
|
||||||
@@ -111,12 +109,10 @@ class AdminUtilities extends AbstractSmartyPlugin
|
|||||||
if ($current_order == $order) {
|
if ($current_order == $order) {
|
||||||
$icon = 'up';
|
$icon = 'up';
|
||||||
$order_change = $reverse_order;
|
$order_change = $reverse_order;
|
||||||
}
|
} elseif ($current_order == $reverse_order) {
|
||||||
else if ($current_order == $reverse_order) {
|
|
||||||
$icon = 'down';
|
$icon = 'down';
|
||||||
$order_change = $order;
|
$order_change = $order;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$order_change = $order;
|
$order_change = $order;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +124,6 @@ class AdminUtilities extends AbstractSmartyPlugin
|
|||||||
return sprintf('%s<a href="%s">%s</a>', $output, URL::getInstance()->absoluteUrl($path, array('order' => $order_change)), $label);
|
return sprintf('%s<a href="%s">%s</a>', $output, URL::getInstance()->absoluteUrl($path, array('order' => $order_change)), $label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the various smarty plugins handled by this class
|
* Define the various smarty plugins handled by this class
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -107,8 +107,7 @@ class Form extends AbstractSmartyPlugin
|
|||||||
|
|
||||||
$template->assign("form_error", $instance->hasError() ? true : false);
|
$template->assign("form_error", $instance->hasError() ? true : false);
|
||||||
$template->assign("form_error_message", $instance->getErrorMessage());
|
$template->assign("form_error_message", $instance->getErrorMessage());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -201,7 +200,6 @@ class Form extends AbstractSmartyPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function assignFieldErrorVars(\Smarty_Internal_Template $template, array $errors)
|
protected function assignFieldErrorVars(\Smarty_Internal_Template $template, array $errors)
|
||||||
{
|
{
|
||||||
$template->assign("message", $errors[0]->getMessage());
|
$template->assign("message", $errors[0]->getMessage());
|
||||||
@@ -223,7 +221,6 @@ class Form extends AbstractSmartyPlugin
|
|||||||
if (null == $fieldName)
|
if (null == $fieldName)
|
||||||
throw new \InvalidArgumentException("'field' parameter is missing");
|
throw new \InvalidArgumentException("'field' parameter is missing");
|
||||||
|
|
||||||
|
|
||||||
if (empty($instance->getView()[$fieldName]))
|
if (empty($instance->getView()[$fieldName]))
|
||||||
throw new \InvalidArgumentException(sprintf("Field name '%s' not found in form %s", $fieldName, $instance->getName()));
|
throw new \InvalidArgumentException(sprintf("Field name '%s' not found in form %s", $fieldName, $instance->getName()));
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,6 @@ class Format extends AbstractSmartyPlugin
|
|||||||
|
|
||||||
$lang = $this->request->getSession()->getLang();
|
$lang = $this->request->getSession()->getLang();
|
||||||
|
|
||||||
|
|
||||||
$decimals = array_key_exists("decimals", $params) ? $params["decimals"] : $lang->getDecimals();
|
$decimals = array_key_exists("decimals", $params) ? $params["decimals"] : $lang->getDecimals();
|
||||||
$decPoint = array_key_exists("dec_point", $params) ? $params["dec_point"] : $lang->getDecimalSeparator();
|
$decPoint = array_key_exists("dec_point", $params) ? $params["dec_point"] : $lang->getDecimalSeparator();
|
||||||
$thousandsSep = array_key_exists("thousands_sep", $params) ? $params["thousands_sep"] : $lang->getThousandsSeparator();
|
$thousandsSep = array_key_exists("thousands_sep", $params) ? $params["thousands_sep"] : $lang->getThousandsSeparator();
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user