Merge branch 'master' of https://github.com/thelia/thelia into coupon
# By Manuel Raynaud (19) and others # Via Manuel Raynaud (8) and others * 'master' of https://github.com/thelia/thelia: (47 commits) tax engine tax engine - Add orders view route - Add view & action for orders index Removed a redondant "use" 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 Add customer view finish Add modal for create/delete customer Update body background fixed typo searching route return relative path pse loop currency ... Conflicts: core/lib/Thelia/Controller/Admin/CouponController.php core/lib/Thelia/Core/Event/TheliaEvents.php web/index_dev.php
This commit is contained in:
@@ -27,7 +27,6 @@ use Thelia\Core\Event\AddressCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\Address as AddressModel;
|
||||
|
||||
|
||||
/**
|
||||
* Class Address
|
||||
* @package Thelia\Action
|
||||
@@ -50,7 +49,6 @@ class Address extends BaseAction implements EventSubscriberInterface
|
||||
$this->createOrUpdate($addressModel, $event);
|
||||
}
|
||||
|
||||
|
||||
protected function createOrUpdate(AddressModel $addressModel, AddressCreateOrUpdateEvent $event)
|
||||
{
|
||||
$addressModel->setDispatcher($this->getDispatcher());
|
||||
@@ -105,4 +103,4 @@ class Address extends BaseAction implements EventSubscriberInterface
|
||||
TheliaEvents::ADDRESS_UPDATE => array("update", 128)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,6 @@
|
||||
/*************************************************************************************/
|
||||
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;
|
||||
|
||||
class BaseAction
|
||||
@@ -49,4 +45,4 @@ class BaseAction
|
||||
{
|
||||
return $this->container->get('event_dispatcher');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,12 +23,9 @@
|
||||
|
||||
namespace Thelia\Action;
|
||||
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\CartEvent;
|
||||
use Thelia\Form\CartAdd;
|
||||
use Thelia\Model\ProductPrice;
|
||||
use Thelia\Model\ProductPriceQuery;
|
||||
use Thelia\Model\CartItem;
|
||||
|
||||
@@ -31,7 +31,6 @@ use Thelia\Model\CategoryQuery;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\Propel;
|
||||
use Thelia\Model\Map\CategoryTableMap;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
|
||||
use Thelia\Core\Event\CategoryCreateEvent;
|
||||
use Thelia\Core\Event\CategoryDeleteEvent;
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Action;
|
||||
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
use Thelia\Model\ConfigQuery;
|
||||
|
||||
@@ -28,9 +28,6 @@ use Thelia\Constraint\ConstraintFactory;
|
||||
use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\Coupon as CouponModel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\Propel;
|
||||
use Thelia\Model\Map\CategoryTableMap;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Action;
|
||||
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
@@ -60,7 +59,6 @@ class Currency extends BaseAction implements EventSubscriberInterface
|
||||
->save()
|
||||
;
|
||||
|
||||
|
||||
$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');
|
||||
|
||||
$rate_data = @file_get_contents($rates_url);
|
||||
|
||||
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"]);
|
||||
$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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,17 +27,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
use Thelia\Core\Event\CustomerCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Form\CustomerCreation;
|
||||
use Thelia\Form\CustomerModification;
|
||||
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;
|
||||
|
||||
/**
|
||||
@@ -96,7 +86,6 @@ class Customer extends BaseAction implements EventSubscriberInterface
|
||||
$event->setCustomer($customer);
|
||||
}
|
||||
|
||||
|
||||
public function login(CustomerLoginEvent $event)
|
||||
{
|
||||
$this->getSecurityContext()->setCustomerUser($event->getCustomer());
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace Thelia\Action;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
use Thelia\Core\Event\ImageEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Tools\URL;
|
||||
@@ -86,8 +85,8 @@ class Image extends BaseAction implements EventSubscriberInterface
|
||||
*
|
||||
* @param ImageEvent $event
|
||||
*/
|
||||
public function clearCache(ImageEvent $event) {
|
||||
|
||||
public function clearCache(ImageEvent $event)
|
||||
{
|
||||
$path = $this->getCachePath($event->getCacheSubdirectory(), false);
|
||||
|
||||
$this->clearDirectory($path);
|
||||
@@ -98,8 +97,8 @@ class Image extends BaseAction implements EventSubscriberInterface
|
||||
*
|
||||
* @param string $path the directory path
|
||||
*/
|
||||
protected function clearDirectory($path) {
|
||||
|
||||
protected function clearDirectory($path)
|
||||
{
|
||||
$iterator = new \DirectoryIterator($path);
|
||||
|
||||
foreach ($iterator as $fileinfo) {
|
||||
@@ -108,8 +107,7 @@ class Image extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
if ($fileinfo->isFile() || $fileinfo->isLink()) {
|
||||
@unlink($fileinfo->getPathname());
|
||||
}
|
||||
else if ($fileinfo->isDir()) {
|
||||
} elseif ($fileinfo->isDir()) {
|
||||
$this->clearDirectory($fileinfo->getPathname());
|
||||
}
|
||||
}
|
||||
@@ -124,7 +122,7 @@ class Image extends BaseAction implements EventSubscriberInterface
|
||||
*
|
||||
* This method updates the cache_file_path and file_url attributes of the event
|
||||
*
|
||||
* @param ImageEvent $event
|
||||
* @param ImageEvent $event
|
||||
* @throws \InvalidArgumentException, ImageException
|
||||
*/
|
||||
public function processImage(ImageEvent $event)
|
||||
@@ -160,8 +158,7 @@ class Image extends BaseAction implements EventSubscriberInterface
|
||||
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));
|
||||
}
|
||||
}
|
||||
else {// mode = 'copy'
|
||||
} else {// mode = 'copy'
|
||||
if (false == @copy($source_file, $originalImagePathInCache)) {
|
||||
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) {
|
||||
$bg_color = new Color($background_color);
|
||||
}
|
||||
else
|
||||
} else
|
||||
$bg_color = null;
|
||||
|
||||
// Apply resize
|
||||
@@ -252,8 +248,7 @@ class Image extends BaseAction implements EventSubscriberInterface
|
||||
$cacheFilePath,
|
||||
array('quality' => $quality)
|
||||
);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new ImageException(sprintf("Source file %s cannot be opened.", basename($source_file)));
|
||||
}
|
||||
}
|
||||
@@ -277,13 +272,13 @@ class Image extends BaseAction implements EventSubscriberInterface
|
||||
* Process image resizing, with borders or cropping. If $dest_width and $dest_height
|
||||
* are both null, no resize is performed.
|
||||
*
|
||||
* @param ImagineInterface $imagine the Imagine instance
|
||||
* @param ImageInterface $image the image to process
|
||||
* @param int $dest_width the required width
|
||||
* @param int $dest_height the required height
|
||||
* @param int $resize_mode the resize mode (crop / bands / keep image ratio)p
|
||||
* @param string $bg_color the bg_color used for bands
|
||||
* @return ImageInterface the resized image.
|
||||
* @param ImagineInterface $imagine the Imagine instance
|
||||
* @param ImageInterface $image the image to process
|
||||
* @param int $dest_width the required width
|
||||
* @param int $dest_height the required height
|
||||
* @param int $resize_mode the resize mode (crop / bands / keep image ratio)p
|
||||
* @param string $bg_color the bg_color used for bands
|
||||
* @return ImageInterface the resized image.
|
||||
*/
|
||||
protected function applyResize(ImagineInterface $imagine, ImageInterface $image, $dest_width, $dest_height, $resize_mode, $bg_color)
|
||||
{
|
||||
@@ -313,8 +308,7 @@ class Image extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
$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);
|
||||
}
|
||||
else if ($width_diff > $height_diff) {
|
||||
} elseif ($width_diff > $height_diff) {
|
||||
// Image height > image width
|
||||
|
||||
$next_height = $dest_height;
|
||||
@@ -324,12 +318,10 @@ class Image extends BaseAction implements EventSubscriberInterface
|
||||
$next_width = $dest_width;
|
||||
$next_height = intval($height_orig * $dest_width / $width_orig);
|
||||
$delta_y = ($next_height - $dest_height) / 2;
|
||||
}
|
||||
else if ($resize_mode != self::EXACT_RATIO_WITH_BORDERS) {
|
||||
} elseif ($resize_mode != self::EXACT_RATIO_WITH_BORDERS) {
|
||||
$dest_width = $next_width;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Image width > image height
|
||||
$next_width = $dest_width;
|
||||
$next_height = intval($height_orig * $dest_width / $width_orig);
|
||||
@@ -338,8 +330,7 @@ class Image extends BaseAction implements EventSubscriberInterface
|
||||
$next_height = $dest_height;
|
||||
$next_width = intval(($width_orig * $next_height) / $height_orig);
|
||||
$delta_x = ($next_width - $dest_width) / 2;
|
||||
}
|
||||
else if ($resize_mode != self::EXACT_RATIO_WITH_BORDERS) {
|
||||
} elseif ($resize_mode != self::EXACT_RATIO_WITH_BORDERS) {
|
||||
$dest_height = $next_height;
|
||||
}
|
||||
}
|
||||
@@ -357,9 +348,7 @@ class Image extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
return $imagine->create($canvas, $bg_color)
|
||||
->paste($image, new Point($border_width, $border_height));
|
||||
}
|
||||
|
||||
else if ($resize_mode == self::EXACT_RATIO_WITH_CROP) {
|
||||
} elseif ($resize_mode == self::EXACT_RATIO_WITH_CROP) {
|
||||
$image->crop(
|
||||
new Point($delta_x, $delta_y),
|
||||
new Box($dest_width, $dest_height)
|
||||
@@ -370,12 +359,11 @@ class Image extends BaseAction implements EventSubscriberInterface
|
||||
return $image;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the absolute URL to the cached image
|
||||
*
|
||||
* @param string $subdir the subdirectory related to cache base
|
||||
* @param string $filename the safe filename, as returned by getCacheFilePath()
|
||||
* @param string $subdir the subdirectory related to cache base
|
||||
* @param string $filename the safe filename, as returned by getCacheFilePath()
|
||||
* @return string the absolute URL to the cached image
|
||||
*/
|
||||
protected function getCacheFileURL($subdir, $safe_filename)
|
||||
@@ -388,10 +376,10 @@ class Image extends BaseAction implements EventSubscriberInterface
|
||||
/**
|
||||
* Return the full path of the cached file
|
||||
*
|
||||
* @param string $subdir the subdirectory related to cache base
|
||||
* @param string $filename the filename
|
||||
* @param boolean $forceOriginalImage if true, the origiunal image path in the cache dir is returned.
|
||||
* @return string the cache directory path relative to Web Root
|
||||
* @param string $subdir the subdirectory related to cache base
|
||||
* @param string $filename the filename
|
||||
* @param boolean $forceOriginalImage if true, the origiunal image path in the cache dir is returned.
|
||||
* @return string the cache directory path relative to Web Root
|
||||
*/
|
||||
protected function getCacheFilePath($subdir, $filename, ImageEvent $event, $forceOriginalImage = false)
|
||||
{
|
||||
@@ -409,7 +397,7 @@ class Image extends BaseAction implements EventSubscriberInterface
|
||||
/**
|
||||
* Return the cache directory path relative to Web Root
|
||||
*
|
||||
* @param string $subdir the subdirectory related to cache base, or null to get the cache directory only.
|
||||
* @param string $subdir the subdirectory related to cache base, or null to get the cache directory only.
|
||||
* @return string the cache directory path relative to Web Root
|
||||
*/
|
||||
protected function getCachePathFromWebRoot($subdir = null)
|
||||
@@ -420,21 +408,19 @@ class Image extends BaseAction implements EventSubscriberInterface
|
||||
$safe_subdir = basename($subdir);
|
||||
|
||||
$path = sprintf("%s/%s", $cache_dir_from_web_root, $safe_subdir);
|
||||
}
|
||||
else
|
||||
} else
|
||||
$path = $cache_dir_from_web_root;
|
||||
|
||||
// Check if path is valid, e.g. in the cache dir
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the absolute cache directory path
|
||||
*
|
||||
* @param string $subdir the subdirectory related to cache base, or null to get the cache base directory.
|
||||
* @param string $subdir the subdirectory related to cache base, or null to get the cache base directory.
|
||||
* @throws \RuntimeException if cache directory cannot be created
|
||||
* @return string the absolute cache directory path
|
||||
* @return string the absolute cache directory path
|
||||
*/
|
||||
protected function getCachePath($subdir = null, $create_if_not_exists = true)
|
||||
{
|
||||
@@ -494,4 +480,4 @@ class Image extends BaseAction implements EventSubscriberInterface
|
||||
TheliaEvents::IMAGE_CLEAR_CACHE => array("clearCache", 128),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Action;
|
||||
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
use Thelia\Model\MessageQuery;
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Action;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||
@@ -41,7 +40,7 @@ class PageNotFound extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
public function display404(GetResponseForExceptionEvent $event)
|
||||
{
|
||||
if($event->getException() instanceof NotFoundHttpException) {
|
||||
if ($event->getException() instanceof NotFoundHttpException) {
|
||||
|
||||
$parser = $this->container->get("thelia.parser");
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace Thelia\Action;
|
||||
|
||||
use Thelia\Core\Event\BaseChangePositionEvent;
|
||||
|
||||
trait PositionManagementTrait {
|
||||
|
||||
trait PositionManagementTrait
|
||||
{
|
||||
const POSITION_UP
|
||||
/**
|
||||
* Changes object position, selecting absolute ou relative change.
|
||||
@@ -154,4 +154,4 @@ trait PositionManagementTrait {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user