This commit is contained in:
Manuel Raynaud
2013-09-30 10:35:34 +02:00
parent 43b5a129f7
commit c65ec67bdf
168 changed files with 577 additions and 818 deletions

View File

@@ -244,8 +244,6 @@ class AddressCreateOrUpdateEvent extends ActionEvent
return $this->isDefault;
}
/**
* @param \Thelia\Model\Customer $customer
*/

View File

@@ -23,7 +23,6 @@
namespace Thelia\Core\Event\Content;
/**
* Class ContentCreateEvent
* @package Thelia\Core\Event\Content
@@ -76,9 +75,6 @@ class ContentCreateEvent extends ContentEvent
return $this->default_folder;
}
/**
* @param mixed $visible
*
@@ -119,6 +115,4 @@ class ContentCreateEvent extends ContentEvent
return $this->title;
}
}
}

View File

@@ -23,7 +23,6 @@
namespace Thelia\Core\Event\Content;
/**
* Class ContentDeleteEvent
* @package Thelia\Core\Event\Content
@@ -35,7 +34,7 @@ class ContentDeleteEvent extends ContentEvent
protected $folder_id;
function __construct($content_id)
public function __construct($content_id)
{
$this->content_id = $content_id;
}
@@ -70,5 +69,4 @@ class ContentDeleteEvent extends ContentEvent
return $this->folder_id;
}
}
}

View File

@@ -25,7 +25,6 @@ namespace Thelia\Core\Event\Content;
use Thelia\Core\Event\ActionEvent;
use Thelia\Model\Content;
/**
* Class ContentEvent
* @package Thelia\Core\Event\Content
@@ -38,7 +37,7 @@ class ContentEvent extends ActionEvent
*/
protected $content;
function __construct(Content $content = null)
public function __construct(Content $content = null)
{
$this->content = $content;
}
@@ -70,4 +69,4 @@ class ContentEvent extends ActionEvent
{
return null !== $this->content;
}
}
}

View File

@@ -23,7 +23,6 @@
namespace Thelia\Core\Event\Content;
/**
* Class ContentToggleVisibilityEvent
* @package Thelia\Core\Event\Content
@@ -32,4 +31,4 @@ namespace Thelia\Core\Event\Content;
class ContentToggleVisibilityEvent extends ContentEvent
{
}
}

View File

@@ -23,7 +23,6 @@
namespace Thelia\Core\Event\Content;
/**
* Class ContentUpdateEvent
* @package Thelia\Core\Event\Content
@@ -39,7 +38,7 @@ class ContentUpdateEvent extends ContentCreateEvent
protected $url;
function __construct($content_id)
public function __construct($content_id)
{
$this->content_id = $content_id;
}
@@ -144,7 +143,4 @@ class ContentUpdateEvent extends ContentCreateEvent
return $this->url;
}
}
}

View File

@@ -59,7 +59,7 @@ class CustomerCreateOrUpdateEvent extends ActionEvent
protected $customer;
/**
* @param int $title the title customer id
* @param int $title the title customer id
* @param string $firstname
* @param string $lastname
* @param string $address1
@@ -69,13 +69,13 @@ class CustomerCreateOrUpdateEvent extends ActionEvent
* @param string $cellphone
* @param string $zipcode
* @param string $city
* @param int $country the country id
* @param int $country the country id
* @param string $email
* @param string $password plain password, don't put hash password, it will hashes again
* @param $lang
* @param int $reseller if customer is a reseller
* @param int $sponsor customer's id sponsor
* @param float $discount
* @param int $reseller if customer is a reseller
* @param int $sponsor customer's id sponsor
* @param float $discount
* @param string $company
*/
public function __construct($title, $firstname, $lastname, $address1, $address2, $address3, $phone, $cellphone, $zipcode, $city, $country, $email, $password, $lang, $reseller, $sponsor, $discount, $company)

View File

@@ -66,7 +66,7 @@ class DocumentCreateOrUpdateEvent extends ActionEvent
*
* @param string $documentType Document type
* ex : FileManager::TYPE_CATEGORY
* @param int $parentId Document parent id
* @param int $parentId Document parent id
*/
public function __construct($documentType, $parentId)
{
@@ -214,5 +214,4 @@ class DocumentCreateOrUpdateEvent extends ActionEvent
return $this->oldModelDocument;
}
}

