+ * $query->filterByPosition(1234); // WHERE position = 1234
+ * $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
+ * $query->filterByPosition(array('min' => 12)); // WHERE position > 12
+ *
+ *
+ * @param mixed $position 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 ChildCurrencyQuery The current query, for fluid interface
+ */
+ public function filterByPosition($position = null, $comparison = null)
+ {
+ if (is_array($position)) {
+ $useMinMax = false;
+ if (isset($position['min'])) {
+ $this->addUsingAlias(CurrencyTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($position['max'])) {
+ $this->addUsingAlias(CurrencyTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CurrencyTableMap::POSITION, $position, $comparison);
+ }
+
/**
* Filter the query on the created_at column
*
diff --git a/core/lib/Thelia/Model/Base/Lang.php b/core/lib/Thelia/Model/Base/Lang.php
index 694f86bc5..63a3c1b8d 100644
--- a/core/lib/Thelia/Model/Base/Lang.php
+++ b/core/lib/Thelia/Model/Base/Lang.php
@@ -90,6 +90,12 @@ abstract class Lang implements ActiveRecordInterface
*/
protected $by_default;
+ /**
+ * The value for the position field.
+ * @var int
+ */
+ protected $position;
+
/**
* The value for the created_at field.
* @var string
@@ -430,6 +436,17 @@ abstract class Lang implements ActiveRecordInterface
return $this->by_default;
}
+ /**
+ * Get the [position] column value.
+ *
+ * @return int
+ */
+ public function getPosition()
+ {
+
+ return $this->position;
+ }
+
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -596,6 +613,27 @@ abstract class Lang implements ActiveRecordInterface
return $this;
} // setByDefault()
+ /**
+ * Set the value of [position] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\Lang The current object (for fluent API support)
+ */
+ public function setPosition($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->position !== $v) {
+ $this->position = $v;
+ $this->modifiedColumns[] = LangTableMap::POSITION;
+ }
+
+
+ return $this;
+ } // setPosition()
+
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -693,13 +731,16 @@ abstract class Lang implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : LangTableMap::translateFieldName('ByDefault', TableMap::TYPE_PHPNAME, $indexType)];
$this->by_default = (null !== $col) ? (int) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : LangTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : LangTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->position = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : LangTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : LangTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : LangTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -712,7 +753,7 @@ abstract class Lang implements ActiveRecordInterface
$this->ensureConsistency();
}
- return $startcol + 8; // 8 = LangTableMap::NUM_HYDRATE_COLUMNS.
+ return $startcol + 9; // 9 = LangTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Lang object", 0, $e);
@@ -950,6 +991,9 @@ abstract class Lang implements ActiveRecordInterface
if ($this->isColumnModified(LangTableMap::BY_DEFAULT)) {
$modifiedColumns[':p' . $index++] = 'BY_DEFAULT';
}
+ if ($this->isColumnModified(LangTableMap::POSITION)) {
+ $modifiedColumns[':p' . $index++] = 'POSITION';
+ }
if ($this->isColumnModified(LangTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
@@ -985,6 +1029,9 @@ abstract class Lang implements ActiveRecordInterface
case 'BY_DEFAULT':
$stmt->bindValue($identifier, $this->by_default, PDO::PARAM_INT);
break;
+ case 'POSITION':
+ $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
+ break;
case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
@@ -1072,9 +1119,12 @@ abstract class Lang implements ActiveRecordInterface
return $this->getByDefault();
break;
case 6:
- return $this->getCreatedAt();
+ return $this->getPosition();
break;
case 7:
+ return $this->getCreatedAt();
+ break;
+ case 8:
return $this->getUpdatedAt();
break;
default:
@@ -1111,8 +1161,9 @@ abstract class Lang implements ActiveRecordInterface
$keys[3] => $this->getLocale(),
$keys[4] => $this->getUrl(),
$keys[5] => $this->getByDefault(),
- $keys[6] => $this->getCreatedAt(),
- $keys[7] => $this->getUpdatedAt(),
+ $keys[6] => $this->getPosition(),
+ $keys[7] => $this->getCreatedAt(),
+ $keys[8] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn)
@@ -1172,9 +1223,12 @@ abstract class Lang implements ActiveRecordInterface
$this->setByDefault($value);
break;
case 6:
- $this->setCreatedAt($value);
+ $this->setPosition($value);
break;
case 7:
+ $this->setCreatedAt($value);
+ break;
+ case 8:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -1207,8 +1261,9 @@ abstract class Lang implements ActiveRecordInterface
if (array_key_exists($keys[3], $arr)) $this->setLocale($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setUrl($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setByDefault($arr[$keys[5]]);
- if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]);
- if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]);
+ if (array_key_exists($keys[6], $arr)) $this->setPosition($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]);
}
/**
@@ -1226,6 +1281,7 @@ abstract class Lang implements ActiveRecordInterface
if ($this->isColumnModified(LangTableMap::LOCALE)) $criteria->add(LangTableMap::LOCALE, $this->locale);
if ($this->isColumnModified(LangTableMap::URL)) $criteria->add(LangTableMap::URL, $this->url);
if ($this->isColumnModified(LangTableMap::BY_DEFAULT)) $criteria->add(LangTableMap::BY_DEFAULT, $this->by_default);
+ if ($this->isColumnModified(LangTableMap::POSITION)) $criteria->add(LangTableMap::POSITION, $this->position);
if ($this->isColumnModified(LangTableMap::CREATED_AT)) $criteria->add(LangTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(LangTableMap::UPDATED_AT)) $criteria->add(LangTableMap::UPDATED_AT, $this->updated_at);
@@ -1296,6 +1352,7 @@ abstract class Lang implements ActiveRecordInterface
$copyObj->setLocale($this->getLocale());
$copyObj->setUrl($this->getUrl());
$copyObj->setByDefault($this->getByDefault());
+ $copyObj->setPosition($this->getPosition());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) {
@@ -1337,6 +1394,7 @@ abstract class Lang implements ActiveRecordInterface
$this->locale = null;
$this->url = null;
$this->by_default = null;
+ $this->position = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;
diff --git a/core/lib/Thelia/Model/Base/LangQuery.php b/core/lib/Thelia/Model/Base/LangQuery.php
index 1a99ff28a..6223bea61 100644
--- a/core/lib/Thelia/Model/Base/LangQuery.php
+++ b/core/lib/Thelia/Model/Base/LangQuery.php
@@ -24,6 +24,7 @@ use Thelia\Model\Map\LangTableMap;
* @method ChildLangQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildLangQuery orderByUrl($order = Criteria::ASC) Order by the url column
* @method ChildLangQuery orderByByDefault($order = Criteria::ASC) Order by the by_default column
+ * @method ChildLangQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildLangQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildLangQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
@@ -33,6 +34,7 @@ use Thelia\Model\Map\LangTableMap;
* @method ChildLangQuery groupByLocale() Group by the locale column
* @method ChildLangQuery groupByUrl() Group by the url column
* @method ChildLangQuery groupByByDefault() Group by the by_default column
+ * @method ChildLangQuery groupByPosition() Group by the position column
* @method ChildLangQuery groupByCreatedAt() Group by the created_at column
* @method ChildLangQuery groupByUpdatedAt() Group by the updated_at column
*
@@ -49,6 +51,7 @@ use Thelia\Model\Map\LangTableMap;
* @method ChildLang findOneByLocale(string $locale) Return the first ChildLang filtered by the locale column
* @method ChildLang findOneByUrl(string $url) Return the first ChildLang filtered by the url column
* @method ChildLang findOneByByDefault(int $by_default) Return the first ChildLang filtered by the by_default column
+ * @method ChildLang findOneByPosition(int $position) Return the first ChildLang filtered by the position column
* @method ChildLang findOneByCreatedAt(string $created_at) Return the first ChildLang filtered by the created_at column
* @method ChildLang findOneByUpdatedAt(string $updated_at) Return the first ChildLang filtered by the updated_at column
*
@@ -58,6 +61,7 @@ use Thelia\Model\Map\LangTableMap;
* @method array findByLocale(string $locale) Return ChildLang objects filtered by the locale column
* @method array findByUrl(string $url) Return ChildLang objects filtered by the url column
* @method array findByByDefault(int $by_default) Return ChildLang objects filtered by the by_default column
+ * @method array findByPosition(int $position) Return ChildLang objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return ChildLang objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildLang objects filtered by the updated_at column
*
@@ -148,7 +152,7 @@ abstract class LangQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
- $sql = 'SELECT ID, TITLE, CODE, LOCALE, URL, BY_DEFAULT, CREATED_AT, UPDATED_AT FROM lang WHERE ID = :p0';
+ $sql = 'SELECT ID, TITLE, CODE, LOCALE, URL, BY_DEFAULT, POSITION, CREATED_AT, UPDATED_AT FROM lang WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -435,6 +439,47 @@ abstract class LangQuery extends ModelCriteria
return $this->addUsingAlias(LangTableMap::BY_DEFAULT, $byDefault, $comparison);
}
+ /**
+ * Filter the query on the position column
+ *
+ * Example usage:
+ *
+ * $query->filterByPosition(1234); // WHERE position = 1234
+ * $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
+ * $query->filterByPosition(array('min' => 12)); // WHERE position > 12
+ *
+ *
+ * @param mixed $position 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 ChildLangQuery The current query, for fluid interface
+ */
+ public function filterByPosition($position = null, $comparison = null)
+ {
+ if (is_array($position)) {
+ $useMinMax = false;
+ if (isset($position['min'])) {
+ $this->addUsingAlias(LangTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($position['max'])) {
+ $this->addUsingAlias(LangTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(LangTableMap::POSITION, $position, $comparison);
+ }
+
/**
* Filter the query on the created_at column
*
diff --git a/core/lib/Thelia/Model/Category.php b/core/lib/Thelia/Model/Category.php
index 25a2ebe48..35ac49e0e 100755
--- a/core/lib/Thelia/Model/Category.php
+++ b/core/lib/Thelia/Model/Category.php
@@ -3,6 +3,7 @@
namespace Thelia\Model;
use Thelia\Model\Base\Category as BaseCategory;
+use Propel\Runtime\ActiveQuery\Criteria;
class Category extends BaseCategory {
/**
@@ -17,6 +18,37 @@ class Category extends BaseCategory {
{
}
+ /**
+ * Create a new category.
+ *
+ * @param string $title the category title
+ * @param int $parent the ID of the parent category
+ * @param string $locale the locale of the title
+ */
+ public function create($title, $parent, $locale)
+ {
+ $this
+ ->setLocale($locale)
+ ->setTitle($title)
+ ->setParent($parent)
+ ->setVisible(1)
+ ->setPosition($this->getNextPosition($parent))
+ ;
+
+ $this->save();
+ }
+
+ public function getNextPosition($parent) {
+
+ $last = CategoryQuery::create()
+ ->filterByParent($parent)
+ ->orderByPosition(Criteria::DESC)
+ ->limit(1)
+ ->findOne()
+ ;
+
+ return $last->getPosition() + 1;
+ }
/**
*
diff --git a/core/lib/Thelia/Model/Map/CurrencyTableMap.php b/core/lib/Thelia/Model/Map/CurrencyTableMap.php
index b1251801a..341a0cb45 100644
--- a/core/lib/Thelia/Model/Map/CurrencyTableMap.php
+++ b/core/lib/Thelia/Model/Map/CurrencyTableMap.php
@@ -57,7 +57,7 @@ class CurrencyTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 7;
+ const NUM_COLUMNS = 8;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class CurrencyTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 7;
+ const NUM_HYDRATE_COLUMNS = 8;
/**
* the column name for the ID field
@@ -94,6 +94,11 @@ class CurrencyTableMap extends TableMap
*/
const BY_DEFAULT = 'currency.BY_DEFAULT';
+ /**
+ * the column name for the POSITION field
+ */
+ const POSITION = 'currency.POSITION';
+
/**
* the column name for the CREATED_AT field
*/
@@ -125,12 +130,12 @@ class CurrencyTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'Code', 'Symbol', 'Rate', 'ByDefault', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'code', 'symbol', 'rate', 'byDefault', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(CurrencyTableMap::ID, CurrencyTableMap::CODE, CurrencyTableMap::SYMBOL, CurrencyTableMap::RATE, CurrencyTableMap::BY_DEFAULT, CurrencyTableMap::CREATED_AT, CurrencyTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'SYMBOL', 'RATE', 'BY_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('id', 'code', 'symbol', 'rate', 'by_default', 'created_at', 'updated_at', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
+ self::TYPE_PHPNAME => array('Id', 'Code', 'Symbol', 'Rate', 'ByDefault', 'Position', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'code', 'symbol', 'rate', 'byDefault', 'position', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(CurrencyTableMap::ID, CurrencyTableMap::CODE, CurrencyTableMap::SYMBOL, CurrencyTableMap::RATE, CurrencyTableMap::BY_DEFAULT, CurrencyTableMap::POSITION, CurrencyTableMap::CREATED_AT, CurrencyTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'SYMBOL', 'RATE', 'BY_DEFAULT', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'code', 'symbol', 'rate', 'by_default', 'position', 'created_at', 'updated_at', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
);
/**
@@ -140,12 +145,12 @@ class CurrencyTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Symbol' => 2, 'Rate' => 3, 'ByDefault' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'symbol' => 2, 'rate' => 3, 'byDefault' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
- self::TYPE_COLNAME => array(CurrencyTableMap::ID => 0, CurrencyTableMap::CODE => 1, CurrencyTableMap::SYMBOL => 2, CurrencyTableMap::RATE => 3, CurrencyTableMap::BY_DEFAULT => 4, CurrencyTableMap::CREATED_AT => 5, CurrencyTableMap::UPDATED_AT => 6, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'SYMBOL' => 2, 'RATE' => 3, 'BY_DEFAULT' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'symbol' => 2, 'rate' => 3, 'by_default' => 4, 'created_at' => 5, 'updated_at' => 6, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
+ self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Symbol' => 2, 'Rate' => 3, 'ByDefault' => 4, 'Position' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'symbol' => 2, 'rate' => 3, 'byDefault' => 4, 'position' => 5, 'createdAt' => 6, 'updatedAt' => 7, ),
+ self::TYPE_COLNAME => array(CurrencyTableMap::ID => 0, CurrencyTableMap::CODE => 1, CurrencyTableMap::SYMBOL => 2, CurrencyTableMap::RATE => 3, CurrencyTableMap::BY_DEFAULT => 4, CurrencyTableMap::POSITION => 5, CurrencyTableMap::CREATED_AT => 6, CurrencyTableMap::UPDATED_AT => 7, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'SYMBOL' => 2, 'RATE' => 3, 'BY_DEFAULT' => 4, 'POSITION' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'symbol' => 2, 'rate' => 3, 'by_default' => 4, 'position' => 5, 'created_at' => 6, 'updated_at' => 7, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
);
/**
@@ -169,6 +174,7 @@ class CurrencyTableMap extends TableMap
$this->addColumn('SYMBOL', 'Symbol', 'VARCHAR', false, 45, null);
$this->addColumn('RATE', 'Rate', 'FLOAT', false, null, null);
$this->addColumn('BY_DEFAULT', 'ByDefault', 'TINYINT', false, null, null);
+ $this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -352,6 +358,7 @@ class CurrencyTableMap extends TableMap
$criteria->addSelectColumn(CurrencyTableMap::SYMBOL);
$criteria->addSelectColumn(CurrencyTableMap::RATE);
$criteria->addSelectColumn(CurrencyTableMap::BY_DEFAULT);
+ $criteria->addSelectColumn(CurrencyTableMap::POSITION);
$criteria->addSelectColumn(CurrencyTableMap::CREATED_AT);
$criteria->addSelectColumn(CurrencyTableMap::UPDATED_AT);
} else {
@@ -360,6 +367,7 @@ class CurrencyTableMap extends TableMap
$criteria->addSelectColumn($alias . '.SYMBOL');
$criteria->addSelectColumn($alias . '.RATE');
$criteria->addSelectColumn($alias . '.BY_DEFAULT');
+ $criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
diff --git a/core/lib/Thelia/Model/Map/LangTableMap.php b/core/lib/Thelia/Model/Map/LangTableMap.php
index 86e3ebe16..c057cb315 100644
--- a/core/lib/Thelia/Model/Map/LangTableMap.php
+++ b/core/lib/Thelia/Model/Map/LangTableMap.php
@@ -57,7 +57,7 @@ class LangTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 8;
+ const NUM_COLUMNS = 9;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class LangTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 8;
+ const NUM_HYDRATE_COLUMNS = 9;
/**
* the column name for the ID field
@@ -99,6 +99,11 @@ class LangTableMap extends TableMap
*/
const BY_DEFAULT = 'lang.BY_DEFAULT';
+ /**
+ * the column name for the POSITION field
+ */
+ const POSITION = 'lang.POSITION';
+
/**
* the column name for the CREATED_AT field
*/
@@ -121,12 +126,12 @@ class LangTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'Title', 'Code', 'Locale', 'Url', 'ByDefault', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'title', 'code', 'locale', 'url', 'byDefault', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(LangTableMap::ID, LangTableMap::TITLE, LangTableMap::CODE, LangTableMap::LOCALE, LangTableMap::URL, LangTableMap::BY_DEFAULT, LangTableMap::CREATED_AT, LangTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('ID', 'TITLE', 'CODE', 'LOCALE', 'URL', 'BY_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('id', 'title', 'code', 'locale', 'url', 'by_default', 'created_at', 'updated_at', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
+ self::TYPE_PHPNAME => array('Id', 'Title', 'Code', 'Locale', 'Url', 'ByDefault', 'Position', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'title', 'code', 'locale', 'url', 'byDefault', 'position', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(LangTableMap::ID, LangTableMap::TITLE, LangTableMap::CODE, LangTableMap::LOCALE, LangTableMap::URL, LangTableMap::BY_DEFAULT, LangTableMap::POSITION, LangTableMap::CREATED_AT, LangTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'TITLE', 'CODE', 'LOCALE', 'URL', 'BY_DEFAULT', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'title', 'code', 'locale', 'url', 'by_default', 'position', 'created_at', 'updated_at', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
@@ -136,12 +141,12 @@ class LangTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'Title' => 1, 'Code' => 2, 'Locale' => 3, 'Url' => 4, 'ByDefault' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'title' => 1, 'code' => 2, 'locale' => 3, 'url' => 4, 'byDefault' => 5, 'createdAt' => 6, 'updatedAt' => 7, ),
- self::TYPE_COLNAME => array(LangTableMap::ID => 0, LangTableMap::TITLE => 1, LangTableMap::CODE => 2, LangTableMap::LOCALE => 3, LangTableMap::URL => 4, LangTableMap::BY_DEFAULT => 5, LangTableMap::CREATED_AT => 6, LangTableMap::UPDATED_AT => 7, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE' => 1, 'CODE' => 2, 'LOCALE' => 3, 'URL' => 4, 'BY_DEFAULT' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'title' => 1, 'code' => 2, 'locale' => 3, 'url' => 4, 'by_default' => 5, 'created_at' => 6, 'updated_at' => 7, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
+ self::TYPE_PHPNAME => array('Id' => 0, 'Title' => 1, 'Code' => 2, 'Locale' => 3, 'Url' => 4, 'ByDefault' => 5, 'Position' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'title' => 1, 'code' => 2, 'locale' => 3, 'url' => 4, 'byDefault' => 5, 'position' => 6, 'createdAt' => 7, 'updatedAt' => 8, ),
+ self::TYPE_COLNAME => array(LangTableMap::ID => 0, LangTableMap::TITLE => 1, LangTableMap::CODE => 2, LangTableMap::LOCALE => 3, LangTableMap::URL => 4, LangTableMap::BY_DEFAULT => 5, LangTableMap::POSITION => 6, LangTableMap::CREATED_AT => 7, LangTableMap::UPDATED_AT => 8, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE' => 1, 'CODE' => 2, 'LOCALE' => 3, 'URL' => 4, 'BY_DEFAULT' => 5, 'POSITION' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'title' => 1, 'code' => 2, 'locale' => 3, 'url' => 4, 'by_default' => 5, 'position' => 6, 'created_at' => 7, 'updated_at' => 8, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
@@ -166,6 +171,7 @@ class LangTableMap extends TableMap
$this->addColumn('LOCALE', 'Locale', 'VARCHAR', false, 45, null);
$this->addColumn('URL', 'Url', 'VARCHAR', false, 255, null);
$this->addColumn('BY_DEFAULT', 'ByDefault', 'TINYINT', false, null, null);
+ $this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -334,6 +340,7 @@ class LangTableMap extends TableMap
$criteria->addSelectColumn(LangTableMap::LOCALE);
$criteria->addSelectColumn(LangTableMap::URL);
$criteria->addSelectColumn(LangTableMap::BY_DEFAULT);
+ $criteria->addSelectColumn(LangTableMap::POSITION);
$criteria->addSelectColumn(LangTableMap::CREATED_AT);
$criteria->addSelectColumn(LangTableMap::UPDATED_AT);
} else {
@@ -343,6 +350,7 @@ class LangTableMap extends TableMap
$criteria->addSelectColumn($alias . '.LOCALE');
$criteria->addSelectColumn($alias . '.URL');
$criteria->addSelectColumn($alias . '.BY_DEFAULT');
+ $criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
diff --git a/core/lib/Thelia/Tools/URL.php b/core/lib/Thelia/Tools/URL.php
index 460703199..cf0800e07 100644
--- a/core/lib/Thelia/Tools/URL.php
+++ b/core/lib/Thelia/Tools/URL.php
@@ -44,7 +44,7 @@ class URL
*/
public static function absoluteUrl($path, array $parameters = array(), $path_only = false)
{
- // Already absolute ?
+ // Already absolute ?
if (substr($path, 0, 4) != 'http') {
$root = $path_only ? ConfigQuery::read('base_url', '/') : self::getIndexPage();
@@ -57,7 +57,7 @@ class URL
$queryString = '';
foreach($parameters as $name => $value) {
- $queryString = sprintf("%s=%s&", urlencode($name), urlencode($value));
+ $queryString .= sprintf("%s=%s&", urlencode($name), urlencode($value));
}
$sepChar = strstr($base, '?') === false ? '?' : '&';
@@ -77,7 +77,7 @@ class URL
*/
public static function adminViewUrl($viewName, array $parameters = array()) {
- $path = sprintf("%s/admin/%s", self::getIndexPage(), $viewName); // FIXME ! view= should not be necessaray, check routing parameters
+ $path = sprintf("%s/admin/%s", self::getIndexPage(), $viewName); // FIXME ! view= should not be required, check routing parameters
return self::absoluteUrl($path, $parameters);
}
diff --git a/install/insert.sql b/install/insert.sql
index 6518462c4..d4697f94b 100755
--- a/install/insert.sql
+++ b/install/insert.sql
@@ -1,8 +1,8 @@
-INSERT INTO `lang`(`id`,`title`,`code`,`locale`,`url`,`by_default`,`created_at`,`updated_at`)VALUES
-(1, 'Français', 'fr', 'fr_FR', '','1', NOW(), NOW()),
-(2, 'English', 'en', 'en_EN', '', '0', NOW(), NOW()),
-(3, 'Espanol', 'es', 'es_ES', '', '0', NOW(), NOW()),
-(4, 'Italiano', 'it', 'it_IT', '','0', NOW(), NOW());
+INSERT INTO `lang`(`id`,`title`,`code`,`locale`,`url`,`by_default`,`position`,`created_at`,`updated_at`)VALUES
+(1, 'Français', 'fr', 'fr_FR', '','1', '1', NOW(), NOW()),
+(2, 'English', 'en', 'en_EN', '', '0', '2', NOW(), NOW()),
+(3, 'Espanol', 'es', 'es_ES', '', '0', '3', NOW(), NOW()),
+(4, 'Italiano', 'it', 'it_IT', '','0', '4', NOW(), NOW());
INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updated_at`) VALUES
('session_config.default', '1', 1, 1, NOW(), NOW()),
@@ -23,11 +23,11 @@ INSERT INTO `customer_title_i18n` (`id`, `locale`, `short`, `long`) VALUES
(3, 'en_US', 'Miss', 'Miss'),
(3, 'fr_FR', 'Mlle', 'Madamemoiselle');
-INSERT INTO `currency` (`id` ,`code` ,`symbol` ,`rate` ,`by_default` ,`created_at` ,`updated_at`)
+INSERT INTO `currency` (`id` ,`code` ,`symbol` ,`rate` ,`by_default`, `position` ,`created_at` ,`updated_at`)
VALUES
-(1, 'EUR', '€', '1', '1', NOW() , NOW()),
-(2, 'USD', '$', '1.26', '0', NOW(), NOW()),
-(3, 'GBP', '£', '0.89', '0', NOW(), NOW());
+(1, 'EUR', '€', '1', '1', '1', NOW() , NOW()),
+(2, 'USD', '$', '1.26', '0', '2', NOW(), NOW()),
+(3, 'GBP', '£', '0.89', '0', '3', NOW(), NOW());
INSERT INTO `currency_i18n` (`id` ,`locale` ,`name`)
VALUES
diff --git a/install/thelia.sql b/install/thelia.sql
index 0cf0efe7f..a2797af33 100755
--- a/install/thelia.sql
+++ b/install/thelia.sql
@@ -522,6 +522,7 @@ CREATE TABLE `lang`
`locale` VARCHAR(45),
`url` VARCHAR(255),
`by_default` TINYINT,
+ `position` INTEGER,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)
@@ -763,6 +764,7 @@ CREATE TABLE `currency`
`symbol` VARCHAR(45),
`rate` FLOAT,
`by_default` TINYINT,
+ `position` INTEGER,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)
diff --git a/local/config/schema.xml b/local/config/schema.xml
index 533bf2d37..744e1746c 100755
--- a/local/config/schema.xml
+++ b/local/config/schema.xml
@@ -589,7 +589,8 @@
| {$TITLE} | +{$TITLE} | {module_include location='category_list_row'} @@ -59,15 +61,27 @@- - {$POSITION} - + {loop type="auth" name="can_change" context="admin" roles="ADMIN" permissions="admin.category.edit"} + + {$POSITION} + + {/loop} + + {elseloop rel="can_change"} + {$POSITION} + {/elseloop} | - - - + + + {loop type="auth" name="can_change" context="admin" roles="ADMIN" permissions="admin.category.edit"} + + {/loop} + + {loop type="auth" name="can_delete" context="admin" roles="ADMIN" permissions="admin.category.delete"} + + {/loop} | ||
| Image ! | +Image ! | -{$TITLE} | +{$TITLE} | {module_include location='product_list_row'} @@ -135,14 +159,14 @@- + {$POSITION} - + | - - + + |