From 0cb0e893824b8c69f413eeda0b58c2980ad8f090 Mon Sep 17 00:00:00 2001 From: Benjamin Perche Date: Wed, 9 Jul 2014 16:48:04 +0200 Subject: [PATCH] =?UTF-8?q?Continue=20import=20export=20management=20=09mo?= =?UTF-8?q?difi=C3=A9:=20=20=20=20=20=20=20=20=20core/lib/Thelia/Config/Re?= =?UTF-8?q?sources/loop.xml=20=09nouveau=20fichier:=20core/lib/Thelia/Core?= =?UTF-8?q?/Template/Loop/ImportExportCategory.php=20=09nouveau=20fichier:?= =?UTF-8?q?=20core/lib/Thelia/Core/Template/Loop/ImportExportType.php=20?= =?UTF-8?q?=09nouveau=20fichier:=20core/lib/Thelia/Form/ExportForm.php=20?= =?UTF-8?q?=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20core/lib/Thelia/Mode?= =?UTF-8?q?l/Base/ImportExportType.php=20=09modifi=C3=A9:=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20core/lib/Thelia/Model/Base/ImportExportTypeQuery.ph?= =?UTF-8?q?p=20=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20core/lib/Thelia/?= =?UTF-8?q?Model/Map/ImportExportTypeTableMap.php=20=09modifi=C3=A9:=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20local/config/schema.xml=20=09modifi=C3=A9:?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20setup/thelia.sql=20=09modifi=C3=A9:?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20templates/backOffice/default/export.?= =?UTF-8?q?html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/lib/Thelia/Config/Resources/loop.xml | 1 + .../Template/Loop/ImportExportCategory.php | 136 ++++++++++++++++++ .../Core/Template/Loop/ImportExportType.php | 87 +++++++++++ core/lib/Thelia/Form/ExportForm.php | 99 +++++++++++++ .../Thelia/Model/Base/ImportExportType.php | 76 ++++++++-- .../Model/Base/ImportExportTypeQuery.php | 47 +++++- .../Model/Map/ImportExportTypeTableMap.php | 36 +++-- local/config/schema.xml | 1 + setup/thelia.sql | 1 + templates/backOffice/default/export.html | 56 +++++--- 10 files changed, 495 insertions(+), 45 deletions(-) create mode 100644 core/lib/Thelia/Core/Template/Loop/ImportExportCategory.php create mode 100644 core/lib/Thelia/Core/Template/Loop/ImportExportType.php create mode 100644 core/lib/Thelia/Form/ExportForm.php diff --git a/core/lib/Thelia/Config/Resources/loop.xml b/core/lib/Thelia/Config/Resources/loop.xml index 90678a5e0..3588e3787 100644 --- a/core/lib/Thelia/Config/Resources/loop.xml +++ b/core/lib/Thelia/Config/Resources/loop.xml @@ -57,6 +57,7 @@ + diff --git a/core/lib/Thelia/Core/Template/Loop/ImportExportCategory.php b/core/lib/Thelia/Core/Template/Loop/ImportExportCategory.php new file mode 100644 index 000000000..f20c38bf6 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/ImportExportCategory.php @@ -0,0 +1,136 @@ + + */ +class ImportExportCategory extends BaseLoop implements PropelSearchLoopInterface +{ + protected $timestampable = true; + + /** + * @param LoopResult $loopResult + * + * @return LoopResult + */ + public function parseResults(LoopResult $loopResult) + { + /** @var \Thelia\Model\ImportExportCategory $category */ + foreach ($loopResult->getResultDataCollection() as $category) + { + $loopResultRow = new LoopResultRow($category); + + $loopResultRow + ->set("ID", $category->getId()) + ->set("TITLE", $category->getTitle()) + ->set("POSITION", $category->getPosition()) + ; + + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } + + /** + * this method returns a Propel ModelCriteria + * + * @return \Propel\Runtime\ActiveQuery\ModelCriteria + */ + public function buildModelCriteria() + { + $query = ImportExportCategoryQuery::create(); + + if (null !== $ids = $this->getId()) { + $query->filterById($ids, Criteria::IN); + } + + if (null !== $orders = $this->getOrder()) { + foreach ($orders as $order) { + switch($order) { + case "id": + $query->orderById(); + break; + case "id_reverse": + $query->orderById(Criteria::DESC); + break; + case "alpha": + $query->addAscendingOrderByColumn("i18n_TITLE"); + break; + case "alpha_reverse": + $query->addDescendingOrderByColumn("i18n_TITLE"); + break; + case "manual": + $query->orderByPosition(); + break; + case "manual_reverse": + $query->orderByPosition(Criteria::DESC); + break; + } + } + } + + return $query; + } + + /** + * Definition of loop arguments + * + * example : + * + * public function getArgDefinitions() + * { + * return new ArgumentCollection( + * + * Argument::createIntListTypeArgument('id'), + * new Argument( + * 'ref', + * new TypeCollection( + * new Type\AlphaNumStringListType() + * ) + * ), + * Argument::createIntListTypeArgument('category'), + * Argument::createBooleanTypeArgument('new'), + * ... + * ); + * } + * + * @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntListTypeArgument('id'), + new Argument( + "order", + new TypeCollection( + new EnumListType(["id", "id_reverse", "alpha", "alpha_reverse", "manual", "manual_reverse"]) + ), + "manual" + ) + ); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/ImportExportType.php b/core/lib/Thelia/Core/Template/Loop/ImportExportType.php new file mode 100644 index 000000000..7990a4a6b --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/ImportExportType.php @@ -0,0 +1,87 @@ + + */ +class ImportExportType extends BaseLoop implements PropelSearchLoopInterface +{ + /** + * @param LoopResult $loopResult + * + * @return LoopResult + */ + public function parseResults(LoopResult $loopResult) + { + // TODO: Implement parseResults() method. + } + + + /** + * this method returns a Propel ModelCriteria + * + * @return \Propel\Runtime\ActiveQuery\ModelCriteria + */ + public function buildModelCriteria() + { + // TODO: Implement buildModelCriteria() method. + } + + /** + * Definition of loop arguments + * + * example : + * + * public function getArgDefinitions() + * { + * return new ArgumentCollection( + * + * Argument::createIntListTypeArgument('id'), + * new Argument( + * 'ref', + * new TypeCollection( + * new Type\AlphaNumStringListType() + * ) + * ), + * Argument::createIntListTypeArgument('category'), + * Argument::createBooleanTypeArgument('new'), + * ... + * ); + * } + * + * @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntListTypeArgument('id'), + new Argument( + "order", + new TypeCollection( + new EnumListType(["id", "id_reverse", "alpha", "alpha_reverse", "manual", "manual_reverse"]) + ), + "manual" + ) + ); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Form/ExportForm.php b/core/lib/Thelia/Form/ExportForm.php new file mode 100644 index 000000000..33fb8e029 --- /dev/null +++ b/core/lib/Thelia/Form/ExportForm.php @@ -0,0 +1,99 @@ + + */ +class ExportForm extends BaseForm +{ + protected $archiveBuilderManager = array(); + + protected $formattersNames = array(); + + protected $exportTypes = array(); + + protected $translator; + + public function __construct(Request $request, $type= "form", $data = array(), $options = array()) + { + $this->translator = Translator::getInstance(); + + parent::__construct($request, $type, $data, $options); + } + + protected function buildForm() + { + $this->formBuilder + ->add("formatter", "choice", array( + "label" => $this->translator->trans("File format"), + "label_attr" => ["for" => "formatter"], + "required" => true, + "multiple" => false, + "choices" => $this->formattersNames, + )) + ->add("archive_builder", "choice", array( + "label" => $this->translator->trans("Archive Format"), + "label_attr" => ["for" => "archive_builder"], + "required" => true, + "multiple" => false, + "choices" => $this->archiveBuilderManager, + )) + ->add("images", "checkbox", array( + "label" => $this->translator->trans("Include images"), + "label_attr" => ["for" => "with_images"], + "required" => false, + )) + ->add("documents", "checkbox", array( + "label" => $this->translator->trans("Include documents"), + "label_attr" => ["for" => "with_documents"], + "required" => false, + )) + ->add("export_type", "choice", array( + "required" => true, + "choices" => $this->exportTypes, + )) + ; + } + + + public function setFormatters(array $formattersNames) { + $this->formattersNames = $formattersNames; + + return $this; + } + + public function setArchiveBuilderNames(array $archiveBuildersNames) + { + $this->archiveBuilderManager += $archiveBuildersNames; + + return $this; + } + + public function setExportTypes(array $exportType) + { + $this->exportTypes = $exportType; + + return $this; + } + + public function getName() + { + return "thelia_export"; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Model/Base/ImportExportType.php b/core/lib/Thelia/Model/Base/ImportExportType.php index c15281a34..47595ded9 100644 --- a/core/lib/Thelia/Model/Base/ImportExportType.php +++ b/core/lib/Thelia/Model/Base/ImportExportType.php @@ -77,6 +77,12 @@ abstract class ImportExportType implements ActiveRecordInterface */ protected $import_export_category_id; + /** + * The value for the position field. + * @var int + */ + protected $position; + /** * The value for the created_at field. * @var string @@ -419,6 +425,17 @@ abstract class ImportExportType implements ActiveRecordInterface return $this->import_export_category_id; } + /** + * Get the [position] column value. + * + * @return int + */ + public function getPosition() + { + + return $this->position; + } + /** * Get the [optionally formatted] temporal [created_at] column value. * @@ -526,6 +543,27 @@ abstract class ImportExportType implements ActiveRecordInterface return $this; } // setImportExportCategoryId() + /** + * Set the value of [position] column. + * + * @param int $v new value + * @return \Thelia\Model\ImportExportType 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[ImportExportTypeTableMap::POSITION] = true; + } + + + return $this; + } // setPosition() + /** * Sets the value of [created_at] column to a normalized version of the date/time value specified. * @@ -614,13 +652,16 @@ abstract class ImportExportType implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ImportExportTypeTableMap::translateFieldName('ImportExportCategoryId', TableMap::TYPE_PHPNAME, $indexType)]; $this->import_export_category_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ImportExportTypeTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ImportExportTypeTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; + $this->position = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ImportExportTypeTableMap::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 ? 4 + $startcol : ImportExportTypeTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ImportExportTypeTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -633,7 +674,7 @@ abstract class ImportExportType implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 5; // 5 = ImportExportTypeTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 6; // 6 = ImportExportTypeTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\ImportExportType object", 0, $e); @@ -897,6 +938,9 @@ abstract class ImportExportType implements ActiveRecordInterface if ($this->isColumnModified(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID)) { $modifiedColumns[':p' . $index++] = '`IMPORT_EXPORT_CATEGORY_ID`'; } + if ($this->isColumnModified(ImportExportTypeTableMap::POSITION)) { + $modifiedColumns[':p' . $index++] = '`POSITION`'; + } if ($this->isColumnModified(ImportExportTypeTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } @@ -923,6 +967,9 @@ abstract class ImportExportType implements ActiveRecordInterface case '`IMPORT_EXPORT_CATEGORY_ID`': $stmt->bindValue($identifier, $this->import_export_category_id, 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; @@ -1001,9 +1048,12 @@ abstract class ImportExportType implements ActiveRecordInterface return $this->getImportExportCategoryId(); break; case 3: - return $this->getCreatedAt(); + return $this->getPosition(); break; case 4: + return $this->getCreatedAt(); + break; + case 5: return $this->getUpdatedAt(); break; default: @@ -1038,8 +1088,9 @@ abstract class ImportExportType implements ActiveRecordInterface $keys[0] => $this->getId(), $keys[1] => $this->getUrlAction(), $keys[2] => $this->getImportExportCategoryId(), - $keys[3] => $this->getCreatedAt(), - $keys[4] => $this->getUpdatedAt(), + $keys[3] => $this->getPosition(), + $keys[4] => $this->getCreatedAt(), + $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -1097,9 +1148,12 @@ abstract class ImportExportType implements ActiveRecordInterface $this->setImportExportCategoryId($value); break; case 3: - $this->setCreatedAt($value); + $this->setPosition($value); break; case 4: + $this->setCreatedAt($value); + break; + case 5: $this->setUpdatedAt($value); break; } // switch() @@ -1129,8 +1183,9 @@ abstract class ImportExportType implements ActiveRecordInterface if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setUrlAction($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setImportExportCategoryId($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); + if (array_key_exists($keys[3], $arr)) $this->setPosition($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]); } /** @@ -1145,6 +1200,7 @@ abstract class ImportExportType implements ActiveRecordInterface if ($this->isColumnModified(ImportExportTypeTableMap::ID)) $criteria->add(ImportExportTypeTableMap::ID, $this->id); if ($this->isColumnModified(ImportExportTypeTableMap::URL_ACTION)) $criteria->add(ImportExportTypeTableMap::URL_ACTION, $this->url_action); if ($this->isColumnModified(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID)) $criteria->add(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, $this->import_export_category_id); + if ($this->isColumnModified(ImportExportTypeTableMap::POSITION)) $criteria->add(ImportExportTypeTableMap::POSITION, $this->position); if ($this->isColumnModified(ImportExportTypeTableMap::CREATED_AT)) $criteria->add(ImportExportTypeTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(ImportExportTypeTableMap::UPDATED_AT)) $criteria->add(ImportExportTypeTableMap::UPDATED_AT, $this->updated_at); @@ -1212,6 +1268,7 @@ abstract class ImportExportType implements ActiveRecordInterface { $copyObj->setUrlAction($this->getUrlAction()); $copyObj->setImportExportCategoryId($this->getImportExportCategoryId()); + $copyObj->setPosition($this->getPosition()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); @@ -1556,6 +1613,7 @@ abstract class ImportExportType implements ActiveRecordInterface $this->id = null; $this->url_action = null; $this->import_export_category_id = null; + $this->position = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; diff --git a/core/lib/Thelia/Model/Base/ImportExportTypeQuery.php b/core/lib/Thelia/Model/Base/ImportExportTypeQuery.php index 68adab4a0..953591923 100644 --- a/core/lib/Thelia/Model/Base/ImportExportTypeQuery.php +++ b/core/lib/Thelia/Model/Base/ImportExportTypeQuery.php @@ -25,12 +25,14 @@ use Thelia\Model\Map\ImportExportTypeTableMap; * @method ChildImportExportTypeQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildImportExportTypeQuery orderByUrlAction($order = Criteria::ASC) Order by the url_action column * @method ChildImportExportTypeQuery orderByImportExportCategoryId($order = Criteria::ASC) Order by the import_export_category_id column + * @method ChildImportExportTypeQuery orderByPosition($order = Criteria::ASC) Order by the position column * @method ChildImportExportTypeQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildImportExportTypeQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * * @method ChildImportExportTypeQuery groupById() Group by the id column * @method ChildImportExportTypeQuery groupByUrlAction() Group by the url_action column * @method ChildImportExportTypeQuery groupByImportExportCategoryId() Group by the import_export_category_id column + * @method ChildImportExportTypeQuery groupByPosition() Group by the position column * @method ChildImportExportTypeQuery groupByCreatedAt() Group by the created_at column * @method ChildImportExportTypeQuery groupByUpdatedAt() Group by the updated_at column * @@ -52,12 +54,14 @@ use Thelia\Model\Map\ImportExportTypeTableMap; * @method ChildImportExportType findOneById(int $id) Return the first ChildImportExportType filtered by the id column * @method ChildImportExportType findOneByUrlAction(string $url_action) Return the first ChildImportExportType filtered by the url_action column * @method ChildImportExportType findOneByImportExportCategoryId(int $import_export_category_id) Return the first ChildImportExportType filtered by the import_export_category_id column + * @method ChildImportExportType findOneByPosition(int $position) Return the first ChildImportExportType filtered by the position column * @method ChildImportExportType findOneByCreatedAt(string $created_at) Return the first ChildImportExportType filtered by the created_at column * @method ChildImportExportType findOneByUpdatedAt(string $updated_at) Return the first ChildImportExportType filtered by the updated_at column * * @method array findById(int $id) Return ChildImportExportType objects filtered by the id column * @method array findByUrlAction(string $url_action) Return ChildImportExportType objects filtered by the url_action column * @method array findByImportExportCategoryId(int $import_export_category_id) Return ChildImportExportType objects filtered by the import_export_category_id column + * @method array findByPosition(int $position) Return ChildImportExportType objects filtered by the position column * @method array findByCreatedAt(string $created_at) Return ChildImportExportType objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildImportExportType objects filtered by the updated_at column * @@ -148,7 +152,7 @@ abstract class ImportExportTypeQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT `ID`, `URL_ACTION`, `IMPORT_EXPORT_CATEGORY_ID`, `CREATED_AT`, `UPDATED_AT` FROM `import_export_type` WHERE `ID` = :p0'; + $sql = 'SELECT `ID`, `URL_ACTION`, `IMPORT_EXPORT_CATEGORY_ID`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `import_export_type` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -350,6 +354,47 @@ abstract class ImportExportTypeQuery extends ModelCriteria return $this->addUsingAlias(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, $importExportCategoryId, $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 ChildImportExportTypeQuery 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(ImportExportTypeTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($position['max'])) { + $this->addUsingAlias(ImportExportTypeTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ImportExportTypeTableMap::POSITION, $position, $comparison); + } + /** * Filter the query on the created_at column * diff --git a/core/lib/Thelia/Model/Map/ImportExportTypeTableMap.php b/core/lib/Thelia/Model/Map/ImportExportTypeTableMap.php index bfca378c5..5533343fd 100644 --- a/core/lib/Thelia/Model/Map/ImportExportTypeTableMap.php +++ b/core/lib/Thelia/Model/Map/ImportExportTypeTableMap.php @@ -58,7 +58,7 @@ class ImportExportTypeTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 5; + const NUM_COLUMNS = 6; /** * The number of lazy-loaded columns @@ -68,7 +68,7 @@ class ImportExportTypeTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 5; + const NUM_HYDRATE_COLUMNS = 6; /** * the column name for the ID field @@ -85,6 +85,11 @@ class ImportExportTypeTableMap extends TableMap */ const IMPORT_EXPORT_CATEGORY_ID = 'import_export_type.IMPORT_EXPORT_CATEGORY_ID'; + /** + * the column name for the POSITION field + */ + const POSITION = 'import_export_type.POSITION'; + /** * the column name for the CREATED_AT field */ @@ -116,12 +121,12 @@ class ImportExportTypeTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'UrlAction', 'ImportExportCategoryId', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'urlAction', 'importExportCategoryId', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(ImportExportTypeTableMap::ID, ImportExportTypeTableMap::URL_ACTION, ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, ImportExportTypeTableMap::CREATED_AT, ImportExportTypeTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'URL_ACTION', 'IMPORT_EXPORT_CATEGORY_ID', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'url_action', 'import_export_category_id', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + self::TYPE_PHPNAME => array('Id', 'UrlAction', 'ImportExportCategoryId', 'Position', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'urlAction', 'importExportCategoryId', 'position', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(ImportExportTypeTableMap::ID, ImportExportTypeTableMap::URL_ACTION, ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, ImportExportTypeTableMap::POSITION, ImportExportTypeTableMap::CREATED_AT, ImportExportTypeTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'URL_ACTION', 'IMPORT_EXPORT_CATEGORY_ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'url_action', 'import_export_category_id', 'position', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -131,12 +136,12 @@ class ImportExportTypeTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'UrlAction' => 1, 'ImportExportCategoryId' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'urlAction' => 1, 'importExportCategoryId' => 2, 'createdAt' => 3, 'updatedAt' => 4, ), - self::TYPE_COLNAME => array(ImportExportTypeTableMap::ID => 0, ImportExportTypeTableMap::URL_ACTION => 1, ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID => 2, ImportExportTypeTableMap::CREATED_AT => 3, ImportExportTypeTableMap::UPDATED_AT => 4, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'URL_ACTION' => 1, 'IMPORT_EXPORT_CATEGORY_ID' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ), - self::TYPE_FIELDNAME => array('id' => 0, 'url_action' => 1, 'import_export_category_id' => 2, 'created_at' => 3, 'updated_at' => 4, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + self::TYPE_PHPNAME => array('Id' => 0, 'UrlAction' => 1, 'ImportExportCategoryId' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'urlAction' => 1, 'importExportCategoryId' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, ), + self::TYPE_COLNAME => array(ImportExportTypeTableMap::ID => 0, ImportExportTypeTableMap::URL_ACTION => 1, ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID => 2, ImportExportTypeTableMap::POSITION => 3, ImportExportTypeTableMap::CREATED_AT => 4, ImportExportTypeTableMap::UPDATED_AT => 5, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'URL_ACTION' => 1, 'IMPORT_EXPORT_CATEGORY_ID' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ), + self::TYPE_FIELDNAME => array('id' => 0, 'url_action' => 1, 'import_export_category_id' => 2, 'position' => 3, 'created_at' => 4, 'updated_at' => 5, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -158,6 +163,7 @@ class ImportExportTypeTableMap extends TableMap $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addColumn('URL_ACTION', 'UrlAction', 'VARCHAR', true, 255, null); $this->addForeignKey('IMPORT_EXPORT_CATEGORY_ID', 'ImportExportCategoryId', 'INTEGER', 'import_export_category', 'ID', true, null, null); + $this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); } // initialize() @@ -335,12 +341,14 @@ class ImportExportTypeTableMap extends TableMap $criteria->addSelectColumn(ImportExportTypeTableMap::ID); $criteria->addSelectColumn(ImportExportTypeTableMap::URL_ACTION); $criteria->addSelectColumn(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID); + $criteria->addSelectColumn(ImportExportTypeTableMap::POSITION); $criteria->addSelectColumn(ImportExportTypeTableMap::CREATED_AT); $criteria->addSelectColumn(ImportExportTypeTableMap::UPDATED_AT); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.URL_ACTION'); $criteria->addSelectColumn($alias . '.IMPORT_EXPORT_CATEGORY_ID'); + $criteria->addSelectColumn($alias . '.POSITION'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); } diff --git a/local/config/schema.xml b/local/config/schema.xml index f9e62b9ed..0738419ee 100644 --- a/local/config/schema.xml +++ b/local/config/schema.xml @@ -1527,6 +1527,7 @@ + diff --git a/setup/thelia.sql b/setup/thelia.sql index d46b81c98..d5d300552 100644 --- a/setup/thelia.sql +++ b/setup/thelia.sql @@ -1899,6 +1899,7 @@ CREATE TABLE `import_export_type` `id` INTEGER NOT NULL AUTO_INCREMENT, `url_action` VARCHAR(255) NOT NULL, `import_export_category_id` INTEGER NOT NULL, + `position` INTEGER NOT NULL, `created_at` DATETIME, `updated_at` DATETIME, PRIMARY KEY (`id`), diff --git a/templates/backOffice/default/export.html b/templates/backOffice/default/export.html index ed1360a2a..6cafbd178 100644 --- a/templates/backOffice/default/export.html +++ b/templates/backOffice/default/export.html @@ -27,31 +27,45 @@ {module_include location='tools_top'} - {include file='includes/export-form-definition.html' form=$form} -
+ {loop name="import-export-category" type="import-export-category"} + {if $LOOP_COUNT % 3} +
+ {/if} -
- + {if $LOOP_COUNT % 3} +
+ {/if} + {/loop} + + {module_include location='configuration_bottom'}