- * $obj = $c->findPk(12, $con);
+ * $obj = $c->findPk(array(12, 34), $con);
*
*
- * @param mixed $key Primary key to use for the query
+ * @param array[$product_sale_elements_id, $currency_id] $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildProductPrice|array|mixed the result, formatted by the current formatter
@@ -127,7 +123,7 @@ abstract class ProductPriceQuery extends ModelCriteria
if ($key === null) {
return null;
}
- if ((null !== ($obj = ProductPriceTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ if ((null !== ($obj = ProductPriceTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
@@ -155,10 +151,11 @@ abstract class ProductPriceQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
- $sql = 'SELECT ID, PRODUCT_SALE_ELEMENTS_ID, CURRENCY_ID, PRICE, PROMO_PRICE, CREATED_AT, UPDATED_AT FROM product_price WHERE ID = :p0';
+ $sql = 'SELECT PRODUCT_SALE_ELEMENTS_ID, CURRENCY_ID, PRICE, PROMO_PRICE, CREATED_AT, UPDATED_AT FROM product_price WHERE PRODUCT_SALE_ELEMENTS_ID = :p0 AND CURRENCY_ID = :p1';
try {
$stmt = $con->prepare($sql);
- $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
@@ -168,7 +165,7 @@ abstract class ProductPriceQuery extends ModelCriteria
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildProductPrice();
$obj->hydrate($row);
- ProductPriceTableMap::addInstanceToPool($obj, (string) $key);
+ ProductPriceTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
}
$stmt->closeCursor();
@@ -197,7 +194,7 @@ abstract class ProductPriceQuery extends ModelCriteria
/**
* Find objects by primary key
*
- * $objs = $c->findPks(array(12, 56, 832), $con);
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
*
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
@@ -227,8 +224,10 @@ abstract class ProductPriceQuery extends ModelCriteria
*/
public function filterByPrimaryKey($key)
{
+ $this->addUsingAlias(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(ProductPriceTableMap::CURRENCY_ID, $key[1], Criteria::EQUAL);
- return $this->addUsingAlias(ProductPriceTableMap::ID, $key, Criteria::EQUAL);
+ return $this;
}
/**
@@ -240,49 +239,17 @@ abstract class ProductPriceQuery extends ModelCriteria
*/
public function filterByPrimaryKeys($keys)
{
-
- return $this->addUsingAlias(ProductPriceTableMap::ID, $keys, Criteria::IN);
- }
-
- /**
- * Filter the query on the id column
- *
- * Example usage:
- *
- * $query->filterById(1234); // WHERE id = 1234
- * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
- * $query->filterById(array('min' => 12)); // WHERE id > 12
- *
- *
- * @param mixed $id The value to use as filter.
- * Use scalar values for equality.
- * Use array values for in_array() equivalent.
- * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return ChildProductPriceQuery The current query, for fluid interface
- */
- public function filterById($id = null, $comparison = null)
- {
- if (is_array($id)) {
- $useMinMax = false;
- if (isset($id['min'])) {
- $this->addUsingAlias(ProductPriceTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($id['max'])) {
- $this->addUsingAlias(ProductPriceTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(ProductPriceTableMap::CURRENCY_ID, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
}
- return $this->addUsingAlias(ProductPriceTableMap::ID, $id, $comparison);
+ return $this;
}
/**
@@ -699,7 +666,9 @@ abstract class ProductPriceQuery extends ModelCriteria
public function prune($productPrice = null)
{
if ($productPrice) {
- $this->addUsingAlias(ProductPriceTableMap::ID, $productPrice->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond0', $this->getAliasedColName(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID), $productPrice->getProductSaleElementsId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(ProductPriceTableMap::CURRENCY_ID), $productPrice->getCurrencyId(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
diff --git a/core/lib/Thelia/Model/Base/ProductSaleElements.php b/core/lib/Thelia/Model/Base/ProductSaleElements.php
index f79d9a246..4c14580ff 100644
--- a/core/lib/Thelia/Model/Base/ProductSaleElements.php
+++ b/core/lib/Thelia/Model/Base/ProductSaleElements.php
@@ -2248,7 +2248,10 @@ abstract class ProductSaleElements implements ActiveRecordInterface
$productPricesToDelete = $this->getProductPrices(new Criteria(), $con)->diff($productPrices);
- $this->productPricesScheduledForDeletion = $productPricesToDelete;
+ //since at least one column in the foreign key is at the same time a PK
+ //we can not just set a PK to NULL in the lines below. We have to store
+ //a backup of all values, so we are able to manipulate these items based on the onDelete value later.
+ $this->productPricesScheduledForDeletion = clone $productPricesToDelete;
foreach ($productPricesToDelete as $productPriceRemoved) {
$productPriceRemoved->setProductSaleElements(null);
diff --git a/core/lib/Thelia/Model/ConfigQuery.php b/core/lib/Thelia/Model/ConfigQuery.php
index 87b506e93..ced3783fe 100755
--- a/core/lib/Thelia/Model/ConfigQuery.php
+++ b/core/lib/Thelia/Model/ConfigQuery.php
@@ -42,4 +42,9 @@ class ConfigQuery extends BaseConfigQuery {
{
return self::read('active-template', 'default');
}
+
+ public static function useTaxFreeAmounts()
+ {
+ return self::read('use_tax_free_amounts', 'default') == 1;
+ }
} // ConfigQuery
diff --git a/core/lib/Thelia/Model/Currency.php b/core/lib/Thelia/Model/Currency.php
index 843211d5a..6ec452456 100755
--- a/core/lib/Thelia/Model/Currency.php
+++ b/core/lib/Thelia/Model/Currency.php
@@ -2,6 +2,7 @@
namespace Thelia\Model;
+use Propel\Runtime\Exception\PropelException;
use Thelia\Model\Base\Currency as BaseCurrency;
use Thelia\Core\Event\TheliaEvents;
use Propel\Runtime\Connection\ConnectionInterface;
@@ -80,4 +81,19 @@ class Currency extends BaseCurrency {
{
$this->dispatchEvent(TheliaEvents::AFTER_DELETECURRENCY, new CurrencyEvent($this));
}
+
+ /**
+ * Get the [rate] column value.
+ *
+ * @return double
+ * @throws PropelException
+ */
+ public function getRate()
+ {
+ if(false === filter_var($this->rate, FILTER_VALIDATE_FLOAT)) {
+ throw new PropelException('Currency::rate is not float value');
+ }
+
+ return $this->rate;
+ }
}
\ No newline at end of file
diff --git a/core/lib/Thelia/Model/Map/ProductPriceTableMap.php b/core/lib/Thelia/Model/Map/ProductPriceTableMap.php
index 1a6274e2d..86a22b680 100644
--- a/core/lib/Thelia/Model/Map/ProductPriceTableMap.php
+++ b/core/lib/Thelia/Model/Map/ProductPriceTableMap.php
@@ -57,7 +57,7 @@ class ProductPriceTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 7;
+ const NUM_COLUMNS = 6;
/**
* The number of lazy-loaded columns
@@ -67,12 +67,7 @@ class ProductPriceTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 7;
-
- /**
- * the column name for the ID field
- */
- const ID = 'product_price.ID';
+ const NUM_HYDRATE_COLUMNS = 6;
/**
* the column name for the PRODUCT_SALE_ELEMENTS_ID field
@@ -116,12 +111,12 @@ class ProductPriceTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'ProductSaleElementsId', 'CurrencyId', 'Price', 'PromoPrice', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'productSaleElementsId', 'currencyId', 'price', 'promoPrice', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(ProductPriceTableMap::ID, ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID, ProductPriceTableMap::CURRENCY_ID, ProductPriceTableMap::PRICE, ProductPriceTableMap::PROMO_PRICE, ProductPriceTableMap::CREATED_AT, ProductPriceTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('ID', 'PRODUCT_SALE_ELEMENTS_ID', 'CURRENCY_ID', 'PRICE', 'PROMO_PRICE', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('id', 'product_sale_elements_id', 'currency_id', 'price', 'promo_price', 'created_at', 'updated_at', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
+ self::TYPE_PHPNAME => array('ProductSaleElementsId', 'CurrencyId', 'Price', 'PromoPrice', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('productSaleElementsId', 'currencyId', 'price', 'promoPrice', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID, ProductPriceTableMap::CURRENCY_ID, ProductPriceTableMap::PRICE, ProductPriceTableMap::PROMO_PRICE, ProductPriceTableMap::CREATED_AT, ProductPriceTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('PRODUCT_SALE_ELEMENTS_ID', 'CURRENCY_ID', 'PRICE', 'PROMO_PRICE', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('product_sale_elements_id', 'currency_id', 'price', 'promo_price', 'created_at', 'updated_at', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
);
/**
@@ -131,12 +126,12 @@ class ProductPriceTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'ProductSaleElementsId' => 1, 'CurrencyId' => 2, 'Price' => 3, 'PromoPrice' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'productSaleElementsId' => 1, 'currencyId' => 2, 'price' => 3, 'promoPrice' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
- self::TYPE_COLNAME => array(ProductPriceTableMap::ID => 0, ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID => 1, ProductPriceTableMap::CURRENCY_ID => 2, ProductPriceTableMap::PRICE => 3, ProductPriceTableMap::PROMO_PRICE => 4, ProductPriceTableMap::CREATED_AT => 5, ProductPriceTableMap::UPDATED_AT => 6, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'PRODUCT_SALE_ELEMENTS_ID' => 1, 'CURRENCY_ID' => 2, 'PRICE' => 3, 'PROMO_PRICE' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'product_sale_elements_id' => 1, 'currency_id' => 2, 'price' => 3, 'promo_price' => 4, 'created_at' => 5, 'updated_at' => 6, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
+ self::TYPE_PHPNAME => array('ProductSaleElementsId' => 0, 'CurrencyId' => 1, 'Price' => 2, 'PromoPrice' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
+ self::TYPE_STUDLYPHPNAME => array('productSaleElementsId' => 0, 'currencyId' => 1, 'price' => 2, 'promoPrice' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
+ self::TYPE_COLNAME => array(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID => 0, ProductPriceTableMap::CURRENCY_ID => 1, ProductPriceTableMap::PRICE => 2, ProductPriceTableMap::PROMO_PRICE => 3, ProductPriceTableMap::CREATED_AT => 4, ProductPriceTableMap::UPDATED_AT => 5, ),
+ self::TYPE_RAW_COLNAME => array('PRODUCT_SALE_ELEMENTS_ID' => 0, 'CURRENCY_ID' => 1, 'PRICE' => 2, 'PROMO_PRICE' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
+ self::TYPE_FIELDNAME => array('product_sale_elements_id' => 0, 'currency_id' => 1, 'price' => 2, 'promo_price' => 3, 'created_at' => 4, 'updated_at' => 5, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
);
/**
@@ -153,11 +148,10 @@ class ProductPriceTableMap extends TableMap
$this->setPhpName('ProductPrice');
$this->setClassName('\\Thelia\\Model\\ProductPrice');
$this->setPackage('Thelia.Model');
- $this->setUseIdGenerator(true);
+ $this->setUseIdGenerator(false);
// columns
- $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
- $this->addForeignKey('PRODUCT_SALE_ELEMENTS_ID', 'ProductSaleElementsId', 'INTEGER', 'product_sale_elements', 'ID', true, null, null);
- $this->addForeignKey('CURRENCY_ID', 'CurrencyId', 'INTEGER', 'currency', 'ID', true, null, null);
+ $this->addForeignPrimaryKey('PRODUCT_SALE_ELEMENTS_ID', 'ProductSaleElementsId', 'INTEGER' , 'product_sale_elements', 'ID', true, null, null);
+ $this->addForeignPrimaryKey('CURRENCY_ID', 'CurrencyId', 'INTEGER' , 'currency', 'ID', true, null, null);
$this->addColumn('PRICE', 'Price', 'FLOAT', true, null, null);
$this->addColumn('PROMO_PRICE', 'PromoPrice', 'FLOAT', false, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
@@ -186,6 +180,59 @@ class ProductPriceTableMap extends TableMap
);
} // getBehaviors()
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by find*()
+ * and findPk*() calls.
+ *
+ * @param \Thelia\Model\ProductPrice $obj A \Thelia\Model\ProductPrice object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (null === $key) {
+ $key = serialize(array((string) $obj->getProductSaleElementsId(), (string) $obj->getCurrencyId()));
+ } // if key === null
+ self::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A \Thelia\Model\ProductPrice object or a primary key value.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && null !== $value) {
+ if (is_object($value) && $value instanceof \Thelia\Model\ProductPrice) {
+ $key = serialize(array((string) $value->getProductSaleElementsId(), (string) $value->getCurrencyId()));
+
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key";
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } elseif ($value instanceof Criteria) {
+ self::$instances = [];
+
+ return;
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\ProductPrice object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
+ throw $e;
+ }
+
+ unset(self::$instances[$key]);
+ }
+ }
+
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
@@ -200,11 +247,11 @@ class ProductPriceTableMap extends TableMap
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
// If the PK cannot be derived from the row, return NULL.
- if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
+ if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('ProductSaleElementsId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('CurrencyId', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
- return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('ProductSaleElementsId', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('CurrencyId', TableMap::TYPE_PHPNAME, $indexType)]));
}
/**
@@ -222,11 +269,7 @@ class ProductPriceTableMap extends TableMap
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
- return (int) $row[
- $indexType == TableMap::TYPE_NUM
- ? 0 + $offset
- : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
- ];
+ return $pks;
}
/**
@@ -324,7 +367,6 @@ class ProductPriceTableMap extends TableMap
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
- $criteria->addSelectColumn(ProductPriceTableMap::ID);
$criteria->addSelectColumn(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID);
$criteria->addSelectColumn(ProductPriceTableMap::CURRENCY_ID);
$criteria->addSelectColumn(ProductPriceTableMap::PRICE);
@@ -332,7 +374,6 @@ class ProductPriceTableMap extends TableMap
$criteria->addSelectColumn(ProductPriceTableMap::CREATED_AT);
$criteria->addSelectColumn(ProductPriceTableMap::UPDATED_AT);
} else {
- $criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.PRODUCT_SALE_ELEMENTS_ID');
$criteria->addSelectColumn($alias . '.CURRENCY_ID');
$criteria->addSelectColumn($alias . '.PRICE');
@@ -390,7 +431,17 @@ class ProductPriceTableMap extends TableMap
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(ProductPriceTableMap::DATABASE_NAME);
- $criteria->add(ProductPriceTableMap::ID, (array) $values, Criteria::IN);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(ProductPriceTableMap::CURRENCY_ID, $value[1]));
+ $criteria->addOr($criterion);
+ }
}
$query = ProductPriceQuery::create()->mergeWith($criteria);
@@ -436,10 +487,6 @@ class ProductPriceTableMap extends TableMap
$criteria = $criteria->buildCriteria(); // build Criteria from ProductPrice object
}
- if ($criteria->containsKey(ProductPriceTableMap::ID) && $criteria->keyContainsValue(ProductPriceTableMap::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.ProductPriceTableMap::ID.')');
- }
-
// Set the correct dbName
$query = ProductPriceQuery::create()->mergeWith($criteria);
diff --git a/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php b/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php
index 5e5dae010..c7426ef71 100755
--- a/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php
+++ b/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php
@@ -110,7 +110,7 @@ class ModelCriteriaTools
{
// If a lang has been requested, find the related Lang object, and get the locale
if ($requestedLangId !== null) {
- $localeSearch = LangQuery::create()->findOneById($requestedLangId);
+ $localeSearch = LangQuery::create()->findPk($requestedLangId);
if ($localeSearch === null) {
throw new \InvalidArgumentException(sprintf('Incorrect lang argument given : lang ID %d not found', $requestedLangId));
diff --git a/core/lib/Thelia/Module/BaseModule.php b/core/lib/Thelia/Module/BaseModule.php
index 145da3c02..9d76e08f3 100755
--- a/core/lib/Thelia/Module/BaseModule.php
+++ b/core/lib/Thelia/Module/BaseModule.php
@@ -46,9 +46,10 @@ abstract class BaseModule extends ContainerAware
public function getContainer()
{
- if($this->hasContainer() === false) {
+ if ($this->hasContainer() === false) {
throw new \RuntimeException("Sorry, container his not available in this context");
}
+
return $this->container;
}
diff --git a/core/lib/Thelia/Module/BaseModuleInterface.php b/core/lib/Thelia/Module/BaseModuleInterface.php
index 2db450830..5cfd98409 100644
--- a/core/lib/Thelia/Module/BaseModuleInterface.php
+++ b/core/lib/Thelia/Module/BaseModuleInterface.php
@@ -23,15 +23,14 @@
namespace Thelia\Module;
-
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
-interface BaseModuleInterface {
-
+interface BaseModuleInterface
+{
public function setRequest(Request $request);
public function getRequest();
public function setDispatcher(EventDispatcherInterface $dispatcher);
public function getDispatcher();
-}
\ No newline at end of file
+}
diff --git a/core/lib/Thelia/Module/DeliveryModuleInterface.php b/core/lib/Thelia/Module/DeliveryModuleInterface.php
index b8ffcfc01..ba218ac4d 100644
--- a/core/lib/Thelia/Module/DeliveryModuleInterface.php
+++ b/core/lib/Thelia/Module/DeliveryModuleInterface.php
@@ -23,9 +23,8 @@
namespace Thelia\Module;
-
-interface DeliveryModuleInterface extends BaseModuleInterface {
-
+interface DeliveryModuleInterface extends BaseModuleInterface
+{
/**
*
* calculate and return delivery price
@@ -33,4 +32,4 @@ interface DeliveryModuleInterface extends BaseModuleInterface {
* @return mixed
*/
public function calculate($country = null);
-}
\ No newline at end of file
+}
diff --git a/core/lib/Thelia/Tests/Action/AddressTest.php b/core/lib/Thelia/Tests/Action/AddressTest.php
index 68fc97923..69f5b5329 100644
--- a/core/lib/Thelia/Tests/Action/AddressTest.php
+++ b/core/lib/Thelia/Tests/Action/AddressTest.php
@@ -26,7 +26,6 @@ use Thelia\Action\Address;
use Thelia\Core\Event\AddressCreateOrUpdateEvent;
use Thelia\Model\Base\CustomerQuery;
-
/**
*
* test address eventListener
@@ -120,7 +119,6 @@ class AddressTest extends \PHPUnit_Framework_TestCase
$actionAddress = new Address($this->getContainer());
$actionAddress->update($addressEvent);
-
$updatedAddress = $addressEvent->getAddress();
$this->assertInstanceOf("Thelia\Model\Address", $updatedAddress);
$this->assertFalse($updatedAddress->isNew());
@@ -142,4 +140,4 @@ class AddressTest extends \PHPUnit_Framework_TestCase
}
-}
\ No newline at end of file
+}
diff --git a/core/lib/Thelia/Tests/Action/ImageTest.php b/core/lib/Thelia/Tests/Action/ImageTest.php
index 8cc6e5644..f08da25b9 100755
--- a/core/lib/Thelia/Tests/Action/ImageTest.php
+++ b/core/lib/Thelia/Tests/Action/ImageTest.php
@@ -30,7 +30,6 @@ use Thelia\Core\HttpFoundation\Session\Session;
use Thelia\Action\Image;
use Thelia\Core\Event\ImageEvent;
use Thelia\Model\ConfigQuery;
-use Thelia\Tools\URL;
/**
* Class ImageTest
@@ -78,7 +77,8 @@ class ImageTest extends \Thelia\Tests\TestCaseWithURLToolSetup
}
}
- public static function setUpBeforeClass() {
+ public static function setUpBeforeClass()
+ {
$dir = THELIA_WEB_DIR."/cache/tests";
if ($dh = @opendir($dir)) {
while ($file = readdir($dh)) {
@@ -91,7 +91,8 @@ class ImageTest extends \Thelia\Tests\TestCaseWithURLToolSetup
}
}
- public function tearDown() {
+ public function tearDown()
+ {
// restore cache configuration.
$config = ConfigQuery::create()->filterByName('image_cache_dir_from_web_root')->findOne();
@@ -249,7 +250,6 @@ class ImageTest extends \Thelia\Tests\TestCaseWithURLToolSetup
$image->processImage($event);
}
-
/**
* Apply all transformations
*/
@@ -343,7 +343,8 @@ class ImageTest extends \Thelia\Tests\TestCaseWithURLToolSetup
$image->processImage($event);
}
- public function testClearTestsCache() {
+ public function testClearTestsCache()
+ {
$event = new ImageEvent($this->request);
$event->setCacheSubdirectory('tests');
@@ -353,7 +354,8 @@ class ImageTest extends \Thelia\Tests\TestCaseWithURLToolSetup
$image->clearCache($event);
}
- public function testClearWholeCache() {
+ public function testClearWholeCache()
+ {
$event = new ImageEvent($this->request);
$image = new Image($this->getContainer());
@@ -366,7 +368,8 @@ class ImageTest extends \Thelia\Tests\TestCaseWithURLToolSetup
*
* @expectedException \InvalidArgumentException
*/
- public function testClearUnallowedPathCache() {
+ public function testClearUnallowedPathCache()
+ {
$event = new ImageEvent($this->request);
$event->setCacheSubdirectory('../../../..');
@@ -375,4 +378,4 @@ class ImageTest extends \Thelia\Tests\TestCaseWithURLToolSetup
$image->clearCache($event);
}
-}
\ No newline at end of file
+}
diff --git a/core/lib/Thelia/Tests/Command/CacheClearTest.php b/core/lib/Thelia/Tests/Command/CacheClearTest.php
index 741fad299..00d54cb3b 100755
--- a/core/lib/Thelia/Tests/Command/CacheClearTest.php
+++ b/core/lib/Thelia/Tests/Command/CacheClearTest.php
@@ -97,8 +97,7 @@ class CacheClearTest extends \PHPUnit_Framework_TestCase
"command" => $command->getName(),
"--env" => "test"
));
- }
- else {
+ } else {
throw new \RuntimeException("");
}
}
diff --git a/core/lib/Thelia/Tests/Constraint/ConstraintFactoryTest.php b/core/lib/Thelia/Tests/Constraint/ConstraintFactoryTest.php
index 70d6e498c..ccc04fbfc 100644
--- a/core/lib/Thelia/Tests/Constraint/ConstraintFactoryTest.php
+++ b/core/lib/Thelia/Tests/Constraint/ConstraintFactoryTest.php
@@ -130,7 +130,6 @@ class ConstraintFactoryTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected, $actual);
}
-
/**
* Check the Rules serialization module
*/
@@ -180,8 +179,8 @@ class ConstraintFactoryTest extends \PHPUnit_Framework_TestCase
$serializedRules = $constraintFactory->serializeCouponRuleCollection($rules);
$unserializedRules = $constraintFactory->unserializeCouponRuleCollection($serializedRules);
- $expected = (string)$rules;
- $actual = (string)$unserializedRules;
+ $expected = (string) $rules;
+ $actual = (string) $unserializedRules;
$this->assertEquals($expected, $actual);
}
diff --git a/core/lib/Thelia/Tests/Constraint/ConstraintValidatorTest.php b/core/lib/Thelia/Tests/Constraint/ConstraintValidatorTest.php
index 28ac4b952..01e9dde69 100644
--- a/core/lib/Thelia/Tests/Constraint/ConstraintValidatorTest.php
+++ b/core/lib/Thelia/Tests/Constraint/ConstraintValidatorTest.php
@@ -76,7 +76,6 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
AvailableForTotalAmountManager::INPUT2 => 'EUR');
$rule1->setValidatorsFromForm($operators, $values);
-
$rules = new CouponRuleCollection();
$rules->add($rule1);
@@ -111,7 +110,6 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
AvailableForTotalAmountManager::INPUT2 => 'EUR');
$rule1->setValidatorsFromForm($operators, $values);
-
$rules = new CouponRuleCollection();
$rules->add($rule1);
@@ -216,7 +214,6 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected, $actual, 'Constraints validator always think Customer is matching rules');
}
-
public function testVariableOpComparisonSuccess()
{
$ConstraintValidator = new ConstraintValidator();
diff --git a/core/lib/Thelia/Tests/Constraint/Rule/AvailableForTotalAmountTest.php b/core/lib/Thelia/Tests/Constraint/Rule/AvailableForTotalAmountTest.php
index bfcde8a21..4c6da4ad2 100644
--- a/core/lib/Thelia/Tests/Constraint/Rule/AvailableForTotalAmountTest.php
+++ b/core/lib/Thelia/Tests/Constraint/Rule/AvailableForTotalAmountTest.php
@@ -151,7 +151,6 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
// $this->assertEquals($expected, $actual);
// }
-
/**
* Check if test inferior operator is working
*
@@ -512,7 +511,6 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected, $actual);
}
-
/**
* Check if test superior operator is working
*
@@ -585,7 +583,6 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected, $actual);
}
-
/**
* Check currency is checked
*
@@ -658,7 +655,6 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected, $actual);
}
-
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
diff --git a/core/lib/Thelia/Tests/Constraint/Rule/AvailableForXArticlesTest.php b/core/lib/Thelia/Tests/Constraint/Rule/AvailableForXArticlesTest.php
index cc5caee2a..76a744848 100644
--- a/core/lib/Thelia/Tests/Constraint/Rule/AvailableForXArticlesTest.php
+++ b/core/lib/Thelia/Tests/Constraint/Rule/AvailableForXArticlesTest.php
@@ -177,10 +177,6 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
// $this->assertEquals($expected, $actual);
// }
-
-
-
-
/**
* Check if test inferior operator is working
*
@@ -501,7 +497,6 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected, $actual);
}
-
/**
* Check if test superior operator is working
*
@@ -661,7 +656,6 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
//
// }
-
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
diff --git a/core/lib/Thelia/Tests/Constraint/Rule/OperatorsTest.php b/core/lib/Thelia/Tests/Constraint/Rule/OperatorsTest.php
index c86e827b6..0b29baa62 100644
--- a/core/lib/Thelia/Tests/Constraint/Rule/OperatorsTest.php
+++ b/core/lib/Thelia/Tests/Constraint/Rule/OperatorsTest.php
@@ -416,8 +416,6 @@ class OperatorsTest extends \PHPUnit_Framework_TestCase
// $this->assertFalse($actual);
// }
-
-
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
diff --git a/core/lib/Thelia/Tests/Constraint/Validator/CustomerParamTest.php b/core/lib/Thelia/Tests/Constraint/Validator/CustomerParamTest.php
index afb7b8c80..db281bcc5 100644
--- a/core/lib/Thelia/Tests/Constraint/Validator/CustomerParamTest.php
+++ b/core/lib/Thelia/Tests/Constraint/Validator/CustomerParamTest.php
@@ -25,7 +25,6 @@ namespace Thelia\Coupon;
use InvalidArgumentException;
use Thelia\Constraint\Validator\CustomerParam;
-use Thelia\Constraint\Validator\PriceParam;
use Thelia\Constraint\Validator\QuantityParam;
use Thelia\Model\Customer;
diff --git a/core/lib/Thelia/Tests/Constraint/Validator/QuantityParamTest.php b/core/lib/Thelia/Tests/Constraint/Validator/QuantityParamTest.php
index afcc62f6e..806cedf8d 100644
--- a/core/lib/Thelia/Tests/Constraint/Validator/QuantityParamTest.php
+++ b/core/lib/Thelia/Tests/Constraint/Validator/QuantityParamTest.php
@@ -24,7 +24,6 @@
namespace Thelia\Coupon;
use InvalidArgumentException;
-use Thelia\Constraint\Validator\PriceParam;
use Thelia\Constraint\Validator\QuantityParam;
/**
diff --git a/core/lib/Thelia/Tests/Constraint/Validator/RepeatedDateParamTest.php b/core/lib/Thelia/Tests/Constraint/Validator/RepeatedDateParamTest.php
index 677117348..be03743d3 100644
--- a/core/lib/Thelia/Tests/Constraint/Validator/RepeatedDateParamTest.php
+++ b/core/lib/Thelia/Tests/Constraint/Validator/RepeatedDateParamTest.php
@@ -24,7 +24,6 @@
namespace Thelia\Coupon;
use InvalidArgumentException;
-use Symfony\Component\Intl\Exception\NotImplementedException;
use Thelia\Constraint\Validator\RepeatedDateParam;
/**
diff --git a/core/lib/Thelia/Tests/Constraint/Validator/RepeatedIntervalParamTest.php b/core/lib/Thelia/Tests/Constraint/Validator/RepeatedIntervalParamTest.php
index 513e85836..c5565a322 100644
--- a/core/lib/Thelia/Tests/Constraint/Validator/RepeatedIntervalParamTest.php
+++ b/core/lib/Thelia/Tests/Constraint/Validator/RepeatedIntervalParamTest.php
@@ -23,7 +23,6 @@
namespace Thelia\Coupon;
-use Symfony\Component\Intl\Exception\NotImplementedException;
use Thelia\Constraint\Validator\RepeatedIntervalParam;
/**
diff --git a/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php b/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php
index 177802078..3ecae7c01 100755
--- a/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php
+++ b/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php
@@ -68,7 +68,6 @@ class DefaultControllerTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($request->attributes->get('_view'), 'foo');
}
-
public function testNoActionWithAttribute()
{
$defaultController = new DefaultController();
diff --git a/core/lib/Thelia/Tests/Core/Template/Smarty/Plugins/FormatTest.php b/core/lib/Thelia/Tests/Core/Template/Smarty/Plugins/FormatTest.php
index 38c00b55f..e8d5ff0fc 100644
--- a/core/lib/Thelia/Tests/Core/Template/Smarty/Plugins/FormatTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Smarty/Plugins/FormatTest.php
@@ -168,7 +168,6 @@ class FormatTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($dateTime->format("Y-m-d H:i:s"), $render);
}
-
/**
* test formatNumber without mandatory parameters
*
@@ -269,6 +268,4 @@ class FormatTest extends \PHPUnit_Framework_TestCase
return $mock;
}
-
-
-}
\ No newline at end of file
+}
diff --git a/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php b/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php
index 5a3d7881f..d0662442a 100644
--- a/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php
+++ b/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php
@@ -25,10 +25,8 @@ namespace Thelia\Coupon;
use Thelia\Constraint\Validator\PriceParam;
use Thelia\Constraint\Validator\RuleValidator;
-use Thelia\Constraint\Rule\AvailableForTotalAmountManager;
use Thelia\Constraint\Rule\Operators;
use Thelia\Coupon\Type\CouponInterface;
-use Thelia\Coupon\Type\RemoveXAmountManager;
use Thelia\Tools\PhpUnitUtils;
/**
diff --git a/core/lib/Thelia/Tests/Coupon/Type/RemoveXAmountTest.php b/core/lib/Thelia/Tests/Coupon/Type/RemoveXAmountTest.php
index 8467852ac..990309f28 100644
--- a/core/lib/Thelia/Tests/Coupon/Type/RemoveXAmountTest.php
+++ b/core/lib/Thelia/Tests/Coupon/Type/RemoveXAmountTest.php
@@ -25,7 +25,6 @@ namespace Thelia\Coupon;
use Thelia\Constraint\Validator\PriceParam;
use Thelia\Constraint\Validator\RuleValidator;
-use Thelia\Constraint\Rule\AvailableForTotalAmountManager;
use Thelia\Constraint\Rule\Operators;
use Thelia\Coupon\Type\RemoveXAmountManager;
diff --git a/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentTest.php b/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentTest.php
index 7fc327df6..b5d6529b1 100644
--- a/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentTest.php
+++ b/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentTest.php
@@ -24,7 +24,6 @@
namespace Thelia\Coupon;
use PHPUnit_Framework_TestCase;
-use Thelia\Constraint\Rule\AvailableForTotalAmountManager;
use Thelia\Constraint\Rule\Operators;
use Thelia\Constraint\Validator\PriceParam;
use Thelia\Constraint\Validator\RuleValidator;
diff --git a/core/lib/Thelia/Tests/Rewriting/RewritingResolverTest.php b/core/lib/Thelia/Tests/Rewriting/RewritingResolverTest.php
index 6cd4bdf42..97a6eebc0 100755
--- a/core/lib/Thelia/Tests/Rewriting/RewritingResolverTest.php
+++ b/core/lib/Thelia/Tests/Rewriting/RewritingResolverTest.php
@@ -120,7 +120,7 @@ class RewritingResolverTest extends \PHPUnit_Framework_TestCase
$collection = new ObjectCollection();
$collection->setModel('\Thelia\Model\RewritingArgument');
- for($i=0; $i<3; $i++) {
+ for ($i=0; $i<3; $i++) {
$ra = new RewritingArgument();
$ra->setParameter('foo' . $i);
$ra->setValue('bar' . $i);
@@ -132,7 +132,6 @@ class RewritingResolverTest extends \PHPUnit_Framework_TestCase
$collection->append($ra);
}
-
$resolverQuery = $this->getMock('\Thelia\Model\RewritingUrlQuery', array('getResolverSearch'));
$resolverQuery->expects($this->any())
->method('getResolverSearch')
diff --git a/core/lib/Thelia/Tests/TestCaseWithURLToolSetup.php b/core/lib/Thelia/Tests/TestCaseWithURLToolSetup.php
index 927f7cf62..e0fd3f678 100644
--- a/core/lib/Thelia/Tests/TestCaseWithURLToolSetup.php
+++ b/core/lib/Thelia/Tests/TestCaseWithURLToolSetup.php
@@ -28,15 +28,15 @@ namespace Thelia\Tests;
*
* @package Thelia\Tests\TestCaseWithURLSetup
*/
-class TestCaseWithURLToolSetup extends \PHPUnit_Framework_TestCase {
-
-
- public function __construct() {
+class TestCaseWithURLToolSetup extends \PHPUnit_Framework_TestCase
+{
+ public function __construct()
+ {
$this->setupURLTool();
}
- protected function setupURLTool() {
-
+ protected function setupURLTool()
+ {
$container = new \Symfony\Component\DependencyInjection\ContainerBuilder();
$context = new \Symfony\Component\Routing\RequestContext(
@@ -61,4 +61,4 @@ class TestCaseWithURLToolSetup extends \PHPUnit_Framework_TestCase {
new \Thelia\Tools\URL($container);
}
-}
\ No newline at end of file
+}
diff --git a/core/lib/Thelia/Tests/Tools/URLTest.php b/core/lib/Thelia/Tests/Tools/URLTest.php
index 86804f5c0..bf70e91c6 100755
--- a/core/lib/Thelia/Tests/Tools/URLTest.php
+++ b/core/lib/Thelia/Tests/Tools/URLTest.php
@@ -62,8 +62,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
new \Thelia\Tools\URL($container);
}
- public function testGetIndexPage() {
-
+ public function testGetIndexPage()
+ {
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->getIndexPage();
$this->assertEquals('http://localhost/thelia/index.php', $url);
@@ -81,7 +81,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('http://localhost/', $url);
}
- public function testGetBaseUrl() {
+ public function testGetBaseUrl()
+ {
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->getBaseUrl();
$this->assertEquals('http://localhost/thelia/index.php', $url);
@@ -95,7 +96,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('http://localhost/', $url);
}
- public function testAbsoluteUrl() {
+ public function testAbsoluteUrl()
+ {
$this->context->setBaseUrl('/');
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action');
$this->assertEquals('http://localhost/path/to/action', $url);
@@ -113,8 +115,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('http://localhost/thelia/index.php/path/to/action', $url);
}
- public function testAbsoluteUrlOnAbsolutePath() {
-
+ public function testAbsoluteUrlOnAbsolutePath()
+ {
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('http://myhost/path/to/action');
$this->assertEquals('http://myhost/path/to/action', $url);
@@ -128,8 +130,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('http://myhost/path/to/action', $url);
}
- public function testAbsoluteUrlOnAbsolutePathWithParameters() {
-
+ public function testAbsoluteUrlOnAbsolutePathWithParameters()
+ {
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('http://myhost/path/to/action', array("p1" => "v1", "p2" => "v2"));
$this->assertEquals('http://myhost/path/to/action?p1=v1&p2=v2', $url);
@@ -143,7 +145,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('http://myhost/path/to/action?p1=v1&p2=v2', $url);
}
- public function testAbsoluteUrlOnAbsolutePathWithParametersAddParameters() {
+ public function testAbsoluteUrlOnAbsolutePathWithParametersAddParameters()
+ {
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('http://myhost/path/to/action?p0=v0', array("p1" => "v1", "p2" => "v2"));
$this->assertEquals('http://myhost/path/to/action?p0=v0&p1=v1&p2=v2', $url);
@@ -157,7 +160,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('http://myhost/path/to/action?p0=v0&p1=v1&p2=v2', $url);
}
- public function testAbsoluteUrlWithParameters() {
+ public function testAbsoluteUrlWithParameters()
+ {
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action', array("p1" => "v1", "p2" => "v2"));
$this->assertEquals('http://localhost/thelia/index.php/path/to/action?p1=v1&p2=v2', $url);
@@ -179,13 +183,15 @@ class URLTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('http://localhost/path/to/action?p1=v1&p2=v2', $url);
}
- public function testAbsoluteUrlPathOnly() {
+ public function testAbsoluteUrlPathOnly()
+ {
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action', array(), URL::PATH_TO_FILE);
$this->assertEquals('http://localhost/thelia/path/to/action', $url);
}
- public function testAbsoluteUrlPathOnlyWithParameters() {
+ public function testAbsoluteUrlPathOnlyWithParameters()
+ {
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action', array("p1" => "v1", "p2" => "v2"), URL::PATH_TO_FILE);
$this->assertEquals('http://localhost/thelia/path/to/action?p1=v1&p2=v2', $url);
@@ -200,7 +206,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
}
- public function testAbsoluteUrlFromIndexWithParameters() {
+ public function testAbsoluteUrlFromIndexWithParameters()
+ {
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/', array("p1" => "v1", "p2" => "v2"));
$this->assertEquals('http://localhost/thelia/index.php/?p1=v1&p2=v2', $url);
@@ -215,7 +222,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
}
- public function testAbsoluteUrlPathOnlyFromIndexWithParameters() {
+ public function testAbsoluteUrlPathOnlyFromIndexWithParameters()
+ {
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/', array("p1" => "v1", "p2" => "v2"), URL::PATH_TO_FILE);
$this->assertEquals('http://localhost/thelia/?p1=v1&p2=v2', $url);
diff --git a/core/lib/Thelia/Tools/DateTimeFormat.php b/core/lib/Thelia/Tools/DateTimeFormat.php
index bd6161389..50c757536 100755
--- a/core/lib/Thelia/Tools/DateTimeFormat.php
+++ b/core/lib/Thelia/Tools/DateTimeFormat.php
@@ -24,7 +24,6 @@
namespace Thelia\Tools;
use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\DependencyInjection\ContainerInterface;
class DateTimeFormat
{
@@ -46,7 +45,7 @@ class DateTimeFormat
$format = null;
- if($lang) {
+ if ($lang) {
switch ($output) {
case "date" :
$format = $lang->getDateFormat();
@@ -63,4 +62,4 @@ class DateTimeFormat
return $format;
}
-}
\ No newline at end of file
+}
diff --git a/core/lib/Thelia/Tools/I18n.php b/core/lib/Thelia/Tools/I18n.php
index 4467bebcd..1f3ff57dd 100644
--- a/core/lib/Thelia/Tools/I18n.php
+++ b/core/lib/Thelia/Tools/I18n.php
@@ -54,4 +54,4 @@ class I18n
return \DateTime::createFromFormat($currentDateFormat, $date);
}
-}
\ No newline at end of file
+}
diff --git a/core/lib/Thelia/Tools/PhpUnitUtils.php b/core/lib/Thelia/Tools/PhpUnitUtils.php
index 89bd3b148..e60c22fe1 100644
--- a/core/lib/Thelia/Tools/PhpUnitUtils.php
+++ b/core/lib/Thelia/Tools/PhpUnitUtils.php
@@ -50,6 +50,7 @@ class PhpUnitUtils
$class = new \ReflectionClass(get_class($obj));
$method = $class->getMethod($name);
$method->setAccessible(true);
+
return $method->invokeArgs($obj, $args);
}
-}
\ No newline at end of file
+}
diff --git a/core/lib/Thelia/Tools/Rest/ResponseRest.php b/core/lib/Thelia/Tools/Rest/ResponseRest.php
index 8618d460f..75d511d78 100644
--- a/core/lib/Thelia/Tools/Rest/ResponseRest.php
+++ b/core/lib/Thelia/Tools/Rest/ResponseRest.php
@@ -9,7 +9,6 @@ use Symfony\Component\Serializer\Encoder\XmlEncoder;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;
-
/**
* Class ResponseRest Create a serialized Response
*
diff --git a/core/lib/Thelia/Tools/URL.php b/core/lib/Thelia/Tools/URL.php
index ffb81992d..d0dcd127d 100755
--- a/core/lib/Thelia/Tools/URL.php
+++ b/core/lib/Thelia/Tools/URL.php
@@ -62,9 +62,9 @@ class URL
* @throws \RuntimeException if the class has not been instanciated.
* @return \Thelia\Tools\URL the instance.
*/
- public static function getInstance() {
+ public static function getInstance()
+ {
if (self::$instance == null) throw new \RuntimeException("URL instance is not initialized.");
-
return self::$instance;
}
@@ -122,7 +122,7 @@ class URL
$base_url = $this->getBaseUrl();
// TODO fix this ugly patch
- if(strpos($path, "index_dev.php")) {
+ if (strpos($path, "index_dev.php")) {
$path = str_replace('index_dev.php', '', $path);
}
@@ -148,7 +148,6 @@ class URL
$sepChar = strstr($base, '?') === false ? '?' : '&';
if ('' !== $queryString = rtrim($queryString, "&")) $queryString = $sepChar . $queryString;
-
return $base . $queryString;
}
@@ -192,12 +191,12 @@ class URL
*/
public function retrieve($view, $viewId, $viewLocale)
{
- if(ConfigQuery::isRewritingEnable()) {
+ if (ConfigQuery::isRewritingEnable()) {
$this->retriever->loadViewUrl($view, $viewLocale, $viewId);
} else {
$allParametersWithoutView = array();
$allParametersWithoutView['locale'] = $viewLocale;
- if(null !== $viewId) {
+ if (null !== $viewId) {
$allParametersWithoutView[$view . '_id'] = $viewId;
}
$this->retriever->rewrittenUrl = null;
@@ -216,19 +215,19 @@ class URL
*/
public function retrieveCurrent(Request $request)
{
- if(ConfigQuery::isRewritingEnable()) {
+ if (ConfigQuery::isRewritingEnable()) {
$view = $request->attributes->get('_view', null);
$viewLocale = $request->query->get('locale', null);
$viewId = $view === null ? null : $request->query->get($view . '_id', null);
$allOtherParameters = $request->query->all();
- if($view !== null) {
+ if ($view !== null) {
unset($allOtherParameters['view']);
- if($viewId !== null) {
+ if ($viewId !== null) {
unset($allOtherParameters[$view . '_id']);
}
}
- if($viewLocale !== null) {
+ if ($viewLocale !== null) {
unset($allOtherParameters['locale']);
}
@@ -236,7 +235,7 @@ class URL
} else {
$allParametersWithoutView = $viewOtherParameters;
$allParametersWithoutView['locale'] = $viewLocale;
- if(null !== $viewId) {
+ if (null !== $viewId) {
$allParametersWithoutView[$view . '_id'] = $viewId;
}
$this->retriever->rewrittenUrl = null;
@@ -256,6 +255,7 @@ class URL
public function resolve($url)
{
$this->resolver->load($url);
+
return $this->resolver;
}
-}
\ No newline at end of file
+}
diff --git a/install/insert.sql b/install/insert.sql
index 8b577fb8e..da1414ce3 100755
--- a/install/insert.sql
+++ b/install/insert.sql
@@ -7,6 +7,7 @@ INSERT INTO `lang`(`id`,`title`,`code`,`locale`,`url`,`date_format`,`time_format
INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updated_at`) VALUES
('session_config.default', '1', 1, 1, NOW(), NOW()),
('verifyStock', '1', 0, 0, NOW(), NOW()),
+('active-template', 'default', 0, 0, NOW(), NOW()),
('default_lang_without_translation', '1', 0, 0, NOW(), NOW()),
('rewriting_enable', '0', 0, 0, NOW(), NOW()),
('imagine_graphic_driver', 'gd', 0, 0, NOW(), NOW()),
@@ -15,7 +16,8 @@ INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updat
('images_library_path', 'local/media/images', 0, 0, NOW(), NOW()),
('image_cache_dir_from_web_root', 'cache/images', 0, 0, NOW(), NOW()),
('currency_rate_update_url', 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml', 0, 0, NOW(), NOW()),
-('page_not_found_view', '404.html', 0, 0, NOW(), NOW());
+('page_not_found_view', '404.html', 0, 0, NOW(), NOW()),
+('use_tax_free_amounts', 1, 1, 0, NOW(), NOW());
INSERT INTO `module` (`id`, `code`, `type`, `activate`, `position`, `full_namespace`, `created_at`, `updated_at`) VALUES
diff --git a/install/thelia.sql b/install/thelia.sql
index d38d45379..0346ffba8 100755
--- a/install/thelia.sql
+++ b/install/thelia.sql
@@ -1213,14 +1213,13 @@ DROP TABLE IF EXISTS `product_price`;
CREATE TABLE `product_price`
(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
`product_sale_elements_id` INTEGER NOT NULL,
`currency_id` INTEGER NOT NULL,
`price` FLOAT NOT NULL,
`promo_price` FLOAT,
`created_at` DATETIME,
`updated_at` DATETIME,
- PRIMARY KEY (`id`),
+ PRIMARY KEY (`product_sale_elements_id`,`currency_id`),
INDEX `idx_product_price_product_sale_elements_id` (`product_sale_elements_id`),
INDEX `idx_product_price_currency_id` (`currency_id`),
CONSTRAINT `fk_product_price_product_sale_elements_id`
diff --git a/local/config/schema.xml b/local/config/schema.xml
index 39f649650..afb7b2c41 100755
--- a/local/config/schema.xml
+++ b/local/config/schema.xml
@@ -1,4 +1,4 @@
-
+
| {#REF} | +{$REF} | - {#COMPANY} + {$COMPANY} | - {#FIRSTNAME} {#LASTNAME} + {$FIRSTNAME} {$LASTNAME} | {module_include location='customer_list_row'} @@ -87,7 +87,7 @@ {/loop} {loop type="auth" name="can_send_mail" roles="ADMIN" permissions="admin.customer.sendMail"} - + {/loop} {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.customer.delete"} @@ -104,33 +104,34 @@ - {module_include location='customer_bottom'} -