From 394edf8fdc355eac13cc095ba9f655f6c1550a6d Mon Sep 17 00:00:00 2001 From: Benjamin Perche Date: Tue, 5 Aug 2014 09:07:18 +0200 Subject: [PATCH 1/8] =?UTF-8?q?Add=20preInsert=20method=20for=20positions?= =?UTF-8?q?=20=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20core/lib/Thelia/M?= =?UTF-8?q?odel/ExportCategory.php=20=09modifi=C3=A9:=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20core/lib/Thelia/Model/Import.php=20=09modifi=C3=A9:=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20core/lib/Thelia/Model/ImportCategory.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/lib/Thelia/Model/ExportCategory.php | 11 +++++++++++ core/lib/Thelia/Model/Import.php | 11 +++++++++++ core/lib/Thelia/Model/ImportCategory.php | 11 +++++++++++ 3 files changed, 33 insertions(+) diff --git a/core/lib/Thelia/Model/ExportCategory.php b/core/lib/Thelia/Model/ExportCategory.php index f6e155eea..f812148ba 100644 --- a/core/lib/Thelia/Model/ExportCategory.php +++ b/core/lib/Thelia/Model/ExportCategory.php @@ -2,6 +2,7 @@ namespace Thelia\Model; +use Propel\Runtime\Connection\ConnectionInterface; use Thelia\Model\Base\ExportCategory as BaseExportCategory; use Thelia\Model\Tools\ModelEventDispatcherTrait; use Thelia\Model\Tools\PositionManagementTrait; @@ -10,4 +11,14 @@ class ExportCategory extends BaseExportCategory { use PositionManagementTrait; use ModelEventDispatcherTrait; + + /** + * {@inheritDoc} + */ + public function preInsert(ConnectionInterface $con = null) + { + $this->setPosition($this->getNextPosition()); + + return true; + } } diff --git a/core/lib/Thelia/Model/Import.php b/core/lib/Thelia/Model/Import.php index f7cbb1000..0c6086e13 100644 --- a/core/lib/Thelia/Model/Import.php +++ b/core/lib/Thelia/Model/Import.php @@ -3,6 +3,7 @@ namespace Thelia\Model; use Exception; +use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\ClassNotFoundException; use Propel\Runtime\Propel; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -57,4 +58,14 @@ class Import extends BaseImport return $instance; } + + /** + * {@inheritDoc} + */ + public function preInsert(ConnectionInterface $con = null) + { + $this->setPosition($this->getNextPosition()); + + return true; + } } diff --git a/core/lib/Thelia/Model/ImportCategory.php b/core/lib/Thelia/Model/ImportCategory.php index 6aca35800..1a1fdef6a 100644 --- a/core/lib/Thelia/Model/ImportCategory.php +++ b/core/lib/Thelia/Model/ImportCategory.php @@ -2,6 +2,7 @@ namespace Thelia\Model; +use Propel\Runtime\Connection\ConnectionInterface; use Thelia\Model\Base\ImportCategory as BaseImportCategory; use Thelia\Model\Tools\ModelEventDispatcherTrait; use Thelia\Model\Tools\PositionManagementTrait; @@ -10,4 +11,14 @@ class ImportCategory extends BaseImportCategory { use PositionManagementTrait; use ModelEventDispatcherTrait; + + /** + * {@inheritDoc} + */ + public function preInsert(ConnectionInterface $con = null) + { + $this->setPosition($this->getNextPosition()); + + return true; + } } From f3c4d151637dbe0ee5b4382965d5e0ba79f129cf Mon Sep 17 00:00:00 2001 From: Benjamin Perche Date: Tue, 5 Aug 2014 09:17:38 +0200 Subject: [PATCH 2/8] =?UTF-8?q?Add=20position=20management=20with=20catego?= =?UTF-8?q?ries=20for=20imports=20and=20exports=20=09modifi=C3=A9:=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20core/lib/Thelia/Model/Export.php=20=09modi?= =?UTF-8?q?fi=C3=A9:=20=20=20=20=20=20=20=20=20core/lib/Thelia/Model/Impor?= =?UTF-8?q?t.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/lib/Thelia/Model/Export.php | 6 ++++++ core/lib/Thelia/Model/Import.php | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/core/lib/Thelia/Model/Export.php b/core/lib/Thelia/Model/Export.php index fdd9e578b..c9c21bdc0 100644 --- a/core/lib/Thelia/Model/Export.php +++ b/core/lib/Thelia/Model/Export.php @@ -91,4 +91,10 @@ class Export extends BaseExport return true; } + + + public function addCriteriaToPositionQuery($query) + { + $query->filterByExportCategoryId($this->getExportCategoryId()); + } } diff --git a/core/lib/Thelia/Model/Import.php b/core/lib/Thelia/Model/Import.php index 0c6086e13..dc9faf871 100644 --- a/core/lib/Thelia/Model/Import.php +++ b/core/lib/Thelia/Model/Import.php @@ -68,4 +68,9 @@ class Import extends BaseImport return true; } + + public function addCriteriaToPositionQuery($query) + { + $query->filterByImportCategoryId($this->getImportCategoryId()); + } } From 3e51e622417f38f00ca18cb87b1974b429266307 Mon Sep 17 00:00:00 2001 From: Benjamin Perche Date: Tue, 5 Aug 2014 09:19:33 +0200 Subject: [PATCH 3/8] =?UTF-8?q?Fix=20import=20and=20import=20category=20pa?= =?UTF-8?q?rsing=20=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20core/lib/The?= =?UTF-8?q?lia/Core/DependencyInjection/Loader/XmlFileLoader.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php b/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php index 7d92be2f5..1d1fec0fd 100644 --- a/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php +++ b/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php @@ -91,13 +91,13 @@ class XmlFileLoader extends FileLoader ); $this->propelOnlyRun( - [$this, "parseExportCategories"], + [$this, "parseImportCategories"], $xml, ImportCategoryTableMap::DATABASE_NAME ); $this->propelOnlyRun( - [$this, "parseExports"], + [$this, "parseImports"], $xml, ImportTableMap::DATABASE_NAME ); From 9967fbdd6c348770865613f955ad5e8955094e44 Mon Sep 17 00:00:00 2001 From: Benjamin Perche Date: Tue, 5 Aug 2014 09:25:49 +0200 Subject: [PATCH 4/8] =?UTF-8?q?Add=20import=20positionning=20=09modifi?= =?UTF-8?q?=C3=A9:=20=20=20=20=20=20=20=20=20core/lib/Thelia/Controller/Ad?= =?UTF-8?q?min/ImportController.php=20=09modifi=C3=A9:=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20templates/backOffice/default/import.html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/Admin/ImportController.php | 2 + templates/backOffice/default/import.html | 79 +++++++++++++++---- 2 files changed, 67 insertions(+), 14 deletions(-) diff --git a/core/lib/Thelia/Controller/Admin/ImportController.php b/core/lib/Thelia/Controller/Admin/ImportController.php index 2847e6116..dd156d3c1 100644 --- a/core/lib/Thelia/Controller/Admin/ImportController.php +++ b/core/lib/Thelia/Controller/Admin/ImportController.php @@ -444,6 +444,8 @@ class ImportController extends BaseAdminController $event = new UpdatePositionEvent($id, $this->getMode($mode), $value); $this->dispatch(TheliaEvents::IMPORT_CHANGE_POSITION, $event); + + return $this->render('import'); } public function changeCategoryPosition() diff --git a/templates/backOffice/default/import.html b/templates/backOffice/default/import.html index ac455134f..43226fc74 100644 --- a/templates/backOffice/default/import.html +++ b/templates/backOffice/default/import.html @@ -41,13 +41,15 @@
@@ -82,13 +84,15 @@ {$TITLE}
- - - - {$POSITION} - - - + {admin_position_block + resource="admin.import" + access="UPDATE" + path={url path="admin/import/position/category"} + url_parameter="id" + in_place_edit_class="importCategoryPositionChange" + position=$POSITION + id=$ID + } {$TITLE}
- - - - {$POSITION} - - - + {admin_position_block + resource="admin.import" + access="UPDATE" + path={url path="admin/import/position"} + url_parameter="id" + in_place_edit_class="importPositionChange" + position=$POSITION + id=$ID + }
@@ -119,9 +123,56 @@
{/block} +{block name="javascript-initialization"} + + {javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'} + + {/javascripts} + +{/block} + {block name="javascript-last-call"}