Merge branch 'optim' of https://github.com/thelia/thelia into optim
Conflicts: core/lib/Thelia/Action/Order.php core/lib/Thelia/Core/Template/Element/BaseLoop.php
This commit is contained in:
@@ -36,7 +36,7 @@ use Thelia\Model\Map\AddressTableMap;
|
||||
* @package Thelia\Action
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class Address extends BaseAction implements EventSubscriberInterface
|
||||
class Address implements EventSubscriberInterface
|
||||
{
|
||||
|
||||
public function create(AddressCreateOrUpdateEvent $event)
|
||||
@@ -69,7 +69,7 @@ class Address extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
protected function createOrUpdate(AddressModel $addressModel, AddressCreateOrUpdateEvent $event)
|
||||
{
|
||||
$addressModel->setDispatcher($this->getDispatcher());
|
||||
$addressModel->setDispatcher($event->getDispatcher());
|
||||
$con = Propel::getWriteConnection(AddressTableMap::DATABASE_NAME);
|
||||
$con->beginTransaction();
|
||||
try {
|
||||
|
||||
@@ -30,7 +30,7 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\Admin as AdminModel;
|
||||
use Thelia\Model\AdminQuery;
|
||||
|
||||
class Administrator extends BaseAction implements EventSubscriberInterface
|
||||
class Administrator implements EventSubscriberInterface
|
||||
{
|
||||
/**
|
||||
* @param AdministratorEvent $event
|
||||
@@ -40,12 +40,13 @@ class Administrator extends BaseAction implements EventSubscriberInterface
|
||||
$administrator = new AdminModel();
|
||||
|
||||
$administrator
|
||||
->setDispatcher($this->getDispatcher())
|
||||
->setDispatcher($event->getDispatcher())
|
||||
->setFirstname($event->getFirstname())
|
||||
->setLastname($event->getLastname())
|
||||
->setLogin($event->getLogin())
|
||||
->setPassword($event->getPassword())
|
||||
->setProfileId($event->getProfile())
|
||||
->setLocale($event->getLocale())
|
||||
;
|
||||
|
||||
$administrator->save();
|
||||
@@ -61,11 +62,12 @@ class Administrator extends BaseAction implements EventSubscriberInterface
|
||||
if (null !== $administrator = AdminQuery::create()->findPk($event->getId())) {
|
||||
|
||||
$administrator
|
||||
->setDispatcher($this->getDispatcher())
|
||||
->setDispatcher($event->getDispatcher())
|
||||
->setFirstname($event->getFirstname())
|
||||
->setLastname($event->getLastname())
|
||||
->setLogin($event->getLogin())
|
||||
->setProfileId($event->getProfile())
|
||||
->setLocale($event->getLocale())
|
||||
;
|
||||
|
||||
if ('' !== $event->getPassword()) {
|
||||
|
||||
@@ -23,15 +23,12 @@
|
||||
|
||||
namespace Thelia\Action;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\Config as ConfigModel;
|
||||
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
|
||||
use Thelia\Core\Event\Config\ConfigUpdateEvent;
|
||||
use Thelia\Core\Event\Config\ConfigCreateEvent;
|
||||
use Thelia\Core\Event\Config\ConfigDeleteEvent;
|
||||
use Thelia\Core\Event\Config\ConfigUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\Config as ConfigModel;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
|
||||
class Config extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
@@ -44,9 +41,14 @@ class Config extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
$config = new ConfigModel();
|
||||
|
||||
$config->setDispatcher($this->getDispatcher())->setName($event->getEventName())->setValue($event->getValue())
|
||||
->setLocale($event->getLocale())->setTitle($event->getTitle())->setHidden($event->getHidden())
|
||||
->setSecured($event->getSecured())->save();
|
||||
$config->setDispatcher($this->getDispatcher())
|
||||
->setName($event->getEventName())
|
||||
->setValue($event->getValue())
|
||||
->setLocale($event->getLocale())
|
||||
->setTitle($event->getTitle())
|
||||
->setHidden($event->getHidden())
|
||||
->setSecured($event->getSecured())
|
||||
->save();
|
||||
|
||||
$event->setConfig($config);
|
||||
}
|
||||
@@ -59,7 +61,7 @@ class Config extends BaseAction implements EventSubscriberInterface
|
||||
public function setValue(ConfigUpdateEvent $event)
|
||||
{
|
||||
|
||||
if (null !== $config = $search->findPk($event->getConfigId())) {
|
||||
if (null !== $config = ConfigQuery::create()->findPk($event->getConfigId())) {
|
||||
|
||||
if ($event->getValue() !== $config->getValue()) {
|
||||
|
||||
@@ -80,10 +82,17 @@ class Config extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
if (null !== $config = ConfigQuery::create()->findPk($event->getConfigId())) {
|
||||
|
||||
$config->setDispatcher($this->getDispatcher())->setName($event->getEventName())->setValue($event->getValue())
|
||||
->setHidden($event->getHidden())->setSecured($event->getSecured())->setLocale($event->getLocale())
|
||||
->setTitle($event->getTitle())->setDescription($event->getDescription())->setChapo($event->getChapo())
|
||||
->setPostscriptum($event->getPostscriptum())->save();
|
||||
$config->setDispatcher($this->getDispatcher())
|
||||
->setName($event->getEventName())
|
||||
->setValue($event->getValue())
|
||||
->setHidden($event->getHidden())
|
||||
->setSecured($event->getSecured())
|
||||
->setLocale($event->getLocale())
|
||||
->setTitle($event->getTitle())
|
||||
->setDescription($event->getDescription())
|
||||
->setChapo($event->getChapo())
|
||||
->setPostscriptum($event->getPostscriptum())
|
||||
->save();
|
||||
|
||||
$event->setConfig($config);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ use Thelia\Core\Event\ActionEvent;
|
||||
use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Customer\CustomerEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Security\SecurityContext;
|
||||
use Thelia\Model\Customer as CustomerModel;
|
||||
use Thelia\Core\Event\Customer\CustomerLoginEvent;
|
||||
|
||||
@@ -39,8 +40,14 @@ use Thelia\Core\Event\Customer\CustomerLoginEvent;
|
||||
* @package Thelia\Action
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class Customer extends BaseAction implements EventSubscriberInterface
|
||||
class Customer implements EventSubscriberInterface
|
||||
{
|
||||
protected $securityContext;
|
||||
|
||||
public function __construct(SecurityContext $securityContext)
|
||||
{
|
||||
$this->securityContext = $securityContext;
|
||||
}
|
||||
|
||||
public function create(CustomerCreateOrUpdateEvent $event)
|
||||
{
|
||||
@@ -65,7 +72,7 @@ class Customer extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
$customer = $event->getCustomer();
|
||||
|
||||
$customer->setDispatcher($this->getDispatcher());
|
||||
$customer->setDispatcher($event->getDispatcher());
|
||||
|
||||
$customer
|
||||
->setTitleId($event->getTitle())
|
||||
@@ -91,7 +98,7 @@ class Customer extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
private function createOrUpdateCustomer(CustomerModel $customer, CustomerCreateOrUpdateEvent $event)
|
||||
{
|
||||
$customer->setDispatcher($this->getDispatcher());
|
||||
$customer->setDispatcher($event->getDispatcher());
|
||||
|
||||
$customer->createOrUpdate(
|
||||
$event->getTitle(),
|
||||
@@ -140,7 +147,7 @@ class Customer extends BaseAction implements EventSubscriberInterface
|
||||
*/
|
||||
protected function getSecurityContext()
|
||||
{
|
||||
return $this->container->get('thelia.securityContext');
|
||||
return $this->securityContext;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,33 +23,30 @@
|
||||
|
||||
namespace Thelia\Action;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Cart\CartTrait;
|
||||
use Thelia\Core\Event\Cart\CartEvent;
|
||||
use Thelia\Core\Event\Order\OrderAddressEvent;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\Order\OrderManualEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Exception\TheliaProcessException;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\Cart as CartModel;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\MessageQuery;
|
||||
use Thelia\Model\OrderProductAttributeCombination;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
use Thelia\Model\OrderProduct;
|
||||
use Thelia\Model\OrderStatus;
|
||||
use Thelia\Model\Currency;
|
||||
use Thelia\Model\Customer;
|
||||
use Thelia\Model\Lang;
|
||||
use Thelia\Model\Map\OrderTableMap;
|
||||
use Thelia\Model\MessageQuery;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
use Thelia\Model\Order as ModelOrder;
|
||||
use Thelia\Model\OrderAddress;
|
||||
use Thelia\Model\OrderProduct;
|
||||
use Thelia\Model\OrderProductAttributeCombination;
|
||||
use Thelia\Model\OrderStatus;
|
||||
use Thelia\Model\OrderStatusQuery;
|
||||
use Thelia\Tools\I18n;
|
||||
use Thelia\Model\Currency;
|
||||
use Thelia\Model\Lang;
|
||||
use Thelia\Model\Country;
|
||||
use Thelia\Model\Customer;
|
||||
use Thelia\Core\Event\Order\OrderManualEvent;
|
||||
|
||||
use Thelia\Model\Cart as CartModel;
|
||||
use Thelia\Model\Order as ModelOrder;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -129,7 +126,7 @@ class Order extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
$con->beginTransaction();
|
||||
|
||||
/* use a copy to avoid errored reccord in session */
|
||||
/* use a copy to avoid errored record in session */
|
||||
$placedOrder = $sessionOrder->copy();
|
||||
$placedOrder->setDispatcher($this->getDispatcher());
|
||||
|
||||
@@ -307,9 +304,7 @@ class Order extends BaseAction implements EventSubscriberInterface
|
||||
$this->getSecurityContext()->getCustomerUser()
|
||||
);
|
||||
|
||||
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_BEFORE_PAYMENT, new OrderEvent($placedOrder));
|
||||
|
||||
$event->getDispatcher()->dispatch(TheliaEvents::ORDER_BEFORE_PAYMENT, new OrderEvent($placedOrder));
|
||||
|
||||
/* clear session */
|
||||
$session
|
||||
@@ -322,7 +317,7 @@ class Order extends BaseAction implements EventSubscriberInterface
|
||||
$event->setPlacedOrder($placedOrder);
|
||||
|
||||
/* empty cart */
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::CART_CLEAR, new CartEvent($this->getCart($this->getRequest())));
|
||||
$event->getDispatcher()->dispatch(TheliaEvents::CART_CLEAR, new CartEvent($this->getCart($this->getRequest())));
|
||||
|
||||
/* call pay method */
|
||||
|
||||
|
||||
@@ -62,6 +62,13 @@ class CreateAdminUser extends ContainerAwareCommand
|
||||
'User last name',
|
||||
null
|
||||
)
|
||||
->addOption(
|
||||
"locale",
|
||||
null,
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
'Preferred locale (default: en_US)',
|
||||
null
|
||||
)
|
||||
->addOption(
|
||||
'password',
|
||||
null,
|
||||
@@ -122,6 +129,7 @@ class CreateAdminUser extends ContainerAwareCommand
|
||||
$admin->setLogin($input->getOption("login_name") ?: $this->enterData($dialog, $output, "Admin login name : ", "Please enter a login name."));
|
||||
$admin->setFirstname($input->getOption("first_name") ?: $this->enterData($dialog, $output, "User first name : ", "Please enter user first name."));
|
||||
$admin->setLastname($input->getOption("last_name") ?: $this->enterData($dialog, $output, "User last name : ", "Please enter user last name."));
|
||||
$admin->setLocale($input->getOption("locale") ?: 'en_US');
|
||||
|
||||
do {
|
||||
$password = $input->getOption("password") ?: $this->enterData($dialog, $output, "Password : ", "Please enter a password.", true);
|
||||
|
||||
@@ -227,6 +227,7 @@ class Install extends ContainerAwareCommand
|
||||
$connectionInfo["username"],
|
||||
$connectionInfo["password"]
|
||||
);
|
||||
$connection->query('SET NAMES \'UTF8\'');
|
||||
} catch (\PDOException $e) {
|
||||
$output->writeln(array(
|
||||
"<error>Wrong connection information</error>"
|
||||
|
||||
@@ -106,7 +106,6 @@ class ModuleGenerateCommand extends BaseModuleGenerate
|
||||
|
||||
$schemaContent = file_get_contents($skeletonDir . "schema.xml");
|
||||
|
||||
$schemaContent = str_replace("%%CONFIG_DIR%%", THELIA_CONF_DIR, $schemaContent);
|
||||
$schemaContent = str_replace("%%NAMESPACE%%", $this->module, $schemaContent);
|
||||
|
||||
file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . "Config". DIRECTORY_SEPARATOR . "schema.xml", $schemaContent);
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
<!--
|
||||
See propel documentation on http://propelorm.org for all information about schema file
|
||||
-->
|
||||
<external-schema filename="%%CONFIG_DIR%%schema.xml" referenceOnly="true" />
|
||||
<external-schema filename="local/config/schema.xml" referenceOnly="true" />
|
||||
</database>
|
||||
|
||||
205
core/lib/Thelia/Config/I18n/en_US.php
Normal file → Executable file
205
core/lib/Thelia/Config/I18n/en_US.php
Normal file → Executable file
@@ -1,14 +1,201 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Delivery module' => 'Delivery module',
|
||||
'Quantity' => 'Quantity',
|
||||
'Product' => 'Product',
|
||||
'Unit. price' => 'Unit. price',
|
||||
'Tax' => 'Tax',
|
||||
'Unit taxed price' => 'Unit taxed price',
|
||||
'Taxed total' => 'Taxed total',
|
||||
'Payment module' => 'Payment module',
|
||||
'%obj SEO modification' => '%obj SEO modification',
|
||||
'%obj creation' => '%obj creation',
|
||||
'%obj modification' => '%obj modification',
|
||||
'A currency with code "%name" already exists.' => 'A currency with code "%name" already exists.',
|
||||
'A message with name "%name" already exists.' => 'A message with name "%name" already exists.',
|
||||
'A variable with name "%name" already exists.' => 'A variable with name "%name" already exists.',
|
||||
'Activate logs only for these IP Addresses' => 'Activate logs only for these IP Addresses',
|
||||
'Activate logs only for these files' => 'Activate logs only for these files',
|
||||
'Add to all product templates' => 'Add to all product templates',
|
||||
'Additional address' => 'Additional address',
|
||||
'Address Line 2' => 'Address Line 2',
|
||||
'Address Line 3' => 'Address Line 3',
|
||||
'Address label' => 'Address label',
|
||||
'Advertise this product as new' => 'Advertise this product as new',
|
||||
'Alerts' => 'Alerts',
|
||||
'Alpha code 2 *' => 'Alpha code 2 *',
|
||||
'Alpha code 3 *' => 'Alpha code 3 *',
|
||||
'Amount removed from the cart' => 'Amount removed from the cart',
|
||||
'Apply exchange rates on price in %sym' => 'Apply exchange rates on price in %sym',
|
||||
'Area' => 'Area',
|
||||
'Attribute ID:Attribute AV ID' => 'Attribute ID:Attribute AV ID',
|
||||
'Auth mode' => 'Auth mode',
|
||||
'Available quantity' => 'Available quantity',
|
||||
'Available quantity *' => 'Available quantity *',
|
||||
'Business ID' => 'Business ID',
|
||||
'Cannot find a default country. Please define one.' => 'Cannot find a default country. Please define one.',
|
||||
'Cannot find the shop country. Please select a shop country.' => 'Cannot find the shop country. Please select a shop country.',
|
||||
'Category title *' => 'Category title *',
|
||||
'Cellphone' => 'Cellphone',
|
||||
'Chapo' => 'Chapo',
|
||||
'City' => 'City',
|
||||
'Combination builder' => 'Combination builder',
|
||||
'Compagny' => 'Compagny',
|
||||
'Company' => 'Company',
|
||||
'Company Name' => 'Company Name',
|
||||
'Conclusion' => 'Conclusion',
|
||||
'Constant amount' => 'Constant amount',
|
||||
'Constant amount found in one of the product\'s feature' => 'Constant amount found in one of the product\'s feature',
|
||||
'Content title *' => 'Content title *',
|
||||
'Country' => 'Country',
|
||||
'Country area' => 'Country area',
|
||||
'Country title *' => 'Country title *',
|
||||
'Critical' => 'Critical',
|
||||
'Current Password' => 'Current Password',
|
||||
'Debug' => 'Debug',
|
||||
'Default folder *' => 'Default folder *',
|
||||
'Default product category *' => 'Default product category *',
|
||||
'Default product sale element' => 'Default product sale element',
|
||||
'Description' => 'Description',
|
||||
'Detailed description' => 'Detailed description',
|
||||
'Disabled' => 'Disabled',
|
||||
'EAN Code' => 'EAN Code',
|
||||
'Email Address' => 'Email Address',
|
||||
'Email address' => 'Email address',
|
||||
'Emergency' => 'Emergency',
|
||||
'Enable remote SMTP use' => 'Enable remote SMTP use',
|
||||
'Encryption' => 'Encryption',
|
||||
'Errors' => 'Errors',
|
||||
'Failed to update language definition: %ex' => 'Failed to update language definition: %ex',
|
||||
'Fax' => 'Fax',
|
||||
'Feature value does not match FLOAT format' => 'Feature value does not match FLOAT format',
|
||||
'First Name' => 'First Name',
|
||||
'Firstname' => 'Firstname',
|
||||
'Folder title *' => 'Folder title *',
|
||||
'Full Name' => 'Full Name',
|
||||
'HTML Message' => 'HTML Message',
|
||||
'Host' => 'Host',
|
||||
'I would like to receive the newsletter or the latest news.' => 'I would like to receive the newsletter or the latest news.',
|
||||
'ISO 4217 code *' => 'ISO 4217 code *',
|
||||
'ISO 639-1 Code' => 'ISO 639-1 Code',
|
||||
'ISO Code *' => 'ISO Code *',
|
||||
'If a translation is missing or incomplete :' => 'If a translation is missing or incomplete :',
|
||||
'Information' => 'Information',
|
||||
'Invalid product_sale_elements' => 'Invalid product_sale_elements',
|
||||
'Invalid value for walkMode parameter: %value' => 'Invalid value for walkMode parameter: %value',
|
||||
'Is it the default product sale element ?' => 'Is it the default product sale element ?',
|
||||
'Language name' => 'Language name',
|
||||
'Last Name' => 'Last Name',
|
||||
'Lastname' => 'Lastname',
|
||||
'Log format *' => 'Log format *',
|
||||
'Log level *' => 'Log level *',
|
||||
'Login' => 'Login',
|
||||
'Login failed. Please check your username and password.' => 'Login failed. Please check your username and password.',
|
||||
'Make this address as my primary address' => 'Make this address as my primary address',
|
||||
'Message subject' => 'Message subject',
|
||||
'Meta Description' => 'Meta Description',
|
||||
'Meta Keywords' => 'Meta Keywords',
|
||||
'Name' => 'Name',
|
||||
'Name *' => 'Name *',
|
||||
'Name of the HTML layout file' => 'Name of the HTML layout file',
|
||||
'Name of the HTML template file' => 'Name of the HTML template file',
|
||||
'Name of the text layout file' => 'Name of the text layout file',
|
||||
'Name of the text template file' => 'Name of the text template file',
|
||||
'New Password' => 'New Password',
|
||||
'No %obj was created.' => 'No %obj was created.',
|
||||
'No %obj was updated.' => 'No %obj was updated.',
|
||||
'No, I am a new customer.' => 'No, I am a new customer.',
|
||||
'Notices' => 'Notices',
|
||||
'Page Title' => 'Page Title',
|
||||
'Parent category *' => 'Parent category *',
|
||||
'Parent folder *' => 'Parent folder *',
|
||||
'Password' => 'Password',
|
||||
'Password *' => 'Password *',
|
||||
'Password confirmation' => 'Password confirmation',
|
||||
'Percentage of the product price' => 'Percentage of the product price',
|
||||
'Percentage removed from the cart' => 'Percentage removed from the cart',
|
||||
'Phone' => 'Phone',
|
||||
'Please enter your email address' => 'Please enter your email address',
|
||||
'Please enter your password' => 'Please enter your password',
|
||||
'Please specify either \'path\' or \'file\' parameter in {url} function.' => 'Please specify either \'path\' or \'file\' parameter in {url} function.',
|
||||
'Port' => 'Port',
|
||||
'Post Scriptum' => 'Post Scriptum',
|
||||
'Postage' => 'Postage',
|
||||
'Total' => 'Total',
|
||||
'Preferred locale' => 'Preferred locale',
|
||||
'Prevent mailing template modification or deletion, except for super-admin' => 'Prevent mailing template modification or deletion, except for super-admin',
|
||||
'Prevent variable modification or deletion, except for super-admin' => 'Prevent variable modification or deletion, except for super-admin',
|
||||
'Price' => 'Price',
|
||||
'Price currency *' => 'Price currency *',
|
||||
'Prodcut ID *' => 'Prodcut ID *',
|
||||
'Product ID' => 'Product ID',
|
||||
'Product ID *' => 'Product ID *',
|
||||
'Product base price excluding taxes *' => 'Product base price excluding taxes *',
|
||||
'Product price excluding taxes' => 'Product price excluding taxes',
|
||||
'Product price excluding taxes *' => 'Product price excluding taxes *',
|
||||
'Product price including taxes' => 'Product price including taxes',
|
||||
'Product reference *' => 'Product reference *',
|
||||
'Product sale element ID *' => 'Product sale element ID *',
|
||||
'Product template' => 'Product template',
|
||||
'Product title *' => 'Product title *',
|
||||
'ProductSaleElement modification' => 'ProductSaleElement modification',
|
||||
'Profile' => 'Profile',
|
||||
'Profile Code' => 'Profile Code',
|
||||
'Purpose *' => 'Purpose *',
|
||||
'Quantity' => 'Quantity',
|
||||
'Rate from € *' => 'Rate from € *',
|
||||
'Redirecting ...' => 'Redirecting ...',
|
||||
'Redirecting to %url' => 'Redirecting to %url',
|
||||
'Reference' => 'Reference',
|
||||
'Reference *' => 'Reference *',
|
||||
'Remember me ?' => 'Remember me ?',
|
||||
'Remove X amount to total cart' => 'Remove X amount to total cart',
|
||||
'Remove X percent to total cart' => 'Remove X percent to total cart',
|
||||
'Replace by the default language' => 'Replace by the default language',
|
||||
'Replace current document by this file' => 'Replace current document by this file',
|
||||
'Replace current image by this file' => 'Replace current image by this file',
|
||||
'Rewriten URL' => 'Rewriten URL',
|
||||
'Rotated Text File' => 'Rotated Text File',
|
||||
'Sale price excluding taxes' => 'Sale price excluding taxes',
|
||||
'Sale price including taxes' => 'Sale price including taxes',
|
||||
'Show redirections *' => 'Show redirections *',
|
||||
'Sorry, an error occured: %msg' => 'Sorry, an error occured: %msg',
|
||||
'Sorry, you are not allowed to perform this action.' => 'Sorry, you are not allowed to perform this action.',
|
||||
'Sorry, you\'re not allowed to perform this action' => 'Sorry, you\'re not allowed to perform this action',
|
||||
'Source IP' => 'Source IP',
|
||||
'Store configuration failed.' => 'Store configuration failed.',
|
||||
'Store email address' => 'Store email address',
|
||||
'Store logs into text file' => 'Store logs into text file',
|
||||
'Store logs into text file, up to a certian size, then a new file is created' => 'Store logs into text file, up to a certian size, then a new file is created',
|
||||
'Store name' => 'Store name',
|
||||
'Street Address' => 'Street Address',
|
||||
'Street Address ' => 'Street Address ',
|
||||
'Strictly use the requested language' => 'Strictly use the requested language',
|
||||
'Subject' => 'Subject',
|
||||
'Summary' => 'Summary',
|
||||
'Symbol *' => 'Symbol *',
|
||||
'System log configuration failed.' => 'System log configuration failed.',
|
||||
'Tax rule for this product *' => 'Tax rule for this product *',
|
||||
'Template Name *' => 'Template Name *',
|
||||
'Template file %file cannot be found.' => 'Template file %file cannot be found.',
|
||||
'Text File' => 'Text File',
|
||||
'Text Message' => 'Text Message',
|
||||
'This category is online.' => 'This category is online.',
|
||||
'This content is online.' => 'This content is online.',
|
||||
'This extension must be installed and loaded' => 'This extension must be installed and loaded',
|
||||
'This folder is online.' => 'This folder is online.',
|
||||
'This product is on sale' => 'This product is on sale',
|
||||
'This product is online' => 'This product is online',
|
||||
'Timeout' => 'Timeout',
|
||||
'Title' => 'Title',
|
||||
'Title *' => 'Title *',
|
||||
'Type' => 'Type',
|
||||
'Username' => 'Username',
|
||||
'Username *' => 'Username *',
|
||||
'Value' => 'Value',
|
||||
'Value *' => 'Value *',
|
||||
'Warnings' => 'Warnings',
|
||||
'Weight' => 'Weight',
|
||||
'Weight *' => 'Weight *',
|
||||
'Yes, I have a password :' => 'Yes, I have a password :',
|
||||
'Your Email Address' => 'Your Email Address',
|
||||
'Your Message' => 'Your Message',
|
||||
'Zip code' => 'Zip code',
|
||||
'date format' => 'date format',
|
||||
'language locale' => 'language locale',
|
||||
'mailing system modification' => 'mailing system modification',
|
||||
'shipping area name' => 'shipping area name',
|
||||
'time format' => 'time format',
|
||||
);
|
||||
|
||||
42
core/lib/Thelia/Config/I18n/es_ES.php
Normal file → Executable file
42
core/lib/Thelia/Config/I18n/es_ES.php
Normal file → Executable file
@@ -1,36 +1,14 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Combination builder' => 'Combination builder',
|
||||
'Title' => 'Title',
|
||||
'City' => 'City',
|
||||
'Zip code' => 'Zip code',
|
||||
'Country' => 'Country',
|
||||
'Phone' => 'Phone',
|
||||
'Login' => 'Login',
|
||||
'Password' => 'Password',
|
||||
'Profile' => 'Profile',
|
||||
'Postage' => 'Postage',
|
||||
'Add to all product templates' => 'Add to all product templates',
|
||||
'Quantity' => 'Quantity',
|
||||
'Name' => 'Name',
|
||||
'Value' => 'Value',
|
||||
'Subject' => 'Subject',
|
||||
'Company' => 'Company',
|
||||
'Description' => 'Description',
|
||||
'Language name' => 'Language name',
|
||||
'ISO 639 Code' => 'ISO 639 Code',
|
||||
'If a translation is missing or incomplete :' => 'If a translation is missing or incomplete :',
|
||||
'Host' => 'Host',
|
||||
'Port' => 'Port',
|
||||
'Encryption' => 'Encryption',
|
||||
'Username' => 'Username',
|
||||
'Timeout' => 'Timeout',
|
||||
'Source IP' => 'Source IP',
|
||||
'Email address' => 'Email address',
|
||||
'Firstname' => 'Firstname',
|
||||
'Lastname' => 'Lastname',
|
||||
'Additional address' => 'Additional address',
|
||||
'Reference' => 'Reference',
|
||||
'EAN Code' => 'EAN Code',
|
||||
'Delivery module' => 'Módulo de entrega',
|
||||
'Quantity' => 'Cantidad',
|
||||
'Product' => 'Producto',
|
||||
'Unit. price' => 'Precio unitario',
|
||||
'Tax' => 'Impuestos',
|
||||
'Unit taxed price' => 'Precio unitario IVA incluido',
|
||||
'Taxed total' => 'Total + IVA',
|
||||
'Payment module' => 'Módulo de pago',
|
||||
'Postage' => 'Gastos de envío',
|
||||
'Total' => 'Total',
|
||||
);
|
||||
|
||||
28
core/lib/Thelia/Config/I18n/fr_FR.php
Normal file → Executable file
28
core/lib/Thelia/Config/I18n/fr_FR.php
Normal file → Executable file
@@ -19,7 +19,9 @@ return array(
|
||||
'Alpha code 2 *' => 'Code Alpha 2 *',
|
||||
'Alpha code 3 *' => 'Code Alpha 3 *',
|
||||
'Amount removed from the cart' => 'Montant déduit du panier',
|
||||
'Apply exchange rates on price in %sym' => 'Appliquer le taux de change sur le prix en %sym',
|
||||
'Area' => 'Zone',
|
||||
'Attribute ID:Attribute AV ID' => 'Déclinaison ID : Valeur de déclinaison ID',
|
||||
'Auth mode' => 'Mode d\'authentification',
|
||||
'Available quantity' => 'Quantité disponible',
|
||||
'Available quantity *' => 'Quantité disponible *',
|
||||
@@ -30,11 +32,13 @@ return array(
|
||||
'Cellphone' => 'Numéro de portable',
|
||||
'Chapo' => 'Chapeau',
|
||||
'City' => 'Ville',
|
||||
'Combination builder' => 'Constructeur de combinaison',
|
||||
'Combination builder' => 'générateur de combinaison',
|
||||
'Compagny' => 'Société',
|
||||
'Company' => 'Entreprise',
|
||||
'Company Name' => 'Nom de la société',
|
||||
'Conclusion' => 'Conclusion',
|
||||
'Constant amount' => 'Montant fixe',
|
||||
'Constant amount found in one of the product\'s feature' => 'Montant fixe trouvé depuis une caractéristique produit',
|
||||
'Content title *' => 'Titre du contenu *',
|
||||
'Country' => 'Pays',
|
||||
'Country area' => 'Zone du pays',
|
||||
@@ -44,6 +48,7 @@ return array(
|
||||
'Debug' => 'Debug',
|
||||
'Default folder *' => 'Dossier par défaut *',
|
||||
'Default product category *' => 'Catégorie du produit par défaut *',
|
||||
'Default product sale element' => 'Product Sale Element par défaut',
|
||||
'Description' => 'Description',
|
||||
'Detailed description' => 'Description détaillée',
|
||||
'Disabled' => 'Désactivé',
|
||||
@@ -54,21 +59,24 @@ return array(
|
||||
'Enable remote SMTP use' => 'Activer l\'utilisation d\'un serveur SMTP distant.',
|
||||
'Encryption' => 'Chiffrement',
|
||||
'Errors' => 'Erreurs',
|
||||
'Failed to update language definition: %ex' => 'Erreur lors de la mise à jour de la définition de la langue : %ex',
|
||||
'Fax' => 'Fax',
|
||||
'Feature value does not match FLOAT format' => 'valeur de caractéristique n\'est pas un FLOAT',
|
||||
'First Name' => 'Prénom',
|
||||
'Firstname' => 'Prénom',
|
||||
'Folder title *' => 'Titre du dossier *',
|
||||
'Full Name' => 'Nom complet',
|
||||
'HTML Message' => 'Message au format HTML',
|
||||
'Host' => 'Host',
|
||||
'Host' => 'Nom de l\'hôte',
|
||||
'I would like to receive the newsletter or the latest news.' => 'Je souhaite recevoir la lettre d\'information ou les dernières actualités.',
|
||||
'ISO 4217 code *' => 'Code ISO 4217 *',
|
||||
'ISO 639 Code' => 'Code ISO 639',
|
||||
'ISO 639-1 Code' => 'Code ISO 639-1',
|
||||
'ISO Code *' => 'Code ISO *',
|
||||
'If a translation is missing or incomplete :' => 'Si une traduction est manquante ou incomplète:',
|
||||
'If a translation is missing or incomplete :' => 'Si une traduction est manquante ou incomplète :',
|
||||
'Information' => 'Information',
|
||||
'Invalid product_sale_elements' => 'product_sale_elements invalide',
|
||||
'Invalid value for walkMode parameter: %value' => 'Valeur incorrecte pour le paramètre walkMode : %value',
|
||||
'Is it the default product sale element ?' => 'Product Sale Element par défaut ?',
|
||||
'Language name' => 'Nom de la langue',
|
||||
'Last Name' => 'Nom',
|
||||
'Lastname' => 'Nom',
|
||||
@@ -97,6 +105,7 @@ return array(
|
||||
'Password' => 'Mot de passe',
|
||||
'Password *' => 'Mot de passe *',
|
||||
'Password confirmation' => 'Confirmation du mot de passe.',
|
||||
'Percentage of the product price' => 'Pourcentage du prix du produit',
|
||||
'Percentage removed from the cart' => 'Pourcentage déduit du panier',
|
||||
'Phone' => 'Téléphone',
|
||||
'Please enter your email address' => 'Renseignez votre adresse mail',
|
||||
@@ -105,6 +114,7 @@ return array(
|
||||
'Port' => 'Port',
|
||||
'Post Scriptum' => 'Post-scriptum',
|
||||
'Postage' => 'Frais de livraison',
|
||||
'Preferred locale' => 'locale souhaitée',
|
||||
'Prevent mailing template modification or deletion, except for super-admin' => 'Prévenir la suppression ou la modification ds templates de mail, excepté pour les super-administrateurs.',
|
||||
'Prevent variable modification or deletion, except for super-admin' => 'Prévenir la suppression ou la modification de variables, excepté pour les super-administrateurs.',
|
||||
'Price' => 'Prix',
|
||||
@@ -114,18 +124,20 @@ return array(
|
||||
'Product ID *' => 'ID produit *',
|
||||
'Product base price excluding taxes *' => 'Prix du produit Hors Taxe *',
|
||||
'Product price excluding taxes' => 'Prix du produit Hors Taxes',
|
||||
'Product price excluding taxes *' => 'prix HT',
|
||||
'Product price including taxes' => 'Prix du produit taxes incluses',
|
||||
'Product reference *' => 'Référence du produit *',
|
||||
'Product sale element ID *' => 'Product sale element ID *',
|
||||
'Product template' => 'Template du produit',
|
||||
'Product title *' => 'Titre du produit *',
|
||||
'ProductSaleElement modification' => 'Modification de ProductSaleElement.',
|
||||
'Profile' => 'Profil',
|
||||
'Profile Code' => 'Profil',
|
||||
'Quantity' => 'Quantité',
|
||||
'Purpose *' => 'Objet',
|
||||
'Rate from € *' => 'Taux à partie de l\'€ *',
|
||||
'Redirecting ...' => 'Redirection ...',
|
||||
'Redirecting to %url' => 'Redirection vers %url',
|
||||
'Reference' => 'Reference',
|
||||
'Reference' => 'Référence',
|
||||
'Reference *' => 'Référence *',
|
||||
'Remember me ?' => 'Se souvenir de moi ?',
|
||||
'Remove X amount to total cart' => 'Enlève un montant fixe du total du panier',
|
||||
@@ -134,6 +146,7 @@ return array(
|
||||
'Replace current document by this file' => 'Remplacer le document courant par ce fichier',
|
||||
'Replace current image by this file' => 'Remplacer l\'image courante par ce fichier',
|
||||
'Rewriten URL' => 'URL re-écrite',
|
||||
'Rotated Text File' => 'Rotation du fichier texte',
|
||||
'Sale price excluding taxes' => 'Prix de vente Hors Taxes',
|
||||
'Sale price including taxes' => 'Prix de vente Toutes Taxes Comprises',
|
||||
'Show redirections *' => 'Montrer les redirections *',
|
||||
@@ -144,6 +157,7 @@ return array(
|
||||
'Store configuration failed.' => 'Erreur de configuration du magasin.',
|
||||
'Store email address' => 'Adresse mail du magasin',
|
||||
'Store logs into text file' => 'Conserver les logs dans des fichiers texte',
|
||||
'Store logs into text file, up to a certian size, then a new file is created' => 'Sauvegarder les logs dans un fichier texte. A partir d\'une certaine taille un nouveau fichier est crée',
|
||||
'Store name' => 'Nom du magasin',
|
||||
'Street Address' => 'Adresse',
|
||||
'Street Address ' => 'Rue',
|
||||
@@ -163,7 +177,7 @@ return array(
|
||||
'This folder is online.' => 'Ce dossier est en ligne.',
|
||||
'This product is on sale' => 'Ce produit est en promo',
|
||||
'This product is online' => 'Ce produit est en ligne',
|
||||
'Timeout' => 'Timeout',
|
||||
'Timeout' => 'Délai d\'attente expiré',
|
||||
'Title' => 'Titre',
|
||||
'Title *' => 'Titre *',
|
||||
'Type' => 'Type',
|
||||
|
||||
0
core/lib/Thelia/Config/I18n/it_IT.php
Normal file → Executable file
0
core/lib/Thelia/Config/I18n/it_IT.php
Normal file → Executable file
@@ -16,13 +16,12 @@
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
<service id="thelia.action.customer" class="Thelia\Action\Customer">
|
||||
<argument type="service" id="service_container"/>
|
||||
<service id="thelia.action.customer" class="Thelia\Action\Customer" scope="request">
|
||||
<argument type="service" id="thelia.securityContext"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
<service id="thelia.action.address" class="Thelia\Action\Address">
|
||||
<argument type="service" id="service_container"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
@@ -156,7 +155,6 @@
|
||||
</service>
|
||||
|
||||
<service id="thelia.action.administrator" class="Thelia\Action\Administrator">
|
||||
<argument type="service" id="service_container"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ class AdministratorController extends AbstractCrudController
|
||||
$event->setLastname($formData['lastname']);
|
||||
$event->setPassword($formData['password']);
|
||||
$event->setProfile($formData['profile'] ? : null);
|
||||
$event->setLocale($formData['locale']);
|
||||
|
||||
return $event;
|
||||
}
|
||||
@@ -80,6 +81,7 @@ class AdministratorController extends AbstractCrudController
|
||||
$event->setLastname($formData['lastname']);
|
||||
$event->setPassword($formData['password']);
|
||||
$event->setProfile($formData['profile'] ? : null);
|
||||
$event->setLocale($formData['locale']);
|
||||
|
||||
return $event;
|
||||
}
|
||||
@@ -108,6 +110,7 @@ class AdministratorController extends AbstractCrudController
|
||||
'lastname' => $object->getLastname(),
|
||||
'login' => $object->getLogin(),
|
||||
'profile' => $object->getProfileId(),
|
||||
'locale' => $object->getLocale()
|
||||
);
|
||||
|
||||
// Setup the object form
|
||||
|
||||
@@ -38,6 +38,7 @@ use Thelia\Form\Lang\LangDefaultBehaviorForm;
|
||||
use Thelia\Form\Lang\LangUpdateForm;
|
||||
use Thelia\Form\Lang\LangUrlEvent;
|
||||
use Thelia\Form\Lang\LangUrlForm;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\LangQuery;
|
||||
|
||||
@@ -118,11 +119,12 @@ class LangController extends BaseAdminController
|
||||
$changedObject = $event->getLang();
|
||||
$this->adminLogAppend(AdminResources::LANGUAGE, AccessManager::UPDATE, sprintf("%s %s (ID %s) modified", 'Lang', $changedObject->getTitle(), $changedObject->getId()));
|
||||
$this->redirectToRoute('admin.configuration.languages');
|
||||
} catch (\Exception $e) {
|
||||
$error_msg = $e->getMessage();
|
||||
} catch (\Exception $ex) {
|
||||
$error_msg = $this->getTranslator()->trans("Failed to update language definition: %ex", array("%ex" => $ex->getMessage()));
|
||||
Tlog::getInstance()->addError("Failed to update language definition", $ex->getMessage());
|
||||
}
|
||||
|
||||
return $this->renderDefault();
|
||||
return $this->renderDefault(array('error_message' => $error_msg));
|
||||
}
|
||||
|
||||
protected function hydrateEvent($event,Form $form)
|
||||
@@ -156,7 +158,7 @@ class LangController extends BaseAdminController
|
||||
$this->adminLogAppend(AdminResources::LANGUAGE, AccessManager::UPDATE, sprintf("%s %s (ID %s) modified", 'Lang', $changedObject->getTitle(), $changedObject->getId()));
|
||||
|
||||
} catch (\Exception $e) {
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("Error on changing default languages with message : %s", $e->getMessage()));
|
||||
Tlog::getInstance()->error(sprintf("Error on changing default languages with message : %s", $e->getMessage()));
|
||||
$error = $e->getMessage();
|
||||
}
|
||||
|
||||
@@ -223,12 +225,12 @@ class LangController extends BaseAdminController
|
||||
|
||||
$this->redirectToRoute('admin.configuration.languages');
|
||||
} catch (\Exception $ex) {
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("error during language removal with message : %s", $ex->getMessage()));
|
||||
Tlog::getInstance()->error(sprintf("error during language removal with message : %s", $ex->getMessage()));
|
||||
$error_msg = $ex->getMessage();
|
||||
}
|
||||
|
||||
return $this->renderDefault(array(
|
||||
'error_delete_message' => $error_msg
|
||||
'error_message' => $error_msg
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
@@ -46,7 +46,11 @@ class OrderController extends BaseAdminController
|
||||
public function indexAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER, array(), AccessManager::VIEW)) return $response;
|
||||
return $this->render("orders", array("display_order" => 20));
|
||||
|
||||
return $this->render("orders", array(
|
||||
"display_order" => 20,
|
||||
"orders_order" => $this->getListOrderFromSession("orders", "orders_order", "create-date-reverse")
|
||||
));
|
||||
}
|
||||
|
||||
public function viewAction($order_id)
|
||||
|
||||
@@ -26,8 +26,11 @@ namespace Thelia\Controller\Admin;
|
||||
use Thelia\Form\AdminLogin;
|
||||
use Thelia\Core\Security\Authentication\AdminUsernamePasswordFormAuthenticator;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Model\Admin;
|
||||
use Thelia\Model\AdminLog;
|
||||
use Thelia\Core\Security\Exception\AuthenticationException;
|
||||
use Thelia\Model\Lang;
|
||||
use Thelia\Model\LangQuery;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Tools\Redirect;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
@@ -56,8 +59,11 @@ class SessionController extends BaseAdminController
|
||||
// Update the cookie
|
||||
$this->createAdminRememberMeCookie($user);
|
||||
|
||||
$this->applyUserLocale($user);
|
||||
|
||||
// Render the home page
|
||||
return $this->render("home");
|
||||
|
||||
} catch (TokenAuthenticationException $ex) {
|
||||
$this->adminLogAppend("admin", "LOGIN", "Token based authentication failed.");
|
||||
|
||||
@@ -69,6 +75,18 @@ class SessionController extends BaseAdminController
|
||||
return $this->render("login");
|
||||
}
|
||||
|
||||
protected function applyUserLocale(Admin $user) {
|
||||
|
||||
// Set the current language according to Admin locale preference
|
||||
$locale = $user->getLocale();
|
||||
|
||||
if (null === $lang = LangQuery::create()->findOneByLocale($locale)) {
|
||||
$lang = Lang::getDefaultLanguage();
|
||||
}
|
||||
|
||||
$this->getSession()->setLang($lang);
|
||||
}
|
||||
|
||||
public function checkLogoutAction()
|
||||
{
|
||||
$this->dispatch(TheliaEvents::ADMIN_LOGOUT);
|
||||
@@ -102,6 +120,8 @@ class SessionController extends BaseAdminController
|
||||
// Log authentication success
|
||||
AdminLog::append("admin", "LOGIN", "Authentication successful", $request, $user, false);
|
||||
|
||||
$this->applyUserLocale($user);
|
||||
|
||||
/**
|
||||
* FIXME: we have tou find a way to send cookie
|
||||
*/
|
||||
|
||||
@@ -35,6 +35,7 @@ class AdministratorEvent extends ActionEvent
|
||||
protected $login = null;
|
||||
protected $password = null;
|
||||
protected $profile = null;
|
||||
protected $locale = null;
|
||||
|
||||
public function __construct(Admin $administrator = null)
|
||||
{
|
||||
@@ -61,6 +62,8 @@ class AdministratorEvent extends ActionEvent
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
@@ -71,6 +74,8 @@ class AdministratorEvent extends ActionEvent
|
||||
public function setFirstname($firstname)
|
||||
{
|
||||
$this->firstname = $firstname;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFirstname()
|
||||
@@ -81,6 +86,8 @@ class AdministratorEvent extends ActionEvent
|
||||
public function setLastname($lastname)
|
||||
{
|
||||
$this->lastname = $lastname;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLastname()
|
||||
@@ -91,6 +98,8 @@ class AdministratorEvent extends ActionEvent
|
||||
public function setLogin($login)
|
||||
{
|
||||
$this->login = $login;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLogin()
|
||||
@@ -101,6 +110,8 @@ class AdministratorEvent extends ActionEvent
|
||||
public function setPassword($password)
|
||||
{
|
||||
$this->password = $password;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPassword()
|
||||
@@ -111,10 +122,23 @@ class AdministratorEvent extends ActionEvent
|
||||
public function setProfile($profile)
|
||||
{
|
||||
$this->profile = $profile;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getProfile()
|
||||
{
|
||||
return $this->profile;
|
||||
}
|
||||
}
|
||||
|
||||
public function setLocale($locale)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLocale()
|
||||
{
|
||||
return $this->locale;
|
||||
}
|
||||
}
|
||||
@@ -54,6 +54,8 @@ class AdministratorUpdatePasswordEvent extends ActionEvent
|
||||
public function setPassword($password)
|
||||
{
|
||||
$this->password = $password;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,6 +72,8 @@ class AdministratorUpdatePasswordEvent extends ActionEvent
|
||||
public function setAdmin(Admin $admin)
|
||||
{
|
||||
$this->admin = $admin;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,6 +48,7 @@ class CartEvent extends ActionEvent
|
||||
public function setAppend($append)
|
||||
{
|
||||
$this->append = $append;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,6 +65,7 @@ class CartEvent extends ActionEvent
|
||||
public function setCartItem($cartItem)
|
||||
{
|
||||
$this->cartItem = $cartItem;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,6 +82,7 @@ class CartEvent extends ActionEvent
|
||||
public function setNewness($newness)
|
||||
{
|
||||
$this->newness = $newness;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,6 +99,7 @@ class CartEvent extends ActionEvent
|
||||
public function setProduct($product)
|
||||
{
|
||||
$this->product = $product;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,6 +116,7 @@ class CartEvent extends ActionEvent
|
||||
public function setProductSaleElementsId($productSaleElementsId)
|
||||
{
|
||||
$this->productSaleElementsId = $productSaleElementsId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,6 +133,7 @@ class CartEvent extends ActionEvent
|
||||
public function setQuantity($quantity)
|
||||
{
|
||||
$this->quantity = $quantity;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,5 +151,4 @@ class CartEvent extends ActionEvent
|
||||
{
|
||||
return $this->cart;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
266
core/lib/Thelia/Core/Event/Order/OrderManualEvent.php
Normal file
266
core/lib/Thelia/Core/Event/Order/OrderManualEvent.php
Normal file
@@ -0,0 +1,266 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event\Order;
|
||||
|
||||
use Thelia\Model\Order;
|
||||
use Thelia\Model\Currency;
|
||||
use Thelia\Model\Lang;
|
||||
use Thelia\Model\Cart;
|
||||
use Thelia\Model\Customer;
|
||||
|
||||
class OrderManualEvent extends OrderEvent
|
||||
{
|
||||
protected $currency = null;
|
||||
protected $lang = null;
|
||||
protected $cart = null;
|
||||
protected $customer = null;
|
||||
|
||||
/**
|
||||
* @param Order $order
|
||||
*/
|
||||
public function __construct(Order $order, Currency $currency, Lang $lang, Cart $cart, Customer $customer)
|
||||
{
|
||||
$this
|
||||
->setOrder($order)
|
||||
->setCurrency($currency)
|
||||
->setLang($lang)
|
||||
->setCart($cart)
|
||||
->setCustomer($customer)
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Order $order
|
||||
*/
|
||||
public function setOrder(Order $order)
|
||||
{
|
||||
$this->order = $order;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Order $order
|
||||
*/
|
||||
public function setPlacedOrder(Order $order)
|
||||
{
|
||||
$this->placedOrder = $order;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $address
|
||||
*/
|
||||
public function setInvoiceAddress($address)
|
||||
{
|
||||
$this->invoiceAddress = $address;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $address
|
||||
*/
|
||||
public function setDeliveryAddress($address)
|
||||
{
|
||||
$this->deliveryAddress = $address;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $module
|
||||
*/
|
||||
public function setDeliveryModule($module)
|
||||
{
|
||||
$this->deliveryModule = $module;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $module
|
||||
*/
|
||||
public function setPaymentModule($module)
|
||||
{
|
||||
$this->paymentModule = $module;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $postage
|
||||
*/
|
||||
public function setPostage($postage)
|
||||
{
|
||||
$this->postage = $postage;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $ref
|
||||
*/
|
||||
public function setRef($ref)
|
||||
{
|
||||
$this->ref = $ref;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $status
|
||||
*/
|
||||
public function setStatus($status)
|
||||
{
|
||||
$this->status = $status;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $deliveryRef
|
||||
*/
|
||||
public function setDeliveryRef($deliveryRef)
|
||||
{
|
||||
$this->deliveryRef = $deliveryRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|Order
|
||||
*/
|
||||
public function getOrder()
|
||||
{
|
||||
return $this->order;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|Order
|
||||
*/
|
||||
public function getPlacedOrder()
|
||||
{
|
||||
return $this->placedOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|int
|
||||
*/
|
||||
public function getInvoiceAddress()
|
||||
{
|
||||
return $this->invoiceAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|int
|
||||
*/
|
||||
public function getDeliveryAddress()
|
||||
{
|
||||
return $this->deliveryAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|int
|
||||
*/
|
||||
public function getDeliveryModule()
|
||||
{
|
||||
return $this->deliveryModule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|int
|
||||
*/
|
||||
public function getPaymentModule()
|
||||
{
|
||||
return $this->paymentModule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|int
|
||||
*/
|
||||
public function getPostage()
|
||||
{
|
||||
return $this->postage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|int
|
||||
*/
|
||||
public function getRef()
|
||||
{
|
||||
return $this->ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|int
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getDeliveryRef()
|
||||
{
|
||||
return $this->deliveryRef;
|
||||
}
|
||||
|
||||
public function getCurrency()
|
||||
{
|
||||
return $this->currency;
|
||||
}
|
||||
|
||||
public function setCurrency($currency)
|
||||
{
|
||||
$this->currency = $currency;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLang()
|
||||
{
|
||||
return $this->lang;
|
||||
}
|
||||
|
||||
public function setLang($lang)
|
||||
{
|
||||
$this->lang = $lang;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCart()
|
||||
{
|
||||
return $this->cart;
|
||||
}
|
||||
|
||||
public function setCart($cart)
|
||||
{
|
||||
$this->cart = $cart;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCustomer()
|
||||
{
|
||||
return $this->customer;
|
||||
}
|
||||
|
||||
public function setCustomer($customer)
|
||||
{
|
||||
$this->customer = $customer;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -378,6 +378,8 @@ final class TheliaEvents
|
||||
const ORDER_AFTER_CREATE = "action.order.afterCreate";
|
||||
const ORDER_BEFORE_PAYMENT = "action.order.beforePayment";
|
||||
|
||||
const ORDER_CREATE_MANUAL = "action.order.createManual";
|
||||
|
||||
const ORDER_UPDATE_STATUS = "action.order.updateStatus";
|
||||
const ORDER_UPDATE_DELIVERY_REF = "action.order.updateDeliveryRef";
|
||||
const ORDER_UPDATE_ADDRESS = "action.order.updateAddress";
|
||||
|
||||
@@ -24,14 +24,11 @@
|
||||
namespace Thelia\Core\Template\Element;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Thelia\Core\Security\SecurityContext;
|
||||
use Thelia\Core\Template\Element\Exception\LoopException;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Thelia\Core\Security\SecurityContext;
|
||||
use Thelia\Type\AlphaNumStringListType;
|
||||
use Thelia\Type\EnumListType;
|
||||
use Thelia\Type\EnumType;
|
||||
use Thelia\Type\TypeCollection;
|
||||
@@ -67,6 +64,9 @@ abstract class BaseLoop
|
||||
protected $timestampable = false;
|
||||
protected $versionable = false;
|
||||
|
||||
private static $cacheLoopResult = array();
|
||||
private static $cacheCount = array();
|
||||
|
||||
/**
|
||||
* Create a new Loop
|
||||
*
|
||||
@@ -335,71 +335,79 @@ abstract class BaseLoop
|
||||
|
||||
public function count()
|
||||
{
|
||||
$count = 0;
|
||||
if ($this instanceof PropelSearchLoopInterface) {
|
||||
$searchModelCriteria = $this->buildModelCriteria();
|
||||
if (null === $searchModelCriteria) {
|
||||
$count = 0;
|
||||
} else {
|
||||
$count = $searchModelCriteria->count();
|
||||
}
|
||||
} elseif ($this instanceof ArraySearchLoopInterface) {
|
||||
$searchArray = $this->buildArray();
|
||||
if (null === $searchArray) {
|
||||
$count = 0;
|
||||
} else {
|
||||
$count = count($searchArray);
|
||||
$hash = $this->args->getHash();
|
||||
if(false === isset(self::$cacheCount[$hash]))
|
||||
{
|
||||
$count = 0;
|
||||
if ($this instanceof PropelSearchLoopInterface) {
|
||||
$searchModelCriteria = $this->buildModelCriteria();
|
||||
if (null === $searchModelCriteria) {
|
||||
$count = 0;
|
||||
} else {
|
||||
$count = $searchModelCriteria->count();
|
||||
}
|
||||
} elseif ($this instanceof ArraySearchLoopInterface) {
|
||||
$searchArray = $this->buildArray();
|
||||
if (null === $searchArray) {
|
||||
$count = 0;
|
||||
} else {
|
||||
$count = count($searchArray);
|
||||
}
|
||||
}
|
||||
self::$cacheCount[$hash] = $count;
|
||||
}
|
||||
|
||||
return $count;
|
||||
return self::$cacheCount[$hash];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $pagination
|
||||
* @return LoopResult
|
||||
*/
|
||||
public function exec(&$pagination, $count = false)
|
||||
public function exec(&$pagination)
|
||||
{
|
||||
if ($this instanceof PropelSearchLoopInterface) {
|
||||
$searchModelCriteria = $this->buildModelCriteria();
|
||||
if (null === $searchModelCriteria) {
|
||||
$results = array();
|
||||
} else {
|
||||
$results = $this->search(
|
||||
$searchModelCriteria,
|
||||
$pagination
|
||||
);
|
||||
$hash = $this->args->getHash();
|
||||
if(false === isset(self::$cacheLoopResult[$hash]))
|
||||
{
|
||||
if ($this instanceof PropelSearchLoopInterface) {
|
||||
$searchModelCriteria = $this->buildModelCriteria();
|
||||
if (null === $searchModelCriteria) {
|
||||
$results = array();
|
||||
} else {
|
||||
$results = $this->search(
|
||||
$searchModelCriteria,
|
||||
$pagination
|
||||
);
|
||||
}
|
||||
} elseif ($this instanceof ArraySearchLoopInterface) {
|
||||
$searchArray = $this->buildArray();
|
||||
if (null === $searchArray) {
|
||||
$results = array();
|
||||
} else {
|
||||
$results = $this->searchArray(
|
||||
$searchArray,
|
||||
$pagination
|
||||
);
|
||||
}
|
||||
}
|
||||
} elseif ($this instanceof ArraySearchLoopInterface) {
|
||||
$searchArray = $this->buildArray();
|
||||
if (null === $searchArray) {
|
||||
$results = array();
|
||||
} else {
|
||||
$results = $this->searchArray(
|
||||
$searchArray,
|
||||
$pagination
|
||||
);
|
||||
|
||||
$loopResult = new LoopResult($results);
|
||||
|
||||
if (true === $this->countable) {
|
||||
$loopResult->setCountable();
|
||||
}
|
||||
if (true === $this->timestampable) {
|
||||
$loopResult->setTimestamped();
|
||||
}
|
||||
if (true === $this->versionable) {
|
||||
$loopResult->setVersioned();
|
||||
}
|
||||
|
||||
self::$cacheLoopResult[$hash] = $this->parseResults($loopResult);
|
||||
}
|
||||
|
||||
if ($count) {
|
||||
return $results ? count($results) : 0;
|
||||
}
|
||||
return self::$cacheLoopResult[$hash];
|
||||
|
||||
$loopResult = new LoopResult($results);
|
||||
|
||||
if (true === $this->countable) {
|
||||
$loopResult->setCountable();
|
||||
}
|
||||
if (true === $this->timestampable) {
|
||||
$loopResult->setTimestamped();
|
||||
}
|
||||
if (true === $this->versionable) {
|
||||
$loopResult->setVersioned();
|
||||
}
|
||||
|
||||
return $this->parseResults($loopResult);
|
||||
}
|
||||
|
||||
protected function checkInterface()
|
||||
|
||||
@@ -89,6 +89,7 @@ class Admin extends BaseLoop implements PropelSearchLoopInterface
|
||||
->set("FIRSTNAME",$admin->getFirstname())
|
||||
->set("LASTNAME",$admin->getLastname())
|
||||
->set("LOGIN",$admin->getLogin())
|
||||
->set("LOCALE",$admin->getLocale())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
|
||||
@@ -56,6 +56,11 @@ class Argument
|
||||
return $this->type->getFormattedValue($this->value);
|
||||
}
|
||||
|
||||
public function getRawValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function setValue($value)
|
||||
{
|
||||
if ($value === null) {
|
||||
@@ -147,4 +152,5 @@ class Argument
|
||||
$empty
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -144,4 +144,20 @@ class ArgumentCollection implements \Iterator
|
||||
{
|
||||
reset($this->arguments);
|
||||
}
|
||||
|
||||
public function getHash()
|
||||
{
|
||||
$arguments = $this->arguments;
|
||||
|
||||
if (array_key_exists('name', $arguments)) {
|
||||
unset($arguments['name']);
|
||||
}
|
||||
|
||||
$string = '';
|
||||
foreach ($arguments as $key => $argument) {
|
||||
$string .= $key.'='.$argument->getRawValue();
|
||||
}
|
||||
|
||||
return md5($string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,8 @@ class FeatureValue extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse'))
|
||||
),
|
||||
'manual'
|
||||
)
|
||||
),
|
||||
Argument::createBooleanTypeArgument('force_return', true)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,17 +26,20 @@ namespace Thelia\Core\Template\Loop;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
||||
use Thelia\Core\Template\Element\SearchLoopInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Model\Base\Customer;
|
||||
use Thelia\Model\CustomerQuery;
|
||||
use Thelia\Model\Map\CustomerTableMap;
|
||||
use Thelia\Model\Map\OrderAddressTableMap;
|
||||
use Thelia\Model\OrderAddressQuery;
|
||||
use Thelia\Model\OrderQuery;
|
||||
use Thelia\Type\TypeCollection;
|
||||
use Thelia\Type;
|
||||
use Thelia\Type\TypeCollection;
|
||||
|
||||
/**
|
||||
*
|
||||
* @package Thelia\Core\Template\Loop
|
||||
@@ -72,7 +75,14 @@ class Order extends BaseLoop implements SearchLoopInterface, PropelSearchLoopInt
|
||||
new Argument(
|
||||
'order',
|
||||
new TypeCollection(
|
||||
new Type\EnumListType(array('create-date', 'create-date-reverse'))
|
||||
new Type\EnumListType(array(
|
||||
'id', 'id-reverse',
|
||||
'reference', 'reference-reverse',
|
||||
'create-date', 'create-date-reverse',
|
||||
'company', 'company-reverse',
|
||||
'customer-name', 'customer-name-reverse',
|
||||
'status', 'status-reverse'
|
||||
))
|
||||
),
|
||||
'create-date-reverse'
|
||||
)
|
||||
@@ -165,12 +175,67 @@ class Order extends BaseLoop implements SearchLoopInterface, PropelSearchLoopInt
|
||||
|
||||
foreach ($orderers as $orderer) {
|
||||
switch ($orderer) {
|
||||
case 'id':
|
||||
$search->orderById(Criteria::ASC);
|
||||
break;
|
||||
case 'id_reverse':
|
||||
$search->orderById(Criteria::DESC);
|
||||
break;
|
||||
|
||||
case 'reference':
|
||||
$search->orderByRef(Criteria::ASC);
|
||||
break;
|
||||
case 'reference_reverse':
|
||||
$search->orderByRef(Criteria::DESC);
|
||||
break;
|
||||
|
||||
case "create-date":
|
||||
$search->orderByCreatedAt(Criteria::ASC);
|
||||
break;
|
||||
case "create-date-reverse":
|
||||
$search->orderByCreatedAt(Criteria::DESC);
|
||||
break;
|
||||
|
||||
case "status":
|
||||
$search->orderByStatusId(Criteria::ASC);
|
||||
break;
|
||||
case "status":
|
||||
$search->orderByStatusId(Criteria::DESC);
|
||||
break;
|
||||
|
||||
case 'company' :
|
||||
$search
|
||||
->joinOrderAddressRelatedByDeliveryOrderAddressId()
|
||||
->withColumn(OrderAddressTableMap::COMPANY, 'company')
|
||||
->orderBy('company', Criteria::ASC)
|
||||
;
|
||||
break;
|
||||
case 'companyreverse' :
|
||||
$search
|
||||
->joinOrderAddressRelatedByDeliveryOrderAddressId()
|
||||
->withColumn(OrderAddressTableMap::COMPANY, 'company')
|
||||
->orderBy('company', Criteria::DESC)
|
||||
;
|
||||
break;
|
||||
|
||||
case 'customer-name' :
|
||||
$search
|
||||
->joinCustomer()
|
||||
->withColumn(CustomerTableMap::FIRSTNAME, 'firstname')
|
||||
->withColumn(CustomerTableMap::LASTNAME, 'lastname')
|
||||
->orderBy('lastname', Criteria::ASC)
|
||||
->orderBy('firstname', Criteria::ASC)
|
||||
;
|
||||
break;
|
||||
case 'customer-name-reverse' :
|
||||
$search
|
||||
->joinCustomer()
|
||||
->withColumn(CustomerTableMap::FIRSTNAME, 'firstname')
|
||||
->withColumn(CustomerTableMap::LASTNAME, 'lastname')
|
||||
->orderBy('lastname', Criteria::DESC)
|
||||
->orderBy('firstname', Criteria::DESC)
|
||||
;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,10 +36,12 @@ use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Exception\TaxEngineException;
|
||||
use Thelia\Model\CategoryQuery;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
use Thelia\Model\Map\ProductPriceTableMap;
|
||||
use Thelia\Model\Map\ProductSaleElementsTableMap;
|
||||
use Thelia\Model\Map\ProductTableMap;
|
||||
use Thelia\Model\ProductCategoryQuery;
|
||||
use Thelia\Model\ProductQuery;
|
||||
use Thelia\TaxEngine\TaxEngine;
|
||||
use Thelia\Type\TypeCollection;
|
||||
|
||||
@@ -28,6 +28,7 @@ use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
||||
use Thelia\Core\Template\Smarty\Exception\SmartyPluginException;
|
||||
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
|
||||
use Thelia\Tools\DateTimeFormat;
|
||||
use Thelia\Tools\MoneyFormat;
|
||||
use Thelia\Tools\NumberFormat;
|
||||
|
||||
/**
|
||||
@@ -135,6 +136,40 @@ class Format extends AbstractSmartyPlugin
|
||||
$this->getParam($params, "thousands_sep", null)
|
||||
);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* display a amount in expected format
|
||||
*
|
||||
* available parameters :
|
||||
* number => int or float number
|
||||
* decimals => how many decimals format expected
|
||||
* dec_point => separator for the decimal point
|
||||
* thousands_sep => thousands separator
|
||||
* symbol => Currency symbol
|
||||
*
|
||||
* ex : {format_money number="1246.12" decimals="1" dec_point="," thousands_sep=" " symbol="€"} will output "1 246,1 €"
|
||||
*
|
||||
* @param $params
|
||||
* @param null $template
|
||||
* @throws \Thelia\Core\Template\Smarty\Exception\SmartyPluginException
|
||||
* @return string the expected number formatted
|
||||
*/
|
||||
public function formatMoney($params, $template = null)
|
||||
{
|
||||
$number = $this->getParam($params, "number", false);
|
||||
|
||||
if ($number === false || $number == '') {
|
||||
return "";
|
||||
}
|
||||
|
||||
return MoneyFormat::getInstance($this->request)->format(
|
||||
$number,
|
||||
$this->getParam($params, "decimals", null),
|
||||
$this->getParam($params, "dec_point", null),
|
||||
$this->getParam($params, "thousands_sep", null),
|
||||
$this->getParam($params, "symbol", null)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an array of SmartyPluginDescriptor
|
||||
@@ -143,7 +178,8 @@ class Format extends AbstractSmartyPlugin
|
||||
{
|
||||
return array(
|
||||
new SmartyPluginDescriptor("function", "format_date", $this, "formatDate"),
|
||||
new SmartyPluginDescriptor("function", "format_number", $this, "formatNumber")
|
||||
);
|
||||
new SmartyPluginDescriptor("function", "format_number", $this, "formatNumber"),
|
||||
new SmartyPluginDescriptor("function", "format_money", $this, "formatMoney")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,8 +82,9 @@ class Module extends AbstractSmartyPlugin
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($content))
|
||||
if (! empty($content)) {
|
||||
return $template->fetch(sprintf("string:%s", $content));
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -31,9 +31,6 @@ use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
|
||||
use Thelia\Core\Template\Element\Exception\ElementNotFoundException;
|
||||
use Thelia\Core\Template\Element\Exception\InvalidElementException;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Thelia\Core\Security\SecurityContext;
|
||||
|
||||
class TheliaLoop extends AbstractSmartyPlugin
|
||||
{
|
||||
protected static $pagination = null;
|
||||
|
||||
@@ -59,7 +59,7 @@ use Thelia\Log\Tlog;
|
||||
class Thelia extends Kernel
|
||||
{
|
||||
|
||||
const THELIA_VERSION = '2.0.0-beta3';
|
||||
const THELIA_VERSION = '2.0.0-beta4';
|
||||
|
||||
public function init()
|
||||
{
|
||||
@@ -87,7 +87,7 @@ class Thelia extends Kernel
|
||||
$con->setAttribute(ConnectionWrapper::PROPEL_ATTR_CACHE_PREPARES, true);
|
||||
if ($this->isDebug()) {
|
||||
$serviceContainer->setLogger('defaultLogger', \Thelia\Log\Tlog::getInstance());
|
||||
//$con->useDebug(true);
|
||||
$con->useDebug(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Model\AdminQuery;
|
||||
use Thelia\Model\LangQuery;
|
||||
use Thelia\Model\ProfileQuery;
|
||||
|
||||
class AdministratorCreationForm extends BaseForm
|
||||
@@ -100,9 +101,35 @@ class AdministratorCreationForm extends BaseForm
|
||||
),
|
||||
)
|
||||
)
|
||||
->add(
|
||||
'locale',
|
||||
"choice",
|
||||
array(
|
||||
"choices" => $this->getLocaleList(),
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank(),
|
||||
),
|
||||
"label" => Translator::getInstance()->trans('Preferred locale'),
|
||||
"label_attr" => array(
|
||||
"for" => "locale"
|
||||
),
|
||||
)
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
protected function getLocaleList() {
|
||||
$locales = array();
|
||||
|
||||
$list = LangQuery::create()->find();
|
||||
|
||||
foreach($list as $item) {
|
||||
$locales[$item->getLocale()] = $item->getLocale();
|
||||
}
|
||||
|
||||
return $locales;
|
||||
}
|
||||
|
||||
public function verifyPasswordField($value, ExecutionContextInterface $context)
|
||||
{
|
||||
$data = $context->getRoot()->getData();
|
||||
|
||||
@@ -70,7 +70,7 @@ class LangCreateForm extends BaseForm
|
||||
'constraints' => array(
|
||||
new NotBlank()
|
||||
),
|
||||
'label' => Translator::getInstance()->trans('ISO 639 Code'),
|
||||
'label' => Translator::getInstance()->trans('ISO 639-1 Code'),
|
||||
'label_attr' => array(
|
||||
'for' => 'code_lang'
|
||||
)
|
||||
|
||||
@@ -28,6 +28,7 @@ use Thelia\Core\Form\Type\TheliaType;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\TaxEngine\TaxEngine;
|
||||
use Thelia\Model\Tax;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Class TaxCreationForm
|
||||
|
||||
@@ -39,7 +39,8 @@ class Update
|
||||
protected static $version = array(
|
||||
'0' => '2.0.0-beta1',
|
||||
'1' => '2.0.0-beta2',
|
||||
'2' => '2.0.0-beta3'
|
||||
'2' => '2.0.0-beta3',
|
||||
'3' => '2.0.0-beta4'
|
||||
);
|
||||
|
||||
protected function isLatestVersion($version)
|
||||
|
||||
@@ -26,31 +26,29 @@ namespace Thelia\Log;
|
||||
abstract class AbstractTlogDestination
|
||||
{
|
||||
//Tableau de TlogDestinationConfig paramétrant la destination
|
||||
protected $_configs;
|
||||
protected $_configs = array();
|
||||
|
||||
//Tableau des lignes de logs stockés avant utilisation par ecrire()
|
||||
protected $_logs;
|
||||
protected $_logs = array();
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->_configs = array();
|
||||
$this->_logs = array();
|
||||
|
||||
// Initialiser les variables de configuration
|
||||
$this->_configs = $this->getConfigs();
|
||||
$this->_configs = $this->getConfigs();
|
||||
|
||||
// Appliquer la configuration
|
||||
$this->configure();
|
||||
}
|
||||
|
||||
//Affecte une valeur à une configuration de la destination
|
||||
public function setConfig($name, $value)
|
||||
public function setConfig($name, $value, $apply_changes = true)
|
||||
{
|
||||
foreach ($this->_configs as $config) {
|
||||
if ($config->getName() == $name) {
|
||||
$config->setValue($value);
|
||||
|
||||
// Appliquer les changements
|
||||
$this->configure();
|
||||
if ($apply_changes) $this->configure();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -37,9 +37,6 @@ class TlogDestinationFile extends AbstractTlogDestination
|
||||
const VAR_MODE = "tlog_destinationfile_mode";
|
||||
const VALEUR_MODE_DEFAULT = "A";
|
||||
|
||||
const VAR_MAX_FILE_SIZE_KB = "tlog_destinationfile_max_file_size";
|
||||
const MAX_FILE_SIZE_KB_DEFAULT = 1024; // 1 Mb
|
||||
|
||||
protected $path_defaut = false;
|
||||
protected $fh = false;
|
||||
|
||||
@@ -49,10 +46,18 @@ class TlogDestinationFile extends AbstractTlogDestination
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function getFilePath() {
|
||||
return $this->getConfig(self::VAR_PATH_FILE);
|
||||
}
|
||||
|
||||
protected function getOpenMode() {
|
||||
return strtolower($this->getConfig(self::VAR_MODE, self::VALEUR_MODE_DEFAULT)) == 'a' ? 'a' : 'w';
|
||||
}
|
||||
|
||||
public function configure()
|
||||
{
|
||||
$file_path = $this->getConfig(self::VAR_PATH_FILE);
|
||||
$mode = strtolower($this->getConfig(self::VAR_MODE, self::VALEUR_MODE_DEFAULT)) == 'a' ? 'a' : 'w';
|
||||
$file_path = $this->getFilePath();
|
||||
$mode = $this->getOpenMode();
|
||||
|
||||
if (! empty($file_path)) {
|
||||
if (! is_file($file_path)) {
|
||||
@@ -67,23 +72,6 @@ class TlogDestinationFile extends AbstractTlogDestination
|
||||
|
||||
if ($this->fh) @fclose($this->fh);
|
||||
|
||||
if (filesize($file_path) > 1024 * $this->getConfig(self::VAR_MAX_FILE_SIZE_KB, self::MAX_FILE_SIZE_KB_DEFAULT)) {
|
||||
|
||||
$idx = 1;
|
||||
|
||||
do {
|
||||
$file_path_bk = "$file_path.$idx";
|
||||
|
||||
$idx++;
|
||||
|
||||
} while (file_exists($file_path_bk));
|
||||
|
||||
@rename($file_path, $file_path_bk);
|
||||
|
||||
@touch($file_path);
|
||||
@chmod($file_path, 0666);
|
||||
}
|
||||
|
||||
$this->fh = fopen($file_path, $mode);
|
||||
}
|
||||
}
|
||||
@@ -114,13 +102,6 @@ class TlogDestinationFile extends AbstractTlogDestination
|
||||
'Enter E to empty this file for each request, or A to always append logs. Consider resetting the file from time to time',
|
||||
self::VALEUR_MODE_DEFAULT,
|
||||
TlogDestinationConfig::TYPE_TEXTFIELD
|
||||
),
|
||||
new TlogDestinationConfig(
|
||||
self::VAR_MAX_FILE_SIZE_KB,
|
||||
'Maximum log file size, in Kb',
|
||||
'When this size if exeeded, a backup copy of the file is made, and a new log file is opened. As the file size check is performed only at the beginning of a request, the file size may be bigger thant this limit. Note: 1 Mb = 1024 Kb',
|
||||
self::MAX_FILE_SIZE_KB_DEFAULT,
|
||||
TlogDestinationConfig::TYPE_TEXTFIELD
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
101
core/lib/Thelia/Log/Destination/TlogDestinationRotatingFile.php
Normal file
101
core/lib/Thelia/Log/Destination/TlogDestinationRotatingFile.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Log\Destination;
|
||||
|
||||
use Thelia\Log\AbstractTlogDestination;
|
||||
use Thelia\Log\TlogDestinationConfig;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
class TlogDestinationRotatingFile extends TlogDestinationFile
|
||||
{
|
||||
// Nom des variables de configuration
|
||||
// ----------------------------------
|
||||
|
||||
const VAR_MAX_FILE_SIZE_KB = "tlog_destinationfile_max_file_size";
|
||||
const MAX_FILE_SIZE_KB_DEFAULT = 1024; // 1 Mb
|
||||
|
||||
public function __construct($maxFileSize = self::MAX_FILE_SIZE_KB_DEFAULT)
|
||||
{
|
||||
$this->path_defaut = THELIA_ROOT . "log" . DS . self::TLOG_DEFAULT_NAME;
|
||||
|
||||
$this->setConfig(self::VAR_MAX_FILE_SIZE_KB, $maxFileSize, false);
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function configure()
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$file_path = $this->getFilePath();
|
||||
$mode = $this->getOpenMode();
|
||||
|
||||
if ($this->fh) @fclose($this->fh);
|
||||
|
||||
if (filesize($file_path) > 1024 * $this->getConfig(self::VAR_MAX_FILE_SIZE_KB, self::MAX_FILE_SIZE_KB_DEFAULT)) {
|
||||
|
||||
$idx = 1;
|
||||
|
||||
do {
|
||||
$file_path_bk = "$file_path.$idx";
|
||||
|
||||
$idx++;
|
||||
|
||||
} while (file_exists($file_path_bk));
|
||||
|
||||
@rename($file_path, $file_path_bk);
|
||||
|
||||
@touch($file_path);
|
||||
@chmod($file_path, 0666);
|
||||
}
|
||||
|
||||
$this->fh = fopen($file_path, $mode);
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return Translator::getInstance()->trans('Rotated Text File');
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return Translator::getInstance()->trans('Store logs into text file, up to a certian size, then a new file is created');
|
||||
}
|
||||
|
||||
public function getConfigs()
|
||||
{
|
||||
$arr = parent::getConfigs();
|
||||
|
||||
$arr[] =
|
||||
new TlogDestinationConfig(
|
||||
self::VAR_MAX_FILE_SIZE_KB,
|
||||
'Maximum log file size, in Kb',
|
||||
'When this size if exeeded, a backup copy of the file is made, and a new log file is opened. As the file size check is performed only at the beginning of a request, the file size may be bigger thant this limit. Note: 1 Mb = 1024 Kb',
|
||||
self::MAX_FILE_SIZE_KB_DEFAULT,
|
||||
TlogDestinationConfig::TYPE_TEXTFIELD
|
||||
);
|
||||
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ class Tlog Implements LoggerInterface
|
||||
|
||||
// default values
|
||||
const DEFAULT_LEVEL = self::DEBUG;
|
||||
const DEFAUT_DESTINATIONS = "Thelia\Log\Destination\TlogDestinationFile";
|
||||
const DEFAUT_DESTINATIONS = "Thelia\Log\Destination\TlogDestinationRotatingFile";
|
||||
const DEFAUT_PREFIXE = "#INDEX: #LEVEL [#FILE:#FUNCTION()] {#LINE} #DATE #HOUR: ";
|
||||
const DEFAUT_FILES = "*";
|
||||
const DEFAUT_IP = "";
|
||||
|
||||
@@ -31,7 +31,7 @@ class Admin extends BaseAdmin implements UserInterface
|
||||
{
|
||||
$profileId = $this->getProfileId();
|
||||
|
||||
if( null === $profileId ) {
|
||||
if( null === $profileId || 0 === $profileId ) {
|
||||
return AdminResources::SUPERADMINISTRATOR;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,12 @@ abstract class Admin implements ActiveRecordInterface
|
||||
*/
|
||||
protected $password;
|
||||
|
||||
/**
|
||||
* The value for the locale field.
|
||||
* @var string
|
||||
*/
|
||||
protected $locale;
|
||||
|
||||
/**
|
||||
* The value for the algo field.
|
||||
* @var string
|
||||
@@ -465,6 +471,17 @@ abstract class Admin implements ActiveRecordInterface
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [locale] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLocale()
|
||||
{
|
||||
|
||||
return $this->locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [algo] column value.
|
||||
*
|
||||
@@ -679,6 +696,27 @@ abstract class Admin implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setPassword()
|
||||
|
||||
/**
|
||||
* Set the value of [locale] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\Admin The current object (for fluent API support)
|
||||
*/
|
||||
public function setLocale($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->locale !== $v) {
|
||||
$this->locale = $v;
|
||||
$this->modifiedColumns[AdminTableMap::LOCALE] = true;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setLocale()
|
||||
|
||||
/**
|
||||
* Set the value of [algo] column.
|
||||
*
|
||||
@@ -860,25 +898,28 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : AdminTableMap::translateFieldName('Password', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->password = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : AdminTableMap::translateFieldName('Algo', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : AdminTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->locale = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : AdminTableMap::translateFieldName('Algo', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->algo = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : AdminTableMap::translateFieldName('Salt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : AdminTableMap::translateFieldName('Salt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->salt = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : AdminTableMap::translateFieldName('RememberMeToken', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : AdminTableMap::translateFieldName('RememberMeToken', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->remember_me_token = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : AdminTableMap::translateFieldName('RememberMeSerial', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : AdminTableMap::translateFieldName('RememberMeSerial', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->remember_me_serial = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : AdminTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : AdminTableMap::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 ? 11 + $startcol : AdminTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : AdminTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -891,7 +932,7 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 12; // 12 = AdminTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 13; // 13 = AdminTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\Admin object", 0, $e);
|
||||
@@ -1145,6 +1186,9 @@ abstract class Admin implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(AdminTableMap::PASSWORD)) {
|
||||
$modifiedColumns[':p' . $index++] = '`PASSWORD`';
|
||||
}
|
||||
if ($this->isColumnModified(AdminTableMap::LOCALE)) {
|
||||
$modifiedColumns[':p' . $index++] = '`LOCALE`';
|
||||
}
|
||||
if ($this->isColumnModified(AdminTableMap::ALGO)) {
|
||||
$modifiedColumns[':p' . $index++] = '`ALGO`';
|
||||
}
|
||||
@@ -1192,6 +1236,9 @@ abstract class Admin implements ActiveRecordInterface
|
||||
case '`PASSWORD`':
|
||||
$stmt->bindValue($identifier, $this->password, PDO::PARAM_STR);
|
||||
break;
|
||||
case '`LOCALE`':
|
||||
$stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
|
||||
break;
|
||||
case '`ALGO`':
|
||||
$stmt->bindValue($identifier, $this->algo, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1291,21 +1338,24 @@ abstract class Admin implements ActiveRecordInterface
|
||||
return $this->getPassword();
|
||||
break;
|
||||
case 6:
|
||||
return $this->getAlgo();
|
||||
return $this->getLocale();
|
||||
break;
|
||||
case 7:
|
||||
return $this->getSalt();
|
||||
return $this->getAlgo();
|
||||
break;
|
||||
case 8:
|
||||
return $this->getRememberMeToken();
|
||||
return $this->getSalt();
|
||||
break;
|
||||
case 9:
|
||||
return $this->getRememberMeSerial();
|
||||
return $this->getRememberMeToken();
|
||||
break;
|
||||
case 10:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getRememberMeSerial();
|
||||
break;
|
||||
case 11:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 12:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1343,12 +1393,13 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$keys[3] => $this->getLastname(),
|
||||
$keys[4] => $this->getLogin(),
|
||||
$keys[5] => $this->getPassword(),
|
||||
$keys[6] => $this->getAlgo(),
|
||||
$keys[7] => $this->getSalt(),
|
||||
$keys[8] => $this->getRememberMeToken(),
|
||||
$keys[9] => $this->getRememberMeSerial(),
|
||||
$keys[10] => $this->getCreatedAt(),
|
||||
$keys[11] => $this->getUpdatedAt(),
|
||||
$keys[6] => $this->getLocale(),
|
||||
$keys[7] => $this->getAlgo(),
|
||||
$keys[8] => $this->getSalt(),
|
||||
$keys[9] => $this->getRememberMeToken(),
|
||||
$keys[10] => $this->getRememberMeSerial(),
|
||||
$keys[11] => $this->getCreatedAt(),
|
||||
$keys[12] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach ($virtualColumns as $key => $virtualColumn) {
|
||||
@@ -1412,21 +1463,24 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$this->setPassword($value);
|
||||
break;
|
||||
case 6:
|
||||
$this->setAlgo($value);
|
||||
$this->setLocale($value);
|
||||
break;
|
||||
case 7:
|
||||
$this->setSalt($value);
|
||||
$this->setAlgo($value);
|
||||
break;
|
||||
case 8:
|
||||
$this->setRememberMeToken($value);
|
||||
$this->setSalt($value);
|
||||
break;
|
||||
case 9:
|
||||
$this->setRememberMeSerial($value);
|
||||
$this->setRememberMeToken($value);
|
||||
break;
|
||||
case 10:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setRememberMeSerial($value);
|
||||
break;
|
||||
case 11:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 12:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1459,12 +1513,13 @@ abstract class Admin implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[3], $arr)) $this->setLastname($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setLogin($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setPassword($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setAlgo($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setSalt($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setRememberMeToken($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setRememberMeSerial($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setCreatedAt($arr[$keys[10]]);
|
||||
if (array_key_exists($keys[11], $arr)) $this->setUpdatedAt($arr[$keys[11]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setLocale($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setAlgo($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setSalt($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setRememberMeToken($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setRememberMeSerial($arr[$keys[10]]);
|
||||
if (array_key_exists($keys[11], $arr)) $this->setCreatedAt($arr[$keys[11]]);
|
||||
if (array_key_exists($keys[12], $arr)) $this->setUpdatedAt($arr[$keys[12]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1482,6 +1537,7 @@ abstract class Admin implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(AdminTableMap::LASTNAME)) $criteria->add(AdminTableMap::LASTNAME, $this->lastname);
|
||||
if ($this->isColumnModified(AdminTableMap::LOGIN)) $criteria->add(AdminTableMap::LOGIN, $this->login);
|
||||
if ($this->isColumnModified(AdminTableMap::PASSWORD)) $criteria->add(AdminTableMap::PASSWORD, $this->password);
|
||||
if ($this->isColumnModified(AdminTableMap::LOCALE)) $criteria->add(AdminTableMap::LOCALE, $this->locale);
|
||||
if ($this->isColumnModified(AdminTableMap::ALGO)) $criteria->add(AdminTableMap::ALGO, $this->algo);
|
||||
if ($this->isColumnModified(AdminTableMap::SALT)) $criteria->add(AdminTableMap::SALT, $this->salt);
|
||||
if ($this->isColumnModified(AdminTableMap::REMEMBER_ME_TOKEN)) $criteria->add(AdminTableMap::REMEMBER_ME_TOKEN, $this->remember_me_token);
|
||||
@@ -1556,6 +1612,7 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$copyObj->setLastname($this->getLastname());
|
||||
$copyObj->setLogin($this->getLogin());
|
||||
$copyObj->setPassword($this->getPassword());
|
||||
$copyObj->setLocale($this->getLocale());
|
||||
$copyObj->setAlgo($this->getAlgo());
|
||||
$copyObj->setSalt($this->getSalt());
|
||||
$copyObj->setRememberMeToken($this->getRememberMeToken());
|
||||
@@ -1652,6 +1709,7 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$this->lastname = null;
|
||||
$this->login = null;
|
||||
$this->password = null;
|
||||
$this->locale = null;
|
||||
$this->algo = null;
|
||||
$this->salt = null;
|
||||
$this->remember_me_token = null;
|
||||
|
||||
@@ -27,6 +27,7 @@ use Thelia\Model\Map\AdminTableMap;
|
||||
* @method ChildAdminQuery orderByLastname($order = Criteria::ASC) Order by the lastname column
|
||||
* @method ChildAdminQuery orderByLogin($order = Criteria::ASC) Order by the login column
|
||||
* @method ChildAdminQuery orderByPassword($order = Criteria::ASC) Order by the password column
|
||||
* @method ChildAdminQuery orderByLocale($order = Criteria::ASC) Order by the locale column
|
||||
* @method ChildAdminQuery orderByAlgo($order = Criteria::ASC) Order by the algo column
|
||||
* @method ChildAdminQuery orderBySalt($order = Criteria::ASC) Order by the salt column
|
||||
* @method ChildAdminQuery orderByRememberMeToken($order = Criteria::ASC) Order by the remember_me_token column
|
||||
@@ -40,6 +41,7 @@ use Thelia\Model\Map\AdminTableMap;
|
||||
* @method ChildAdminQuery groupByLastname() Group by the lastname column
|
||||
* @method ChildAdminQuery groupByLogin() Group by the login column
|
||||
* @method ChildAdminQuery groupByPassword() Group by the password column
|
||||
* @method ChildAdminQuery groupByLocale() Group by the locale column
|
||||
* @method ChildAdminQuery groupByAlgo() Group by the algo column
|
||||
* @method ChildAdminQuery groupBySalt() Group by the salt column
|
||||
* @method ChildAdminQuery groupByRememberMeToken() Group by the remember_me_token column
|
||||
@@ -64,6 +66,7 @@ use Thelia\Model\Map\AdminTableMap;
|
||||
* @method ChildAdmin findOneByLastname(string $lastname) Return the first ChildAdmin filtered by the lastname column
|
||||
* @method ChildAdmin findOneByLogin(string $login) Return the first ChildAdmin filtered by the login column
|
||||
* @method ChildAdmin findOneByPassword(string $password) Return the first ChildAdmin filtered by the password column
|
||||
* @method ChildAdmin findOneByLocale(string $locale) Return the first ChildAdmin filtered by the locale column
|
||||
* @method ChildAdmin findOneByAlgo(string $algo) Return the first ChildAdmin filtered by the algo column
|
||||
* @method ChildAdmin findOneBySalt(string $salt) Return the first ChildAdmin filtered by the salt column
|
||||
* @method ChildAdmin findOneByRememberMeToken(string $remember_me_token) Return the first ChildAdmin filtered by the remember_me_token column
|
||||
@@ -77,6 +80,7 @@ use Thelia\Model\Map\AdminTableMap;
|
||||
* @method array findByLastname(string $lastname) Return ChildAdmin objects filtered by the lastname column
|
||||
* @method array findByLogin(string $login) Return ChildAdmin objects filtered by the login column
|
||||
* @method array findByPassword(string $password) Return ChildAdmin objects filtered by the password column
|
||||
* @method array findByLocale(string $locale) Return ChildAdmin objects filtered by the locale column
|
||||
* @method array findByAlgo(string $algo) Return ChildAdmin objects filtered by the algo column
|
||||
* @method array findBySalt(string $salt) Return ChildAdmin objects filtered by the salt column
|
||||
* @method array findByRememberMeToken(string $remember_me_token) Return ChildAdmin objects filtered by the remember_me_token column
|
||||
@@ -171,7 +175,7 @@ abstract class AdminQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT `ID`, `PROFILE_ID`, `FIRSTNAME`, `LASTNAME`, `LOGIN`, `PASSWORD`, `ALGO`, `SALT`, `REMEMBER_ME_TOKEN`, `REMEMBER_ME_SERIAL`, `CREATED_AT`, `UPDATED_AT` FROM `admin` WHERE `ID` = :p0';
|
||||
$sql = 'SELECT `ID`, `PROFILE_ID`, `FIRSTNAME`, `LASTNAME`, `LOGIN`, `PASSWORD`, `LOCALE`, `ALGO`, `SALT`, `REMEMBER_ME_TOKEN`, `REMEMBER_ME_SERIAL`, `CREATED_AT`, `UPDATED_AT` FROM `admin` WHERE `ID` = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -460,6 +464,35 @@ abstract class AdminQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(AdminTableMap::PASSWORD, $password, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the locale column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
|
||||
* $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $locale 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 ChildAdminQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByLocale($locale = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($locale)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $locale)) {
|
||||
$locale = str_replace('*', '%', $locale);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AdminTableMap::LOCALE, $locale, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the algo column
|
||||
*
|
||||
|
||||
@@ -92,6 +92,9 @@ class ConfigQuery extends BaseConfigQuery {
|
||||
return self::read('check-available-stock', 1) != 0;
|
||||
}
|
||||
|
||||
public static function getUnknownFlagPath() {
|
||||
return self::read('unknown-flag-path', '/assets/img/flags/unknown.png');
|
||||
}
|
||||
/* smtp config */
|
||||
public static function isSmtpEnable()
|
||||
{
|
||||
|
||||
@@ -5,8 +5,11 @@ namespace Thelia\Model;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Propel;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Thelia\Core\Event\Lang\LangEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Template\TemplateHelper;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Model\Base\Lang as BaseLang;
|
||||
use Thelia\Model\LangQuery;
|
||||
use Thelia\Model\Map\LangTableMap;
|
||||
@@ -53,6 +56,33 @@ class Lang extends BaseLang {
|
||||
|
||||
}
|
||||
|
||||
protected function fixMissingFlag() {
|
||||
// Be sure that a lang have a flag, otherwise copy the
|
||||
// "unknown" flag
|
||||
$adminTemplate = TemplateHelper::getInstance()->getActiveAdminTemplate();
|
||||
$unknownFlag = ConfigQuery::getUnknownFlagPath();
|
||||
|
||||
$unknownFlagPath = $adminTemplate->getAbsolutePath().DS.$unknownFlag;
|
||||
|
||||
if (! file_exists($unknownFlagPath)) {
|
||||
throw new \RuntimeException(
|
||||
Translator::getInstance()->trans(
|
||||
"The image which replaces an undefined country flag (%file) was not found. Please check unknown-flag-path configuration variable, and check that the image exists.",
|
||||
array("%file" => $unknownFlag)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Check if the country flag exists
|
||||
$countryFlag = rtrim(dirname($unknownFlagPath), DS).DS.$this->getCode().'.png';
|
||||
|
||||
if (! file_exists($countryFlag)) {
|
||||
$fs = new Filesystem();
|
||||
|
||||
$fs->copy($unknownFlagPath, $countryFlag);
|
||||
}
|
||||
}
|
||||
|
||||
public function preInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_CREATELANG, new LangEvent($this));
|
||||
@@ -63,6 +93,8 @@ class Lang extends BaseLang {
|
||||
public function postInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_CREATELANG, new LangEvent($this));
|
||||
|
||||
$this->fixMissingFlag();
|
||||
}
|
||||
|
||||
public function preUpdate(ConnectionInterface $con = null)
|
||||
@@ -75,6 +107,8 @@ class Lang extends BaseLang {
|
||||
public function postUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_UPDATELANG, new LangEvent($this));
|
||||
|
||||
$this->fixMissingFlag();
|
||||
}
|
||||
|
||||
public function preDelete(ConnectionInterface $con = null)
|
||||
|
||||
@@ -58,7 +58,7 @@ class AdminTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 12;
|
||||
const NUM_COLUMNS = 13;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -68,7 +68,7 @@ class AdminTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 12;
|
||||
const NUM_HYDRATE_COLUMNS = 13;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -100,6 +100,11 @@ class AdminTableMap extends TableMap
|
||||
*/
|
||||
const PASSWORD = 'admin.PASSWORD';
|
||||
|
||||
/**
|
||||
* the column name for the LOCALE field
|
||||
*/
|
||||
const LOCALE = 'admin.LOCALE';
|
||||
|
||||
/**
|
||||
* the column name for the ALGO field
|
||||
*/
|
||||
@@ -142,12 +147,12 @@ class AdminTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'ProfileId', 'Firstname', 'Lastname', 'Login', 'Password', 'Algo', 'Salt', 'RememberMeToken', 'RememberMeSerial', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'profileId', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'rememberMeToken', 'rememberMeSerial', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(AdminTableMap::ID, AdminTableMap::PROFILE_ID, AdminTableMap::FIRSTNAME, AdminTableMap::LASTNAME, AdminTableMap::LOGIN, AdminTableMap::PASSWORD, AdminTableMap::ALGO, AdminTableMap::SALT, AdminTableMap::REMEMBER_ME_TOKEN, AdminTableMap::REMEMBER_ME_SERIAL, AdminTableMap::CREATED_AT, AdminTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'PROFILE_ID', 'FIRSTNAME', 'LASTNAME', 'LOGIN', 'PASSWORD', 'ALGO', 'SALT', 'REMEMBER_ME_TOKEN', 'REMEMBER_ME_SERIAL', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'profile_id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'remember_me_token', 'remember_me_serial', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
|
||||
self::TYPE_PHPNAME => array('Id', 'ProfileId', 'Firstname', 'Lastname', 'Login', 'Password', 'Locale', 'Algo', 'Salt', 'RememberMeToken', 'RememberMeSerial', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'profileId', 'firstname', 'lastname', 'login', 'password', 'locale', 'algo', 'salt', 'rememberMeToken', 'rememberMeSerial', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(AdminTableMap::ID, AdminTableMap::PROFILE_ID, AdminTableMap::FIRSTNAME, AdminTableMap::LASTNAME, AdminTableMap::LOGIN, AdminTableMap::PASSWORD, AdminTableMap::LOCALE, AdminTableMap::ALGO, AdminTableMap::SALT, AdminTableMap::REMEMBER_ME_TOKEN, AdminTableMap::REMEMBER_ME_SERIAL, AdminTableMap::CREATED_AT, AdminTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'PROFILE_ID', 'FIRSTNAME', 'LASTNAME', 'LOGIN', 'PASSWORD', 'LOCALE', 'ALGO', 'SALT', 'REMEMBER_ME_TOKEN', 'REMEMBER_ME_SERIAL', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'profile_id', 'firstname', 'lastname', 'login', 'password', 'locale', 'algo', 'salt', 'remember_me_token', 'remember_me_serial', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -157,12 +162,12 @@ class AdminTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'ProfileId' => 1, 'Firstname' => 2, 'Lastname' => 3, 'Login' => 4, 'Password' => 5, 'Algo' => 6, 'Salt' => 7, 'RememberMeToken' => 8, 'RememberMeSerial' => 9, 'CreatedAt' => 10, 'UpdatedAt' => 11, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'profileId' => 1, 'firstname' => 2, 'lastname' => 3, 'login' => 4, 'password' => 5, 'algo' => 6, 'salt' => 7, 'rememberMeToken' => 8, 'rememberMeSerial' => 9, 'createdAt' => 10, 'updatedAt' => 11, ),
|
||||
self::TYPE_COLNAME => array(AdminTableMap::ID => 0, AdminTableMap::PROFILE_ID => 1, AdminTableMap::FIRSTNAME => 2, AdminTableMap::LASTNAME => 3, AdminTableMap::LOGIN => 4, AdminTableMap::PASSWORD => 5, AdminTableMap::ALGO => 6, AdminTableMap::SALT => 7, AdminTableMap::REMEMBER_ME_TOKEN => 8, AdminTableMap::REMEMBER_ME_SERIAL => 9, AdminTableMap::CREATED_AT => 10, AdminTableMap::UPDATED_AT => 11, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PROFILE_ID' => 1, 'FIRSTNAME' => 2, 'LASTNAME' => 3, 'LOGIN' => 4, 'PASSWORD' => 5, 'ALGO' => 6, 'SALT' => 7, 'REMEMBER_ME_TOKEN' => 8, 'REMEMBER_ME_SERIAL' => 9, 'CREATED_AT' => 10, 'UPDATED_AT' => 11, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'profile_id' => 1, 'firstname' => 2, 'lastname' => 3, 'login' => 4, 'password' => 5, 'algo' => 6, 'salt' => 7, 'remember_me_token' => 8, 'remember_me_serial' => 9, 'created_at' => 10, 'updated_at' => 11, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'ProfileId' => 1, 'Firstname' => 2, 'Lastname' => 3, 'Login' => 4, 'Password' => 5, 'Locale' => 6, 'Algo' => 7, 'Salt' => 8, 'RememberMeToken' => 9, 'RememberMeSerial' => 10, 'CreatedAt' => 11, 'UpdatedAt' => 12, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'profileId' => 1, 'firstname' => 2, 'lastname' => 3, 'login' => 4, 'password' => 5, 'locale' => 6, 'algo' => 7, 'salt' => 8, 'rememberMeToken' => 9, 'rememberMeSerial' => 10, 'createdAt' => 11, 'updatedAt' => 12, ),
|
||||
self::TYPE_COLNAME => array(AdminTableMap::ID => 0, AdminTableMap::PROFILE_ID => 1, AdminTableMap::FIRSTNAME => 2, AdminTableMap::LASTNAME => 3, AdminTableMap::LOGIN => 4, AdminTableMap::PASSWORD => 5, AdminTableMap::LOCALE => 6, AdminTableMap::ALGO => 7, AdminTableMap::SALT => 8, AdminTableMap::REMEMBER_ME_TOKEN => 9, AdminTableMap::REMEMBER_ME_SERIAL => 10, AdminTableMap::CREATED_AT => 11, AdminTableMap::UPDATED_AT => 12, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PROFILE_ID' => 1, 'FIRSTNAME' => 2, 'LASTNAME' => 3, 'LOGIN' => 4, 'PASSWORD' => 5, 'LOCALE' => 6, 'ALGO' => 7, 'SALT' => 8, 'REMEMBER_ME_TOKEN' => 9, 'REMEMBER_ME_SERIAL' => 10, 'CREATED_AT' => 11, 'UPDATED_AT' => 12, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'profile_id' => 1, 'firstname' => 2, 'lastname' => 3, 'login' => 4, 'password' => 5, 'locale' => 6, 'algo' => 7, 'salt' => 8, 'remember_me_token' => 9, 'remember_me_serial' => 10, 'created_at' => 11, 'updated_at' => 12, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -187,6 +192,7 @@ class AdminTableMap extends TableMap
|
||||
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', true, 100, null);
|
||||
$this->addColumn('LOGIN', 'Login', 'VARCHAR', true, 100, null);
|
||||
$this->addColumn('PASSWORD', 'Password', 'VARCHAR', true, 128, null);
|
||||
$this->addColumn('LOCALE', 'Locale', 'VARCHAR', true, 45, null);
|
||||
$this->addColumn('ALGO', 'Algo', 'VARCHAR', false, 128, null);
|
||||
$this->addColumn('SALT', 'Salt', 'VARCHAR', false, 128, null);
|
||||
$this->addColumn('REMEMBER_ME_TOKEN', 'RememberMeToken', 'VARCHAR', false, 255, null);
|
||||
@@ -360,6 +366,7 @@ class AdminTableMap extends TableMap
|
||||
$criteria->addSelectColumn(AdminTableMap::LASTNAME);
|
||||
$criteria->addSelectColumn(AdminTableMap::LOGIN);
|
||||
$criteria->addSelectColumn(AdminTableMap::PASSWORD);
|
||||
$criteria->addSelectColumn(AdminTableMap::LOCALE);
|
||||
$criteria->addSelectColumn(AdminTableMap::ALGO);
|
||||
$criteria->addSelectColumn(AdminTableMap::SALT);
|
||||
$criteria->addSelectColumn(AdminTableMap::REMEMBER_ME_TOKEN);
|
||||
@@ -373,6 +380,7 @@ class AdminTableMap extends TableMap
|
||||
$criteria->addSelectColumn($alias . '.LASTNAME');
|
||||
$criteria->addSelectColumn($alias . '.LOGIN');
|
||||
$criteria->addSelectColumn($alias . '.PASSWORD');
|
||||
$criteria->addSelectColumn($alias . '.LOCALE');
|
||||
$criteria->addSelectColumn($alias . '.ALGO');
|
||||
$criteria->addSelectColumn($alias . '.SALT');
|
||||
$criteria->addSelectColumn($alias . '.REMEMBER_ME_TOKEN');
|
||||
|
||||
@@ -208,7 +208,7 @@ class CouponTableMap extends TableMap
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null);
|
||||
$this->addColumn('TYPE', 'Type', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('SERIALIZED_EFFECTS', 'SerializedEffects', 'LONGVARCHAR', true, null, null);
|
||||
$this->addColumn('SERIALIZED_EFFECTS', 'SerializedEffects', 'CLOB', true, null, null);
|
||||
$this->addColumn('IS_ENABLED', 'IsEnabled', 'BOOLEAN', true, 1, null);
|
||||
$this->addColumn('EXPIRATION_DATE', 'ExpirationDate', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('MAX_USAGE', 'MaxUsage', 'INTEGER', true, null, null);
|
||||
|
||||
@@ -199,7 +199,7 @@ class CouponVersionTableMap extends TableMap
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'coupon', 'ID', true, null, null);
|
||||
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null);
|
||||
$this->addColumn('TYPE', 'Type', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('SERIALIZED_EFFECTS', 'SerializedEffects', 'LONGVARCHAR', true, null, null);
|
||||
$this->addColumn('SERIALIZED_EFFECTS', 'SerializedEffects', 'CLOB', true, null, null);
|
||||
$this->addColumn('IS_ENABLED', 'IsEnabled', 'BOOLEAN', true, 1, null);
|
||||
$this->addColumn('EXPIRATION_DATE', 'ExpirationDate', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('MAX_USAGE', 'MaxUsage', 'INTEGER', true, null, null);
|
||||
|
||||
@@ -55,6 +55,8 @@ class Product extends BaseProduct
|
||||
|
||||
/**
|
||||
* Return the default PSE for this product.
|
||||
*
|
||||
* @return ProductSaleElements
|
||||
*/
|
||||
public function getDefaultSaleElements() {
|
||||
return ProductSaleElementsQuery::create()->filterByProductId($this->id)->filterByIsDefault(true)->find();
|
||||
|
||||
@@ -36,7 +36,7 @@ use Thelia\Tests\Action\BaseAction;
|
||||
* @package Thelia\Tests\Action
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class AddressTest extends BaseAction
|
||||
class AddressTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function testCreatedAddress()
|
||||
@@ -59,8 +59,9 @@ class AddressTest extends BaseAction
|
||||
""
|
||||
);
|
||||
$AddressCreateOrUpdateEvent->setCustomer($customer);
|
||||
$AddressCreateOrUpdateEvent->setDispatcher($this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface"));
|
||||
|
||||
$actionAddress = new Address($this->getContainer());
|
||||
$actionAddress = new Address();
|
||||
$actionAddress->create($AddressCreateOrUpdateEvent);
|
||||
|
||||
$createdAddress = $AddressCreateOrUpdateEvent->getAddress();
|
||||
@@ -106,8 +107,9 @@ class AddressTest extends BaseAction
|
||||
""
|
||||
);
|
||||
$addressEvent->setAddress($address);
|
||||
$addressEvent->setDispatcher($this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface"));
|
||||
|
||||
$actionAddress = new Address($this->getContainer());
|
||||
$actionAddress = new Address();
|
||||
$actionAddress->update($addressEvent);
|
||||
|
||||
$updatedAddress = $addressEvent->getAddress();
|
||||
|
||||
143
core/lib/Thelia/Tests/Action/AdministratorTest.php
Normal file
143
core/lib/Thelia/Tests/Action/AdministratorTest.php
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Tests\Action;
|
||||
|
||||
use Thelia\Action\Administrator;
|
||||
use Thelia\Core\Event\Administrator\AdministratorEvent;
|
||||
use Thelia\Core\Event\Administrator\AdministratorUpdatePasswordEvent;
|
||||
use Thelia\Model\AdminQuery;
|
||||
use Thelia\Model\LangQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Class AdministratorTest
|
||||
* @package Thelia\Tests\Action
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class AdministratorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function testCreate()
|
||||
{
|
||||
$login = 'thelia'.uniqid();
|
||||
$locale = LangQuery::create()->findOne()->getLocale();
|
||||
$adminEvent = new AdministratorEvent();
|
||||
$adminEvent
|
||||
->setFirstname('thelia')
|
||||
->setLastname('thelia')
|
||||
->setLogin($login)
|
||||
->setPassword('azerty')
|
||||
->setLocale($locale)
|
||||
->setDispatcher($this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface"))
|
||||
;
|
||||
|
||||
$admin = new Administrator();
|
||||
$admin->create($adminEvent);
|
||||
|
||||
$createdAdmin = $adminEvent->getAdministrator();
|
||||
|
||||
$this->assertInstanceOf("Thelia\Model\Admin", $createdAdmin);
|
||||
$this->assertFalse($createdAdmin->isNew());
|
||||
|
||||
$this->assertEquals($adminEvent->getFirstname(), $createdAdmin->getFirstname());
|
||||
$this->assertEquals($adminEvent->getLastname(), $createdAdmin->getLastname());
|
||||
$this->assertEquals($adminEvent->getLogin(), $createdAdmin->getLogin());
|
||||
$this->assertEquals($adminEvent->getLocale(), $createdAdmin->getLocale());
|
||||
$this->assertEquals($adminEvent->getProfile(), $createdAdmin->getProfileId());
|
||||
$this->assertTrue(password_verify($adminEvent->getPassword(), $createdAdmin->getPassword()));
|
||||
}
|
||||
|
||||
public function testUpdate()
|
||||
{
|
||||
$admin = AdminQuery::create()->findOne();
|
||||
|
||||
$login = 'thelia'.uniqid();
|
||||
$locale = LangQuery::create()->findOne()->getLocale();
|
||||
$adminEvent = new AdministratorEvent();
|
||||
$adminEvent
|
||||
->setId($admin->getId())
|
||||
->setFirstname('thelia_update')
|
||||
->setLastname('thelia_update')
|
||||
->setLogin($login)
|
||||
->setPassword('azertyuiop')
|
||||
->setLocale($locale)
|
||||
->setDispatcher($this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface"))
|
||||
;
|
||||
|
||||
$actionAdmin = new Administrator();
|
||||
$actionAdmin->update($adminEvent);
|
||||
|
||||
$updatedAdmin = $adminEvent->getAdministrator();
|
||||
|
||||
$this->assertInstanceOf("Thelia\Model\Admin", $updatedAdmin);
|
||||
$this->assertFalse($updatedAdmin->isNew());
|
||||
|
||||
$this->assertEquals($adminEvent->getFirstname(), $updatedAdmin->getFirstname());
|
||||
$this->assertEquals($adminEvent->getLastname(), $updatedAdmin->getLastname());
|
||||
$this->assertEquals($adminEvent->getLogin(), $updatedAdmin->getLogin());
|
||||
$this->assertEquals($adminEvent->getLocale(), $updatedAdmin->getLocale());
|
||||
$this->assertEquals($adminEvent->getProfile(), $updatedAdmin->getProfileId());
|
||||
$this->assertTrue(password_verify($adminEvent->getPassword(), $updatedAdmin->getPassword()));
|
||||
}
|
||||
|
||||
public function testDelete()
|
||||
{
|
||||
$admin = AdminQuery::create()->findOne();
|
||||
|
||||
$adminEvent = new AdministratorEvent();
|
||||
|
||||
$adminEvent
|
||||
->setId($admin->getId())
|
||||
->setDispatcher($this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface"))
|
||||
;
|
||||
|
||||
$actionAdmin = new Administrator();
|
||||
$actionAdmin->delete($adminEvent);
|
||||
|
||||
$deletedAdmin = $adminEvent->getAdministrator();
|
||||
|
||||
$this->assertInstanceOf("Thelia\Model\Admin", $deletedAdmin);
|
||||
$this->assertTrue($deletedAdmin->isDeleted());
|
||||
}
|
||||
|
||||
public function testUpdatePassword()
|
||||
{
|
||||
$admin = AdminQuery::create()->findOne();
|
||||
|
||||
$adminEvent = new AdministratorUpdatePasswordEvent($admin);
|
||||
$adminEvent
|
||||
->setPassword('toto')
|
||||
->setDispatcher($this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface"));
|
||||
|
||||
$actionAdmin = new Administrator();
|
||||
$actionAdmin->updatePassword($adminEvent);
|
||||
|
||||
$updatedAdmin = $adminEvent->getAdmin();
|
||||
|
||||
$this->assertInstanceOf("Thelia\Model\Admin", $updatedAdmin);
|
||||
$this->assertTrue(password_verify($adminEvent->getPassword(), $updatedAdmin->getPassword()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -24,6 +24,9 @@
|
||||
namespace Thelia\Tests\Action\ImageTest;
|
||||
use Thelia\Action\Customer;
|
||||
use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Core\Security\SecurityContext;
|
||||
use Thelia\Model\CustomerQuery;
|
||||
|
||||
/**
|
||||
* Class CustomerTest
|
||||
@@ -32,15 +35,12 @@ use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
|
||||
*/
|
||||
class CustomerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function getContainer()
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
$container = new \Symfony\Component\DependencyInjection\ContainerBuilder();
|
||||
|
||||
$dispatcher = $this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface");
|
||||
|
||||
$container->set("event_dispatcher", $dispatcher);
|
||||
|
||||
return $container;
|
||||
CustomerQuery::create()
|
||||
->filterByRef('testRef')
|
||||
->delete();
|
||||
}
|
||||
|
||||
public function testCreatedCustomer()
|
||||
@@ -67,7 +67,9 @@ class CustomerTest extends \PHPUnit_Framework_TestCase
|
||||
null
|
||||
);
|
||||
|
||||
$customerAction = new Customer($this->getContainer());
|
||||
$customerCreateEvent->setDispatcher($this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface"));
|
||||
|
||||
$customerAction = new Customer(new SecurityContext(new Request()));
|
||||
|
||||
$customerAction->create($customerCreateEvent);
|
||||
|
||||
@@ -126,7 +128,9 @@ class CustomerTest extends \PHPUnit_Framework_TestCase
|
||||
'testRef'
|
||||
);
|
||||
|
||||
$customerAction = new Customer($this->getContainer());
|
||||
$customerCreateEvent->setDispatcher($this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface"));
|
||||
|
||||
$customerAction = new Customer(new SecurityContext(new Request()));
|
||||
|
||||
$customerAction->create($customerCreateEvent);
|
||||
|
||||
|
||||
57
core/lib/Thelia/Tools/MoneyFormat.php
Normal file
57
core/lib/Thelia/Tools/MoneyFormat.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Tools;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class MoneyFormat extends NumberFormat
|
||||
{
|
||||
public static function getInstance(Request $request)
|
||||
{
|
||||
return new MoneyFormat($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a standard number, with '.' as decimal point no thousands separator, and no currency symbol
|
||||
* so that this number can be used to perform calculations.
|
||||
*
|
||||
* @param float $number the number
|
||||
* @param string $decimals number of decimal figures
|
||||
*/
|
||||
public function formatStandardMoney($number, $decimals = null)
|
||||
{
|
||||
return parent::formatStandardNumber($number, $decimals);
|
||||
}
|
||||
|
||||
public function format($number, $decimals = null, $decPoint = null, $thousandsSep = null, $symbol = null)
|
||||
{
|
||||
$number = parent::format($number, $decimals, $decPoint, $thousandsSep);
|
||||
|
||||
if ($symbol !== null) {
|
||||
// FIXME: should be a parameter related to i18n configuration
|
||||
$number = $number . ' ' . $symbol;
|
||||
}
|
||||
return $number;
|
||||
}
|
||||
}
|
||||
@@ -154,7 +154,8 @@ class URL
|
||||
$sepChar = strstr($base, '?') === false ? '?' : '&';
|
||||
|
||||
if ('' !== $queryString = rtrim($queryString, "&")) $queryString = $sepChar . $queryString;
|
||||
return $base . $queryString;
|
||||
|
||||
return rtrim($base, '&') . $queryString;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user