View File

@@ -109,5 +109,4 @@ class DocumentDeleteEvent extends ActionEvent
return $this->documentToDelete;
}
}

View File

@@ -50,4 +50,4 @@ class FeatureProductEvent extends ActionEvent
return $this;
}
}
}

View File

@@ -24,13 +24,13 @@
namespace Thelia\Core\Event\Folder;
use Thelia\Core\Event\Folder\FolderEvent;
/**
* Class FolderCreateEvent
* @package Thelia\Core\Event
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class FolderCreateEvent extends FolderEvent {
class FolderCreateEvent extends FolderEvent
{
protected $title;
protected $parent;
protected $locale;
@@ -117,5 +117,4 @@ class FolderCreateEvent extends FolderEvent {
return $this->visible;
}
}
}

View File

@@ -24,14 +24,13 @@
namespace Thelia\Core\Event\Folder;
use Thelia\Core\Event\Folder\FolderEvent;
/**
* Class FolderDeleteEvent
* @package Thelia\Core\Event
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class FolderDeleteEvent extends FolderEvent{
class FolderDeleteEvent extends FolderEvent
{
/**
* @var int folder id
*/
@@ -40,7 +39,7 @@ class FolderDeleteEvent extends FolderEvent{
/**
* @param int $folder_id
*/
function __construct($folder_id)
public function __construct($folder_id)
{
$this->folder_id = $folder_id;
}
@@ -61,5 +60,4 @@ class FolderDeleteEvent extends FolderEvent{
return $this->folder_id;
}
}
}

View File

@@ -25,20 +25,19 @@ namespace Thelia\Core\Event\Folder;
use Thelia\Core\Event\ActionEvent;
use Thelia\Model\Folder;
/**
* Class FolderEvent
* @package Thelia\Core\Event
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class FolderEvent extends ActionEvent {
class FolderEvent extends ActionEvent
{
/**
* @var \Thelia\Model\Folder
*/
protected $folder;
function __construct(Folder $folder = null)
public function __construct(Folder $folder = null)
{
$this->folder = $folder;
}
@@ -71,4 +70,4 @@ class FolderEvent extends ActionEvent {
return null !== $this->folder;
}
}
}

View File

@@ -24,12 +24,11 @@
namespace Thelia\Core\Event\Folder;
use Thelia\Core\Event\Folder\FolderEvent;
/**
* Class FolderToggleVisibilityEvent
* @package Thelia\Core\Event
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class FolderToggleVisibilityEvent extends FolderEvent {
}
class FolderToggleVisibilityEvent extends FolderEvent
{
}

View File

@@ -24,13 +24,13 @@
namespace Thelia\Core\Event\Folder;
use Thelia\Core\Event\Folder\FolderCreateEvent;
/**
* Class FolderUpdateEvent
* @package Thelia\Core\Event
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class FolderUpdateEvent extends FolderCreateEvent {
class FolderUpdateEvent extends FolderCreateEvent
{
protected $folder_id;
protected $chapo;
@@ -39,7 +39,7 @@ class FolderUpdateEvent extends FolderCreateEvent {
protected $url;
function __construct($folder_id)
public function __construct($folder_id)
{
$this->folder_id = $folder_id;
}
@@ -134,4 +134,4 @@ class FolderUpdateEvent extends FolderCreateEvent {
return $this->url;
}
}
}

View File

@@ -23,14 +23,13 @@
namespace Thelia\Core\Event;
/**
* Class GenerateRewrittenUrlEvent
* @package Thelia\Core\Event
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class GenerateRewrittenUrlEvent extends ActionEvent {
class GenerateRewrittenUrlEvent extends ActionEvent
{
protected $object;
protected $locale;
@@ -57,4 +56,4 @@ class GenerateRewrittenUrlEvent extends ActionEvent {
return $this->url;
}
}
}

View File

@@ -60,9 +60,9 @@ class ImageCreateOrUpdateEvent extends ActionEvent
/**
* Constructor
*
* @param string $imageType Image type
* @param string $imageType Image type
* ex : FileManager::TYPE_CATEGORY
* @param int $parentId Image parent id
* @param int $parentId Image parent id
*/
public function __construct($imageType, $parentId)
{
@@ -210,5 +210,4 @@ class ImageCreateOrUpdateEvent extends ActionEvent
return $this->oldModelImage;
}
}

