fix cs
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Core\Event\Lang;
|
||||
|
||||
|
||||
/**
|
||||
* Class LangCreateEvent
|
||||
* @package Thelia\Core\Event\Lang
|
||||
@@ -137,5 +136,4 @@ class LangCreateEvent extends LangEvent
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
namespace Thelia\Core\Event\Lang;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
|
||||
|
||||
/**
|
||||
* Class LangDefaultBehaviorEvent
|
||||
* @package Thelia\Core\Event\Lang
|
||||
@@ -37,7 +36,7 @@ class LangDefaultBehaviorEvent extends ActionEvent
|
||||
*/
|
||||
protected $defaultBehavior;
|
||||
|
||||
function __construct($defaultBehavior)
|
||||
public function __construct($defaultBehavior)
|
||||
{
|
||||
$this->defaultBehavior = $defaultBehavior;
|
||||
}
|
||||
@@ -58,7 +57,4 @@ class LangDefaultBehaviorEvent extends ActionEvent
|
||||
return $this->defaultBehavior;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Core\Event\Lang;
|
||||
|
||||
|
||||
/**
|
||||
* Class LangDeleteEvent
|
||||
* @package Thelia\Core\Event\Lang
|
||||
@@ -39,7 +38,7 @@ class LangDeleteEvent extends LangEvent
|
||||
/**
|
||||
* @param int $lang_id
|
||||
*/
|
||||
function __construct($lang_id)
|
||||
public function __construct($lang_id)
|
||||
{
|
||||
$this->lang_id = $lang_id;
|
||||
}
|
||||
@@ -64,4 +63,4 @@ class LangDeleteEvent extends LangEvent
|
||||
return $this->lang_id;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace Thelia\Core\Event\Lang;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
use Thelia\Model\Lang;
|
||||
|
||||
|
||||
/**
|
||||
* Class LangEvent
|
||||
* @package Thelia\Core\Event\Lang
|
||||
@@ -38,7 +37,7 @@ class LangEvent extends ActionEvent
|
||||
*/
|
||||
protected $lang;
|
||||
|
||||
function __construct(Lang $lang = null)
|
||||
public function __construct(Lang $lang = null)
|
||||
{
|
||||
$this->lang = $lang;
|
||||
}
|
||||
@@ -70,7 +69,4 @@ class LangEvent extends ActionEvent
|
||||
return null !== $this->lang;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Core\Event\Lang;
|
||||
|
||||
|
||||
/**
|
||||
* Class LangToggleDefaultEvent
|
||||
* @package Thelia\Core\Event\Lang
|
||||
@@ -39,7 +38,7 @@ class LangToggleDefaultEvent extends LangEvent
|
||||
/**
|
||||
* @param int $lang_id
|
||||
*/
|
||||
function __construct($lang_id)
|
||||
public function __construct($lang_id)
|
||||
{
|
||||
$this->lang_id = $lang_id;
|
||||
}
|
||||
@@ -64,6 +63,4 @@ class LangToggleDefaultEvent extends LangEvent
|
||||
return $this->lang_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Core\Event\Lang;
|
||||
|
||||
|
||||
/**
|
||||
* Class LangUpdateEvent
|
||||
* @package Thelia\Core\Event\Lang
|
||||
@@ -39,12 +38,11 @@ class LangUpdateEvent extends LangCreateEvent
|
||||
/**
|
||||
* @param int $id
|
||||
*/
|
||||
function __construct($id)
|
||||
public function __construct($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
*
|
||||
@@ -65,5 +63,4 @@ class LangUpdateEvent extends LangCreateEvent
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Core\Event\Module;
|
||||
|
||||
|
||||
/**
|
||||
* Class ModuleDeleteEvent
|
||||
* @package Thelia\Core\Event\Module
|
||||
@@ -36,7 +35,7 @@ class ModuleDeleteEvent extends ModuleEvent
|
||||
*/
|
||||
protected $module_id;
|
||||
|
||||
function __construct($module_id)
|
||||
public function __construct($module_id)
|
||||
{
|
||||
$this->module_id = $module_id;
|
||||
}
|
||||
@@ -57,5 +56,4 @@ class ModuleDeleteEvent extends ModuleEvent
|
||||
return $this->module_id;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
namespace Thelia\Core\Event\Newsletter;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
|
||||
|
||||
/**
|
||||
* Class NewsletterEvent
|
||||
* @package Thelia\Core\Event\Newsletter
|
||||
@@ -57,7 +56,7 @@ class NewsletterEvent extends ActionEvent
|
||||
*/
|
||||
protected $locale;
|
||||
|
||||
function __construct($email, $locale)
|
||||
public function __construct($email, $locale)
|
||||
{
|
||||
$this->email = $email;
|
||||
$this->locale = $locale;
|
||||
@@ -159,8 +158,4 @@ class NewsletterEvent extends ActionEvent
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
namespace Thelia\Core\Event\ProductSaleElement;
|
||||
|
||||
use Thelia\Model\Product;
|
||||
use Thelia\Core\Event\Product\ProductEvent;
|
||||
|
||||
class ProductSaleElementCreateEvent extends ProductSaleElementEvent
|
||||
{
|
||||
@@ -65,15 +64,16 @@ class ProductSaleElementCreateEvent extends ProductSaleElementEvent
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getProduct() {
|
||||
public function getProduct()
|
||||
{
|
||||
return $this->product;
|
||||
}
|
||||
|
||||
public function setProduct($product) {
|
||||
public function setProduct($product)
|
||||
{
|
||||
$this->product = $product;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Core\Event\ProductSaleElement;
|
||||
use Thelia\Model\Product;
|
||||
use Thelia\Core\Event\Product\ProductEvent;
|
||||
|
||||
class ProductSaleElementDeleteEvent extends ProductSaleElementEvent
|
||||
{
|
||||
@@ -58,6 +57,7 @@ class ProductSaleElementDeleteEvent extends ProductSaleElementEvent
|
||||
public function setCurrencyId($currency_id)
|
||||
{
|
||||
$this->currency_id = $currency_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,9 +22,7 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event\ProductSaleElement;
|
||||
use Thelia\Core\Event\Product\ProductCreateEvent;
|
||||
use Thelia\Model\Product;
|
||||
use Thelia\Core\Event\Product\ProductEvent;
|
||||
|
||||
class ProductSaleElementUpdateEvent extends ProductSaleElementEvent
|
||||
{
|
||||
@@ -217,6 +215,7 @@ class ProductSaleElementUpdateEvent extends ProductSaleElementEvent
|
||||
public function setFromDefaultCurrency($from_default_currency)
|
||||
{
|
||||
$this->from_default_currency = $from_default_currency;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -552,7 +552,6 @@ final class TheliaEvents
|
||||
const TAX_UPDATE = "action.updateTax";
|
||||
const TAX_DELETE = "action.deleteTax";
|
||||
|
||||
|
||||
// -- Profile management ---------------------------------------------
|
||||
|
||||
const PROFILE_CREATE = "action.createProfile";
|
||||
|
||||
@@ -46,4 +46,4 @@ class TheliaType extends AbstractType
|
||||
{
|
||||
return 'thelia_type';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,13 +23,6 @@
|
||||
|
||||
namespace Thelia\Core\Security;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Security\User\UserInterface;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Model\ProfileQuery;
|
||||
use Thelia\Model\ProfileResourceQuery;
|
||||
|
||||
/**
|
||||
* A simple security manager, in charge of checking user
|
||||
*
|
||||
@@ -49,7 +42,7 @@ class AccessManager
|
||||
self::DELETE => false,
|
||||
);
|
||||
|
||||
static protected $accessPows = array(
|
||||
protected static $accessPows = array(
|
||||
self::VIEW => 3,
|
||||
self::CREATE => 2,
|
||||
self::UPDATE => 1,
|
||||
@@ -67,7 +60,7 @@ class AccessManager
|
||||
|
||||
public function can($type)
|
||||
{
|
||||
if(!array_key_exists($type, $this->accessGranted)) {
|
||||
if (!array_key_exists($type, $this->accessGranted)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -75,7 +68,7 @@ class AccessManager
|
||||
|
||||
}
|
||||
|
||||
static public function getMaxAccessValue()
|
||||
public static function getMaxAccessValue()
|
||||
{
|
||||
return pow(2, current(array_slice( self::$accessPows, -1, 1, true ))) - 1;
|
||||
}
|
||||
@@ -83,8 +76,8 @@ class AccessManager
|
||||
public function build($accesses)
|
||||
{
|
||||
$this->accessValue = 0;
|
||||
foreach($accesses as $access) {
|
||||
if(array_key_exists($access, self::$accessPows)) {
|
||||
foreach ($accesses as $access) {
|
||||
if (array_key_exists($access, self::$accessPows)) {
|
||||
$this->accessValue += pow(2, self::$accessPows[$access]);
|
||||
}
|
||||
}
|
||||
@@ -95,9 +88,9 @@ class AccessManager
|
||||
protected function fillGrantedAccess()
|
||||
{
|
||||
$accessValue = $this->accessValue;
|
||||
foreach(self::$accessPows as $type => $value) {
|
||||
foreach (self::$accessPows as $type => $value) {
|
||||
$pow = pow(2, $value);
|
||||
if($accessValue >= $pow) {
|
||||
if ($accessValue >= $pow) {
|
||||
$accessValue -= $pow;
|
||||
$this->accessGranted[$type] = true;
|
||||
} else {
|
||||
@@ -106,7 +99,6 @@ class AccessManager
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getAccessValue()
|
||||
{
|
||||
return $this->accessValue;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace Thelia\Core\Security\Exception;
|
||||
|
||||
class ResourceException extends \RuntimeException
|
||||
class RessourceException extends \RuntimeException
|
||||
{
|
||||
const UNKNOWN_EXCEPTION = 0;
|
||||
|
||||
|
||||
@@ -33,17 +33,17 @@ use Thelia\Core\Security\Exception\ResourceException;
|
||||
*/
|
||||
final class AdminResources
|
||||
{
|
||||
static private $selfReflection = null;
|
||||
private static $selfReflection = null;
|
||||
|
||||
static public function retrieve($name)
|
||||
public static function retrieve($name)
|
||||
{
|
||||
$constantName = strtoupper($name);
|
||||
|
||||
if(null === self::$selfReflection) {
|
||||
if (null === self::$selfReflection) {
|
||||
self::$selfReflection = new \ReflectionClass(__CLASS__);
|
||||
}
|
||||
|
||||
if(self::$selfReflection->hasConstant($constantName)) {
|
||||
if (self::$selfReflection->hasConstant($constantName)) {
|
||||
return self::$selfReflection->getConstant($constantName);
|
||||
} else {
|
||||
throw new ResourceException(sprintf('Resource `%s` not found', $constantName), ResourceException::RESOURCE_NOT_FOUND);
|
||||
|
||||
@@ -23,12 +23,9 @@
|
||||
|
||||
namespace Thelia\Core\Security;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Security\User\UserInterface;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Model\ProfileQuery;
|
||||
use Thelia\Model\ProfileResourceQuery;
|
||||
|
||||
/**
|
||||
* A simple security manager, in charge of checking user
|
||||
@@ -147,29 +144,29 @@ class SecurityContext
|
||||
return true;
|
||||
}
|
||||
|
||||
if( !method_exists($user, 'getPermissions') ) {
|
||||
if ( !method_exists($user, 'getPermissions') ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$userPermissions = $user->getPermissions();
|
||||
|
||||
if($userPermissions === AdminResources::SUPERADMINISTRATOR) {
|
||||
if ($userPermissions === AdminResources::SUPERADMINISTRATOR) {
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach($resources as $resource) {
|
||||
if($resource === '') {
|
||||
foreach ($resources as $resource) {
|
||||
if ($resource === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$resource = strtolower($resource);
|
||||
|
||||
if(!array_key_exists($resource, $userPermissions)) {
|
||||
if (!array_key_exists($resource, $userPermissions)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach($accesses as $access) {
|
||||
if(!$userPermissions[$resource]->can($access)) {
|
||||
foreach ($accesses as $access) {
|
||||
if (!$userPermissions[$resource]->can($access)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Thelia\Core\Template\Element\Exception\SearchLoopException;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Thelia\Core\Security\SecurityContext;
|
||||
@@ -95,7 +94,7 @@ abstract class BaseLoop
|
||||
Argument::createBooleanTypeArgument('force_return', false),
|
||||
);
|
||||
|
||||
if(true === $this->countable) {
|
||||
if (true === $this->countable) {
|
||||
$defaultArgs = array_merge($defaultArgs, array(
|
||||
Argument::createIntTypeArgument('offset', 0),
|
||||
Argument::createIntTypeArgument('page'),
|
||||
@@ -103,7 +102,7 @@ abstract class BaseLoop
|
||||
));
|
||||
}
|
||||
|
||||
if($this instanceof SearchLoopInterface) {
|
||||
if ($this instanceof SearchLoopInterface) {
|
||||
$defaultArgs = array_merge($defaultArgs, array(
|
||||
Argument::createAnyTypeArgument('search_term'),
|
||||
new Argument(
|
||||
@@ -241,13 +240,13 @@ abstract class BaseLoop
|
||||
*/
|
||||
protected function search(ModelCriteria $search, &$pagination = null)
|
||||
{
|
||||
if($this instanceof SearchLoopInterface) {
|
||||
if ($this instanceof SearchLoopInterface) {
|
||||
$searchTerm = $this->getSearch_term();
|
||||
$searchIn = $this->getSearch_in();
|
||||
$searchMode = $this->getSearch_mode();
|
||||
if(null !== $searchTerm && null !== $searchIn) {
|
||||
if (null !== $searchTerm && null !== $searchIn) {
|
||||
|
||||
switch($searchMode) {
|
||||
switch ($searchMode) {
|
||||
case SearchLoopInterface::MODE_ANY_WORD:
|
||||
$searchCriteria = Criteria::IN;
|
||||
$searchTerm = explode(' ', $searchTerm);
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Core\Template\Element;
|
||||
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
namespace Thelia\Core\Template\Loop;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
@@ -34,7 +33,6 @@ use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Model\AdminQuery;
|
||||
use Thelia\Type;
|
||||
use Thelia\Type\BooleanOrBothType;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -16,7 +16,6 @@ use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Model\CountryQuery;
|
||||
use Thelia\Type;
|
||||
use Thelia\Type\TypeCollection;
|
||||
|
||||
class Cart extends BaseLoop
|
||||
{
|
||||
@@ -90,17 +89,17 @@ class Cart extends BaseLoop
|
||||
|
||||
$countCartItems = count($cartItems);
|
||||
|
||||
if($limit <= 0 || $limit >= $countCartItems){
|
||||
if ($limit <= 0 || $limit >= $countCartItems) {
|
||||
$limit = $countCartItems;
|
||||
}
|
||||
|
||||
$position = $this->getPosition();
|
||||
|
||||
if(isset($position)){
|
||||
if($position == "first"){
|
||||
if (isset($position)) {
|
||||
if ($position == "first") {
|
||||
$limit = 1;
|
||||
$cartItems = array($cartItems[0]);
|
||||
}else if($position == "last"){
|
||||
} elseif ($position == "last") {
|
||||
$limit = 1;
|
||||
$cartItems = array(end($cartItems));
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Model\FolderQuery;
|
||||
use Thelia\Model\Map\ContentTableMap;
|
||||
use Thelia\Model\ContentFolderQuery;
|
||||
use Thelia\Model\ContentQuery;
|
||||
use Thelia\Type\TypeCollection;
|
||||
use Thelia\Type;
|
||||
|
||||
@@ -88,11 +88,11 @@ class Customer extends BaseLoop implements SearchLoopInterface
|
||||
{
|
||||
|
||||
$search->_and();
|
||||
foreach($searchIn as $index => $searchInElement) {
|
||||
if($index > 0) {
|
||||
foreach ($searchIn as $index => $searchInElement) {
|
||||
if ($index > 0) {
|
||||
$search->_or();
|
||||
}
|
||||
switch($searchInElement) {
|
||||
switch ($searchInElement) {
|
||||
case "ref":
|
||||
$search->filterByRef($searchTerm, $searchCriteria);
|
||||
break;
|
||||
|
||||
@@ -107,7 +107,7 @@ class Module extends BaseI18nLoop
|
||||
|
||||
$code = $this->getCode();
|
||||
|
||||
if(null !== $code) {
|
||||
if (null !== $code) {
|
||||
$search->filterByCode($code, Criteria::IN);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ use Thelia\Core\Template\Element\SearchLoopInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Model\CustomerQuery;
|
||||
use Thelia\Model\OrderAddress;
|
||||
use Thelia\Model\OrderAddressQuery;
|
||||
use Thelia\Model\OrderQuery;
|
||||
use Thelia\Type\TypeCollection;
|
||||
@@ -100,11 +99,11 @@ class Order extends BaseLoop implements SearchLoopInterface
|
||||
{
|
||||
|
||||
$search->_and();
|
||||
foreach($searchIn as $index => $searchInElement) {
|
||||
if($index > 0) {
|
||||
foreach ($searchIn as $index => $searchInElement) {
|
||||
if ($index > 0) {
|
||||
$search->_or();
|
||||
}
|
||||
switch($searchInElement) {
|
||||
switch ($searchInElement) {
|
||||
case "ref":
|
||||
$search->filterByRef($searchTerm, $searchCriteria);
|
||||
break;
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace Thelia\Core\Template\Loop;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\Join;
|
||||
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
|
||||
@@ -35,7 +34,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Exception\TaxEngineException;
|
||||
use Thelia\Model\Base\ProductSaleElementsQuery;
|
||||
use Thelia\Model\CategoryQuery;
|
||||
use Thelia\Model\CountryQuery;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
@@ -148,11 +146,11 @@ class Product extends BaseI18nLoop implements SearchLoopInterface
|
||||
{
|
||||
|
||||
$search->_and();
|
||||
foreach($searchIn as $index => $searchInElement) {
|
||||
if($index > 0) {
|
||||
foreach ($searchIn as $index => $searchInElement) {
|
||||
if ($index > 0) {
|
||||
$search->_or();
|
||||
}
|
||||
switch($searchInElement) {
|
||||
switch ($searchInElement) {
|
||||
case "ref":
|
||||
$search->filterByRef($searchTerm, $searchCriteria);
|
||||
break;
|
||||
@@ -172,7 +170,7 @@ class Product extends BaseI18nLoop implements SearchLoopInterface
|
||||
public function exec(&$pagination)
|
||||
{
|
||||
$complex = $this->getComplex();
|
||||
if(true === $complex) {
|
||||
if (true === $complex) {
|
||||
return $this->execComplex($pagination);
|
||||
}
|
||||
|
||||
@@ -237,7 +235,7 @@ class Product extends BaseI18nLoop implements SearchLoopInterface
|
||||
|
||||
$title = $this->getTitle();
|
||||
|
||||
if(!is_null($title)) {
|
||||
if (!is_null($title)) {
|
||||
$search->where("CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".Criteria::LIKE." ?", "%".$title."%", \PDO::PARAM_STR);
|
||||
}
|
||||
|
||||
@@ -594,7 +592,7 @@ class Product extends BaseI18nLoop implements SearchLoopInterface
|
||||
|
||||
$title = $this->getTitle();
|
||||
|
||||
if(!is_null($title)){
|
||||
if (!is_null($title)) {
|
||||
|
||||
$search->where(" CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".Criteria::LIKE." ?", "%".$title."%", \PDO::PARAM_STR);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Model\ProfileQuery;
|
||||
use Thelia\Type;
|
||||
use Thelia\Type\BooleanOrBothType;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -34,7 +34,6 @@ use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Model\ResourceQuery;
|
||||
use Thelia\Type;
|
||||
use Thelia\Type\BooleanOrBothType;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -87,7 +86,7 @@ class Resource extends BaseI18nLoop
|
||||
|
||||
$code = $this->getCode();
|
||||
|
||||
if(null !== $code) {
|
||||
if (null !== $code) {
|
||||
$search->filterByCode($code, Criteria::IN);
|
||||
}
|
||||
|
||||
|
||||
@@ -85,10 +85,10 @@ class TaxRuleCountry extends BaseI18nLoop
|
||||
$country = $this->getCountry();
|
||||
$taxRule = $this->getTax_rule();
|
||||
|
||||
if($ask === 'countries') {
|
||||
if ($ask === 'countries') {
|
||||
$taxCountForOriginCountry = TaxRuleCountryQuery::create()->filterByCountryId($country)->count();
|
||||
|
||||
if($taxCountForOriginCountry > 0) {
|
||||
if ($taxCountForOriginCountry > 0) {
|
||||
$search->groupByCountryId();
|
||||
|
||||
$originalCountryJoin = new Join();
|
||||
@@ -127,7 +127,7 @@ class TaxRuleCountry extends BaseI18nLoop
|
||||
|
||||
$search->addAscendingOrderByColumn('i18n_TITLE');
|
||||
}
|
||||
} elseif($ask === 'taxes') {
|
||||
} elseif ($ask === 'taxes') {
|
||||
$search->filterByCountryId($country);
|
||||
|
||||
/* manage tax translation */
|
||||
@@ -151,8 +151,8 @@ class TaxRuleCountry extends BaseI18nLoop
|
||||
|
||||
$loopResultRow = new LoopResultRow($loopResult, $taxRuleCountry, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
if($ask === 'countries') {
|
||||
if($taxCountForOriginCountry > 0) {
|
||||
if ($ask === 'countries') {
|
||||
if ($taxCountForOriginCountry > 0) {
|
||||
$loopResultRow
|
||||
->set("COUNTRY" , $taxRuleCountry->getCountryId())
|
||||
->set("COUNTRY_TITLE" , $taxRuleCountry->getVirtualColumn(CountryTableMap::TABLE_NAME . '_i18n_TITLE'))
|
||||
@@ -167,7 +167,7 @@ class TaxRuleCountry extends BaseI18nLoop
|
||||
->set("COUNTRY_DESCRIPTION" , $taxRuleCountry->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("COUNTRY_POSTSCRIPTUM" , $taxRuleCountry->getVirtualColumn('i18n_POSTSCRIPTUM'));
|
||||
}
|
||||
} elseif($ask === 'taxes') {
|
||||
} elseif ($ask === 'taxes') {
|
||||
$loopResultRow
|
||||
->set("TAX_RULE" , $taxRuleCountry->getTaxRuleId())
|
||||
->set("COUNTRY" , $taxRuleCountry->getCountryId())
|
||||
@@ -178,8 +178,6 @@ class TaxRuleCountry extends BaseI18nLoop
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
namespace Thelia\Core\Template;
|
||||
|
||||
use Thelia\Core\Thelia;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Form\BaseForm;
|
||||
/**
|
||||
|
||||
@@ -40,7 +40,7 @@ abstract class AbstractSmartyPlugin
|
||||
*/
|
||||
protected function _explode($commaSeparatedValues)
|
||||
{
|
||||
if(null === $commaSeparatedValues) {
|
||||
if (null === $commaSeparatedValues) {
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@ use Symfony\Component\Form\Extension\Core\View\ChoiceView;
|
||||
*/
|
||||
class Form extends AbstractSmartyPlugin
|
||||
{
|
||||
static private $taggedFieldsStack = null;
|
||||
static private $taggedFieldsStackPosition = null;
|
||||
private static $taggedFieldsStack = null;
|
||||
private static $taggedFieldsStackPosition = null;
|
||||
|
||||
protected $request;
|
||||
protected $parserContext;
|
||||
@@ -113,8 +113,7 @@ class Form extends AbstractSmartyPlugin
|
||||
|
||||
$template->assign("form_error", $instance->hasError() ? true : false);
|
||||
$template->assign("form_error_message", $instance->getErrorMessage());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
@@ -127,7 +126,6 @@ class Form extends AbstractSmartyPlugin
|
||||
|
||||
$template->assign("checked", isset($fieldVars['checked']) ? $fieldVars['checked'] : false);
|
||||
|
||||
|
||||
//data
|
||||
$template->assign("data", $fieldVars['data']);
|
||||
|
||||
@@ -161,13 +159,13 @@ class Form extends AbstractSmartyPlugin
|
||||
$formFieldType = $formFieldConfig->getType()->getInnerType();
|
||||
|
||||
/* access to choices */
|
||||
if($formFieldType instanceof ChoiceType) {
|
||||
if ($formFieldType instanceof ChoiceType) {
|
||||
$template->assign("choices", $formFieldView->vars['choices']);
|
||||
}
|
||||
|
||||
/* access to collections */
|
||||
if($formFieldType instanceof CollectionType) {
|
||||
if( true === $formFieldConfig->getOption('prototype') ) {
|
||||
if ($formFieldType instanceof CollectionType) {
|
||||
if ( true === $formFieldConfig->getOption('prototype') ) {
|
||||
|
||||
} else {
|
||||
/* access to choices */
|
||||
@@ -179,17 +177,16 @@ class Form extends AbstractSmartyPlugin
|
||||
}
|
||||
|
||||
/* access to thelia type */
|
||||
if($formFieldType instanceof TheliaType) {
|
||||
if ($formFieldType instanceof TheliaType) {
|
||||
$template->assign("formType", $formFieldView->vars['type']);
|
||||
|
||||
|
||||
switch($formFieldView->vars['type']) {
|
||||
switch ($formFieldView->vars['type']) {
|
||||
case "choice":
|
||||
if(!isset($formFieldView->vars['options']['choices']) || !is_array($formFieldView->vars['options']['choices'])) {
|
||||
if (!isset($formFieldView->vars['options']['choices']) || !is_array($formFieldView->vars['options']['choices'])) {
|
||||
//throw new
|
||||
}
|
||||
$choices = array();
|
||||
foreach($formFieldView->vars['options']['choices'] as $value => $choice) {
|
||||
foreach ($formFieldView->vars['options']['choices'] as $value => $choice) {
|
||||
$choices[] = new ChoiceView($value, $value, $choice);
|
||||
}
|
||||
$template->assign("choices", $choices);
|
||||
@@ -223,32 +220,29 @@ class Form extends AbstractSmartyPlugin
|
||||
$val = $value[$key];
|
||||
|
||||
$this->assignFieldValues($template, $name, $val, $formFieldView->vars, $value_count);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new \InvalidArgumentException(sprintf("Missing or empty parameter 'value_key' for field '%s'", $formFieldView->vars["name"]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->assignFieldValues($template, $formFieldView->vars["full_name"], $formFieldView->vars["value"], $formFieldView->vars);
|
||||
}
|
||||
|
||||
$formFieldView->setRendered();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
||||
public function renderTaggedFormFields($params, $content, \Smarty_Internal_Template $template, &$repeat)
|
||||
{
|
||||
if(null === $content) {
|
||||
if (null === $content) {
|
||||
self::$taggedFieldsStack = $this->getFormFieldsFromTag($params);
|
||||
self::$taggedFieldsStackPosition = 0;
|
||||
} else {
|
||||
self::$taggedFieldsStackPosition++;
|
||||
}
|
||||
|
||||
if(isset(self::$taggedFieldsStack[self::$taggedFieldsStackPosition])) {
|
||||
if (isset(self::$taggedFieldsStack[self::$taggedFieldsStackPosition])) {
|
||||
$this->assignFieldValues(
|
||||
$template,
|
||||
self::$taggedFieldsStack[self::$taggedFieldsStackPosition]['view']->vars["full_name"],
|
||||
@@ -268,7 +262,7 @@ class Form extends AbstractSmartyPlugin
|
||||
self::$taggedFieldsStackPosition = null;
|
||||
}
|
||||
|
||||
if(null !== $content) {
|
||||
if (null !== $content) {
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
@@ -322,8 +316,7 @@ class Form extends AbstractSmartyPlugin
|
||||
|
||||
if ($repeat) {
|
||||
$this->assignFieldErrorVars($template, $errors);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
@@ -364,8 +357,8 @@ class Form extends AbstractSmartyPlugin
|
||||
throw new \InvalidArgumentException("'tag' parameter is missing");
|
||||
|
||||
$viewList = array();
|
||||
foreach($instance->getView() as $view) {
|
||||
if(isset($view->vars['attr']['tag']) && $tag == $view->vars['attr']['tag']) {
|
||||
foreach ($instance->getView() as $view) {
|
||||
if (isset($view->vars['attr']['tag']) && $tag == $view->vars['attr']['tag']) {
|
||||
$fieldData = $instance->getForm()->all()[$view->vars['name']];
|
||||
$viewList[] = array(
|
||||
'view' => $view,
|
||||
|
||||
@@ -8,7 +8,6 @@ use \Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use \Smarty;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Thelia\Core\Template\ParserInterface;
|
||||
|
||||
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
||||
|
||||
Reference in New Issue
Block a user