fix cs
This commit is contained in:
@@ -186,11 +186,11 @@ class Cart extends BaseAction implements EventSubscriberInterface
|
||||
/**
|
||||
* try to attach a new item to an existing cart
|
||||
*
|
||||
* @param \Thelia\Model\Cart $cart
|
||||
* @param int $productId
|
||||
* @param \Thelia\Model\Cart $cart
|
||||
* @param int $productId
|
||||
* @param \Thelia\Model\ProductSaleElements $productSaleElements
|
||||
* @param float $quantity
|
||||
* @param ProductPrice $productPrice
|
||||
* @param float $quantity
|
||||
* @param ProductPrice $productPrice
|
||||
*
|
||||
* @return CartItem
|
||||
*/
|
||||
|
||||
@@ -211,7 +211,7 @@ class Coupon extends BaseAction implements EventSubscriberInterface
|
||||
/** @var CouponManager $couponManager */
|
||||
$couponManager = $this->container->get('thelia.coupon.manager');
|
||||
|
||||
if($couponManager->isCouponRemovingPostage()) {
|
||||
if ($couponManager->isCouponRemovingPostage()) {
|
||||
$order = $event->getOrder();
|
||||
|
||||
$order->setPostage(0);
|
||||
@@ -235,7 +235,7 @@ class Coupon extends BaseAction implements EventSubscriberInterface
|
||||
$consumedCoupons = $request->getSession()->getConsumedCoupons();
|
||||
|
||||
if (is_array($consumedCoupons)) {
|
||||
foreach($consumedCoupons as $couponCode) {
|
||||
foreach ($consumedCoupons as $couponCode) {
|
||||
$couponQuery = CouponQuery::create();
|
||||
$couponModel = $couponQuery->findOneByCode($couponCode);
|
||||
$couponModel->setLocale($request->getSession()->getLang()->getLocale());
|
||||
|
||||
@@ -30,7 +30,6 @@ use Thelia\Core\Event\Cart\CartEvent;
|
||||
use Thelia\Core\Event\Order\OrderAddressEvent;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Coupon\CouponManager;
|
||||
use Thelia\Exception\TheliaProcessException;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
|
||||
@@ -27,8 +27,6 @@ use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Thelia\Install\Exception\UpToDateException;
|
||||
use Thelia\Install\Update;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Class UpdateCommand
|
||||
@@ -65,7 +63,7 @@ class UpdateCommand extends ContainerAwareCommand
|
||||
'<info>Your database is updated successfully !</info>',
|
||||
''
|
||||
));
|
||||
} catch(PropelException $e) {
|
||||
} catch (PropelException $e) {
|
||||
$errorMsg = $e->getMessage();
|
||||
|
||||
$output->writeln(array(
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace Thelia\Condition;
|
||||
use ArrayAccess;
|
||||
use Countable;
|
||||
use Iterator;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Thelia\Condition\Implementation\ConditionInterface;
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,12 +23,10 @@
|
||||
|
||||
namespace Thelia\Condition;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Thelia\Condition\Implementation\ConditionInterface;
|
||||
use Thelia\Condition\Operators;
|
||||
use Thelia\Condition\ConditionCollection;
|
||||
|
||||
|
||||
/**
|
||||
* Validate Conditions
|
||||
*
|
||||
|
||||
@@ -28,7 +28,6 @@ use Thelia\Condition\Implementation\ConditionInterface;
|
||||
use Thelia\Coupon\FacadeInterface;
|
||||
use Thelia\Condition\ConditionCollection;
|
||||
|
||||
|
||||
/**
|
||||
* Manage how Condition could interact with the current application state (Thelia)
|
||||
*
|
||||
@@ -114,7 +113,6 @@ class ConditionFactory
|
||||
return $collection;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build a Condition from form
|
||||
*
|
||||
@@ -123,7 +121,7 @@ class ConditionFactory
|
||||
* @param array $values Values setting this Condition
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return ConditionInterface Ready to use Condition or false
|
||||
* @return ConditionInterface Ready to use Condition or false
|
||||
*/
|
||||
public function build($conditionServiceId, array $operators, array $values)
|
||||
{
|
||||
@@ -166,7 +164,6 @@ class ConditionFactory
|
||||
*/
|
||||
public function getInputsFromConditionInterface(ConditionInterface $condition)
|
||||
{
|
||||
|
||||
return $condition->getValidators();
|
||||
}
|
||||
}
|
||||
@@ -171,7 +171,6 @@ abstract class ConditionAbstract implements ConditionInterface
|
||||
return $serializableCondition;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if currency if valid or not
|
||||
*
|
||||
@@ -232,7 +231,7 @@ abstract class ConditionAbstract implements ConditionInterface
|
||||
$selectHtml = '';
|
||||
$optionHtml = '';
|
||||
$inputs = $this->getValidators();
|
||||
if(isset($inputs['inputs'][$inputKey])) {
|
||||
if (isset($inputs['inputs'][$inputKey])) {
|
||||
$operators = $inputs['inputs'][$inputKey]['availableOperators'];
|
||||
foreach ($operators as $key => $operator) {
|
||||
$selected = '';
|
||||
@@ -282,6 +281,7 @@ abstract class ConditionAbstract implements ConditionInterface
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
namespace Thelia\Condition\Implementation;
|
||||
|
||||
use Thelia\Condition\SerializableCondition;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Coupon\FacadeInterface;
|
||||
|
||||
/**
|
||||
@@ -41,7 +40,7 @@ interface ConditionInterface
|
||||
*
|
||||
* @param FacadeInterface $adapter Service adapter
|
||||
*/
|
||||
function __construct(FacadeInterface $adapter);
|
||||
public function __construct(FacadeInterface $adapter);
|
||||
|
||||
/**
|
||||
* Get Condition Service id
|
||||
@@ -75,7 +74,6 @@ interface ConditionInterface
|
||||
*/
|
||||
public function getAvailableOperators();
|
||||
|
||||
|
||||
/**
|
||||
* Get I18n name
|
||||
*
|
||||
|
||||
@@ -148,7 +148,6 @@ class MatchForEveryone extends ConditionAbstract
|
||||
public function drawBackOfficeInputs()
|
||||
{
|
||||
// No input
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Condition\Implementation;
|
||||
|
||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||
use Thelia\Condition\Implementation\ConditionAbstract;
|
||||
use Thelia\Condition\Operators;
|
||||
use Thelia\Exception\InvalidConditionOperatorException;
|
||||
@@ -119,10 +118,8 @@ class MatchForTotalAmount extends ConditionAbstract
|
||||
|
||||
$this->isPriceValid($priceValue);
|
||||
|
||||
|
||||
$this->isCurrencyValid($currencyValue);
|
||||
|
||||
|
||||
$this->operators = array(
|
||||
self::INPUT1 => $priceOperator,
|
||||
self::INPUT2 => $currencyOperator,
|
||||
|
||||
@@ -247,6 +247,7 @@ class MatchForXArticles extends ConditionAbstract
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
@@ -314,7 +314,6 @@ class CouponController extends BaseAdminController
|
||||
/** @var ConditionInterface $condition */
|
||||
$condition = $this->container->get($conditionId);
|
||||
|
||||
|
||||
if ($inputs === null) {
|
||||
return $this->pageNotFound();
|
||||
}
|
||||
@@ -723,6 +722,7 @@ class CouponController extends BaseAdminController
|
||||
|
||||
$args = array();
|
||||
$args['conditions'] = $this->cleanConditionForTemplate($couponManager->getConditions());
|
||||
|
||||
return $this->render('coupon/conditions', $args);
|
||||
|
||||
}
|
||||
|
||||
@@ -87,10 +87,10 @@ class CouponCreateOrUpdateEvent extends ActionEvent
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $code Coupon Code
|
||||
* @param string $serviceId Coupon Service id
|
||||
* @param string $title Coupon title
|
||||
* @param array $effects Coupon effects ready to be serialized
|
||||
* @param string $code Coupon Code
|
||||
* @param string $serviceId Coupon Service id
|
||||
* @param string $title Coupon title
|
||||
* @param array $effects Coupon effects ready to be serialized
|
||||
* 'amount' key is mandatory and reflects
|
||||
* the amount deduced from the cart
|
||||
* @param string $shortDescription Coupon short description
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
|
||||
namespace Thelia\Core\Template\Assets;
|
||||
|
||||
interface AssetManagerInterface {
|
||||
interface AssetManagerInterface
|
||||
{
|
||||
/**
|
||||
* Prepare an asset directory by checking that no changes occured in
|
||||
* the source directory. If any change is detected, the whole asset directory
|
||||
@@ -45,23 +46,23 @@ interface AssetManagerInterface {
|
||||
/**
|
||||
* Generates assets from $asset_path in $output_path, using $filters.
|
||||
*
|
||||
* @param $assetSource
|
||||
* @param $assetDirectoryBase
|
||||
* @param string $webAssetsDirectoryBase the full path to the asset file (or file collection, e.g. *.less)
|
||||
* @param $assetSource
|
||||
* @param $assetDirectoryBase
|
||||
* @param string $webAssetsDirectoryBase the full path to the asset file (or file collection, e.g. *.less)
|
||||
*
|
||||
* @param string $webAssetsTemplate the full disk path to the base assets output directory in the web space
|
||||
* @param $webAssetsKey
|
||||
* @param string $outputUrl the URL to the base assets output directory in the web space
|
||||
* @param string $webAssetsTemplate the full disk path to the base assets output directory in the web space
|
||||
* @param $webAssetsKey
|
||||
* @param string $outputUrl the URL to the base assets output directory in the web space
|
||||
*
|
||||
* @param string $assetType the asset type: css, js, ... The generated files will have this extension. Pass an empty string to use the asset source extension.
|
||||
* @param array $filters a list of filters, as defined below (see switch($filter_name) ...)
|
||||
* @param string $assetType the asset type: css, js, ... The generated files will have this extension. Pass an empty string to use the asset source extension.
|
||||
* @param array $filters a list of filters, as defined below (see switch($filter_name) ...)
|
||||
*
|
||||
* @param boolean $debug true / false
|
||||
* @param boolean $debug true / false
|
||||
*
|
||||
* @internal param string $web_assets_directory_base the full disk path to the base assets output directory in the web space
|
||||
* @internal param string $output_url the URL to the base assets output directory in the web space
|
||||
*
|
||||
* @return string The URL to the generated asset file.
|
||||
* @return string The URL to the generated asset file.
|
||||
*/
|
||||
public function processAsset($assetSource, $assetDirectoryBase, $webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey, $outputUrl, $assetType, $filters, $debug);
|
||||
}
|
||||
@@ -51,7 +51,7 @@ class AsseticAssetManager implements AssetManagerInterface
|
||||
/**
|
||||
* Create a stamp form the modification time of the content of the given directory and all of its subdirectories
|
||||
*
|
||||
* @param string $directory ther directory name
|
||||
* @param string $directory ther directory name
|
||||
* @return string the stamp of this directory
|
||||
*/
|
||||
protected function getStamp($directory)
|
||||
@@ -76,7 +76,8 @@ class AsseticAssetManager implements AssetManagerInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isSourceFile(\SplFileInfo $fileInfo) {
|
||||
protected function isSourceFile(\SplFileInfo $fileInfo)
|
||||
{
|
||||
return in_array($fileInfo->getExtension(), $this->source_file_extensions);
|
||||
}
|
||||
|
||||
@@ -84,9 +85,9 @@ class AsseticAssetManager implements AssetManagerInterface
|
||||
* Recursively copy assets from the source directory to the destination
|
||||
* directory in the web space, omitting source files.
|
||||
*
|
||||
* @param Filesystem $fs
|
||||
* @param string $from_directory the source
|
||||
* @param string $to_directory the destination
|
||||
* @param Filesystem $fs
|
||||
* @param string $from_directory the source
|
||||
* @param string $to_directory the destination
|
||||
* @throws \RuntimeException if a problem occurs.
|
||||
*/
|
||||
protected function copyAssets(Filesystem $fs, $from_directory, $to_directory)
|
||||
@@ -205,8 +206,7 @@ class AsseticAssetManager implements AssetManagerInterface
|
||||
throw new \RuntimeException(
|
||||
"Failed to create asset stamp file $stamp_file_path. Please check that your web server has the proper access rights to do that.");
|
||||
}
|
||||
/* }
|
||||
else {
|
||||
/* } else {
|
||||
@fclose($fp);
|
||||
}
|
||||
*/
|
||||
@@ -216,13 +216,13 @@ class AsseticAssetManager implements AssetManagerInterface
|
||||
/**
|
||||
* Decode the filters names, and initialize the Assetic FilterManager
|
||||
*
|
||||
* @param FilterManager $filterManager the Assetic filter manager
|
||||
* @param string $filters a comma separated list of filter names
|
||||
* @param FilterManager $filterManager the Assetic filter manager
|
||||
* @param string $filters a comma separated list of filter names
|
||||
* @throws \InvalidArgumentException if a wrong filter is passed
|
||||
* @return an array of filter names
|
||||
* @return an array of filter names
|
||||
*/
|
||||
protected function decodeAsseticFilters(FilterManager $filterManager, $filters) {
|
||||
|
||||
protected function decodeAsseticFilters(FilterManager $filterManager, $filters)
|
||||
{
|
||||
if (!empty($filters)) {
|
||||
|
||||
$filter_list = explode(',', $filters);
|
||||
@@ -261,8 +261,7 @@ class AsseticAssetManager implements AssetManagerInterface
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$filter_list = array();
|
||||
}
|
||||
|
||||
@@ -272,20 +271,20 @@ class AsseticAssetManager implements AssetManagerInterface
|
||||
/**
|
||||
* Generates assets from $asset_path in $output_path, using $filters.
|
||||
*
|
||||
* @param $assetSource
|
||||
* @param $assetDirectoryBase
|
||||
* @param string $webAssetsDirectoryBase the full path to the asset file (or file collection, e.g. *.less)
|
||||
* @param $assetSource
|
||||
* @param $assetDirectoryBase
|
||||
* @param string $webAssetsDirectoryBase the full path to the asset file (or file collection, e.g. *.less)
|
||||
*
|
||||
* @param string $webAssetsTemplate the full disk path to the base assets output directory in the web space
|
||||
* @param $webAssetsKey
|
||||
* @param string $outputUrl the URL to the base assets output directory in the web space
|
||||
* @param string $webAssetsTemplate the full disk path to the base assets output directory in the web space
|
||||
* @param $webAssetsKey
|
||||
* @param string $outputUrl the URL to the base assets output directory in the web space
|
||||
*
|
||||
* @param string $assetType the asset type: css, js, ... The generated files will have this extension. Pass an empty string to use the asset source extension.
|
||||
* @param array $filters a list of filters, as defined below (see switch($filter_name) ...)
|
||||
* @param string $assetType the asset type: css, js, ... The generated files will have this extension. Pass an empty string to use the asset source extension.
|
||||
* @param array $filters a list of filters, as defined below (see switch($filter_name) ...)
|
||||
*
|
||||
* @param boolean $debug true / false
|
||||
* @param boolean $debug true / false
|
||||
*
|
||||
* @return string The URL to the generated asset file.
|
||||
* @return string The URL to the generated asset file.
|
||||
*/
|
||||
public function processAsset($assetSource, $assetDirectoryBase, $webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey, $outputUrl, $assetType, $filters, $debug)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,6 @@ use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Model\CountryQuery;
|
||||
use Thelia\TaxEngine\TaxEngine;
|
||||
use Thelia\Type;
|
||||
|
||||
|
||||
@@ -25,8 +25,6 @@ namespace Thelia\Core\Template\Loop;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Condition\ConditionFactory;
|
||||
use Thelia\Condition\Implementation\ConditionInterface;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
@@ -35,7 +33,6 @@ use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Model\OrderCouponQuery;
|
||||
use Thelia\Model\OrderQuery;
|
||||
use Thelia\Type;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -36,7 +36,6 @@ use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Exception\TaxEngineException;
|
||||
use Thelia\Model\CategoryQuery;
|
||||
use Thelia\Model\CountryQuery;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
use Thelia\Model\Map\ProductPriceTableMap;
|
||||
use Thelia\Model\Map\ProductSaleElementsTableMap;
|
||||
|
||||
@@ -34,7 +34,6 @@ use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Exception\TaxEngineException;
|
||||
use Thelia\Model\Base\ProductSaleElementsQuery;
|
||||
use Thelia\Model\CountryQuery;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
use Thelia\Model\Map\ProductSaleElementsTableMap;
|
||||
use Thelia\TaxEngine\TaxEngine;
|
||||
|
||||
@@ -23,19 +23,12 @@
|
||||
|
||||
namespace Thelia\Core\Template\Loop;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
|
||||
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Model\ModuleQuery;
|
||||
|
||||
use Thelia\Module\BaseModule;
|
||||
use Thelia\Type;
|
||||
use Thelia\Core\Template\TemplateHelper;
|
||||
use Thelia\Core\Template\TemplateDefinition;
|
||||
@@ -72,7 +65,8 @@ class Template extends BaseLoop implements ArraySearchLoopInterface
|
||||
);
|
||||
}
|
||||
|
||||
public function buildArray() {
|
||||
public function buildArray()
|
||||
{
|
||||
$type = $this->getArg('template-type')->getValue();
|
||||
|
||||
if ($type == 'front-office')
|
||||
|
||||
@@ -43,20 +43,19 @@ interface ParserInterface
|
||||
*
|
||||
* @param unknown $templateType the template type (
|
||||
*
|
||||
* @param string $templateName the template name
|
||||
* @param string $templateDirectory path to the template dirtectory
|
||||
* @param unknown $key ???
|
||||
* @param string $unshift ??? Etienne ?
|
||||
* @param string $templateName the template name
|
||||
* @param string $templateDirectory path to the template dirtectory
|
||||
* @param unknown $key ???
|
||||
* @param string $unshift ??? Etienne ?
|
||||
*/
|
||||
public function addTemplateDirectory($templateType, $templateName, $templateDirectory, $key, $unshift = false);
|
||||
|
||||
|
||||
/**
|
||||
* Return the registeted template directories for a givent template type
|
||||
*
|
||||
* @param unknown $templateType
|
||||
* @param unknown $templateType
|
||||
* @throws InvalidArgumentException if the tempmateType is not defined
|
||||
* @return array: an array of defined templates directories for the given template type
|
||||
* @return array: an array of defined templates directories for the given template type
|
||||
*/
|
||||
public function getTemplateDirectories($templateType);
|
||||
}
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Core\Template\Smarty\Assets;
|
||||
|
||||
use Thelia\Core\Template\Assets\AsseticHelper;
|
||||
use Thelia\Core\Template\TemplateDefinition;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Core\Template\Assets\AssetManagerInterface;
|
||||
@@ -37,14 +36,14 @@ class SmartyAssetsManager
|
||||
private $web_root;
|
||||
private $path_relative_to_web_root;
|
||||
|
||||
static private $assetsDirectory = null;
|
||||
private static $assetsDirectory = null;
|
||||
|
||||
/**
|
||||
* Creates a new SmartyAssetsManager instance
|
||||
*
|
||||
* @param AssetManagerInterface $assetsManager an asset manager instance
|
||||
* @param string $web_root the disk path to the web root (with final /)
|
||||
* @param string $path_relative_to_web_root the path (relative to web root) where the assets will be generated
|
||||
* @param AssetManagerInterface $assetsManager an asset manager instance
|
||||
* @param string $web_root the disk path to the web root (with final /)
|
||||
* @param string $path_relative_to_web_root the path (relative to web root) where the assets will be generated
|
||||
*/
|
||||
public function __construct(AssetManagerInterface $assetsManager, $web_root, $path_relative_to_web_root)
|
||||
{
|
||||
@@ -67,7 +66,7 @@ class SmartyAssetsManager
|
||||
if (isset($templateDirectories[$templateDefinition->getName()])) {
|
||||
|
||||
/* create assets foreach registered directory : main @ modules */
|
||||
foreach($templateDirectories[$templateDefinition->getName()] as $key => $directory) {
|
||||
foreach ($templateDirectories[$templateDefinition->getName()] as $key => $directory) {
|
||||
|
||||
$tpl_path = $directory . DS . self::$assetsDirectory;
|
||||
|
||||
@@ -95,7 +94,7 @@ class SmartyAssetsManager
|
||||
|
||||
/* we trick here relative thinking for file attribute */
|
||||
$file = ltrim($file, '/');
|
||||
while(substr($file, 0, 3) == '../') {
|
||||
while (substr($file, 0, 3) == '../') {
|
||||
$file = substr($file, 3);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@ use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
||||
use Thelia\Core\Template\Exception\ResourceNotFoundException;
|
||||
use Thelia\Core\Template\ParserContext;
|
||||
use Thelia\Core\Template\TemplateDefinition;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Core\Template\TemplateHelper;
|
||||
use Imagine\Exception\InvalidArgumentException;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
@@ -72,7 +70,6 @@ class SmartyParser extends Smarty implements ParserInterface
|
||||
$this->setCompileDir($compile_dir);
|
||||
$this->setCacheDir($cache_dir);
|
||||
|
||||
|
||||
$this->debugging = $debug;
|
||||
|
||||
// Prevent smarty ErrorException: Notice: Undefined index bla bla bla...
|
||||
@@ -80,7 +77,7 @@ class SmartyParser extends Smarty implements ParserInterface
|
||||
|
||||
// Si on n'est pas en mode debug, activer le cache, avec une lifetime de 15mn, et en vérifiant que les templates sources n'ont pas été modifiés.
|
||||
|
||||
if($debug) {
|
||||
if ($debug) {
|
||||
$this->setCaching(Smarty::CACHING_OFF);
|
||||
$this->setForceCompile(true);
|
||||
} else {
|
||||
@@ -89,7 +86,6 @@ class SmartyParser extends Smarty implements ParserInterface
|
||||
|
||||
//$this->enableSecurity();
|
||||
|
||||
|
||||
// The default HTTP status
|
||||
$this->status = 200;
|
||||
|
||||
@@ -100,15 +96,15 @@ class SmartyParser extends Smarty implements ParserInterface
|
||||
/**
|
||||
* Add a template directory to the current template list
|
||||
*
|
||||
* @param unknown $templateType the template type (a TemplateDefinition type constant)
|
||||
* @param string $templateName the template name
|
||||
* @param string $templateDirectory path to the template dirtectory
|
||||
* @param unknown $key ???
|
||||
* @param string $unshift ??? Etienne ?
|
||||
* @param unknown $templateType the template type (a TemplateDefinition type constant)
|
||||
* @param string $templateName the template name
|
||||
* @param string $templateDirectory path to the template dirtectory
|
||||
* @param unknown $key ???
|
||||
* @param string $unshift ??? Etienne ?
|
||||
*/
|
||||
public function addTemplateDirectory($templateType, $templateName, $templateDirectory, $key, $unshift = false) {
|
||||
|
||||
if(true === $unshift && isset($this->templateDirectories[$templateType][$templateName])) {
|
||||
public function addTemplateDirectory($templateType, $templateName, $templateDirectory, $key, $unshift = false)
|
||||
{
|
||||
if (true === $unshift && isset($this->templateDirectories[$templateType][$templateName])) {
|
||||
|
||||
$this->templateDirectories[$templateType][$templateName] = array_merge(
|
||||
array(
|
||||
@@ -124,7 +120,7 @@ class SmartyParser extends Smarty implements ParserInterface
|
||||
/**
|
||||
* Return the registeted template directories for a givent template type
|
||||
*
|
||||
* @param unknown $templateType
|
||||
* @param unknown $templateType
|
||||
* @throws InvalidArgumentException
|
||||
* @return multitype:
|
||||
*/
|
||||
@@ -176,7 +172,7 @@ class SmartyParser extends Smarty implements ParserInterface
|
||||
|
||||
/* do not pass array directly to addTemplateDir since we cant control on keys */
|
||||
if (isset($this->templateDirectories[$templateDefinition->getType()][$templateDefinition->getName()])) {
|
||||
foreach($this->templateDirectories[$templateDefinition->getType()][$templateDefinition->getName()] as $key => $directory) {
|
||||
foreach ($this->templateDirectories[$templateDefinition->getType()][$templateDefinition->getName()] as $key => $directory) {
|
||||
$this->addTemplateDir($directory, $key);
|
||||
}
|
||||
}
|
||||
@@ -194,9 +190,9 @@ class SmartyParser extends Smarty implements ParserInterface
|
||||
/**
|
||||
* Return a rendered template, either from file or ftom a string
|
||||
*
|
||||
* @param string $resourceType either 'string' (rendering from a string) or 'file' (rendering a file)
|
||||
* @param string $resourceType either 'string' (rendering from a string) or 'file' (rendering a file)
|
||||
* @param string $resourceContent the resource content (a text, or a template file name)
|
||||
* @param array $parameters an associative array of names / value pairs
|
||||
* @param array $parameters an associative array of names / value pairs
|
||||
*
|
||||
* @return string the rendered template text
|
||||
*/
|
||||
@@ -215,8 +211,8 @@ class SmartyParser extends Smarty implements ParserInterface
|
||||
/**
|
||||
* Return a rendered template file
|
||||
*
|
||||
* @param string $realTemplateName the template name (from the template directory)
|
||||
* @param array $parameters an associative array of names / value pairs
|
||||
* @param string $realTemplateName the template name (from the template directory)
|
||||
* @param array $parameters an associative array of names / value pairs
|
||||
* @return string the rendered template text
|
||||
*/
|
||||
public function render($realTemplateName, array $parameters = array())
|
||||
@@ -231,8 +227,8 @@ class SmartyParser extends Smarty implements ParserInterface
|
||||
/**
|
||||
* Return a rendered template text
|
||||
*
|
||||
* @param string $templateText the template text
|
||||
* @param array $parameters an associative array of names / value pairs
|
||||
* @param string $templateText the template text
|
||||
* @param array $parameters an associative array of names / value pairs
|
||||
* @return string the rendered template text
|
||||
*/
|
||||
public function renderString($templateText, array $parameters = array())
|
||||
|
||||
@@ -57,13 +57,12 @@ class TemplateDefinition
|
||||
*/
|
||||
protected $type;
|
||||
|
||||
|
||||
public function __construct($name, $type)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->type = $type;
|
||||
|
||||
switch($type) {
|
||||
switch ($type) {
|
||||
case TemplateDefinition::FRONT_OFFICE:
|
||||
$this->path = self::FRONT_OFFICE_SUBDIR . $name;
|
||||
break;
|
||||
@@ -90,14 +89,17 @@ class TemplateDefinition
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getI18nPath() {
|
||||
public function getI18nPath()
|
||||
{
|
||||
return $this->getPath() . DS . 'I18n';
|
||||
}
|
||||
|
||||
public function getAbsoluteI18nPath() {
|
||||
public function getAbsoluteI18nPath()
|
||||
{
|
||||
return THELIA_TEMPLATE_DIR . $this->getI18nPath();
|
||||
}
|
||||
|
||||
@@ -106,7 +108,8 @@ class TemplateDefinition
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
public function getAbsolutePath() {
|
||||
public function getAbsolutePath()
|
||||
{
|
||||
return THELIA_TEMPLATE_DIR . $this->getPath();
|
||||
}
|
||||
|
||||
@@ -115,13 +118,15 @@ class TemplateDefinition
|
||||
return $this->getPath() . DS . 'configs';
|
||||
}
|
||||
|
||||
public function getAbsoluteConfigPath() {
|
||||
public function getAbsoluteConfigPath()
|
||||
{
|
||||
return THELIA_TEMPLATE_DIR . $this->getConfigPath();
|
||||
}
|
||||
|
||||
public function setPath($path)
|
||||
{
|
||||
$this->path = $path;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -133,13 +138,15 @@ class TemplateDefinition
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator on the standard templates subdir names
|
||||
*/
|
||||
public static function getStandardTemplatesSubdirsIterator() {
|
||||
public static function getStandardTemplatesSubdirsIterator()
|
||||
{
|
||||
return new \ArrayIterator(self::$standardTemplatesSubdirs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,8 @@ class TemplateHelper
|
||||
/**
|
||||
* Returns an array which contains all standard template definitions
|
||||
*/
|
||||
public function getStandardTemplateDefinitions() {
|
||||
public function getStandardTemplateDefinitions()
|
||||
{
|
||||
return array(
|
||||
$this->getActiveFrontTemplate(),
|
||||
$this->getActiveAdminTemplate(),
|
||||
@@ -105,16 +106,16 @@ class TemplateHelper
|
||||
/**
|
||||
* Return a list of existing templates for a given template type
|
||||
*
|
||||
* @param int $templateType the template type
|
||||
* @return An array of \Thelia\Core\Template\TemplateDefinition
|
||||
* @param int $templateType the template type
|
||||
* @return An array of \Thelia\Core\Template\TemplateDefinition
|
||||
*/
|
||||
public function getList($templateType) {
|
||||
|
||||
public function getList($templateType)
|
||||
{
|
||||
$list = $exclude = array();
|
||||
|
||||
$tplIterator = TemplateDefinition::getStandardTemplatesSubdirsIterator();
|
||||
|
||||
foreach($tplIterator as $type => $subdir) {
|
||||
foreach ($tplIterator as $type => $subdir) {
|
||||
|
||||
if ($templateType == $type) {
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ use Thelia\Config\DefinePropel;
|
||||
use Thelia\Core\Template\TemplateDefinition;
|
||||
use Thelia\Core\TheliaContainerBuilder;
|
||||
use Thelia\Core\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
|
||||
use Propel\Runtime\Propel;
|
||||
@@ -110,12 +109,13 @@ class Thelia extends Kernel
|
||||
* Add all module's standard templates to the parser environment
|
||||
*
|
||||
* @param TheliaParser $parser the parser
|
||||
* @param Module $module the Module.
|
||||
* @param Module $module the Module.
|
||||
*/
|
||||
protected function addStandardModuleTemplatesToParserEnvironment($parser, $module) {
|
||||
protected function addStandardModuleTemplatesToParserEnvironment($parser, $module)
|
||||
{
|
||||
$stdTpls = TemplateDefinition::getStandardTemplatesSubdirsIterator();
|
||||
|
||||
foreach($stdTpls as $templateType => $templateSubdirName) {
|
||||
foreach ($stdTpls as $templateType => $templateSubdirName) {
|
||||
$this->addModuleTemplateToParserEnvironment($parser, $module, $templateType, $templateSubdirName);
|
||||
}
|
||||
}
|
||||
@@ -123,13 +123,13 @@ class Thelia extends Kernel
|
||||
/**
|
||||
* Add a module template directory to the parser environment
|
||||
*
|
||||
* @param TheliaParser $parser the parser
|
||||
* @param Module $module the Module.
|
||||
* @param string $templateType the template type (one of the TemplateDefinition type constants)
|
||||
* @param string $templateSubdirName the template subdirectory name (one of the TemplateDefinition::XXX_SUBDIR constants)
|
||||
* @param TheliaParser $parser the parser
|
||||
* @param Module $module the Module.
|
||||
* @param string $templateType the template type (one of the TemplateDefinition type constants)
|
||||
* @param string $templateSubdirName the template subdirectory name (one of the TemplateDefinition::XXX_SUBDIR constants)
|
||||
*/
|
||||
protected function addModuleTemplateToParserEnvironment($parser, $module, $templateType, $templateSubdirName) {
|
||||
|
||||
protected function addModuleTemplateToParserEnvironment($parser, $module, $templateType, $templateSubdirName)
|
||||
{
|
||||
// Get template path
|
||||
$templateDirectory = $module->getAbsoluteTemplateDirectoryPath($templateSubdirName);
|
||||
|
||||
@@ -155,8 +155,7 @@ class Thelia extends Kernel
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (\UnexpectedValueException $ex) {
|
||||
} catch (\UnexpectedValueException $ex) {
|
||||
// The directory does not exists, ignore it.
|
||||
}
|
||||
}
|
||||
@@ -176,7 +175,7 @@ class Thelia extends Kernel
|
||||
->depth(0)
|
||||
->in(THELIA_ROOT . "/core/lib/Thelia/Config/Resources");
|
||||
|
||||
foreach($finder as $file) {
|
||||
foreach ($finder as $file) {
|
||||
$loader->load($file->getBaseName());
|
||||
}
|
||||
|
||||
@@ -219,7 +218,7 @@ class Thelia extends Kernel
|
||||
// Standard templates (front, back, pdf, mail)
|
||||
$th = TemplateHelper::getInstance();
|
||||
|
||||
foreach($th->getStandardTemplateDefinitions() as $templateDefinition) {
|
||||
foreach ($th->getStandardTemplateDefinitions() as $templateDefinition) {
|
||||
if (is_dir($dir = $templateDefinition->getAbsoluteI18nPath())) {
|
||||
$translationDirs[] = $dir;
|
||||
}
|
||||
|
||||
@@ -57,9 +57,9 @@ class BaseFacade implements FacadeInterface
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param ContainerInterface $container Service container
|
||||
* @param ContainerInterface $container Service container
|
||||
*/
|
||||
function __construct(ContainerInterface $container)
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
@@ -135,7 +135,6 @@ class BaseFacade implements FacadeInterface
|
||||
return $this->getRequest()->getSession()->getCurrency()->getCode();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the number of Products in the Cart
|
||||
*
|
||||
@@ -202,7 +201,6 @@ class BaseFacade implements FacadeInterface
|
||||
return $this->container->get('thelia.translator');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the main currency
|
||||
* THe one used to set prices in BackOffice
|
||||
@@ -234,7 +232,6 @@ class BaseFacade implements FacadeInterface
|
||||
return $this->container->get('thelia.condition.validator');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return all available currencies
|
||||
*
|
||||
|
||||
@@ -63,7 +63,7 @@ class CouponFactory
|
||||
*
|
||||
* @throws \Thelia\Exception\CouponExpiredException
|
||||
* @throws \Thelia\Exception\InvalidConditionException
|
||||
* @return CouponInterface ready to be processed
|
||||
* @return CouponInterface ready to be processed
|
||||
*/
|
||||
public function buildCouponFromCode($couponCode)
|
||||
{
|
||||
@@ -132,6 +132,4 @@ class CouponFactory
|
||||
return clone $couponManager;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -60,7 +60,6 @@ class CouponManager
|
||||
$this->facade = $container->get('thelia.facade');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Discount for the given Coupons
|
||||
*
|
||||
@@ -241,7 +240,7 @@ class CouponManager
|
||||
$ret = $usageLeft;
|
||||
}
|
||||
|
||||
} catch(\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$ret = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@ interface FacadeInterface
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param ContainerInterface $container Service container
|
||||
* @param ContainerInterface $container Service container
|
||||
*/
|
||||
function __construct(ContainerInterface $container);
|
||||
public function __construct(ContainerInterface $container);
|
||||
|
||||
/**
|
||||
* Return a Cart a CouponManager can process
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Coupon\Type;
|
||||
|
||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||
use Thelia\Condition\ConditionEvaluator;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Coupon\FacadeInterface;
|
||||
@@ -62,7 +61,6 @@ abstract class CouponAbstract implements CouponInterface
|
||||
/** @var ConditionEvaluator Condition validator */
|
||||
protected $conditionEvaluator = null;
|
||||
|
||||
|
||||
/** @var string Service Id */
|
||||
protected $serviceId = null;
|
||||
|
||||
@@ -75,8 +73,6 @@ abstract class CouponAbstract implements CouponInterface
|
||||
/** @var string Coupon code (ex: XMAS) */
|
||||
protected $code = null;
|
||||
|
||||
|
||||
|
||||
/** @var string Coupon title (ex: Coupon for XMAS) */
|
||||
protected $title = null;
|
||||
|
||||
@@ -86,8 +82,6 @@ abstract class CouponAbstract implements CouponInterface
|
||||
/** @var string Coupon description */
|
||||
protected $description = null;
|
||||
|
||||
|
||||
|
||||
/** @var bool if Coupon is enabled */
|
||||
protected $isEnabled = false;
|
||||
|
||||
@@ -106,7 +100,6 @@ abstract class CouponAbstract implements CouponInterface
|
||||
/** @var bool if Coupon is available for Products already on special offers */
|
||||
protected $isAvailableOnSpecialOffers = false;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -146,9 +139,9 @@ abstract class CouponAbstract implements CouponInterface
|
||||
* @param bool $isRemovingPostage If Coupon is removing postage
|
||||
* @param bool $isAvailableOnSpecialOffers If available on Product already
|
||||
* on special offer price
|
||||
* @param bool $isEnabled False if Coupon is disabled by admin
|
||||
* @param int $maxUsage How many usage left
|
||||
* @param \Datetime $expirationDate When the Code is expiring
|
||||
* @param bool $isEnabled False if Coupon is disabled by admin
|
||||
* @param int $maxUsage How many usage left
|
||||
* @param \Datetime $expirationDate When the Code is expiring
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
@@ -355,7 +348,6 @@ abstract class CouponAbstract implements CouponInterface
|
||||
return $this->serviceId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the current state of the application is matching this Coupon conditions
|
||||
* Thelia variables are given by the FacadeInterface
|
||||
@@ -398,5 +390,4 @@ abstract class CouponAbstract implements CouponInterface
|
||||
return $this->extendedInputs;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -76,9 +76,9 @@ interface CouponInterface
|
||||
* @param bool $isRemovingPostage If Coupon is removing postage
|
||||
* @param bool $isAvailableOnSpecialOffers If available on Product already
|
||||
* on special offer price
|
||||
* @param bool $isEnabled False if Coupon is disabled by admin
|
||||
* @param int $maxUsage How many usage left
|
||||
* @param \Datetime $expirationDate When the Code is expiring
|
||||
* @param bool $isEnabled False if Coupon is disabled by admin
|
||||
* @param int $maxUsage How many usage left
|
||||
* @param \Datetime $expirationDate When the Code is expiring
|
||||
*/
|
||||
public function set(
|
||||
FacadeInterface $facade,
|
||||
@@ -138,8 +138,6 @@ interface CouponInterface
|
||||
*/
|
||||
public function isRemovingPostage();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return condition to validate the Coupon or not
|
||||
*
|
||||
@@ -173,7 +171,6 @@ interface CouponInterface
|
||||
*/
|
||||
public function isAvailableOnSpecialOffers();
|
||||
|
||||
|
||||
/**
|
||||
* Check if Coupon has been disabled by admin
|
||||
*
|
||||
@@ -196,7 +193,6 @@ interface CouponInterface
|
||||
*/
|
||||
public function isExpired();
|
||||
|
||||
|
||||
/**
|
||||
* Return effects generated by the coupon
|
||||
* A positive value
|
||||
|
||||
@@ -60,9 +60,9 @@ class RemoveXPercent extends CouponAbstract
|
||||
* @param bool $isRemovingPostage If Coupon is removing postage
|
||||
* @param bool $isAvailableOnSpecialOffers If available on Product already
|
||||
* on special offer price
|
||||
* @param bool $isEnabled False if Coupon is disabled by admin
|
||||
* @param int $maxUsage How many usage left
|
||||
* @param \Datetime $expirationDate When the Code is expiring
|
||||
* @param bool $isEnabled False if Coupon is disabled by admin
|
||||
* @param int $maxUsage How many usage left
|
||||
* @param \Datetime $expirationDate When the Code is expiring
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
@@ -110,7 +110,6 @@ class RemoveXPercent extends CouponAbstract
|
||||
return $basePrice * (( $this->percentage ) / 100);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get I18n name
|
||||
*
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Model\ProfileQuery;
|
||||
|
||||
@@ -53,7 +53,6 @@ abstract class BaseInstall
|
||||
throw new AlreadyInstallException("Thelia is already installed");
|
||||
}
|
||||
|
||||
|
||||
$this->exec();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,12 +24,8 @@
|
||||
namespace Thelia\Install;
|
||||
|
||||
use PDO;
|
||||
use RecursiveDirectoryIterator;
|
||||
use RecursiveIteratorIterator;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Install\Exception\InstallException;
|
||||
|
||||
|
||||
/**
|
||||
* Class CheckDatabaseConnection
|
||||
|
||||
@@ -28,7 +28,6 @@ use RecursiveIteratorIterator;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
|
||||
/**
|
||||
* Class CheckPermission
|
||||
*
|
||||
@@ -164,9 +163,6 @@ class CheckPermission extends BaseInstall
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return $this->isValid;
|
||||
}
|
||||
|
||||
@@ -200,7 +196,6 @@ class CheckPermission extends BaseInstall
|
||||
return (is_writable(THELIA_ROOT . $directory) === true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Translated text about the directory state
|
||||
*
|
||||
@@ -269,7 +264,6 @@ class CheckPermission extends BaseInstall
|
||||
return $translatedText;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Translated text about the directory state
|
||||
* Not usable with CLI
|
||||
@@ -382,7 +376,7 @@ class CheckPermission extends BaseInstall
|
||||
{
|
||||
$serverValueInBytes = $this->returnBytes(ini_get($key));
|
||||
|
||||
if($serverValueInBytes == -1) {
|
||||
if ($serverValueInBytes == -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -400,7 +394,7 @@ class CheckPermission extends BaseInstall
|
||||
{
|
||||
$val = trim($val);
|
||||
$last = strtolower($val[strlen($val)-1]);
|
||||
switch($last) {
|
||||
switch ($last) {
|
||||
// The 'G' modifier is available since PHP 5.1.0
|
||||
case 'g':
|
||||
$val *= 1024;
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Install;
|
||||
|
||||
|
||||
/**
|
||||
* Class Database
|
||||
* @package Thelia\Install
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Install\Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Class AlreadyInstallException
|
||||
* @package Thelia\Install\Exception
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Install\Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Class UpToDateException
|
||||
* @package Thelia\Install\Exception
|
||||
|
||||
@@ -29,7 +29,6 @@ use Thelia\Log\Tlog;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\Map\ProductTableMap;
|
||||
|
||||
|
||||
/**
|
||||
* Class Update
|
||||
* @package Thelia\Install
|
||||
@@ -61,7 +60,7 @@ class Update
|
||||
|
||||
$currentVersion = ConfigQuery::read('thelia_version');
|
||||
$logger->debug("start update process");
|
||||
if(true === $this->isLatestVersion($currentVersion)) {
|
||||
if (true === $this->isLatestVersion($currentVersion)) {
|
||||
$logger->debug("You already have the latest version. No update available");
|
||||
throw new UpToDateException('You already have the latest version. No update available');
|
||||
}
|
||||
@@ -78,7 +77,7 @@ class Update
|
||||
}
|
||||
$con->commit();
|
||||
$logger->debug('update successfully');
|
||||
} catch(PropelException $e) {
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
$logger->error(sprintf('error during update process with message : %s', $e->getMessage()));
|
||||
throw $e;
|
||||
|
||||
@@ -27,13 +27,13 @@ use Thelia\Core\Event\MailTransporterEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Class MailerFactory
|
||||
* @package Thelia\Mailer
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class MailerFactory {
|
||||
class MailerFactory
|
||||
{
|
||||
/**
|
||||
* @var \Swift_Mailer
|
||||
*/
|
||||
@@ -49,7 +49,7 @@ class MailerFactory {
|
||||
$transporterEvent = new MailTransporterEvent();
|
||||
$this->dispatcher->dispatch(TheliaEvents::MAILTRANSPORTER_CONFIG, $transporterEvent);
|
||||
|
||||
if($transporterEvent->hasTransporter()) {
|
||||
if ($transporterEvent->hasTransporter()) {
|
||||
$transporter = $transporterEvent->getTransporter();
|
||||
} else {
|
||||
if (ConfigQuery::isSmtpEnable()) {
|
||||
@@ -74,6 +74,7 @@ class MailerFactory {
|
||||
->setTimeout(ConfigQuery::getSmtpTimeout())
|
||||
->setSourceIp(ConfigQuery::getSmtpSourceIp())
|
||||
;
|
||||
|
||||
return $smtpTransporter;
|
||||
}
|
||||
|
||||
@@ -87,5 +88,4 @@ class MailerFactory {
|
||||
return $this->swiftMailer;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -22,12 +22,8 @@
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Rewriting;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\Join;
|
||||
use Thelia\Exception\RewritingUrlException;
|
||||
use Thelia\Exception\UrlRewritingException;
|
||||
use Thelia\Model\RewritingUrlQuery;
|
||||
use Thelia\Model\Map\RewritingUrlTableMap;
|
||||
|
||||
/**
|
||||
* Class RewritingResolver
|
||||
@@ -51,7 +47,7 @@ class RewritingResolver
|
||||
{
|
||||
$this->rewritingUrlQuery = new RewritingUrlQuery();
|
||||
|
||||
if($url !== null) {
|
||||
if ($url !== null) {
|
||||
$this->load($url);
|
||||
}
|
||||
}
|
||||
@@ -62,7 +58,7 @@ class RewritingResolver
|
||||
$rewrittenUrl = urldecode($rewrittenUrl);
|
||||
$this->search = $this->rewritingUrlQuery->getResolverSearch($rewrittenUrl);
|
||||
|
||||
if($this->search->count() == 0) {
|
||||
if ($this->search->count() == 0) {
|
||||
throw new UrlRewritingException('URL NOT FOUND', UrlRewritingException::URL_NOT_FOUND);
|
||||
}
|
||||
|
||||
@@ -76,16 +72,16 @@ class RewritingResolver
|
||||
|
||||
protected function getOtherParameters()
|
||||
{
|
||||
if($this->search === null) {
|
||||
if ($this->search === null) {
|
||||
throw new UrlRewritingException('RESOLVER NULL SEARCH', UrlRewritingException::RESOLVER_NULL_SEARCH);
|
||||
}
|
||||
|
||||
$otherParameters = array();
|
||||
foreach($this->search as $result) {
|
||||
foreach ($this->search as $result) {
|
||||
$parameter = $result->getParameter();
|
||||
$value = $result->getValue();
|
||||
|
||||
if(null !== $parameter) {
|
||||
if (null !== $parameter) {
|
||||
$otherParameters[$parameter] = $value;
|
||||
}
|
||||
}
|
||||
@@ -93,5 +89,4 @@ class RewritingResolver
|
||||
return $otherParameters;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -22,9 +22,7 @@
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Rewriting;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Model\RewritingUrlQuery;
|
||||
use Thelia\Model\Map\RewritingUrlTableMap;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
/**
|
||||
@@ -46,7 +44,7 @@ class RewritingRetriever
|
||||
{
|
||||
$this->rewritingUrlQuery = new RewritingUrlQuery();
|
||||
|
||||
if($view !== null && $viewLocale !== null) {
|
||||
if ($view !== null && $viewLocale !== null) {
|
||||
$this->load($view, $viewLocale, $viewId);
|
||||
}
|
||||
}
|
||||
@@ -61,16 +59,16 @@ class RewritingRetriever
|
||||
$this->search = $this->rewritingUrlQuery->getViewUrlQuery($view, $viewLocale, $viewId);
|
||||
|
||||
$allParametersWithoutView = array();
|
||||
if(null !== $viewId) {
|
||||
if (null !== $viewId) {
|
||||
$allParametersWithoutView['locale'] = $viewLocale;
|
||||
}
|
||||
if(null !== $viewId) {
|
||||
if (null !== $viewId) {
|
||||
$allParametersWithoutView[$view . '_id'] = $viewId;
|
||||
}
|
||||
|
||||
$this->rewrittenUrl = null;
|
||||
$this->url = URL::getInstance()->viewUrl($view, $allParametersWithoutView);
|
||||
if($this->search !== null) {
|
||||
if ($this->search !== null) {
|
||||
$this->rewrittenUrl = URL::getInstance()->absoluteUrl(
|
||||
$this->search->getUrl()
|
||||
);
|
||||
@@ -85,8 +83,9 @@ class RewritingRetriever
|
||||
*/
|
||||
public function loadSpecificUrl($view, $viewLocale, $viewId = null, $viewOtherParameters = array())
|
||||
{
|
||||
if(empty($viewOtherParameters)) {
|
||||
if (empty($viewOtherParameters)) {
|
||||
$this->loadViewUrl($view, $viewLocale, $viewId);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -94,13 +93,13 @@ class RewritingRetriever
|
||||
|
||||
$allParametersWithoutView = $viewOtherParameters;
|
||||
$allParametersWithoutView['locale'] = $viewLocale;
|
||||
if(null !== $viewId) {
|
||||
if (null !== $viewId) {
|
||||
$allParametersWithoutView[$view . '_id'] = $viewId;
|
||||
}
|
||||
|
||||
$this->rewrittenUrl = null;
|
||||
$this->url = URL::getInstance()->viewUrl($view, $allParametersWithoutView);
|
||||
if($this->search !== null) {
|
||||
if ($this->search !== null) {
|
||||
$this->rewrittenUrl = $this->search->getUrl();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,10 +61,10 @@ class Calculator
|
||||
$this->country = null;
|
||||
$this->taxRulesCollection = null;
|
||||
|
||||
if($product->getId() === null) {
|
||||
if ($product->getId() === null) {
|
||||
throw new TaxEngineException('Product id is empty in Calculator::load', TaxEngineException::UNDEFINED_PRODUCT);
|
||||
}
|
||||
if($country->getId() === null) {
|
||||
if ($country->getId() === null) {
|
||||
throw new TaxEngineException('Country id is empty in Calculator::load', TaxEngineException::UNDEFINED_COUNTRY);
|
||||
}
|
||||
|
||||
@@ -82,13 +82,13 @@ class Calculator
|
||||
$this->country = null;
|
||||
$this->taxRulesCollection = null;
|
||||
|
||||
if($taxRule->getId() === null) {
|
||||
if ($taxRule->getId() === null) {
|
||||
throw new TaxEngineException('TaxRule id is empty in Calculator::loadTaxRule', TaxEngineException::UNDEFINED_TAX_RULE);
|
||||
}
|
||||
if($country->getId() === null) {
|
||||
if ($country->getId() === null) {
|
||||
throw new TaxEngineException('Country id is empty in Calculator::loadTaxRule', TaxEngineException::UNDEFINED_COUNTRY);
|
||||
}
|
||||
if($product->getId() === null) {
|
||||
if ($product->getId() === null) {
|
||||
throw new TaxEngineException('Product id is empty in Calculator::load', TaxEngineException::UNDEFINED_PRODUCT);
|
||||
}
|
||||
|
||||
@@ -120,15 +120,15 @@ class Calculator
|
||||
*/
|
||||
public function getTaxedPrice($untaxedPrice, &$taxCollection = null, $askedLocale = null)
|
||||
{
|
||||
if(null === $this->taxRulesCollection) {
|
||||
if (null === $this->taxRulesCollection) {
|
||||
throw new TaxEngineException('Tax rules collection is empty in Calculator::getTaxedPrice', TaxEngineException::UNDEFINED_TAX_RULES_COLLECTION);
|
||||
}
|
||||
|
||||
if(null === $this->product) {
|
||||
if (null === $this->product) {
|
||||
throw new TaxEngineException('Product is empty in Calculator::getTaxedPrice', TaxEngineException::UNDEFINED_PRODUCT);
|
||||
}
|
||||
|
||||
if(false === filter_var($untaxedPrice, FILTER_VALIDATE_FLOAT)) {
|
||||
if (false === filter_var($untaxedPrice, FILTER_VALIDATE_FLOAT)) {
|
||||
throw new TaxEngineException('BAD AMOUNT FORMAT', TaxEngineException::BAD_AMOUNT_FORMAT);
|
||||
}
|
||||
|
||||
@@ -136,16 +136,16 @@ class Calculator
|
||||
$currentPosition = 1;
|
||||
$currentTax = 0;
|
||||
|
||||
if(null !== $taxCollection) {
|
||||
if (null !== $taxCollection) {
|
||||
$taxCollection = new OrderProductTaxCollection();
|
||||
}
|
||||
foreach($this->taxRulesCollection as $taxRule) {
|
||||
$position = (int)$taxRule->getTaxRuleCountryPosition();
|
||||
foreach ($this->taxRulesCollection as $taxRule) {
|
||||
$position = (int) $taxRule->getTaxRuleCountryPosition();
|
||||
|
||||
$taxType = $taxRule->getTypeInstance();
|
||||
$taxType->loadRequirements( $taxRule->getRequirements() );
|
||||
|
||||
if($currentPosition !== $position) {
|
||||
if ($currentPosition !== $position) {
|
||||
$taxedPrice += $currentTax;
|
||||
$currentTax = 0;
|
||||
$currentPosition = $position;
|
||||
@@ -154,7 +154,7 @@ class Calculator
|
||||
$taxAmount = round($taxType->calculate($this->product, $taxedPrice), 2);
|
||||
$currentTax += $taxAmount;
|
||||
|
||||
if(null !== $taxCollection) {
|
||||
if (null !== $taxCollection) {
|
||||
$taxI18n = I18n::forceI18nRetrieving($askedLocale, 'Tax', $taxRule->getId());
|
||||
$orderProductTax = new OrderProductTax();
|
||||
$orderProductTax->setTitle($taxI18n->getTitle());
|
||||
@@ -171,36 +171,36 @@ class Calculator
|
||||
|
||||
public function getUntaxedPrice($taxedPrice)
|
||||
{
|
||||
if(null === $this->taxRulesCollection) {
|
||||
if (null === $this->taxRulesCollection) {
|
||||
throw new TaxEngineException('Tax rules collection is empty in Calculator::getTaxAmount', TaxEngineException::UNDEFINED_TAX_RULES_COLLECTION);
|
||||
}
|
||||
|
||||
if(null === $this->product) {
|
||||
if (null === $this->product) {
|
||||
throw new TaxEngineException('Product is empty in Calculator::getTaxedPrice', TaxEngineException::UNDEFINED_PRODUCT);
|
||||
}
|
||||
|
||||
if(false === filter_var($taxedPrice, FILTER_VALIDATE_FLOAT)) {
|
||||
if (false === filter_var($taxedPrice, FILTER_VALIDATE_FLOAT)) {
|
||||
throw new TaxEngineException('BAD AMOUNT FORMAT', TaxEngineException::BAD_AMOUNT_FORMAT);
|
||||
}
|
||||
|
||||
$taxRule = $this->taxRulesCollection->getLast();
|
||||
|
||||
if(null === $taxRule) {
|
||||
if (null === $taxRule) {
|
||||
throw new TaxEngineException('Tax rules collection got no tax ', TaxEngineException::NO_TAX_IN_TAX_RULES_COLLECTION);
|
||||
}
|
||||
|
||||
$untaxedPrice = $taxedPrice;
|
||||
$currentPosition = (int)$taxRule->getTaxRuleCountryPosition();
|
||||
$currentPosition = (int) $taxRule->getTaxRuleCountryPosition();
|
||||
$currentFixTax = 0;
|
||||
$currentTaxFactor = 0;
|
||||
|
||||
do {
|
||||
$position = (int)$taxRule->getTaxRuleCountryPosition();
|
||||
$position = (int) $taxRule->getTaxRuleCountryPosition();
|
||||
|
||||
$taxType = $taxRule->getTypeInstance();
|
||||
$taxType->loadRequirements( $taxRule->getRequirements() );
|
||||
|
||||
if($currentPosition !== $position) {
|
||||
if ($currentPosition !== $position) {
|
||||
$untaxedPrice -= $currentFixTax;
|
||||
$untaxedPrice = $untaxedPrice / (1+$currentTaxFactor);
|
||||
$currentFixTax = 0;
|
||||
@@ -211,8 +211,7 @@ class Calculator
|
||||
$currentFixTax += $taxType->fixAmountRetriever($this->product);
|
||||
$currentTaxFactor += $taxType->pricePercentRetriever();
|
||||
|
||||
|
||||
} while($taxRule = $this->taxRulesCollection->getPrevious());
|
||||
} while ($taxRule = $this->taxRulesCollection->getPrevious());
|
||||
|
||||
$untaxedPrice -= $currentFixTax;
|
||||
$untaxedPrice = $untaxedPrice / (1+$currentTaxFactor);
|
||||
@@ -224,7 +223,7 @@ class Calculator
|
||||
|
||||
$untaxedPrice -= $taxType->fixAmountRetriever();
|
||||
|
||||
} while($taxRule = $this->taxRulesCollection->getPrevious());
|
||||
} while ($taxRule = $this->taxRulesCollection->getPrevious());
|
||||
|
||||
$taxRule = $this->taxRulesCollection->getLast();
|
||||
|
||||
@@ -238,7 +237,7 @@ class Calculator
|
||||
|
||||
$toto = true;
|
||||
|
||||
} while($taxRule = $this->taxRulesCollection->getPrevious());
|
||||
} while ($taxRule = $this->taxRulesCollection->getPrevious());
|
||||
|
||||
$untaxedPrice = $untaxedPrice / (1+$currentTaxFactor);*/
|
||||
|
||||
|
||||
@@ -42,13 +42,13 @@ class TaxEngine
|
||||
*/
|
||||
protected $session = null;
|
||||
|
||||
static public function getInstance(Session $session = null)
|
||||
public static function getInstance(Session $session = null)
|
||||
{
|
||||
if(null === self::$instance) {
|
||||
if (null === self::$instance) {
|
||||
self::$instance = new TaxEngine();
|
||||
}
|
||||
|
||||
if(null !== self::$instance) {
|
||||
if (null !== self::$instance) {
|
||||
self::$instance->setSession($session);
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class TaxEngine
|
||||
$fileName = $directoryContent->getFilename();
|
||||
$className = substr($fileName, 0, (1+strlen($directoryContent->getExtension())) * -1);
|
||||
|
||||
if($className == "BaseTaxType") {
|
||||
if ($className == "BaseTaxType") {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -101,14 +101,14 @@ class TaxEngine
|
||||
* Then look at the current customer default address country
|
||||
* Else look at the default website country
|
||||
*
|
||||
* @param bool $force result is static cached ; even if a below parameter change between 2 calls, we need to keep coherent results. but you can force it.
|
||||
* @param bool $force result is static cached ; even if a below parameter change between 2 calls, we need to keep coherent results. but you can force it.
|
||||
* @return null|TaxEngine
|
||||
*/
|
||||
public function getDeliveryCountry($force = false)
|
||||
{
|
||||
if(false === $force || null === self::$taxCountry) {
|
||||
if (false === $force || null === self::$taxCountry) {
|
||||
/* is there a logged in customer ? */
|
||||
if(null !== $customer = $this->session->getCustomerUser()) {
|
||||
if (null !== $customer = $this->session->getCustomerUser()) {
|
||||
if (null !== $this->session->getOrder()
|
||||
&& null !== $this->session->getOrder()->chosenDeliveryAddress
|
||||
&& null !== $currentDeliveryAddress = AddressQuery::create()->findPk($this->session->getOrder()->chosenDeliveryAddress)) {
|
||||
|
||||
@@ -35,13 +35,13 @@ abstract class BaseTaxType
|
||||
{
|
||||
protected $requirements = null;
|
||||
|
||||
public abstract function pricePercentRetriever();
|
||||
abstract public function pricePercentRetriever();
|
||||
|
||||
public abstract function fixAmountRetriever(Product $product);
|
||||
abstract public function fixAmountRetriever(Product $product);
|
||||
|
||||
public abstract function getRequirementsList();
|
||||
abstract public function getRequirementsList();
|
||||
|
||||
public abstract function getTitle();
|
||||
abstract public function getTitle();
|
||||
|
||||
public function calculate(Product $product, $untaxedPrice)
|
||||
{
|
||||
@@ -52,20 +52,20 @@ abstract class BaseTaxType
|
||||
{
|
||||
$this->requirements = $this->getRequirementsList();
|
||||
|
||||
if(!is_array($this->requirements)) {
|
||||
if (!is_array($this->requirements)) {
|
||||
throw new TaxEngineException('getRequirementsList must return an array', TaxEngineException::TAX_TYPE_BAD_ABSTRACT_METHOD);
|
||||
}
|
||||
|
||||
foreach($this->requirements as $requirement => $requirementType) {
|
||||
if(!$requirementType instanceof TypeInterface) {
|
||||
foreach ($this->requirements as $requirement => $requirementType) {
|
||||
if (!$requirementType instanceof TypeInterface) {
|
||||
throw new TaxEngineException('getRequirementsList must return an array of TypeInterface', TaxEngineException::TAX_TYPE_BAD_ABSTRACT_METHOD);
|
||||
}
|
||||
|
||||
if(!array_key_exists($requirement, $requirementsValues)) {
|
||||
if (!array_key_exists($requirement, $requirementsValues)) {
|
||||
throw new TaxEngineException('Cannot load requirements : requirement value for `' . $requirement . '` not found', TaxEngineException::TAX_TYPE_REQUIREMENT_NOT_FOUND);
|
||||
}
|
||||
|
||||
if(!$requirementType->isValid($requirementsValues[$requirement])) {
|
||||
if (!$requirementType->isValid($requirementsValues[$requirement])) {
|
||||
throw new TaxEngineException('Requirement value for `' . $requirement . '` does not match required type', TaxEngineException::TAX_TYPE_BAD_REQUIREMENT_VALUE);
|
||||
}
|
||||
|
||||
@@ -75,11 +75,11 @@ abstract class BaseTaxType
|
||||
|
||||
public function getRequirement($key)
|
||||
{
|
||||
if($this->requirements === null) {
|
||||
if ($this->requirements === null) {
|
||||
throw new TaxEngineException('Requirements are empty in BaseTaxType::getRequirement', TaxEngineException::UNDEFINED_REQUIREMENTS);
|
||||
}
|
||||
|
||||
if(!array_key_exists($key, $this->requirements)) {
|
||||
if (!array_key_exists($key, $this->requirements)) {
|
||||
throw new TaxEngineException('Requirement value for `' . $key . '` does not exists in BaseTaxType::$requirements', TaxEngineException::UNDEFINED_REQUIREMENT_VALUE);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class FeatureFixAmountTaxType extends BaseTaxType
|
||||
$taxAmount = $query->getFreeTextValue();
|
||||
|
||||
$testInt = new FloatType();
|
||||
if(!$testInt->isValid($taxAmount)) {
|
||||
if (!$testInt->isValid($taxAmount)) {
|
||||
throw new TaxEngineException('Feature value does not match FLOAT format', TaxEngineException::FEATURE_BAD_EXPECTED_VALUE);
|
||||
}
|
||||
|
||||
|
||||
@@ -406,7 +406,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
|
||||
|
||||
$couponManager = new RemoveXAmount($stubFacade);
|
||||
|
||||
|
||||
$condition1 = new MatchForTotalAmount($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
|
||||
@@ -439,7 +438,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
|
||||
->method('unserializeConditionCollection')
|
||||
->will($this->returnValue($conditions));
|
||||
|
||||
|
||||
$stubContainer->expects($this->any())
|
||||
->method('get')
|
||||
->will($this->onConsecutiveCalls($stubFacade, $couponManager, $stubConditionFactory));
|
||||
|
||||
Reference in New Issue
Block a user