View File

@@ -52,7 +52,7 @@ class ImageDeleteEvent extends ActionEvent
* Constructor
*
* @param CategoryImage|ProductImage|ContentImage|FolderImage $imageToDelete Image about to be deleted
* @param string $imageType Image type
* @param string $imageType Image type
* ex : FileManager::TYPE_CATEGORY
*/
public function __construct($imageToDelete, $imageType)
@@ -109,5 +109,4 @@ class ImageDeleteEvent extends ActionEvent
return $this->imageToDelete;
}
}

View File

@@ -23,14 +23,13 @@
namespace Thelia\Core\Event;
/**
* Class LostPasswordEvent
* @package Thelia\Core\Event
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class LostPasswordEvent extends ActionEvent {
class LostPasswordEvent extends ActionEvent
{
protected $email;
public function __construct($email)
@@ -46,6 +45,4 @@ class LostPasswordEvent extends ActionEvent {
return $this->email;
}
}
}

View File

@@ -23,13 +23,13 @@
namespace Thelia\Core\Event;
/**
* Class MailTransporterEvent
* @package Thelia\Core\Event
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class MailTransporterEvent extends ActionEvent {
class MailTransporterEvent extends ActionEvent
{
/**
* @var \Swift_Transport
*/
@@ -49,4 +49,4 @@ class MailTransporterEvent extends ActionEvent {
{
return null !== $this->transporter;
}
}
}

View File

@@ -46,6 +46,7 @@ class ProductCreateEvent extends ProductEvent
public function setRef($ref)
{
$this->ref = $ref;
return $this;
}
@@ -57,6 +58,7 @@ class ProductCreateEvent extends ProductEvent
public function setTitle($title)
{
$this->title = $title;
return $this;
}
@@ -68,6 +70,7 @@ class ProductCreateEvent extends ProductEvent
public function setLocale($locale)
{
$this->locale = $locale;
return $this;
}
@@ -79,6 +82,7 @@ class ProductCreateEvent extends ProductEvent
public function setDefaultCategory($default_category)
{
$this->default_category = $default_category;
return $this;
}
@@ -90,6 +94,7 @@ class ProductCreateEvent extends ProductEvent
public function setVisible($visible)
{
$this->visible = $visible;
return $this;
}
@@ -101,6 +106,7 @@ class ProductCreateEvent extends ProductEvent
public function setBasePrice($basePrice)
{
$this->basePrice = $basePrice;
return $this;
}
@@ -112,6 +118,7 @@ class ProductCreateEvent extends ProductEvent
public function setBaseWeight($baseWeight)
{
$this->baseWeight = $baseWeight;
return $this;
}
@@ -123,6 +130,7 @@ class ProductCreateEvent extends ProductEvent
public function setTaxRuleId($taxRuleId)
{
$this->taxRuleId = $taxRuleId;
return $this;
}
@@ -134,6 +142,7 @@ class ProductCreateEvent extends ProductEvent
public function setCurrencyId($currencyId)
{
$this->currencyId = $currencyId;
return $this;
}
}

View File

@@ -24,7 +24,6 @@
namespace Thelia\Core\Event\Product;
use Thelia\Core\Event\ProductEvent;
use Thelia\Model\Product;
use Thelia\Core\Event\ActionEvent;
class ProductSetTemplateEvent extends ProductEvent
{

View File

@@ -57,6 +57,7 @@ class TemplateUpdateEvent extends TemplateCreateEvent
public function setFeatureList($feature_list)
{
$this->feature_list = $feature_list;
return $this;
}
@@ -68,6 +69,7 @@ class TemplateUpdateEvent extends TemplateCreateEvent
public function setAttributeList($attribute_list)
{
$this->attribute_list = $attribute_list;
return $this;
}
}

View File

