- * $query->filterByDefault(1234); // WHERE default = 1234
- * $query->filterByDefault(array(12, 34)); // WHERE default IN (12, 34)
- * $query->filterByDefault(array('min' => 12)); // WHERE default > 12
+ * $query->filterByIsDefault(1234); // WHERE is_default = 1234
+ * $query->filterByIsDefault(array(12, 34)); // WHERE is_default IN (12, 34)
+ * $query->filterByIsDefault(array('min' => 12)); // WHERE is_default > 12
*
*
- * @param mixed $default The value to use as filter.
+ * @param mixed $isDefault 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.
@@ -793,16 +793,16 @@ abstract class AddressQuery extends ModelCriteria
*
* @return ChildAddressQuery The current query, for fluid interface
*/
- public function filterByDefault($default = null, $comparison = null)
+ public function filterByIsDefault($isDefault = null, $comparison = null)
{
- if (is_array($default)) {
+ if (is_array($isDefault)) {
$useMinMax = false;
- if (isset($default['min'])) {
- $this->addUsingAlias(AddressTableMap::DEFAULT, $default['min'], Criteria::GREATER_EQUAL);
+ if (isset($isDefault['min'])) {
+ $this->addUsingAlias(AddressTableMap::IS_DEFAULT, $isDefault['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
- if (isset($default['max'])) {
- $this->addUsingAlias(AddressTableMap::DEFAULT, $default['max'], Criteria::LESS_EQUAL);
+ if (isset($isDefault['max'])) {
+ $this->addUsingAlias(AddressTableMap::IS_DEFAULT, $isDefault['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
@@ -813,7 +813,7 @@ abstract class AddressQuery extends ModelCriteria
}
}
- return $this->addUsingAlias(AddressTableMap::DEFAULT, $default, $comparison);
+ return $this->addUsingAlias(AddressTableMap::IS_DEFAULT, $isDefault, $comparison);
}
/**
diff --git a/core/lib/Thelia/Model/Customer.php b/core/lib/Thelia/Model/Customer.php
index a6bd5f07c..38bdc1dab 100755
--- a/core/lib/Thelia/Model/Customer.php
+++ b/core/lib/Thelia/Model/Customer.php
@@ -15,6 +15,7 @@ use Thelia\Core\Security\User\UserInterface;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Propel;
use Thelia\Model\Map\CustomerTableMap;
+use Thelia\Core\Security\Role\Role;
/**
* Skeleton subclass for representing a row from the 'customer' table.
@@ -87,7 +88,7 @@ class Customer extends BaseCustomer implements UserInterface
->setCellphone($cellphone)
->setZipcode($zipcode)
->setCountryId($countryId)
- ->setDefault(1)
+ ->setIsDefault(1)
->setCustomer($this)
->save($con);
@@ -114,7 +115,7 @@ class Customer extends BaseCustomer implements UserInterface
protected function generateRef()
{
- return date("YmdHI");
+ return date("YmdHisu");
}
public function setPassword($password)
diff --git a/core/lib/Thelia/Model/Map/AddressTableMap.php b/core/lib/Thelia/Model/Map/AddressTableMap.php
index 5a360f08e..a67d383fb 100755
--- a/core/lib/Thelia/Model/Map/AddressTableMap.php
+++ b/core/lib/Thelia/Model/Map/AddressTableMap.php
@@ -145,9 +145,9 @@ class AddressTableMap extends TableMap
const CELLPHONE = 'address.CELLPHONE';
/**
- * the column name for the DEFAULT field
+ * the column name for the IS_DEFAULT field
*/
- const DEFAULT = 'address.DEFAULT';
+ const IS_DEFAULT = 'address.IS_DEFAULT';
/**
* the column name for the CREATED_AT field
@@ -171,11 +171,11 @@ class AddressTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'Title', 'CustomerId', 'CustomerTitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Phone', 'Cellphone', 'Default', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'title', 'customerId', 'customerTitleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'phone', 'cellphone', 'default', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(AddressTableMap::ID, AddressTableMap::TITLE, AddressTableMap::CUSTOMER_ID, AddressTableMap::CUSTOMER_TITLE_ID, AddressTableMap::COMPANY, AddressTableMap::FIRSTNAME, AddressTableMap::LASTNAME, AddressTableMap::ADDRESS1, AddressTableMap::ADDRESS2, AddressTableMap::ADDRESS3, AddressTableMap::ZIPCODE, AddressTableMap::CITY, AddressTableMap::COUNTRY_ID, AddressTableMap::PHONE, AddressTableMap::CELLPHONE, AddressTableMap::DEFAULT, AddressTableMap::CREATED_AT, AddressTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('ID', 'TITLE', 'CUSTOMER_ID', 'CUSTOMER_TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'PHONE', 'CELLPHONE', 'DEFAULT', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('id', 'title', 'customer_id', 'customer_title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'phone', 'cellphone', 'default', 'created_at', 'updated_at', ),
+ self::TYPE_PHPNAME => array('Id', 'Title', 'CustomerId', 'CustomerTitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Phone', 'Cellphone', 'IsDefault', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'title', 'customerId', 'customerTitleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'phone', 'cellphone', 'isDefault', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(AddressTableMap::ID, AddressTableMap::TITLE, AddressTableMap::CUSTOMER_ID, AddressTableMap::CUSTOMER_TITLE_ID, AddressTableMap::COMPANY, AddressTableMap::FIRSTNAME, AddressTableMap::LASTNAME, AddressTableMap::ADDRESS1, AddressTableMap::ADDRESS2, AddressTableMap::ADDRESS3, AddressTableMap::ZIPCODE, AddressTableMap::CITY, AddressTableMap::COUNTRY_ID, AddressTableMap::PHONE, AddressTableMap::CELLPHONE, AddressTableMap::IS_DEFAULT, AddressTableMap::CREATED_AT, AddressTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'TITLE', 'CUSTOMER_ID', 'CUSTOMER_TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'PHONE', 'CELLPHONE', 'IS_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'title', 'customer_id', 'customer_title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'phone', 'cellphone', 'is_default', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
);
@@ -186,11 +186,11 @@ class AddressTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'Title' => 1, 'CustomerId' => 2, 'CustomerTitleId' => 3, 'Company' => 4, 'Firstname' => 5, 'Lastname' => 6, 'Address1' => 7, 'Address2' => 8, 'Address3' => 9, 'Zipcode' => 10, 'City' => 11, 'CountryId' => 12, 'Phone' => 13, 'Cellphone' => 14, 'Default' => 15, 'CreatedAt' => 16, 'UpdatedAt' => 17, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'title' => 1, 'customerId' => 2, 'customerTitleId' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'countryId' => 12, 'phone' => 13, 'cellphone' => 14, 'default' => 15, 'createdAt' => 16, 'updatedAt' => 17, ),
- self::TYPE_COLNAME => array(AddressTableMap::ID => 0, AddressTableMap::TITLE => 1, AddressTableMap::CUSTOMER_ID => 2, AddressTableMap::CUSTOMER_TITLE_ID => 3, AddressTableMap::COMPANY => 4, AddressTableMap::FIRSTNAME => 5, AddressTableMap::LASTNAME => 6, AddressTableMap::ADDRESS1 => 7, AddressTableMap::ADDRESS2 => 8, AddressTableMap::ADDRESS3 => 9, AddressTableMap::ZIPCODE => 10, AddressTableMap::CITY => 11, AddressTableMap::COUNTRY_ID => 12, AddressTableMap::PHONE => 13, AddressTableMap::CELLPHONE => 14, AddressTableMap::DEFAULT => 15, AddressTableMap::CREATED_AT => 16, AddressTableMap::UPDATED_AT => 17, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE' => 1, 'CUSTOMER_ID' => 2, 'CUSTOMER_TITLE_ID' => 3, 'COMPANY' => 4, 'FIRSTNAME' => 5, 'LASTNAME' => 6, 'ADDRESS1' => 7, 'ADDRESS2' => 8, 'ADDRESS3' => 9, 'ZIPCODE' => 10, 'CITY' => 11, 'COUNTRY_ID' => 12, 'PHONE' => 13, 'CELLPHONE' => 14, 'DEFAULT' => 15, 'CREATED_AT' => 16, 'UPDATED_AT' => 17, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'title' => 1, 'customer_id' => 2, 'customer_title_id' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'country_id' => 12, 'phone' => 13, 'cellphone' => 14, 'default' => 15, 'created_at' => 16, 'updated_at' => 17, ),
+ self::TYPE_PHPNAME => array('Id' => 0, 'Title' => 1, 'CustomerId' => 2, 'CustomerTitleId' => 3, 'Company' => 4, 'Firstname' => 5, 'Lastname' => 6, 'Address1' => 7, 'Address2' => 8, 'Address3' => 9, 'Zipcode' => 10, 'City' => 11, 'CountryId' => 12, 'Phone' => 13, 'Cellphone' => 14, 'IsDefault' => 15, 'CreatedAt' => 16, 'UpdatedAt' => 17, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'title' => 1, 'customerId' => 2, 'customerTitleId' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'countryId' => 12, 'phone' => 13, 'cellphone' => 14, 'isDefault' => 15, 'createdAt' => 16, 'updatedAt' => 17, ),
+ self::TYPE_COLNAME => array(AddressTableMap::ID => 0, AddressTableMap::TITLE => 1, AddressTableMap::CUSTOMER_ID => 2, AddressTableMap::CUSTOMER_TITLE_ID => 3, AddressTableMap::COMPANY => 4, AddressTableMap::FIRSTNAME => 5, AddressTableMap::LASTNAME => 6, AddressTableMap::ADDRESS1 => 7, AddressTableMap::ADDRESS2 => 8, AddressTableMap::ADDRESS3 => 9, AddressTableMap::ZIPCODE => 10, AddressTableMap::CITY => 11, AddressTableMap::COUNTRY_ID => 12, AddressTableMap::PHONE => 13, AddressTableMap::CELLPHONE => 14, AddressTableMap::IS_DEFAULT => 15, AddressTableMap::CREATED_AT => 16, AddressTableMap::UPDATED_AT => 17, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE' => 1, 'CUSTOMER_ID' => 2, 'CUSTOMER_TITLE_ID' => 3, 'COMPANY' => 4, 'FIRSTNAME' => 5, 'LASTNAME' => 6, 'ADDRESS1' => 7, 'ADDRESS2' => 8, 'ADDRESS3' => 9, 'ZIPCODE' => 10, 'CITY' => 11, 'COUNTRY_ID' => 12, 'PHONE' => 13, 'CELLPHONE' => 14, 'IS_DEFAULT' => 15, 'CREATED_AT' => 16, 'UPDATED_AT' => 17, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'title' => 1, 'customer_id' => 2, 'customer_title_id' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'country_id' => 12, 'phone' => 13, 'cellphone' => 14, 'is_default' => 15, 'created_at' => 16, 'updated_at' => 17, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
);
@@ -225,7 +225,7 @@ class AddressTableMap extends TableMap
$this->addColumn('COUNTRY_ID', 'CountryId', 'INTEGER', true, null, null);
$this->addColumn('PHONE', 'Phone', 'VARCHAR', false, 20, null);
$this->addColumn('CELLPHONE', 'Cellphone', 'VARCHAR', false, 20, null);
- $this->addColumn('DEFAULT', 'Default', 'TINYINT', false, null, 0);
+ $this->addColumn('IS_DEFAULT', 'IsDefault', 'TINYINT', false, null, 0);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -405,7 +405,7 @@ class AddressTableMap extends TableMap
$criteria->addSelectColumn(AddressTableMap::COUNTRY_ID);
$criteria->addSelectColumn(AddressTableMap::PHONE);
$criteria->addSelectColumn(AddressTableMap::CELLPHONE);
- $criteria->addSelectColumn(AddressTableMap::DEFAULT);
+ $criteria->addSelectColumn(AddressTableMap::IS_DEFAULT);
$criteria->addSelectColumn(AddressTableMap::CREATED_AT);
$criteria->addSelectColumn(AddressTableMap::UPDATED_AT);
} else {
@@ -424,7 +424,7 @@ class AddressTableMap extends TableMap
$criteria->addSelectColumn($alias . '.COUNTRY_ID');
$criteria->addSelectColumn($alias . '.PHONE');
$criteria->addSelectColumn($alias . '.CELLPHONE');
- $criteria->addSelectColumn($alias . '.DEFAULT');
+ $criteria->addSelectColumn($alias . '.IS_DEFAULT');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
diff --git a/core/lib/Thelia/Tools/URL.php b/core/lib/Thelia/Tools/URL.php
index ae30d7280..4f8480eab 100644
--- a/core/lib/Thelia/Tools/URL.php
+++ b/core/lib/Thelia/Tools/URL.php
@@ -27,19 +27,30 @@ use Thelia\Model\ConfigQuery;
class URL
{
+ public static function getIndexPage() {
+ return ConfigQuery::read('base_url', '/') . "index_dev.php"; // FIXME !
+ }
+
/**
- * Returns the Absolute URL for a given path relative to web root
+ * Returns the Absolute URL for a given path relative to web root. By default,
+ * the index.php (or index_dev.php) script name is added to the URL, use
+ * $path_only = true to get a path without the index script.
*
- * @param string $path the relative path
- * @param mixed $parameters An array of parameters
+ * @param string $path the relative path
+ * @param array $parameters An array of parameters
+ * @param boolean $path_only if true, getIndexPage() will not be added
*
* @return string The generated URL
*/
- public static function absoluteUrl($path, array $parameters = array())
+ public static function absoluteUrl($path, array $parameters = array(), $path_only = false)
{
// Already absolute ?
- if (substr($path, 0, 4) != 'http')
- $base = ConfigQuery::read('base_url', '/') . ltrim($path, '/');
+ if (substr($path, 0, 4) != 'http') {
+
+ $root = $path_only ? ConfigQuery::read('base_url', '/') : self::getIndexPage();
+
+ $base = $root . $path;
+ }
else
$base = $path;
@@ -49,7 +60,9 @@ class URL
$queryString = sprintf("%s=%s&", urlencode($name), urlencode($value));
}
- if ('' !== $queryString = rtrim($queryString, "&")) $queryString = '?' . $queryString;
+ $sepChar = strstr($base, '?') === false ? '?' : '&';
+
+ if ('' !== $queryString = rtrim($queryString, "&")) $queryString = $sepChar . $queryString;
return $base . $queryString;
}
@@ -63,7 +76,8 @@ class URL
* @return string The generated URL
*/
public static function viewUrl($viewName, array $parameters = array()) {
- $path = sprintf("%s?view=%s", ConfigQuery::read('base_url', '/'), $viewName);
+
+ $path = sprintf("%s?view=%s", self::getIndexPage(), $viewName);
return self::absoluteUrl($path, $parameters);
}
diff --git a/install/INSTALL-TODO.txt b/install/INSTALL-TODO.txt
index 91662f2b7..772946a7c 100644
--- a/install/INSTALL-TODO.txt
+++ b/install/INSTALL-TODO.txt
@@ -7,3 +7,4 @@ Variables Config à initialiser:
- base_admin_template : chemin du template admin relatif au repertoire template (ex. admin/default)
- default_locale : la locale par défaut (ex. en_US), à utiliser pour les fichiers de traduction
- asset_dir_from_web_root : le chemin relatif à /web du repertoires des assets (ex. assets)
+- active_template: chemin du template front relatif au repertoire template (ex. default)
diff --git a/install/thelia.sql b/install/thelia.sql
index c7d750778..36b041e11 100755
--- a/install/thelia.sql
+++ b/install/thelia.sql
@@ -491,7 +491,7 @@ CREATE TABLE `address`
`country_id` INTEGER NOT NULL,
`phone` VARCHAR(20),
`cellphone` VARCHAR(20),
- `default` TINYINT DEFAULT 0,
+ `is_default` TINYINT DEFAULT 0,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
diff --git a/local/config/schema.xml b/local/config/schema.xml
index 4b9b99de6..7c005fd56 100755
--- a/local/config/schema.xml
+++ b/local/config/schema.xml
@@ -1,927 +1,927 @@
-Customer is authentified :-)
-{/loop} - -{elseloop rel="auth_test"} -Customer is not authentified :-(
-{/elseloop} - -An image from asset directory : -{images file='assets/img/logo-thelia-34px.png'}Category loop example
-Conditional example #1
- - {ifloop rel="catloop2"} - Hey ! Loop catloop2 is not empty: -Loop catloop2 is empty
- {/elseloop} -Conditional example #2
- - {ifloop rel="catloop3"} - Loop catloop3 is not empty: -Loop catloop3 is empty
- {/elseloop} - - {elseloop rel="catloop2"} -... but catloop2 is still empty :-)
- {/elseloop} - -Traditional for loop
- {for $index=5 to 12 step 1} - Compteur = {$index}Some pagination
-PAGE 1
-PAGE 2
-PAGE 1000
-Some pagination with page choice
- {assign var=current_page value=2} -PAGE {$current_page} :
-page choice
- {pageloop rel="catloopwithpaginationchoice"} - {if ${PAGE} != {$current_page}} - {if {$PAGE} > {$current_page}-10 AND {$PAGE} < {$current_page}+10} - {$PAGE} - {/if} - {if {$PAGE} == {$current_page}-10 OR {$PAGE} == {$current_page}+10} - ... - {/if} - {if ({$PAGE} < {$current_page}-10 OR {$PAGE} > {$current_page}+10) AND ({$PAGE}%10 == 0 OR ${PAGE} == {$LAST} OR ${PAGE} == 1)} - {$PAGE} - {/if} - {else} - { {$PAGE} } - {/if} - {if {$PAGE} != {$LAST}} - - - {/if} - {/pageloop} -