From 5e0f9cedf54810540e64dc0abb7c304207e9ef62 Mon Sep 17 00:00:00 2001 From: Etienne Roudeix Date: Thu, 26 Sep 2013 10:43:09 +0200 Subject: [PATCH] fix tests --- core/lib/Thelia/Config/Resources/config.xml | 1 + .../Controller/Admin/OrderController.php | 2 + .../Core/Template/Loop/FeatureValue.php | 39 ++--- core/lib/Thelia/Form/OrderUpdateAddress.php | 136 ++++++++++++++++++ core/lib/Thelia/Model/Base/Attribute.php | 76 ++++++++-- core/lib/Thelia/Model/Base/AttributeQuery.php | 47 +++++- .../Thelia/Model/Base/AttributeTemplate.php | 76 ++-------- .../Model/Base/AttributeTemplateQuery.php | 35 +---- core/lib/Thelia/Model/Base/Feature.php | 76 ++++++++-- core/lib/Thelia/Model/Base/FeatureQuery.php | 47 +++++- .../Thelia/Model/Map/AttributeTableMap.php | 36 +++-- .../Model/Map/AttributeTemplateTableMap.php | 36 ++--- core/lib/Thelia/Model/Map/FeatureTableMap.php | 36 +++-- install/faker.php | 4 +- install/thelia.sql | 3 +- local/config/schema.xml | 3 +- templates/admin/default/order-edit.html | 68 ++++----- templates/admin/default/orders.html | 2 +- 18 files changed, 497 insertions(+), 226 deletions(-) create mode 100644 core/lib/Thelia/Form/OrderUpdateAddress.php diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml index 378650057..7673d9a82 100755 --- a/core/lib/Thelia/Config/Resources/config.xml +++ b/core/lib/Thelia/Config/Resources/config.xml @@ -78,6 +78,7 @@
+ diff --git a/core/lib/Thelia/Controller/Admin/OrderController.php b/core/lib/Thelia/Controller/Admin/OrderController.php index 2ef709d94..1c4a708a4 100644 --- a/core/lib/Thelia/Controller/Admin/OrderController.php +++ b/core/lib/Thelia/Controller/Admin/OrderController.php @@ -97,6 +97,7 @@ class OrderController extends BaseAdminController $this->redirectToRoute("admin.order.list", $params); } else { $params["order_id"] = $order_id; + $params["tab"] = $this->getRequest()->get("tab", 'cart'); $this->redirect(URL::getInstance()->absoluteUrl($this->getRoute("admin.order.update.view", $params))); } } @@ -131,6 +132,7 @@ class OrderController extends BaseAdminController } $params["order_id"] = $order_id; + $params["tab"] = $this->getRequest()->get("tab", 'bill'); $this->redirect(URL::getInstance()->absoluteUrl($this->getRoute("admin.order.update.view", $params))); } diff --git a/core/lib/Thelia/Core/Template/Loop/FeatureValue.php b/core/lib/Thelia/Core/Template/Loop/FeatureValue.php index 30a8dcf27..ac057ff45 100755 --- a/core/lib/Thelia/Core/Template/Loop/FeatureValue.php +++ b/core/lib/Thelia/Core/Template/Loop/FeatureValue.php @@ -59,7 +59,7 @@ class FeatureValue extends BaseI18nLoop Argument::createIntTypeArgument('product', null, true), Argument::createIntListTypeArgument('feature_availability'), Argument::createBooleanTypeArgument('exclude_feature_availability', 0), - Argument::createBooleanTypeArgument('exclude_personal_values', 0), + Argument::createBooleanTypeArgument('exclude_free_text', 0), new Argument( 'order', new TypeCollection( @@ -79,7 +79,7 @@ class FeatureValue extends BaseI18nLoop { $search = FeatureProductQuery::create(); - /* manage featureAv translations */ + // manage featureAv translations $locale = $this->configureI18nProcessing( $search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), @@ -103,13 +103,9 @@ class FeatureValue extends BaseI18nLoop } $excludeFeatureAvailability = $this->getExclude_feature_availability(); - if ($excludeFeatureAvailability == true) { - $search->filterByFeatureAvId(null, Criteria::NULL); - } - $excludeDefaultValues = $this->getExclude_personal_values(); - if ($excludeDefaultValues == true) { - $search->filterByByDefault(null, Criteria::NULL); + if ($excludeFeatureAvailability == true) { + $search->filterByFeatureAvId(null, Criteria::ISNULL); } $orders = $this->getOrder(); @@ -136,21 +132,30 @@ class FeatureValue extends BaseI18nLoop $loopResult = new LoopResult($featureValues); foreach ($featureValues as $featureValue) { + $loopResultRow = new LoopResultRow($loopResult, $featureValue, $this->versionable, $this->timestampable, $this->countable); - $loopResultRow->set("ID", $featureValue->getId()); $loopResultRow - ->set("LOCALE",$locale) - ->set("PERSONAL_VALUE", $featureValue->getByDefault()) - ->set("TITLE",$featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_TITLE')) - ->set("CHAPO", $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_CHAPO')) - ->set("DESCRIPTION", $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_DESCRIPTION')) - ->set("POSTSCRIPTUM", $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_POSTSCRIPTUM')) - ->set("POSITION", $featureValue->getPosition()); + ->set("ID" , $featureValue->getId()) + ->set("PRODUCT" , $featureValue->getProductId()) + ->set("FEATURE_AV_ID" , $featureValue->getFeatureAvId()) + ->set("FREE_TEXT_VALUE" , $featureValue->getFreeTextValue()) + + ->set("IS_FREE_TEXT" , is_null($featureValue->getFeatureAvId()) ? 1 : 0) + ->set("IS_FEATURE_AV" , is_null($featureValue->getFeatureAvId()) ? 0 : 1) + + ->set("LOCALE" , $locale) + ->set("TITLE" , $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_TITLE')) + ->set("CHAPO" , $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_CHAPO')) + ->set("DESCRIPTION" , $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM" , $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_POSTSCRIPTUM')) + + ->set("POSITION" , $featureValue->getPosition()) + ; $loopResult->addRow($loopResultRow); } return $loopResult; } -} +} \ No newline at end of file diff --git a/core/lib/Thelia/Form/OrderUpdateAddress.php b/core/lib/Thelia/Form/OrderUpdateAddress.php new file mode 100644 index 000000000..80cb92ba8 --- /dev/null +++ b/core/lib/Thelia/Form/OrderUpdateAddress.php @@ -0,0 +1,136 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Form; +use Symfony\Component\Validator\Constraints\NotBlank; +use Thelia\Core\Translation\Translator; + +/** + * Class AddressUpdateForm + * @package Thelia\Form + * @author Etienne Roudeix + */ +class OrderUpdateAddress extends BaseForm +{ + protected function buildForm() + { + $this->formBuilder + ->add("title", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => Translator::getInstance()->trans("Title"), + "label_attr" => array( + "for" => "title_update" + ) + )) + ->add("firstname", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => Translator::getInstance()->trans("Firstname"), + "label_attr" => array( + "for" => "firstname_update" + ) + )) + ->add("lastname", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => Translator::getInstance()->trans("Lastname"), + "label_attr" => array( + "for" => "lastname_update" + ) + )) + ->add("address1", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => Translator::getInstance()->trans("Street Address"), + "label_attr" => array( + "for" => "address1_update" + ) + )) + ->add("address2", "text", array( + "label" => Translator::getInstance()->trans("Additional address"), + "label_attr" => array( + "for" => "address2_update" + ) + )) + ->add("address3", "text", array( + "label" => Translator::getInstance()->trans("Additional address"), + "label_attr" => array( + "for" => "address3_update" + ) + )) + ->add("zipcode", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => Translator::getInstance()->trans("Zip code"), + "label_attr" => array( + "for" => "zipcode_update" + ) + )) + ->add("city", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => Translator::getInstance()->trans("City"), + "label_attr" => array( + "for" => "city_update" + ) + )) + ->add("country", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => Translator::getInstance()->trans("Country"), + "label_attr" => array( + "for" => "country_update" + ) + )) + ->add("phone", "text", array( + "label" => Translator::getInstance()->trans("Phone"), + "label_attr" => array( + "for" => "phone_update" + ) + )) + ->add("company", "text", array( + "label" => Translator::getInstance()->trans("Compagny"), + "label_attr" => array( + "for" => "company_update" + ) + )) + ; + + } + + /** + * @return string the name of you form. This name must be unique + */ + public function getName() + { + return "thelia_order_address_update"; + } +} diff --git a/core/lib/Thelia/Model/Base/Attribute.php b/core/lib/Thelia/Model/Base/Attribute.php index 51ddaac83..64e765fdd 100644 --- a/core/lib/Thelia/Model/Base/Attribute.php +++ b/core/lib/Thelia/Model/Base/Attribute.php @@ -71,6 +71,12 @@ abstract class Attribute implements ActiveRecordInterface */ protected $id; + /** + * The value for the position field. + * @var int + */ + protected $position; + /** * The value for the created_at field. * @var string @@ -429,6 +435,17 @@ abstract class Attribute implements ActiveRecordInterface return $this->id; } + /** + * Get the [position] column value. + * + * @return int + */ + public function getPosition() + { + + return $this->position; + } + /** * Get the [optionally formatted] temporal [created_at] column value. * @@ -490,6 +507,27 @@ abstract class Attribute implements ActiveRecordInterface return $this; } // setId() + /** + * Set the value of [position] column. + * + * @param int $v new value + * @return \Thelia\Model\Attribute 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[] = AttributeTableMap::POSITION; + } + + + return $this; + } // setPosition() + /** * Sets the value of [created_at] column to a normalized version of the date/time value specified. * @@ -572,13 +610,16 @@ abstract class Attribute implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : AttributeTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AttributeTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AttributeTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; + $this->position = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AttributeTableMap::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 ? 2 + $startcol : AttributeTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AttributeTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -591,7 +632,7 @@ abstract class Attribute implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 3; // 3 = AttributeTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 4; // 4 = AttributeTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\Attribute object", 0, $e); @@ -918,6 +959,9 @@ abstract class Attribute implements ActiveRecordInterface if ($this->isColumnModified(AttributeTableMap::ID)) { $modifiedColumns[':p' . $index++] = 'ID'; } + if ($this->isColumnModified(AttributeTableMap::POSITION)) { + $modifiedColumns[':p' . $index++] = 'POSITION'; + } if ($this->isColumnModified(AttributeTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; } @@ -938,6 +982,9 @@ abstract class Attribute implements ActiveRecordInterface case 'ID': $stmt->bindValue($identifier, $this->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; @@ -1010,9 +1057,12 @@ abstract class Attribute implements ActiveRecordInterface return $this->getId(); break; case 1: - return $this->getCreatedAt(); + return $this->getPosition(); break; case 2: + return $this->getCreatedAt(); + break; + case 3: return $this->getUpdatedAt(); break; default: @@ -1045,8 +1095,9 @@ abstract class Attribute implements ActiveRecordInterface $keys = AttributeTableMap::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), - $keys[1] => $this->getCreatedAt(), - $keys[2] => $this->getUpdatedAt(), + $keys[1] => $this->getPosition(), + $keys[2] => $this->getCreatedAt(), + $keys[3] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1105,9 +1156,12 @@ abstract class Attribute implements ActiveRecordInterface $this->setId($value); break; case 1: - $this->setCreatedAt($value); + $this->setPosition($value); break; case 2: + $this->setCreatedAt($value); + break; + case 3: $this->setUpdatedAt($value); break; } // switch() @@ -1135,8 +1189,9 @@ abstract class Attribute implements ActiveRecordInterface $keys = AttributeTableMap::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setCreatedAt($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setUpdatedAt($arr[$keys[2]]); + if (array_key_exists($keys[1], $arr)) $this->setPosition($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setCreatedAt($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setUpdatedAt($arr[$keys[3]]); } /** @@ -1149,6 +1204,7 @@ abstract class Attribute implements ActiveRecordInterface $criteria = new Criteria(AttributeTableMap::DATABASE_NAME); if ($this->isColumnModified(AttributeTableMap::ID)) $criteria->add(AttributeTableMap::ID, $this->id); + if ($this->isColumnModified(AttributeTableMap::POSITION)) $criteria->add(AttributeTableMap::POSITION, $this->position); if ($this->isColumnModified(AttributeTableMap::CREATED_AT)) $criteria->add(AttributeTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(AttributeTableMap::UPDATED_AT)) $criteria->add(AttributeTableMap::UPDATED_AT, $this->updated_at); @@ -1214,6 +1270,7 @@ abstract class Attribute implements ActiveRecordInterface */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { + $copyObj->setPosition($this->getPosition()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); @@ -2447,6 +2504,7 @@ abstract class Attribute implements ActiveRecordInterface public function clear() { $this->id = null; + $this->position = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; diff --git a/core/lib/Thelia/Model/Base/AttributeQuery.php b/core/lib/Thelia/Model/Base/AttributeQuery.php index 4a7fd6b20..b496289f8 100644 --- a/core/lib/Thelia/Model/Base/AttributeQuery.php +++ b/core/lib/Thelia/Model/Base/AttributeQuery.php @@ -23,10 +23,12 @@ use Thelia\Model\Map\AttributeTableMap; * * * @method ChildAttributeQuery orderById($order = Criteria::ASC) Order by the id column + * @method ChildAttributeQuery orderByPosition($order = Criteria::ASC) Order by the position column * @method ChildAttributeQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildAttributeQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * * @method ChildAttributeQuery groupById() Group by the id column + * @method ChildAttributeQuery groupByPosition() Group by the position column * @method ChildAttributeQuery groupByCreatedAt() Group by the created_at column * @method ChildAttributeQuery groupByUpdatedAt() Group by the updated_at column * @@ -54,10 +56,12 @@ use Thelia\Model\Map\AttributeTableMap; * @method ChildAttribute findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAttribute matching the query, or a new ChildAttribute object populated from the query conditions when no match is found * * @method ChildAttribute findOneById(int $id) Return the first ChildAttribute filtered by the id column + * @method ChildAttribute findOneByPosition(int $position) Return the first ChildAttribute filtered by the position column * @method ChildAttribute findOneByCreatedAt(string $created_at) Return the first ChildAttribute filtered by the created_at column * @method ChildAttribute findOneByUpdatedAt(string $updated_at) Return the first ChildAttribute filtered by the updated_at column * * @method array findById(int $id) Return ChildAttribute objects filtered by the id column + * @method array findByPosition(int $position) Return ChildAttribute objects filtered by the position column * @method array findByCreatedAt(string $created_at) Return ChildAttribute objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildAttribute objects filtered by the updated_at column * @@ -148,7 +152,7 @@ abstract class AttributeQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CREATED_AT, UPDATED_AT FROM attribute WHERE ID = :p0'; + $sql = 'SELECT ID, POSITION, CREATED_AT, UPDATED_AT FROM attribute WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -278,6 +282,47 @@ abstract class AttributeQuery extends ModelCriteria return $this->addUsingAlias(AttributeTableMap::ID, $id, $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 ChildAttributeQuery 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(AttributeTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($position['max'])) { + $this->addUsingAlias(AttributeTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(AttributeTableMap::POSITION, $position, $comparison); + } + /** * Filter the query on the created_at column * diff --git a/core/lib/Thelia/Model/Base/AttributeTemplate.php b/core/lib/Thelia/Model/Base/AttributeTemplate.php index 0014e1a8d..85d432a62 100644 --- a/core/lib/Thelia/Model/Base/AttributeTemplate.php +++ b/core/lib/Thelia/Model/Base/AttributeTemplate.php @@ -82,12 +82,6 @@ abstract class AttributeTemplate implements ActiveRecordInterface */ protected $position; - /** - * The value for the attribute_templatecol field. - * @var string - */ - protected $attribute_templatecol; - /** * The value for the created_at field. * @var string @@ -416,17 +410,6 @@ abstract class AttributeTemplate implements ActiveRecordInterface return $this->position; } - /** - * Get the [attribute_templatecol] column value. - * - * @return string - */ - public function getAttributeTemplatecol() - { - - return $this->attribute_templatecol; - } - /** * Get the [optionally formatted] temporal [created_at] column value. * @@ -559,27 +542,6 @@ abstract class AttributeTemplate implements ActiveRecordInterface return $this; } // setPosition() - /** - * Set the value of [attribute_templatecol] column. - * - * @param string $v new value - * @return \Thelia\Model\AttributeTemplate The current object (for fluent API support) - */ - public function setAttributeTemplatecol($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->attribute_templatecol !== $v) { - $this->attribute_templatecol = $v; - $this->modifiedColumns[] = AttributeTemplateTableMap::ATTRIBUTE_TEMPLATECOL; - } - - - return $this; - } // setAttributeTemplatecol() - /** * Sets the value of [created_at] column to a normalized version of the date/time value specified. * @@ -671,16 +633,13 @@ abstract class AttributeTemplate implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AttributeTemplateTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; $this->position = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : AttributeTemplateTableMap::translateFieldName('AttributeTemplatecol', TableMap::TYPE_PHPNAME, $indexType)]; - $this->attribute_templatecol = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : AttributeTemplateTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : AttributeTemplateTableMap::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 ? 6 + $startcol : AttributeTemplateTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : AttributeTemplateTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -693,7 +652,7 @@ abstract class AttributeTemplate implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 7; // 7 = AttributeTemplateTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 6; // 6 = AttributeTemplateTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\AttributeTemplate object", 0, $e); @@ -952,9 +911,6 @@ abstract class AttributeTemplate implements ActiveRecordInterface if ($this->isColumnModified(AttributeTemplateTableMap::POSITION)) { $modifiedColumns[':p' . $index++] = 'POSITION'; } - if ($this->isColumnModified(AttributeTemplateTableMap::ATTRIBUTE_TEMPLATECOL)) { - $modifiedColumns[':p' . $index++] = 'ATTRIBUTE_TEMPLATECOL'; - } if ($this->isColumnModified(AttributeTemplateTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; } @@ -984,9 +940,6 @@ abstract class AttributeTemplate implements ActiveRecordInterface case 'POSITION': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'ATTRIBUTE_TEMPLATECOL': - $stmt->bindValue($identifier, $this->attribute_templatecol, PDO::PARAM_STR); - 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; @@ -1068,12 +1021,9 @@ abstract class AttributeTemplate implements ActiveRecordInterface return $this->getPosition(); break; case 4: - return $this->getAttributeTemplatecol(); - break; - case 5: return $this->getCreatedAt(); break; - case 6: + case 5: return $this->getUpdatedAt(); break; default: @@ -1109,9 +1059,8 @@ abstract class AttributeTemplate implements ActiveRecordInterface $keys[1] => $this->getAttributeId(), $keys[2] => $this->getTemplateId(), $keys[3] => $this->getPosition(), - $keys[4] => $this->getAttributeTemplatecol(), - $keys[5] => $this->getCreatedAt(), - $keys[6] => $this->getUpdatedAt(), + $keys[4] => $this->getCreatedAt(), + $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1173,12 +1122,9 @@ abstract class AttributeTemplate implements ActiveRecordInterface $this->setPosition($value); break; case 4: - $this->setAttributeTemplatecol($value); - break; - case 5: $this->setCreatedAt($value); break; - case 6: + case 5: $this->setUpdatedAt($value); break; } // switch() @@ -1209,9 +1155,8 @@ abstract class AttributeTemplate implements ActiveRecordInterface if (array_key_exists($keys[1], $arr)) $this->setAttributeId($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setTemplateId($arr[$keys[2]]); if (array_key_exists($keys[3], $arr)) $this->setPosition($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setAttributeTemplatecol($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]); + if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]); } /** @@ -1227,7 +1172,6 @@ abstract class AttributeTemplate implements ActiveRecordInterface if ($this->isColumnModified(AttributeTemplateTableMap::ATTRIBUTE_ID)) $criteria->add(AttributeTemplateTableMap::ATTRIBUTE_ID, $this->attribute_id); if ($this->isColumnModified(AttributeTemplateTableMap::TEMPLATE_ID)) $criteria->add(AttributeTemplateTableMap::TEMPLATE_ID, $this->template_id); if ($this->isColumnModified(AttributeTemplateTableMap::POSITION)) $criteria->add(AttributeTemplateTableMap::POSITION, $this->position); - if ($this->isColumnModified(AttributeTemplateTableMap::ATTRIBUTE_TEMPLATECOL)) $criteria->add(AttributeTemplateTableMap::ATTRIBUTE_TEMPLATECOL, $this->attribute_templatecol); if ($this->isColumnModified(AttributeTemplateTableMap::CREATED_AT)) $criteria->add(AttributeTemplateTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(AttributeTemplateTableMap::UPDATED_AT)) $criteria->add(AttributeTemplateTableMap::UPDATED_AT, $this->updated_at); @@ -1296,7 +1240,6 @@ abstract class AttributeTemplate implements ActiveRecordInterface $copyObj->setAttributeId($this->getAttributeId()); $copyObj->setTemplateId($this->getTemplateId()); $copyObj->setPosition($this->getPosition()); - $copyObj->setAttributeTemplatecol($this->getAttributeTemplatecol()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); if ($makeNew) { @@ -1438,7 +1381,6 @@ abstract class AttributeTemplate implements ActiveRecordInterface $this->attribute_id = null; $this->template_id = null; $this->position = null; - $this->attribute_templatecol = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; diff --git a/core/lib/Thelia/Model/Base/AttributeTemplateQuery.php b/core/lib/Thelia/Model/Base/AttributeTemplateQuery.php index 5e53ba738..e1a8d0320 100644 --- a/core/lib/Thelia/Model/Base/AttributeTemplateQuery.php +++ b/core/lib/Thelia/Model/Base/AttributeTemplateQuery.php @@ -25,7 +25,6 @@ use Thelia\Model\Map\AttributeTemplateTableMap; * @method ChildAttributeTemplateQuery orderByAttributeId($order = Criteria::ASC) Order by the attribute_id column * @method ChildAttributeTemplateQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column * @method ChildAttributeTemplateQuery orderByPosition($order = Criteria::ASC) Order by the position column - * @method ChildAttributeTemplateQuery orderByAttributeTemplatecol($order = Criteria::ASC) Order by the attribute_templatecol column * @method ChildAttributeTemplateQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildAttributeTemplateQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @@ -33,7 +32,6 @@ use Thelia\Model\Map\AttributeTemplateTableMap; * @method ChildAttributeTemplateQuery groupByAttributeId() Group by the attribute_id column * @method ChildAttributeTemplateQuery groupByTemplateId() Group by the template_id column * @method ChildAttributeTemplateQuery groupByPosition() Group by the position column - * @method ChildAttributeTemplateQuery groupByAttributeTemplatecol() Group by the attribute_templatecol column * @method ChildAttributeTemplateQuery groupByCreatedAt() Group by the created_at column * @method ChildAttributeTemplateQuery groupByUpdatedAt() Group by the updated_at column * @@ -56,7 +54,6 @@ use Thelia\Model\Map\AttributeTemplateTableMap; * @method ChildAttributeTemplate findOneByAttributeId(int $attribute_id) Return the first ChildAttributeTemplate filtered by the attribute_id column * @method ChildAttributeTemplate findOneByTemplateId(int $template_id) Return the first ChildAttributeTemplate filtered by the template_id column * @method ChildAttributeTemplate findOneByPosition(int $position) Return the first ChildAttributeTemplate filtered by the position column - * @method ChildAttributeTemplate findOneByAttributeTemplatecol(string $attribute_templatecol) Return the first ChildAttributeTemplate filtered by the attribute_templatecol column * @method ChildAttributeTemplate findOneByCreatedAt(string $created_at) Return the first ChildAttributeTemplate filtered by the created_at column * @method ChildAttributeTemplate findOneByUpdatedAt(string $updated_at) Return the first ChildAttributeTemplate filtered by the updated_at column * @@ -64,7 +61,6 @@ use Thelia\Model\Map\AttributeTemplateTableMap; * @method array findByAttributeId(int $attribute_id) Return ChildAttributeTemplate objects filtered by the attribute_id column * @method array findByTemplateId(int $template_id) Return ChildAttributeTemplate objects filtered by the template_id column * @method array findByPosition(int $position) Return ChildAttributeTemplate objects filtered by the position column - * @method array findByAttributeTemplatecol(string $attribute_templatecol) Return ChildAttributeTemplate objects filtered by the attribute_templatecol column * @method array findByCreatedAt(string $created_at) Return ChildAttributeTemplate objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildAttributeTemplate objects filtered by the updated_at column * @@ -155,7 +151,7 @@ abstract class AttributeTemplateQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, ATTRIBUTE_ID, TEMPLATE_ID, POSITION, ATTRIBUTE_TEMPLATECOL, CREATED_AT, UPDATED_AT FROM attribute_template WHERE ID = :p0'; + $sql = 'SELECT ID, ATTRIBUTE_ID, TEMPLATE_ID, POSITION, CREATED_AT, UPDATED_AT FROM attribute_template WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -412,35 +408,6 @@ abstract class AttributeTemplateQuery extends ModelCriteria return $this->addUsingAlias(AttributeTemplateTableMap::POSITION, $position, $comparison); } - /** - * Filter the query on the attribute_templatecol column - * - * Example usage: - * - * $query->filterByAttributeTemplatecol('fooValue'); // WHERE attribute_templatecol = 'fooValue' - * $query->filterByAttributeTemplatecol('%fooValue%'); // WHERE attribute_templatecol LIKE '%fooValue%' - * - * - * @param string $attributeTemplatecol The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildAttributeTemplateQuery The current query, for fluid interface - */ - public function filterByAttributeTemplatecol($attributeTemplatecol = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($attributeTemplatecol)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $attributeTemplatecol)) { - $attributeTemplatecol = str_replace('*', '%', $attributeTemplatecol); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(AttributeTemplateTableMap::ATTRIBUTE_TEMPLATECOL, $attributeTemplatecol, $comparison); - } - /** * Filter the query on the created_at column * diff --git a/core/lib/Thelia/Model/Base/Feature.php b/core/lib/Thelia/Model/Base/Feature.php index f771674e1..c9b6c5ed4 100644 --- a/core/lib/Thelia/Model/Base/Feature.php +++ b/core/lib/Thelia/Model/Base/Feature.php @@ -78,6 +78,12 @@ abstract class Feature implements ActiveRecordInterface */ protected $visible; + /** + * The value for the position field. + * @var int + */ + protected $position; + /** * The value for the created_at field. * @var string @@ -460,6 +466,17 @@ abstract class Feature implements ActiveRecordInterface return $this->visible; } + /** + * Get the [position] column value. + * + * @return int + */ + public function getPosition() + { + + return $this->position; + } + /** * Get the [optionally formatted] temporal [created_at] column value. * @@ -542,6 +559,27 @@ abstract class Feature implements ActiveRecordInterface return $this; } // setVisible() + /** + * Set the value of [position] column. + * + * @param int $v new value + * @return \Thelia\Model\Feature 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[] = FeatureTableMap::POSITION; + } + + + return $this; + } // setPosition() + /** * Sets the value of [created_at] column to a normalized version of the date/time value specified. * @@ -631,13 +669,16 @@ abstract class Feature implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : FeatureTableMap::translateFieldName('Visible', TableMap::TYPE_PHPNAME, $indexType)]; $this->visible = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : FeatureTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : FeatureTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; + $this->position = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : FeatureTableMap::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 ? 3 + $startcol : FeatureTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : FeatureTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -650,7 +691,7 @@ abstract class Feature implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 4; // 4 = FeatureTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 5; // 5 = FeatureTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\Feature object", 0, $e); @@ -980,6 +1021,9 @@ abstract class Feature implements ActiveRecordInterface if ($this->isColumnModified(FeatureTableMap::VISIBLE)) { $modifiedColumns[':p' . $index++] = 'VISIBLE'; } + if ($this->isColumnModified(FeatureTableMap::POSITION)) { + $modifiedColumns[':p' . $index++] = 'POSITION'; + } if ($this->isColumnModified(FeatureTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; } @@ -1003,6 +1047,9 @@ abstract class Feature implements ActiveRecordInterface case 'VISIBLE': $stmt->bindValue($identifier, $this->visible, 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; @@ -1078,9 +1125,12 @@ abstract class Feature implements ActiveRecordInterface return $this->getVisible(); break; case 2: - return $this->getCreatedAt(); + return $this->getPosition(); break; case 3: + return $this->getCreatedAt(); + break; + case 4: return $this->getUpdatedAt(); break; default: @@ -1114,8 +1164,9 @@ abstract class Feature implements ActiveRecordInterface $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getVisible(), - $keys[2] => $this->getCreatedAt(), - $keys[3] => $this->getUpdatedAt(), + $keys[2] => $this->getPosition(), + $keys[3] => $this->getCreatedAt(), + $keys[4] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1177,9 +1228,12 @@ abstract class Feature implements ActiveRecordInterface $this->setVisible($value); break; case 2: - $this->setCreatedAt($value); + $this->setPosition($value); break; case 3: + $this->setCreatedAt($value); + break; + case 4: $this->setUpdatedAt($value); break; } // switch() @@ -1208,8 +1262,9 @@ abstract class Feature implements ActiveRecordInterface if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setVisible($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setCreatedAt($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setUpdatedAt($arr[$keys[3]]); + if (array_key_exists($keys[2], $arr)) $this->setPosition($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]]); } /** @@ -1223,6 +1278,7 @@ abstract class Feature implements ActiveRecordInterface if ($this->isColumnModified(FeatureTableMap::ID)) $criteria->add(FeatureTableMap::ID, $this->id); if ($this->isColumnModified(FeatureTableMap::VISIBLE)) $criteria->add(FeatureTableMap::VISIBLE, $this->visible); + if ($this->isColumnModified(FeatureTableMap::POSITION)) $criteria->add(FeatureTableMap::POSITION, $this->position); if ($this->isColumnModified(FeatureTableMap::CREATED_AT)) $criteria->add(FeatureTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(FeatureTableMap::UPDATED_AT)) $criteria->add(FeatureTableMap::UPDATED_AT, $this->updated_at); @@ -1289,6 +1345,7 @@ abstract class Feature implements ActiveRecordInterface public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setVisible($this->getVisible()); + $copyObj->setPosition($this->getPosition()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); @@ -2520,6 +2577,7 @@ abstract class Feature implements ActiveRecordInterface { $this->id = null; $this->visible = null; + $this->position = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; diff --git a/core/lib/Thelia/Model/Base/FeatureQuery.php b/core/lib/Thelia/Model/Base/FeatureQuery.php index 93004f3e6..097646c87 100644 --- a/core/lib/Thelia/Model/Base/FeatureQuery.php +++ b/core/lib/Thelia/Model/Base/FeatureQuery.php @@ -24,11 +24,13 @@ use Thelia\Model\Map\FeatureTableMap; * * @method ChildFeatureQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildFeatureQuery orderByVisible($order = Criteria::ASC) Order by the visible column + * @method ChildFeatureQuery orderByPosition($order = Criteria::ASC) Order by the position column * @method ChildFeatureQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildFeatureQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * * @method ChildFeatureQuery groupById() Group by the id column * @method ChildFeatureQuery groupByVisible() Group by the visible column + * @method ChildFeatureQuery groupByPosition() Group by the position column * @method ChildFeatureQuery groupByCreatedAt() Group by the created_at column * @method ChildFeatureQuery groupByUpdatedAt() Group by the updated_at column * @@ -57,11 +59,13 @@ use Thelia\Model\Map\FeatureTableMap; * * @method ChildFeature findOneById(int $id) Return the first ChildFeature filtered by the id column * @method ChildFeature findOneByVisible(int $visible) Return the first ChildFeature filtered by the visible column + * @method ChildFeature findOneByPosition(int $position) Return the first ChildFeature filtered by the position column * @method ChildFeature findOneByCreatedAt(string $created_at) Return the first ChildFeature filtered by the created_at column * @method ChildFeature findOneByUpdatedAt(string $updated_at) Return the first ChildFeature filtered by the updated_at column * * @method array findById(int $id) Return ChildFeature objects filtered by the id column * @method array findByVisible(int $visible) Return ChildFeature objects filtered by the visible column + * @method array findByPosition(int $position) Return ChildFeature objects filtered by the position column * @method array findByCreatedAt(string $created_at) Return ChildFeature objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildFeature objects filtered by the updated_at column * @@ -152,7 +156,7 @@ abstract class FeatureQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, VISIBLE, CREATED_AT, UPDATED_AT FROM feature WHERE ID = :p0'; + $sql = 'SELECT ID, VISIBLE, POSITION, CREATED_AT, UPDATED_AT FROM feature WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -323,6 +327,47 @@ abstract class FeatureQuery extends ModelCriteria return $this->addUsingAlias(FeatureTableMap::VISIBLE, $visible, $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 ChildFeatureQuery 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(FeatureTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($position['max'])) { + $this->addUsingAlias(FeatureTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(FeatureTableMap::POSITION, $position, $comparison); + } + /** * Filter the query on the created_at column * diff --git a/core/lib/Thelia/Model/Map/AttributeTableMap.php b/core/lib/Thelia/Model/Map/AttributeTableMap.php index 50ea799ca..245dc08d3 100644 --- a/core/lib/Thelia/Model/Map/AttributeTableMap.php +++ b/core/lib/Thelia/Model/Map/AttributeTableMap.php @@ -57,7 +57,7 @@ class AttributeTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 3; + const NUM_COLUMNS = 4; /** * The number of lazy-loaded columns @@ -67,13 +67,18 @@ class AttributeTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 3; + const NUM_HYDRATE_COLUMNS = 4; /** * the column name for the ID field */ const ID = 'attribute.ID'; + /** + * the column name for the POSITION field + */ + const POSITION = 'attribute.POSITION'; + /** * the column name for the CREATED_AT field */ @@ -105,12 +110,12 @@ class AttributeTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(AttributeTableMap::ID, AttributeTableMap::CREATED_AT, AttributeTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, ) + self::TYPE_PHPNAME => array('Id', 'Position', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'position', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(AttributeTableMap::ID, AttributeTableMap::POSITION, AttributeTableMap::CREATED_AT, AttributeTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'position', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, ) ); /** @@ -120,12 +125,12 @@ class AttributeTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'CreatedAt' => 1, 'UpdatedAt' => 2, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'createdAt' => 1, 'updatedAt' => 2, ), - self::TYPE_COLNAME => array(AttributeTableMap::ID => 0, AttributeTableMap::CREATED_AT => 1, AttributeTableMap::UPDATED_AT => 2, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'CREATED_AT' => 1, 'UPDATED_AT' => 2, ), - self::TYPE_FIELDNAME => array('id' => 0, 'created_at' => 1, 'updated_at' => 2, ), - self::TYPE_NUM => array(0, 1, 2, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Position' => 1, 'CreatedAt' => 2, 'UpdatedAt' => 3, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'position' => 1, 'createdAt' => 2, 'updatedAt' => 3, ), + self::TYPE_COLNAME => array(AttributeTableMap::ID => 0, AttributeTableMap::POSITION => 1, AttributeTableMap::CREATED_AT => 2, AttributeTableMap::UPDATED_AT => 3, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'POSITION' => 1, 'CREATED_AT' => 2, 'UPDATED_AT' => 3, ), + self::TYPE_FIELDNAME => array('id' => 0, 'position' => 1, 'created_at' => 2, 'updated_at' => 3, ), + self::TYPE_NUM => array(0, 1, 2, 3, ) ); /** @@ -145,6 +150,7 @@ class AttributeTableMap extends TableMap $this->setUseIdGenerator(true); // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, 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() @@ -326,10 +332,12 @@ class AttributeTableMap extends TableMap { if (null === $alias) { $criteria->addSelectColumn(AttributeTableMap::ID); + $criteria->addSelectColumn(AttributeTableMap::POSITION); $criteria->addSelectColumn(AttributeTableMap::CREATED_AT); $criteria->addSelectColumn(AttributeTableMap::UPDATED_AT); } else { $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.POSITION'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); } diff --git a/core/lib/Thelia/Model/Map/AttributeTemplateTableMap.php b/core/lib/Thelia/Model/Map/AttributeTemplateTableMap.php index c0df89d8f..1df6d56c1 100644 --- a/core/lib/Thelia/Model/Map/AttributeTemplateTableMap.php +++ b/core/lib/Thelia/Model/Map/AttributeTemplateTableMap.php @@ -57,7 +57,7 @@ class AttributeTemplateTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 7; + const NUM_COLUMNS = 6; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class AttributeTemplateTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 7; + const NUM_HYDRATE_COLUMNS = 6; /** * the column name for the ID field @@ -89,11 +89,6 @@ class AttributeTemplateTableMap extends TableMap */ const POSITION = 'attribute_template.POSITION'; - /** - * the column name for the ATTRIBUTE_TEMPLATECOL field - */ - const ATTRIBUTE_TEMPLATECOL = 'attribute_template.ATTRIBUTE_TEMPLATECOL'; - /** * the column name for the CREATED_AT field */ @@ -116,12 +111,12 @@ class AttributeTemplateTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'AttributeId', 'TemplateId', 'Position', 'AttributeTemplatecol', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'attributeId', 'templateId', 'position', 'attributeTemplatecol', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(AttributeTemplateTableMap::ID, AttributeTemplateTableMap::ATTRIBUTE_ID, AttributeTemplateTableMap::TEMPLATE_ID, AttributeTemplateTableMap::POSITION, AttributeTemplateTableMap::ATTRIBUTE_TEMPLATECOL, AttributeTemplateTableMap::CREATED_AT, AttributeTemplateTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'ATTRIBUTE_ID', 'TEMPLATE_ID', 'POSITION', 'ATTRIBUTE_TEMPLATECOL', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'attribute_id', 'template_id', 'position', 'attribute_templatecol', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) + self::TYPE_PHPNAME => array('Id', 'AttributeId', 'TemplateId', 'Position', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'attributeId', 'templateId', 'position', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(AttributeTemplateTableMap::ID, AttributeTemplateTableMap::ATTRIBUTE_ID, AttributeTemplateTableMap::TEMPLATE_ID, AttributeTemplateTableMap::POSITION, AttributeTemplateTableMap::CREATED_AT, AttributeTemplateTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'ATTRIBUTE_ID', 'TEMPLATE_ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'attribute_id', 'template_id', 'position', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -131,12 +126,12 @@ class AttributeTemplateTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'AttributeId' => 1, 'TemplateId' => 2, 'Position' => 3, 'AttributeTemplatecol' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'attributeId' => 1, 'templateId' => 2, 'position' => 3, 'attributeTemplatecol' => 4, 'createdAt' => 5, 'updatedAt' => 6, ), - self::TYPE_COLNAME => array(AttributeTemplateTableMap::ID => 0, AttributeTemplateTableMap::ATTRIBUTE_ID => 1, AttributeTemplateTableMap::TEMPLATE_ID => 2, AttributeTemplateTableMap::POSITION => 3, AttributeTemplateTableMap::ATTRIBUTE_TEMPLATECOL => 4, AttributeTemplateTableMap::CREATED_AT => 5, AttributeTemplateTableMap::UPDATED_AT => 6, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'ATTRIBUTE_ID' => 1, 'TEMPLATE_ID' => 2, 'POSITION' => 3, 'ATTRIBUTE_TEMPLATECOL' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ), - self::TYPE_FIELDNAME => array('id' => 0, 'attribute_id' => 1, 'template_id' => 2, 'position' => 3, 'attribute_templatecol' => 4, 'created_at' => 5, 'updated_at' => 6, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) + self::TYPE_PHPNAME => array('Id' => 0, 'AttributeId' => 1, 'TemplateId' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'attributeId' => 1, 'templateId' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, ), + self::TYPE_COLNAME => array(AttributeTemplateTableMap::ID => 0, AttributeTemplateTableMap::ATTRIBUTE_ID => 1, AttributeTemplateTableMap::TEMPLATE_ID => 2, AttributeTemplateTableMap::POSITION => 3, AttributeTemplateTableMap::CREATED_AT => 4, AttributeTemplateTableMap::UPDATED_AT => 5, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'ATTRIBUTE_ID' => 1, 'TEMPLATE_ID' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ), + self::TYPE_FIELDNAME => array('id' => 0, 'attribute_id' => 1, 'template_id' => 2, 'position' => 3, 'created_at' => 4, 'updated_at' => 5, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -160,7 +155,6 @@ class AttributeTemplateTableMap extends TableMap $this->addForeignKey('ATTRIBUTE_ID', 'AttributeId', 'INTEGER', 'attribute', 'ID', true, null, null); $this->addForeignKey('TEMPLATE_ID', 'TemplateId', 'INTEGER', 'template', 'ID', true, null, null); $this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null); - $this->addColumn('ATTRIBUTE_TEMPLATECOL', 'AttributeTemplatecol', 'VARCHAR', false, 45, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); } // initialize() @@ -329,7 +323,6 @@ class AttributeTemplateTableMap extends TableMap $criteria->addSelectColumn(AttributeTemplateTableMap::ATTRIBUTE_ID); $criteria->addSelectColumn(AttributeTemplateTableMap::TEMPLATE_ID); $criteria->addSelectColumn(AttributeTemplateTableMap::POSITION); - $criteria->addSelectColumn(AttributeTemplateTableMap::ATTRIBUTE_TEMPLATECOL); $criteria->addSelectColumn(AttributeTemplateTableMap::CREATED_AT); $criteria->addSelectColumn(AttributeTemplateTableMap::UPDATED_AT); } else { @@ -337,7 +330,6 @@ class AttributeTemplateTableMap extends TableMap $criteria->addSelectColumn($alias . '.ATTRIBUTE_ID'); $criteria->addSelectColumn($alias . '.TEMPLATE_ID'); $criteria->addSelectColumn($alias . '.POSITION'); - $criteria->addSelectColumn($alias . '.ATTRIBUTE_TEMPLATECOL'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); } diff --git a/core/lib/Thelia/Model/Map/FeatureTableMap.php b/core/lib/Thelia/Model/Map/FeatureTableMap.php index 7aa4c1d5a..c6a29e2f4 100644 --- a/core/lib/Thelia/Model/Map/FeatureTableMap.php +++ b/core/lib/Thelia/Model/Map/FeatureTableMap.php @@ -57,7 +57,7 @@ class FeatureTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 4; + const NUM_COLUMNS = 5; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class FeatureTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 4; + const NUM_HYDRATE_COLUMNS = 5; /** * the column name for the ID field @@ -79,6 +79,11 @@ class FeatureTableMap extends TableMap */ const VISIBLE = 'feature.VISIBLE'; + /** + * the column name for the POSITION field + */ + const POSITION = 'feature.POSITION'; + /** * the column name for the CREATED_AT field */ @@ -110,12 +115,12 @@ class FeatureTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Visible', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'visible', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(FeatureTableMap::ID, FeatureTableMap::VISIBLE, FeatureTableMap::CREATED_AT, FeatureTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'VISIBLE', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'visible', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, ) + self::TYPE_PHPNAME => array('Id', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'visible', 'position', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(FeatureTableMap::ID, FeatureTableMap::VISIBLE, FeatureTableMap::POSITION, FeatureTableMap::CREATED_AT, FeatureTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'visible', 'position', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) ); /** @@ -125,12 +130,12 @@ class FeatureTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Visible' => 1, 'CreatedAt' => 2, 'UpdatedAt' => 3, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'visible' => 1, 'createdAt' => 2, 'updatedAt' => 3, ), - self::TYPE_COLNAME => array(FeatureTableMap::ID => 0, FeatureTableMap::VISIBLE => 1, FeatureTableMap::CREATED_AT => 2, FeatureTableMap::UPDATED_AT => 3, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'VISIBLE' => 1, 'CREATED_AT' => 2, 'UPDATED_AT' => 3, ), - self::TYPE_FIELDNAME => array('id' => 0, 'visible' => 1, 'created_at' => 2, 'updated_at' => 3, ), - self::TYPE_NUM => array(0, 1, 2, 3, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Visible' => 1, 'Position' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'visible' => 1, 'position' => 2, 'createdAt' => 3, 'updatedAt' => 4, ), + self::TYPE_COLNAME => array(FeatureTableMap::ID => 0, FeatureTableMap::VISIBLE => 1, FeatureTableMap::POSITION => 2, FeatureTableMap::CREATED_AT => 3, FeatureTableMap::UPDATED_AT => 4, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'VISIBLE' => 1, 'POSITION' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ), + self::TYPE_FIELDNAME => array('id' => 0, 'visible' => 1, 'position' => 2, 'created_at' => 3, 'updated_at' => 4, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) ); /** @@ -151,6 +156,7 @@ class FeatureTableMap extends TableMap // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addColumn('VISIBLE', 'Visible', 'INTEGER', false, null, 0); + $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() @@ -333,11 +339,13 @@ class FeatureTableMap extends TableMap if (null === $alias) { $criteria->addSelectColumn(FeatureTableMap::ID); $criteria->addSelectColumn(FeatureTableMap::VISIBLE); + $criteria->addSelectColumn(FeatureTableMap::POSITION); $criteria->addSelectColumn(FeatureTableMap::CREATED_AT); $criteria->addSelectColumn(FeatureTableMap::UPDATED_AT); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.VISIBLE'); + $criteria->addSelectColumn($alias . '.POSITION'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); } diff --git a/install/faker.php b/install/faker.php index 22ee3c7b2..f0aa002e5 100755 --- a/install/faker.php +++ b/install/faker.php @@ -225,7 +225,7 @@ try { for($i=0; $i<4; $i++) { $feature = new Thelia\Model\Feature(); $feature->setVisible(1); - //$feature->setPosition($i); + $feature->setPosition($i); setI18n($faker, $feature); $feature->save(); @@ -249,7 +249,7 @@ try { $attributeList = array(); for($i=0; $i<4; $i++) { $attribute = new Thelia\Model\Attribute(); - //$attribute->setPosition($i); + $attribute->setPosition($i); setI18n($faker, $attribute); $attribute->save(); diff --git a/install/thelia.sql b/install/thelia.sql index 84fe21b95..14134ee6a 100755 --- a/install/thelia.sql +++ b/install/thelia.sql @@ -186,6 +186,7 @@ CREATE TABLE `feature` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `visible` INTEGER DEFAULT 0, + `position` INTEGER, `created_at` DATETIME, `updated_at` DATETIME, PRIMARY KEY (`id`) @@ -286,6 +287,7 @@ DROP TABLE IF EXISTS `attribute`; CREATE TABLE `attribute` ( `id` INTEGER NOT NULL AUTO_INCREMENT, + `position` INTEGER, `created_at` DATETIME, `updated_at` DATETIME, PRIMARY KEY (`id`) @@ -387,7 +389,6 @@ CREATE TABLE `attribute_template` `attribute_id` INTEGER NOT NULL, `template_id` INTEGER NOT NULL, `position` INTEGER, - `attribute_templatecol` VARCHAR(45), `created_at` DATETIME, `updated_at` DATETIME, PRIMARY KEY (`id`), diff --git a/local/config/schema.xml b/local/config/schema.xml index e1879ff32..b27a1f09d 100755 --- a/local/config/schema.xml +++ b/local/config/schema.xml @@ -149,6 +149,7 @@ + @@ -225,6 +226,7 @@ + @@ -298,7 +300,6 @@ - diff --git a/templates/admin/default/order-edit.html b/templates/admin/default/order-edit.html index 225d699c0..9def1beba 100644 --- a/templates/admin/default/order-edit.html +++ b/templates/admin/default/order-edit.html @@ -5,6 +5,9 @@ {block name="check-permissions"}admin.order.edit{/block} {block name="main-content"} + + {assign oder_tab {$smarty.get.tab|default:"cart"}} +
@@ -33,6 +36,7 @@ {$REF}
+
@@ -212,7 +217,7 @@ {loop type="title" name="order-invoice-address-title" id=$TITLE}{$LONG}{/loop} - {intl l="Compagny"} + {intl l="Company"} {$COMPANY} @@ -278,7 +283,7 @@ {loop type="title" name="order-delivery-address-title" id=$TITLE}{$LONG}{/loop} - {intl l="Compagny"} + {intl l="Company"} {$COMPANY} @@ -347,34 +352,27 @@ {* Update an Address *} - {form name="thelia.address.update"} + {form name="thelia.order.update.address"} {* Capture the dialog body, to pass it to the generic dialog *} {capture "edit_address_dialog"} {form_hidden_fields form=$form} - {form_field form=$form field='label'} -
- - -
- {/form_field} - {form_field form=$form field='company'}
- - + +
{/form_field} {form_field form=$form field='title'}
- +
@@ -382,54 +380,54 @@ {form_field form=$form field='firstname'}
- - + +
{/form_field} {form_field form=$form field='lastname'}
- - + +
{/form_field} {form_field form=$form field='address1'}
- - + +
{form_field form=$form field='address2'} - + {/form_field}
{form_field form=$form field='address3'} - + {/form_field}
{/form_field} {form_field form=$form field='zipcode'}
- - + +
{/form_field} {form_field form=$form field='city'}
- - + +
{/form_field} {form_field form=$form field='country'}
- +