@@ -331,7 +331,6 @@ final class TheliaEvents
const ORDER_PRODUCT_BEFORE_CREATE = "action.orderProduct.beforeCreate";
const ORDER_PRODUCT_AFTER_CREATE = "action.orderProduct.afterCreate";
/**
* Sent on image processing
*/
@@ -571,7 +570,6 @@ final class TheliaEvents
const BEFORE_DELETEATTRIBUTE_AV = "action.before_deleteAttributeAv";
const AFTER_DELETEATTRIBUTE_AV = "action.after_deleteAttributeAv";
// -- Features values management ----------------------------------------
const FEATURE_AV_CREATE = "action.createFeatureAv";

View File

@@ -100,7 +100,7 @@ class ViewListener implements EventSubscriberInterface
// Redirect to the login template
Redirect::exec($this->container->get('thelia.url.manager')->viewUrl($ex->getLoginTemplate()));
} catch (OrderException $e) {
switch($e->getCode()) {
switch ($e->getCode()) {
case OrderException::CART_EMPTY:
// Redirect to the cart template
Redirect::exec($this->container->get('router.chainRequest')->generate($e->cartRoute, $e->arguments, Router::ABSOLUTE_URL));

View File

@@ -51,10 +51,10 @@ class Session extends BaseSession
public function getLang($forceDefault = true)
{
$lang = $this->get("thelia.current.lang");
if(null === $lang && $forceDefault)
{
if (null === $lang && $forceDefault) {
$lang = Lang::getDefaultLanguage();
}
return $lang;
}
@@ -74,10 +74,10 @@ class Session extends BaseSession
{
$currency = $this->get("thelia.current.currency");
if(null === $currency && $forceDefault)
{
if (null === $currency && $forceDefault) {
$currency = Currency::getDefaultCurrency();
}
return $currency;
}
@@ -108,6 +108,7 @@ class Session extends BaseSession
if (null === $lang) {
$lang = Lang::getDefaultLanguage();
}
return $lang;
}
@@ -187,7 +188,7 @@ class Session extends BaseSession
$cart = null;
if ($cart_id) {
$cart = CartQuery::create()->findPk($cart_id);
if($cart) {
if ($cart) {
try {
$this->verifyValidCart($cart);
} catch (InvalidCartException $e) {
@@ -230,7 +231,6 @@ class Session extends BaseSession
// -- Order ------------------------------------------------------------------
public function setOrder(Order $order)
{
$this->set("thelia.order", $order);
@@ -246,7 +246,6 @@ class Session extends BaseSession
return $this->get("thelia.order");
}
/**
* Set consumed coupons by the Customer
*

View File

@@ -20,15 +20,15 @@
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\HttpKernel\Exceptions;
namespace Thelia\Core\HttpKernel\Exception;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException as BaseNotFountHttpException;
/**
* Class NotFountHttpException
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class NotFountHttpException extends BaseNotFountHttpException {
class NotFountHttpException extends BaseNotFountHttpException
{
protected $adminContext = false;
public function __construct($message = null, \Exception $previous = null, $code = 0, $adminContext = false)
@@ -43,4 +43,4 @@ class NotFountHttpException extends BaseNotFountHttpException {
return $this->adminContext === true;
}
}
}

View File

@@ -24,7 +24,6 @@
namespace Thelia\Core\Security\Authentication;
use Thelia\Core\Security\Authentication\AuthenticatorInterface;
use Thelia\Core\Security\UserProvider\UserProviderInterface;
use Thelia\Core\Security\UserProvider\TokenUserProvider;
use Thelia\Core\Security\Exception\TokenAuthenticationException;
@@ -51,7 +50,6 @@ class TokenAuthenticator implements AuthenticatorInterface
$user = $this->userProvider->getUser($keyData);
if ($user === null) throw new TokenAuthenticationException("No user matches the provided token");
return $user;
}
}

View File

@@ -6,8 +6,8 @@ use Thelia\Core\Security\User\UserInterface;
class TokenProvider
{
public function encodeKey(UserInterface $user) {
public function encodeKey(UserInterface $user)
{
// Always set a new token in the user environment
$user->setToken(uniqid());
@@ -15,7 +15,8 @@ class TokenProvider
array($user->getUsername(), $user->getToken(), $user->getSerial())));
}
public function decodeKey($key) {
public function decodeKey($key)
{
$data = unserialize(base64_decode($key));
return array(

View File

@@ -68,4 +68,4 @@ interface UserInterface
* Set a serial number int the user data (used by remember me authnetication system)
*/
public function setSerial($serial);
}
}

View File

@@ -23,13 +23,12 @@
namespace Thelia\Core\Security\UserProvider;
use Thelia\Model\Admin;
use Thelia\Model\AdminQuery;
class AdminTokenUserProvider extends TokenUserProvider
{
public function getUser($dataArray) {
public function getUser($dataArray)
{
return AdminQuery::create()
->filterByLogin($dataArray['username'])
->filterByRememberMeSerial($dataArray['serial'])

View File

@@ -23,17 +23,16 @@
namespace Thelia\Core\Security\UserProvider;
use Thelia\Action\Customer;
use Thelia\Model\CustomerQuery;
class CustomerTokenUserProvider extends TokenUserProvider
{
public function getUser($dataArray) {
public function getUser($dataArray)
{
return CustomerQuery::create()
->filterByEmail($dataArray['username'])
->filterByRememberMeSerial($dataArray['serial'])
->filterByRememberMeToken($dataArray['token'])
->findOne();
}
}
}

View File

@@ -35,4 +35,4 @@ class CustomerUserProvider implements UserProviderInterface
return $customer;
}
}
}

View File

@@ -23,10 +23,9 @@
namespace Thelia\Core\Security\UserProvider;
use Thelia\Core\Security\User\UserInterface;
use Thelia\Core\Security\Token\TokenProvider;
abstract class TokenUserProvider extends TokenProvider implements UserProviderInterface
{
public abstract function getUser($key);
abstract public function getUser($key);
}

View File

@@ -117,7 +117,7 @@ class Accessory extends Product
$loopResult = parent::exec($pagination);
foreach($loopResult as $loopResultRow) {
foreach ($loopResult as $loopResultRow) {
$accessoryProductId = $loopResultRow->get('ID');

View File

@@ -112,7 +112,7 @@ class Address extends BaseLoop
if ($default === true) {
$search->filterByIsDefault(1, Criteria::EQUAL);
} else if($default === false) {
} elseif ($default === false) {
$search->filterByIsDefault(0, Criteria::EQUAL);
}

View File

@@ -60,10 +60,10 @@ class Argument
{
$x = $value === null;
if($value === null) {
if ($value === null) {
$this->value = null;
} else {
if(false === $value) {
if (false === $value) {
/* (string) $value = "" */
$this->value = 0;
} else {

View File

@@ -159,7 +159,7 @@ class AssociatedContent extends Content
$loopResult = parent::exec($pagination);
foreach($loopResult as $loopResultRow) {
foreach ($loopResult as $loopResultRow) {
$relatedContentId = $loopResultRow->get('ID');

View File

@@ -31,17 +31,12 @@ use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\Base\CategoryQuery;
use Thelia\Model\Base\ProductCategoryQuery;
use Thelia\Model\Base\AttributeQuery;
use Thelia\Model\Map\ProductCategoryTableMap;
use Thelia\Type\TypeCollection;
use Thelia\Type;
use Thelia\Type\BooleanOrBothType;
use Thelia\Model\ProductQuery;
use Thelia\Model\TemplateQuery;
use Thelia\Model\AttributeTemplateQuery;
use Thelia\Core\Translation\Translator;
use Thelia\Model\Map\AttributeTemplateTableMap;
/**
*
@@ -121,7 +116,7 @@ class Attribute extends BaseI18nLoop
// Create template array
if ($template == null) $template = array();
foreach($products as $product) {
foreach ($products as $product) {
$tpl_id = $product->getTemplateId();
if (! is_null($tpl_id)) $template[] = $tpl_id;
@@ -138,8 +133,7 @@ class Attribute extends BaseI18nLoop
;
$use_attribute_pos = false;
}
else if (null !== $exclude_template) {
} elseif (null !== $exclude_template) {
// Join with attribute_template table to get position
$exclude_attributes = AttributeTemplateQuery::create()->filterByTemplateId($exclude_template)->select('attribute_id')->find();

View File

@@ -37,7 +37,6 @@ use Thelia\Coupon\Type\CouponInterface;
use Thelia\Model\Coupon as MCoupon;
use Thelia\Model\CouponQuery;
use Thelia\Type;
use Thelia\Type\BooleanOrBothType;
/**
* Created by JetBrains PhpStorm.

View File

@@ -57,9 +57,9 @@ class Delivery extends BaseSpecificModule
$search->filterByType(BaseModule::DELIVERY_MODULE_TYPE, Criteria::EQUAL);
$countryId = $this->getCountry();
if(null !== $countryId) {
if (null !== $countryId) {
$country = CountryQuery::create()->findPk($countryId);
if(null === $country) {
if (null === $country) {
throw new \InvalidArgumentException('Cannot found country id: `' . $countryId . '` in delivery loop');
}
} else {

View File

@@ -265,8 +265,7 @@ class Document extends BaseI18nLoop
;
$loopResult->addRow($loopResultRow);
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
// Ignore the result and log an error
Tlog::getInstance()->addError("Failed to process document in document loop: ", $this->args);
}

View File

@@ -31,11 +31,8 @@ use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\CategoryQuery;
use Thelia\Model\FeatureI18nQuery;
use Thelia\Model\ProductCategoryQuery;
use Thelia\Model\FeatureQuery;
use Thelia\Model\Map\ProductCategoryTableMap;
use Thelia\Model\ProductQuery;
use Thelia\Type\TypeCollection;
use Thelia\Type;
@@ -124,7 +121,7 @@ class Feature extends BaseI18nLoop
// Create template array
if ($template == null) $template = array();
foreach($products as $product) {
foreach ($products as $product) {
$tpl_id = $product->getTemplateId();
if (! is_null($tpl_id)) $template[] = $tpl_id;
@@ -164,7 +161,7 @@ class Feature extends BaseI18nLoop
->select('id')
->find();
if($features) {
if ($features) {
$search->filterById(
$features,
Criteria::IN
@@ -204,7 +201,6 @@ class Feature extends BaseI18nLoop
}
/* perform search */
$features = $this->search($search, $pagination);

View File

@@ -318,8 +318,7 @@ class Image extends BaseI18nLoop
;
$loopResult->addRow($loopResultRow);
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
// Ignore the result and log an error
Tlog::getInstance()->addError("Failed to process image in image loop: ", $this->args);
}

View File

@@ -103,7 +103,7 @@ class Module extends BaseI18nLoop
$active = $this->getActive();
if($active !== Type\BooleanOrBothType::ANY) {
if ($active !== Type\BooleanOrBothType::ANY) {
$search->filterByActivate($active ? 1 : 0, Criteria::EQUAL);
}

View File

@@ -31,10 +31,7 @@ use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\AddressQuery;
use Thelia\Model\OrderAddressQuery;
use Thelia\Type\TypeCollection;
use Thelia\Type;
/**
*

View File

@@ -31,13 +31,7 @@ use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Exception\TaxEngineException;
use Thelia\Model\Base\OrderProductQuery;
use Thelia\Model\CountryQuery;
use Thelia\Model\CurrencyQuery;
use Thelia\Model\Map\OrderProductTableMap;
use Thelia\Type\TypeCollection;
use Thelia\Type;
/**
*
@@ -76,7 +70,6 @@ class OrderProduct extends BaseLoop
->withColumn('SUM(`opt`.PROMO_AMOUNT)', 'TOTAL_PROMO_TAX')
->groupById();
$order = $this->getOrder();
$search->filterByOrderId($order, Criteria::EQUAL);

View File

@@ -32,8 +32,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\Base\OrderProductAttributeCombinationQuery;
use Thelia\Model\Map\AttributeAvTableMap;
use Thelia\Model\Map\AttributeTableMap;
use Thelia\Type\TypeCollection;
use Thelia\Type;

View File

@@ -25,7 +25,6 @@ namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Module\BaseModule;
/**

View File

@@ -138,9 +138,9 @@ class Product extends BaseI18nLoop
public function exec(&$pagination)
{
$currencyId = $this->getCurrency();
if(null !== $currencyId) {
if (null !== $currencyId) {
$currency = CurrencyQuery::create()->findOneById($currencyId);
if(null === $currency) {
if (null === $currency) {
throw new \InvalidArgumentException('Cannot found currency id: `' . $currency . '` in product_sale_elements loop');
}
} else {
@@ -610,7 +610,7 @@ class Product extends BaseI18nLoop
$taxedPrice = $product->getTaxedPrice(
$taxCountry
);
} catch(TaxEngineException $e) {
} catch (TaxEngineException $e) {
$taxedPrice = null;
}

View File

@@ -158,7 +158,7 @@ class ProductSaleElements extends BaseLoop
$taxedPrice = $PSEValue->getTaxedPrice(
$taxCountry
);
} catch(TaxEngineException $e) {
} catch (TaxEngineException $e) {
$taxedPrice = null;
}
$promoPrice = $PSEValue->getPromoPrice();
@@ -166,7 +166,7 @@ class ProductSaleElements extends BaseLoop
$taxedPromoPrice = $PSEValue->getTaxedPromoPrice(
$taxCountry
);
} catch(TaxEngineException $e) {
} catch (TaxEngineException $e) {
$taxedPromoPrice = null;
}

View File

@@ -132,4 +132,4 @@ class TaxRule extends BaseI18nLoop
return $loopResult;
}
}
}

View File

@@ -31,13 +31,8 @@ use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\Base\CategoryQuery;
use Thelia\Model\Base\ProductCategoryQuery;
use Thelia\Model\Base\TemplateQuery;
use Thelia\Model\Map\ProductCategoryTableMap;
use Thelia\Type\TypeCollection;
use Thelia\Type;
use Thelia\Type\BooleanOrBothType;
/**
*
@@ -111,4 +106,4 @@ class Template extends BaseI18nLoop
return $loopResult;
}
}
}

View File

@@ -162,14 +162,14 @@ class DataAccessFunctions extends AbstractSmartyPlugin
public function countryDataAccess($params, $smarty)
{
if(array_key_exists('defaultCountry', self::$dataAccessCache)) {
if (array_key_exists('defaultCountry', self::$dataAccessCache)) {
$defaultCountry = self::$dataAccessCache['defaultCountry'];
} else {
$defaultCountry = CountryQuery::create()->findOneByByDefault(1);
self::$dataAccessCache['defaultCountry'] = $defaultCountry;
}
switch($params["attr"]) {
switch ($params["attr"]) {
case "default":
return $defaultCountry->getId();
}
@@ -177,7 +177,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
public function cartDataAccess($params, $smarty)
{
if(array_key_exists('currentCountry', self::$dataAccessCache)) {
if (array_key_exists('currentCountry', self::$dataAccessCache)) {
$currentCountry = self::$dataAccessCache['currentCountry'];
} else {
$currentCountry = CountryQuery::create()->findOneById(64); // @TODO : make it magic
@@ -186,7 +186,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
$cart = $this->getCart($this->request);
$result = "";
switch($params["attr"]) {
switch ($params["attr"]) {
case "count_item":
$result = $cart->getCartItems()->count();
break;
@@ -205,7 +205,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
{
$order = $this->request->getSession()->getOrder();
$attribute = $this->getNormalizedParam($params, array('attribute', 'attrib', 'attr'));
switch($attribute) {
switch ($attribute) {
case 'postage':
return $order->getPostage();
case 'delivery_address':
@@ -246,7 +246,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
*/
protected function dataAccessWithI18n($objectLabel, $params, ModelCriteria $search, $columns = array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), $foreignTable = null, $foreignKey = 'ID')
{
if(array_key_exists('data_' . $objectLabel, self::$dataAccessCache)) {
if (array_key_exists('data_' . $objectLabel, self::$dataAccessCache)) {
$data = self::$dataAccessCache['data_' . $objectLabel];
} else {
$lang = $this->getNormalizedParam($params, array('lang'));
@@ -332,7 +332,6 @@ class DataAccessFunctions extends AbstractSmartyPlugin
*/
public function getPluginDescriptors()
{
return array(
new SmartyPluginDescriptor('function', 'admin', $this, 'adminDataAccess'),
new SmartyPluginDescriptor('function', 'customer', $this, 'customerDataAccess'),

View File

@@ -22,13 +22,9 @@
/*************************************************************************************/
namespace Thelia\Core\Template\Smarty\Plugins;
use Symfony\Component\Form\FormView;
use Thelia\Form\BaseForm;
use Thelia\Core\Template\Element\Exception\ElementNotFoundException;
use Symfony\Component\HttpFoundation\Request;
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Core\Template\ParserContext;
/**
* Created by JetBrains PhpStorm.

View File

@@ -168,8 +168,7 @@ $val = $value[$key];
$this->assignFieldValues($template, $name, $val, $formFieldView->vars);
}
}
}
else {
} else {
$this->assignFieldValues($template, $formFieldView->vars["full_name"], $fieldVars["value"], $formFieldView->vars);
}
*/

View File

@@ -46,9 +46,9 @@ class Security extends AbstractSmartyPlugin
/**
* Process security check function
*
* @param array $params
* @param unknown $smarty
* @return string no text is returned.
* @param array $params
* @param unknown $smarty
* @return string no text is returned.
* @throws \Thelia\Core\Security\Exception\AuthenticationException
*/
public function checkAuthFunction($params, &$smarty)
@@ -79,7 +79,7 @@ class Security extends AbstractSmartyPlugin
public function checkCartNotEmptyFunction($params, &$smarty)
{
$cart = $this->request->getSession()->getCart();
if($cart===null || $cart->countCartItems() == 0) {
if ($cart===null || $cart->countCartItems() == 0) {
throw new OrderException('Cart must not be empty', OrderException::CART_EMPTY, array('empty' => 1));
}
@@ -90,11 +90,11 @@ class Security extends AbstractSmartyPlugin
{
$order = $this->request->getSession()->getOrder();
/* Does address and module still exists ? We assume address owner can't change neither module type */
if($order !== null) {
if ($order !== null) {
$checkAddress = AddressQuery::create()->findPk($order->chosenDeliveryAddress);
$checkModule = ModuleQuery::create()->findPk($order->getDeliveryModuleId());
}
if(null === $order || null == $checkAddress || null === $checkModule) {
if (null === $order || null == $checkAddress || null === $checkModule) {
throw new OrderException('Delivery must be defined', OrderException::UNDEFINED_DELIVERY, array('missing' => 1));
}

View File

@@ -247,6 +247,7 @@ class TheliaLoop extends AbstractSmartyPlugin
// Find pagination
$pagination = self::getPagination($loopName);
if ($pagination === null) { // loop gas no result
return '';
}

View File

@@ -23,26 +23,20 @@
namespace Thelia\Core\Template\Smarty\Plugins;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Core\Security\SecurityContext;
use Thelia\Core\Security\Exception\AuthenticationException;
use Thelia\Exception\OrderException;
use Thelia\Model\AddressQuery;
use Thelia\Model\ModuleQuery;
class Type extends AbstractSmartyPlugin
{
public function assertTypeModifier($value, $option)
{
$typeClass = "\\Thelia\\Type\\$option";
if(!class_exists($typeClass)) {
if (!class_exists($typeClass)) {
throw new \InvalidArgumentException(sprintf("Invalid type name `%s` in `assertType` modifier", $option));
}
$typeInstance = new $typeClass();
if(!$typeInstance->isValid($value)) {
if (!$typeInstance->isValid($value)) {
return '';
}

View File

@@ -55,11 +55,9 @@ class UrlGenerator extends AbstractSmartyPlugin
if ($file !== null) {
$path = $file;
$mode = URL::PATH_TO_FILE;
}
else if ($path !== null) {
} elseif ($path !== null) {
$mode = URL::WITH_INDEX_PAGE;
}
else {
} else {
throw \InvalidArgumentException(Translator::getInstance()->trans("Please specify either 'path' or 'file' parameter in {url} function."));
}
@@ -74,7 +72,6 @@ class UrlGenerator extends AbstractSmartyPlugin
if ($noamp == null) $url = str_replace('&', '&amp;', $url);
if ($target != null) $url .= '#'.$target;
return $url;
}

View File

@@ -87,7 +87,6 @@ class Thelia extends Kernel
$con->useDebug(true);
}
}
/**

View File

@@ -148,7 +148,7 @@ class TheliaHttpKernel extends HttpKernel
$currency = null;
if ($request->query->has("currency")) {
$currency = Model\CurrencyQuery::create()->findOneByCode($request->query->get("currency"));
if($currency) {
if ($currency) {
$this->container->get("event_dispatcher")->dispatch(TheliaEvents::CHANGE_DEFAULT_CURRENCY, new CurrencyEvent($currency));
}
} else {