Merge branch 'frontend' of github.com:thelia/thelia into frontend

This commit is contained in:
badsuricate
2013-11-19 14:48:17 +01:00
440 changed files with 1297 additions and 1033 deletions

View File

@@ -56,7 +56,7 @@ class HttpException extends BaseAction implements EventSubscriberInterface
$parser = $this->container->get("thelia.parser");
// Define the template thant shoud be used
$parser->setTemplate(TemplateHelper::getInstance()->getActiveFrontTemplate()->getPath());
$parser->setTemplate(TemplateHelper::getInstance()->getActiveFrontTemplate());
//$event->getRequest()->attributes->set('_view', ConfigQuery::getPageNotFoundView());

View File

@@ -279,12 +279,7 @@ class Order extends BaseAction implements EventSubscriberInterface
$this->getDispatcher()->dispatch(TheliaEvents::CART_CLEAR, new CartEvent($this->getCart($this->getRequest())));
/* call pay method */
$paymentModuleReflection = new \ReflectionClass($paymentModule->getFullNamespace());
$paymentModuleInstance = $paymentModuleReflection->newInstance();
$paymentModuleInstance->setRequest($this->getRequest());
$paymentModuleInstance->setDispatcher($this->getDispatcher());
$paymentModuleInstance = $this->container->get(sprintf('module.%s', $paymentModule->getCode()));
$paymentModuleInstance->pay($placedOrder);
}

View File

@@ -25,7 +25,7 @@ namespace %%NAMESPACE%%;
use Thelia\Module\BaseModule;
class Class extends BaseModule
class %%CLASSNAME%% extends BaseModule
{
/**
* YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class

View File

@@ -16,9 +16,6 @@
<form name="thelia.front.contact" class="Thelia\Form\ContactForm"/>
<form name="thelia.front.newsletter" class="Thelia\Form\NewsletterForm"/>
<!-- Forms for Admin -->
<form name="thelia.install.step3" class="Thelia\Form\InstallStep3Form"/>
<form name="thelia.admin.login" class="Thelia\Form\AdminLogin"/>
<form name="thelia.admin.customer.create" class="Thelia\Form\CustomerCreateForm"/>

View File

@@ -56,16 +56,6 @@
<tag name="router.register" priority="0"/>
</service>
<service id="router.front" class="%router.class%">
<argument type="service" id="router.xmlLoader"/>
<argument>front.xml</argument>
<argument type="collection">
<argument key="cache_dir">%kernel.cache_dir%</argument>
<argument key="debug">%kernel.debug%</argument>
</argument>
<argument type="service" id="request.context"/>
<tag name="router.register" priority="128"/>
</service>
<service id="router.rewrite" class="Thelia\Core\Routing\RewritingRouter">
<tag name="router.register" priority="255"/>

View File

@@ -934,15 +934,23 @@
<default key="_controller">Thelia\Controller\Admin\ModuleController::processUpdateAction</default>
</route>
<route id="admin.module.toggle-activation" path="/admin/modules/toggle-activation/{module_id}">
<route id="admin.module.toggle-activation" path="/admin/module/toggle-activation/{module_id}">
<default key="_controller">Thelia\Controller\Admin\ModuleController::toggleActivationAction</default>
<requirement key="module_id">\d+</requirement>
</route>
<route id="admin.module.delete" path="/admin/modules/delete">
<route id="admin.module.delete" path="/admin/module/delete">
<default key="_controller">Thelia\Controller\Admin\ModuleController::deleteAction</default>
</route>
<!--
Generic module route.
Will be use if module route is not define in module own config file.
-->
<route id="admin.module.configure" path="/admin/module/{module_code}">
<default key="_controller">Thelia\Controller\Admin\ModuleController::configureAction</default>
</route>
<!-- end Modules rule management -->
<!-- tax management -->

View File

@@ -10,7 +10,7 @@
<!-- The assets manager -->
<service id="assetic.asset.manager" class="Thelia\Core\Template\Assets\AsseticAssetManager" >
<argument>%kernel.environment%</argument>
<argument>%kernel.debug%</argument>
</service>
<!-- Smarty parser plugins -->

View File

@@ -201,7 +201,7 @@ class BaseAdminController extends BaseController
$parser = $this->container->get("thelia.parser");
// Define the template that should be used
$parser->setTemplate($template ?: TemplateHelper::getInstance()->getActiveAdminTemplate()->getPath());
$parser->setTemplate($template ?: TemplateHelper::getInstance()->getActiveAdminTemplate());
return $parser;
}

View File

@@ -188,6 +188,24 @@ class ModuleController extends AbstractCrudController
return $this->render("modules");
}
public function configureAction($module_code)
{
$module = ModuleQuery::create()->findOneByCode($module_code);
if(null === $module) {
throw new \InvalidArgumentException(sprintf("Module `%s` does not exists", $module_code));
}
if (null !== $response = $this->checkAuth(array(), $module_code, AccessManager::VIEW)) return $response;
return $this->render(
"module-configure",
array(
"module_code" => $module_code,
)
);
}
public function toggleActivationAction($module_id)
{
if (null !== $response = $this->checkAuth(AdminResources::MODULE, array(), AccessManager::UPDATE)) return $response;

View File

@@ -45,10 +45,6 @@ class TranslationsController extends BaseAdminController
// Find modules
$modules = ModuleQuery::create()->joinI18n($this->getCurrentEditionLocale())->orderByPosition()->find();
TemplateHelper::getInstance()->getList(TemplateDefinition::BACK_OFFICE);
TemplateHelper::getInstance()->getList(TemplateDefinition::PDF);
TemplateHelper::getInstance()->getList(TemplateDefinition::FRONT_OFFICE);
// Get related strings, if all input data are here
$item_to_translate = $this->getRequest()->get('item_to_translate');

View File

@@ -97,7 +97,7 @@ class BaseFrontController extends BaseController
$parser = $this->container->get("thelia.parser");
// Define the template that should be used
$parser->setTemplate($template ?: TemplateHelper::getInstance()->getActiveFrontTemplate()->getPath());
$parser->setTemplate($template ?: TemplateHelper::getInstance()->getActiveFrontTemplate());
return $parser;
}

View File

@@ -78,7 +78,7 @@ class ViewListener implements EventSubscriberInterface
{
$parser = $this->container->get('thelia.parser');
$parser->setTemplate(TemplateHelper::getInstance()->getActiveFrontTemplate()->getPath());
$parser->setTemplate(TemplateHelper::getInstance()->getActiveFrontTemplate());
$request = $this->container->get('request');
try {

View File

@@ -40,13 +40,13 @@ use Symfony\Component\Filesystem\Exception\IOException;
*/
class AsseticAssetManager implements AssetManagerInterface
{
protected $developmentMode;
protected $debugMode;
protected $source_file_extensions = array('less', 'js', 'coffee', 'html', 'tpl', 'htm', 'xml');
public function __construct($developmentMode)
public function __construct($debugMode)
{
$this->developmentMode = $developmentMode;
$this->debugMode = $debugMode;
}
/**
@@ -89,7 +89,7 @@ class AsseticAssetManager implements AssetManagerInterface
*/
protected function copyAssets(Filesystem $fs, $from_directory, $to_directory)
{
Tlog::getInstance()->addDebug("Copying assets from ", $from_directory, " to ", $to_directory);
Tlog::getInstance()->addDebug("Copying assets from $from_directory to $to_directory");
$iterator = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($from_directory, \RecursiveDirectoryIterator::SKIP_DOTS),
@@ -333,10 +333,10 @@ class AsseticAssetManager implements AssetManagerInterface
// This is the final name of the generated asset
$asset_destination_path = $output_directory . DS . $asset_target_filename;
Tlog::getInstance()->addDebug("Asset destination name: ", $asset_destination_path);
Tlog::getInstance()->addDebug("Asset destination full path: $asset_destination_path");
// We generate an asset only if it does not exists, or if the asset processing is forced in development mode
if (! file_exists($asset_destination_path) || ($this->developmentMode && ConfigQuery::read('process_assets', true)) ) {
if (! file_exists($asset_destination_path) || ($this->debugMode && ConfigQuery::read('process_assets', true)) ) {
$writer = new AssetWriter($output_directory);

View File

@@ -25,8 +25,10 @@ namespace Thelia\Core\Template\Loop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Exception\OrderException;
use Thelia\Model\CountryQuery;
use Thelia\Module\BaseModule;
use Thelia\Module\DeliveryModuleInterface;
/**
* Class Delivery
@@ -63,14 +65,24 @@ class Delivery extends BaseSpecificModule
foreach ($loopResult->getResultDataCollection() as $deliveryModule) {
$loopResultRow = new LoopResultRow($deliveryModule);
$moduleReflection = new \ReflectionClass($deliveryModule->getFullNamespace());
if ($moduleReflection->isSubclassOf("Thelia\Module\DeliveryModuleInterface") === false) {
$moduleInstance = $this->container->get(sprintf('module.%s', $deliveryModule->getCode()));
if (false === $moduleInstance instanceof DeliveryModuleInterface) {
throw new \RuntimeException(sprintf("delivery module %s is not a Thelia\Module\DeliveryModuleInterface", $deliveryModule->getCode()));
}
$moduleInstance = $moduleReflection->newInstance();
$moduleInstance->setRequest($this->request);
$moduleInstance->setDispatcher($this->dispatcher);
try {
$postage = $moduleInstance->getPostage($country);
} catch(OrderException $e) {
switch($e->getCode()) {
case OrderException::DELIVERY_MODULE_UNAVAILABLE:
/* do not show this delivery module */
continue(2);
break;
default:
throw $e;
}
}
$loopResultRow
->set('ID', $deliveryModule->getId())
@@ -78,7 +90,7 @@ class Delivery extends BaseSpecificModule
->set('CHAPO', $deliveryModule->getVirtualColumn('i18n_CHAPO'))
->set('DESCRIPTION', $deliveryModule->getVirtualColumn('i18n_DESCRIPTION'))
->set('POSTSCRIPTUM', $deliveryModule->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set('POSTAGE', $moduleInstance->getPostage($country))
->set('POSTAGE', $postage)
;
$loopResult->addRow($loopResultRow);

View File

@@ -24,6 +24,7 @@
namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Thelia\Core\Security\AccessManager;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult;
@@ -148,6 +149,29 @@ class Module extends BaseI18nLoop implements PropelSearchLoopInterface
->set("CLASS", $module->getFullNamespace())
->set("POSITION", $module->getPosition());
$hasConfigurationInterface = false;
/* first test if module defines it's own config route */
$routerId = "router." . $module->getBaseDir();
if($this->container->has($routerId)) {
try {
if($this->container->get($routerId)->match('/admin/module/' . $module->getCode())) {
$hasConfigurationInterface = true;
}
} catch(ResourceNotFoundException $e) {
/* $hasConfigurationInterface stays false */
}
}
/* if not ; test if it uses admin inclusion : module_configuration.html */
if(false === $hasConfigurationInterface) {
if(file_exists( sprintf("%s/%s/AdminIncludes/%s.html", THELIA_MODULE_DIR, $module->getBaseDir(), "module_configuration"))) {
$hasConfigurationInterface = true;
}
}
$loopResultRow->set("CONFIGURABLE", $hasConfigurationInterface ? 1 : 0);
if (null !== $this->getProfile()) {
$accessValue = $module->getVirtualColumn('access');
$manager = new AccessManager($accessValue);

View File

@@ -26,6 +26,7 @@ use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Module\BaseModule;
use Thelia\Module\PaymentModuleInterface;
/**
* Class Payment
@@ -47,14 +48,11 @@ class Payment extends BaseSpecificModule implements PropelSearchLoopInterface
foreach ($loopResult->getResultDataCollection() as $paymentModule) {
$loopResultRow = new LoopResultRow($paymentModule);
$moduleReflection = new \ReflectionClass($paymentModule->getFullNamespace());
if ($moduleReflection->isSubclassOf("Thelia\Module\PaymentModuleInterface") === false) {
$moduleInstance = $this->container->get(sprintf('module.%s', $paymentModule->getCode()));
if (false === $moduleInstance instanceof PaymentModuleInterface) {
throw new \RuntimeException(sprintf("payment module %s is not a Thelia\Module\PaymentModuleInterface", $paymentModule->getCode()));
}
$moduleInstance = $moduleReflection->newInstance();
$moduleInstance->setRequest($this->request);
$moduleInstance->setDispatcher($this->dispatcher);
$loopResultRow
->set('ID', $paymentModule->getId())

View File

@@ -44,10 +44,16 @@ class Module extends AbstractSmartyPlugin
if (false !== $location = $this->getParam($params, 'location', false)) {
$moduleLimit = $this->getParam($params, 'module', null);
$modules = ModuleQuery::getActivated();
foreach ($modules as $module) {
if(null !== $moduleLimit && $moduleLimit != $module->getCode()) {
continue;
}
$file = sprintf("%s/%s/AdminIncludes/%s.html", THELIA_MODULE_DIR, $module->getBaseDir(), $location);
if (file_exists($file)) {

View File

@@ -13,6 +13,7 @@ use Thelia\Core\Template\ParserInterface;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Core\Template\Exception\ResourceNotFoundException;
use Thelia\Core\Template\ParserContext;
use Thelia\Core\Template\TemplateDefinition;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Template\TemplateHelper;
@@ -23,13 +24,15 @@ use Thelia\Core\Template\TemplateHelper;
*/
class SmartyParser extends Smarty implements ParserInterface
{
public $plugins = array();
protected $request;
protected $dispatcher;
protected $parserContext;
protected $backOfficeTemplateDirectories = array();
protected $frontOfficeTemplateDirectories = array();
protected $template = "";
protected $status = 200;
@@ -101,15 +104,59 @@ class SmartyParser extends Smarty implements ParserInterface
}
}
public function setTemplate($template_path_from_template_base)
public function addBackOfficeTemplateDirectory($templateName, $templateDirectory, $key)
{
$this->template = $template_path_from_template_base;
$this->backOfficeTemplateDirectories[$templateName][$key] = $templateDirectory;
}
$this->addTemplateDir(THELIA_TEMPLATE_DIR.$this->template, 0);
public function addFrontOfficeTemplateDirectory($templateName, $templateDirectory, $key)
{
$this->frontOfficeTemplateDirectories[$templateName][$key] = $templateDirectory;
}
$config_dir = THELIA_TEMPLATE_DIR.$this->template.'/configs';
/**
* @param TemplateDefinition $templateDefinition
*/
public function setTemplate(TemplateDefinition $templateDefinition)
{
$this->template = $templateDefinition->getPath();
$this->setConfigDir($config_dir);
/* init template directories */
$this->setTemplateDir(array());
/* add main template directory */
$this->addTemplateDir(THELIA_TEMPLATE_DIR . $this->template, 0);
/* define config directory */
$configDirectory = THELIA_TEMPLATE_DIR . $this->template . '/configs';
$this->setConfigDir($configDirectory);
/* add modules template directories */
switch($templateDefinition->getType()) {
case TemplateDefinition::FRONT_OFFICE:
/* do not pass array directly to addTemplateDir since we cant control on keys */
if(isset($this->frontOfficeTemplateDirectories[$templateDefinition->getName()])) {
foreach($this->frontOfficeTemplateDirectories[$templateDefinition->getName()] as $key => $directory) {
$this->addTemplateDir($directory, $key);
}
}
break;
case TemplateDefinition::BACK_OFFICE:
/* do not pass array directly to addTemplateDir since we cant control on keys */
if(isset($this->backOfficeTemplateDirectories[$templateDefinition->getName()])) {
foreach($this->backOfficeTemplateDirectories[$templateDefinition->getName()] as $key => $directory) {
$this->addTemplateDir($directory, $key);
}
}
break;
case TemplateDefinition::PDF:
break;
default:
break;
}
}
public function getTemplate()

View File

@@ -22,7 +22,6 @@
/*************************************************************************************/
namespace Thelia\Core\Template;
use Thelia\Model\ConfigQuery;
class TemplateDefinition
{
@@ -30,7 +29,8 @@ class TemplateDefinition
const BACK_OFFICE = 2;
const PDF = 3;
const BACK_OFFICE_SUBDIR = 'admin/';
const FRONT_OFFICE_SUBDIR = 'frontOffice/';
const BACK_OFFICE_SUBDIR = 'backOffice/';
const PDF_SUBDIR = 'pdf/';
/**
@@ -54,12 +54,20 @@ class TemplateDefinition
$this->name = $name;
$this->type = $type;
if ($type == self::BACK_OFFICE)
$this->path = self::BACK_OFFICE_SUBDIR . $name;
else if ($type == self::PDF)
$this->path = self::PDF_SUBDIR . $name;
else
$this->path = $name;
switch($type) {
case TemplateDefinition::FRONT_OFFICE:
$this->path = self::FRONT_OFFICE_SUBDIR . $name;
break;
case TemplateDefinition::BACK_OFFICE:
$this->path = self::BACK_OFFICE_SUBDIR . $name;
break;
case TemplateDefinition::PDF:
$this->path = self::PDF_SUBDIR . $name;
break;
default:
$this->path = $name;
break;
}
}
public function getName()

View File

@@ -46,6 +46,9 @@ class TemplateHelper
return self::$instance;
}
/**
* @return TemplateDefinition
*/
public function getActivePdfTemplate() {
return new TemplateDefinition(
ConfigQuery::read('active-pdf-template', 'default'),
@@ -53,6 +56,9 @@ class TemplateHelper
);
}
/**
* @return TemplateDefinition
*/
public function getActiveAdminTemplate() {
return new TemplateDefinition(
ConfigQuery::read('active-admin-template', 'default'),
@@ -60,6 +66,9 @@ class TemplateHelper
);
}
/**
* @return TemplateDefinition
*/
public function getActiveFrontTemplate() {
return new TemplateDefinition(
ConfigQuery::read('active-front-template', 'default'),
@@ -78,7 +87,7 @@ class TemplateHelper
$baseDir = THELIA_TEMPLATE_DIR.TemplateDefinition::PDF_SUBDIR;
}
else {
$baseDir = THELIA_TEMPLATE_DIR;
$baseDir = THELIA_TEMPLATE_DIR.TemplateDefinition::FRONT_OFFICE_SUBDIR;
$exclude = array(TemplateDefinition::BACK_OFFICE_SUBDIR, TemplateDefinition::PDF_SUBDIR);
}

View File

@@ -35,6 +35,7 @@ namespace Thelia\Core;
use Propel\Runtime\Connection\ConnectionWrapper;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Finder\Finder;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
@@ -45,6 +46,7 @@ use Thelia\Core\Bundle;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Config\DatabaseConfiguration;
use Thelia\Config\DefinePropel;
use Thelia\Core\Template\TemplateDefinition;
use Thelia\Core\TheliaContainerBuilder;
use Thelia\Core\DependencyInjection\Loader\XmlFileLoader;
use Thelia\Model\ConfigQuery;
@@ -126,7 +128,6 @@ class Thelia extends Kernel
$modules = \Thelia\Model\ModuleQuery::getActivated();
$translationDirs = array();
$templateDirs = array();
$parser = $container->getDefinition('thelia.parser');
foreach ($modules as $module) {
@@ -134,7 +135,7 @@ class Thelia extends Kernel
$defintion = new Definition();
$defintion->setClass($module->getFullNamespace());
$defintion->addMethodCall("setContainer", array('service_container'));
$defintion->addMethodCall("setContainer", array(new Reference('service_container')));
$container->setDefinition(
"module.".$module->getCode(),
@@ -151,9 +152,54 @@ class Thelia extends Kernel
$translationDirs[] = $dir;
}
if (is_dir($dir = THELIA_MODULE_DIR . "/" . $code . "/templates")) {
//$templateDirs[$code] = $dir;
$parser->addMethodCall('addTemplateDir', array($dir, $code));
/* is there a front-office template directory ? */
$frontOfficeModuleTemplateDirectory = sprintf("%s%s%stemplates%s%s", THELIA_MODULE_DIR, $code, DS, DS, TemplateDefinition::FRONT_OFFICE_SUBDIR);
if (is_dir($frontOfficeModuleTemplateDirectory)) {
try {
$moduleFrontOfficeTemplateBrowser = new \DirectoryIterator($frontOfficeModuleTemplateDirectory);
} catch (\UnexpectedValueException $e) {
throw $e;
}
/* browse the directory */
foreach ($moduleFrontOfficeTemplateBrowser as $moduleFrontOfficeTemplateContent) {
/* is it a directory which is not . or .. ? */
if ($moduleFrontOfficeTemplateContent->isDir() && !$moduleFrontOfficeTemplateContent->isDot()) {
$parser->addMethodCall(
'addFrontOfficeTemplateDirectory',
array(
$moduleFrontOfficeTemplateContent->getFilename(),
$moduleFrontOfficeTemplateContent->getPathName(),
$code,
)
);
}
}
}
/* is there a back-office template directory ? */
$backOfficeModuleTemplateDirectory = sprintf("%s%s%stemplates%s%s", THELIA_MODULE_DIR, $code, DS, DS, TemplateDefinition::BACK_OFFICE_SUBDIR);
if (is_dir($backOfficeModuleTemplateDirectory)) {
try {
$moduleBackOfficeTemplateBrowser = new \DirectoryIterator($backOfficeModuleTemplateDirectory);
} catch (\UnexpectedValueException $e) {
throw $e;
}
/* browse the directory */
foreach ($moduleBackOfficeTemplateBrowser as $moduleBackOfficeTemplateContent) {
/* is it a directory which is not . or .. ? */
if ($moduleBackOfficeTemplateContent->isDir() && !$moduleBackOfficeTemplateContent->isDot()) {
$parser->addMethodCall(
'addBackOfficeTemplateDirectory',
array(
$moduleBackOfficeTemplateContent->getFilename(),
$moduleBackOfficeTemplateContent->getPathName(),
$code,
)
);
}
}
}
} catch (\InvalidArgumentException $e) {
// TODO: process module configuration exception

View File

@@ -38,6 +38,7 @@ class OrderException extends \RuntimeException
const CART_EMPTY = 100;
const UNDEFINED_DELIVERY = 200;
const DELIVERY_MODULE_UNAVAILABLE = 201;
public function __construct($message, $code = null, $arguments = array(), $previous = null)
{

View File

@@ -63,6 +63,14 @@ class CheckPermission extends BaseInstall
'upload_max_filesize' => 2097152
);
protected $extensions = array(
'curl',
'gd',
'intl',
'mcrypt',
'pdo_mysql',
);
protected $validationMessages = array();
/** @var bool If permissions are OK */
@@ -103,6 +111,14 @@ class CheckPermission extends BaseInstall
);
}
foreach ($this->extensions as $extension) {
$this->validationMessages[$extension] = array(
'text' => '',
'hint' => $this->getI18nExtensionHint(),
'status' => true,
);
}
parent::__construct($verifyInstall);
}
@@ -139,6 +155,15 @@ class CheckPermission extends BaseInstall
}
}
foreach ($this->extensions as $extension) {
$this->validationMessages[$extension]['text'] = $this->getI18nExtensionText($extension, true);
if (false === extension_loaded($extension)) {
$this->isValid = false;
$this->validationMessages[$extension]['status'] = false;
$this->validationMessages[$extension]['text'] = $this->getI18nExtensionText($extension, false);
}
}
@@ -176,7 +201,6 @@ class CheckPermission extends BaseInstall
}
/**
* Get Translated text about the directory state
*
@@ -198,8 +222,7 @@ class CheckPermission extends BaseInstall
$sentence,
array(
'%directory%' => $directory
),
'install-wizard'
)
);
} else {
$translatedText = sprintf('Your directory %s needs to be writable', $directory);
@@ -208,6 +231,19 @@ class CheckPermission extends BaseInstall
return $translatedText;
}
protected function getI18nExtensionText($extension, $isValid)
{
if ($isValid) {
$sentence = '%extension% php extension is loaded';
} else {
$sentence = '%extension% php extension is not loaded';
}
return $this->translator->trans($sentence, array(
'%extension%' => $extension
));
}
/**
* Get Translated hint about the directory state
*
@@ -266,6 +302,11 @@ class CheckPermission extends BaseInstall
return $translatedText;
}
protected function getI18nExtensionHint()
{
return $this->translator->trans('This extension must be installed and loaded');
}
/**
* Get Translated hint about the config requirement issue
*
@@ -275,9 +316,7 @@ class CheckPermission extends BaseInstall
{
$sentence = 'Modifying this value on your server php.ini file with admin rights could help';
$translatedText = $this->translator->trans(
$sentence,
array(),
'install-wizard'
$sentence
);
return $translatedText;
@@ -306,8 +345,7 @@ class CheckPermission extends BaseInstall
array(
'%expectedValue%' => $expectedValue,
'%currentValue%' => $currentValue,
),
'install-wizard'
)
);
} else {
$translatedText = sprintf('Thelia needs at least PHP %s (%s currently)', $expectedValue, $currentValue);
@@ -326,8 +364,7 @@ class CheckPermission extends BaseInstall
$sentence = 'Upgrading your version of PHP with admin rights could help';
$translatedText = $this->translator->trans(
$sentence,
array(),
'install-wizard'
array()
);
return $translatedText;

View File

@@ -112,4 +112,18 @@ class Cart extends BaseCart
return $total;
}
public function getWeight()
{
$weight = 0;
foreach($this->getCartItems() as $cartItem) {
$itemWeight = $cartItem->getProductSaleElements()->getWeight();
$itemWeight *= $cartItem->getQuantity();
$weight += $itemWeight;
}
return $weight;
}
}

View File

@@ -24,6 +24,7 @@
namespace Thelia\Tests\Action;
use Propel\Runtime\ActiveQuery\Criteria;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
use Thelia\Core\Event\Order\OrderAddressEvent;
use Thelia\Core\Event\Order\OrderEvent;
@@ -250,6 +251,10 @@ class OrderTest extends \PHPUnit_Framework_TestCase
throw new \Exception('No Payment Module fixture found');
}
/* define payment module in container */
$paymentModuleClass = $paymentModule->getFullNamespace();
$this->container->set(sprintf('module.%s', $paymentModule->getCode()), new $paymentModuleClass());
$this->orderEvent->getOrder()->chosenDeliveryAddress = $validDeliveryAddress->getId();
$this->orderEvent->getOrder()->chosenInvoiceAddress = $validInvoiceAddress->getId();
$this->orderEvent->getOrder()->setDeliveryModuleId($deliveryModule->getId());

View File

@@ -61,7 +61,11 @@ class CategoryTest extends BaseLoopTestor
$category->save();
}
$this->baseTestSearchById($category->getId());
$otherParameters = array(
"visible" => "*",
);
$this->baseTestSearchById($category->getId(), $otherParameters);
}
public function testSearchLimit()

View File

@@ -61,7 +61,11 @@ class ContentTest extends BaseLoopTestor
$content->save();
}
$this->baseTestSearchById($content->getId());
$otherParameters = array(
"visible" => "*",
);
$this->baseTestSearchById($content->getId(), $otherParameters);
}
public function testSearchLimit()

View File

@@ -61,7 +61,11 @@ class FolderTest extends BaseLoopTestor
$folder->save();
}
$this->baseTestSearchById($folder->getId());
$otherParameters = array(
"visible" => "*",
);
$this->baseTestSearchById($folder->getId(), $otherParameters);
}
public function testSearchLimit()

View File

@@ -62,7 +62,11 @@ class ProductTest extends BaseLoopTestor
$product->save();
}
$this->baseTestSearchById($product->getId());
$otherParameters = array(
"visible" => "*",
);
$this->baseTestSearchById($product->getId(), $otherParameters);
}
public function testSearchLimit()

View File

@@ -424,7 +424,7 @@ try {
$stock->setQuantity($faker->randomNumber(1,50));
$stock->setPromo($faker->randomNumber(0,1));
$stock->setNewness($faker->randomNumber(0,1));
$stock->setWeight($faker->randomFloat(2, 100,10000));
$stock->setWeight($faker->randomFloat(2, 1, 5));
$stock->setIsDefault($i == 0);
$stock->setEanCode(substr(str_shuffle("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 13));
$stock->save();

View File

@@ -47,13 +47,16 @@ INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updat
INSERT INTO `module` (`id`, `code`, `type`, `activate`, `position`, `full_namespace`, `created_at`, `updated_at`) VALUES
(1, 'TheliaDebugBar', 1, 1, 1, 'TheliaDebugBar\\TheliaDebugBar', NOW(), NOW()),
(2, 'Colissimo', 2, 0, 1, 'Colissimo\\Colissimo', NOW(), NOW()),
(3, 'Cheque', 3, 0, 1, 'Cheque\\Cheque', NOW(), NOW());
(3, 'Cheque', 3, 0, 1, 'Cheque\\Cheque', NOW(), NOW()),
(4, 'Front', 1, 1, 2, 'Front\\Front', NOW(), NOW());
INSERT INTO `module_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES
('1', 'en_US', 'Debug bar', NULL, NULL, NULL),
('1', 'fr_FR', 'Debug bar', NULL, NULL, NULL),
('2', 'en_US', '72h delivery', NULL, NULL, NULL),
('2', 'fr_FR', 'Livraison par colissimo en 72h', NULL, NULL, NULL);
('2', 'fr_FR', 'Livraison par colissimo en 72h', NULL, NULL, NULL),
('4', 'en_US', 'Front office integration', NULL, NULL, NULL),
('4', 'fr_FR', 'Module Front office', NULL, NULL, NULL);
INSERT INTO `customer_title`(`id`, `by_default`, `position`, `created_at`, `updated_at`) VALUES
@@ -66,7 +69,7 @@ INSERT INTO `customer_title_i18n` (`id`, `locale`, `short`, `long`) VALUES
(1, 'en_US', 'M', 'Mister'),
(2, 'fr_FR', 'Mme', 'Madame'),
(2, 'en_US', 'Mrs', 'Misses'),
(3, 'fr_FR', 'Mlle', 'Madamemoiselle'),
(3, 'fr_FR', 'Mlle', 'Mademoiselle'),
(3, 'en_US', 'Miss', 'Miss');
INSERT INTO `currency` (`id`, `code`, `symbol`, `rate`, `position`, `by_default`, `created_at`, `updated_at`)
@@ -86,285 +89,285 @@ VALUES
INSERT INTO `area` (`id`, `name`, `postage`, `created_at`, `updated_at`) VALUES
(1, 'France', NULL, NOW(), NOW()),
(2, 'Area 1', NULL, NOW(), NOW()),
(3, 'Area 2', NULL, NOW(), NOW()),
(4, 'Area 3', NULL, NOW(), NOW()),
(5, 'Area 4', NULL, NOW(), NOW()),
(6, 'Area 5', NULL, NOW(), NOW()),
(7, 'Area 6', NULL, NOW(), NOW()),
(8, 'Area 7', NULL, NOW(), NOW()),
(9, 'Area 8', NULL, NOW(), NOW()),
(10, 'DOM', NULL, NOW(), NOW()),
(11, 'TOM', NULL, NOW(), NOW());
(2, 'A Zone', NULL, NOW(), NOW()),
(3, 'B Zone', NULL, NOW(), NOW()),
(4, 'C Zone', NULL, NOW(), NOW()),
(5, 'D Zone', NULL, NOW(), NOW()),
(6, 'France OM1', NULL, NOW(), NOW()),
(7, 'France OM2', NULL, NOW(), NOW());
INSERT INTO `area_delivery_module` (`id`, `area_id`, `delivery_module_id`, `created_at`, `updated_at`) VALUES
(1, 1, 2, NOW(), NOW());
(1, 1, 2, NOW(), NOW()),
(2, 2, 2, NOW(), NOW()),
(3, 3, 2, NOW(), NOW()),
(4, 4, 2, NOW(), NOW()),
(5, 5, 2, NOW(), NOW()),
(6, 6, 2, NOW(), NOW());
INSERT INTO `country` (`id`, `area_id`, `isocode`, `isoalpha2`, `isoalpha3`, `by_default`, `shop_country`, `created_at`, `updated_at`) VALUES
(1, NULL, '4', 'AF', 'AFG', 0, 0, NOW(), NOW()),
(2, NULL, '710', 'ZA', 'ZAF', 0, 0, NOW(), NOW()),
(3, NULL, '8', 'AL', 'ALB', 0, 0, NOW(), NOW()),
(4, NULL, '12', 'DZ', 'DZA', 0, 0, NOW(), NOW()),
(5, NULL, '276', 'DE', 'DEU', 0, 0, NOW(), NOW()),
(6, NULL, '20', 'AD', 'AND', 0, 0, NOW(), NOW()),
(7, NULL, '24', 'AO', 'AGO', 0, 0, NOW(), NOW()),
(8, NULL, '28', 'AG', 'ATG', 0, 0, NOW(), NOW()),
(9, NULL, '682', 'SA', 'SAU', 0, 0, NOW(), NOW()),
(10, NULL, '32', 'AR', 'ARG', 0, 0, NOW(), NOW()),
(11, NULL, '51', 'AM', 'ARM', 0, 0, NOW(), NOW()),
(12, NULL, '36', 'AU', 'AUS', 0, 0, NOW(), NOW()),
(13, NULL, '40', 'AT', 'AUT', 0, 0, NOW(), NOW()),
(14, NULL, '31', 'AZ', 'AZE', 0, 0, NOW(), NOW()),
(15, NULL, '44', 'BS', 'BHS', 0, 0, NOW(), NOW()),
(16, NULL, '48', 'BR', 'BHR', 0, 0, NOW(), NOW()),
(17, NULL, '50', 'BD', 'BGD', 0, 0, NOW(), NOW()),
(18, NULL, '52', 'BB', 'BRB', 0, 0, NOW(), NOW()),
(19, NULL, '585', 'PW', 'PLW', 0, 0, NOW(), NOW()),
(20, NULL, '56', 'BE', 'BEL', 0, 0, NOW(), NOW()),
(21, NULL, '84', 'BL', 'BLZ', 0, 0, NOW(), NOW()),
(22, NULL, '204', 'BJ', 'BEN', 0, 0, NOW(), NOW()),
(1, 5, '4', 'AF', 'AFG', 0, 0, NOW(), NOW()),
(2, 4, '710', 'ZA', 'ZAF', 0, 0, NOW(), NOW()),
(3, 3, '8', 'AL', 'ALB', 0, 0, NOW(), NOW()),
(4, 3, '12', 'DZ', 'DZA', 0, 0, NOW(), NOW()),
(5, 2, '276', 'DE', 'DEU', 0, 0, NOW(), NOW()),
(6, 1, '20', 'AD', 'AND', 0, 0, NOW(), NOW()),
(7, 4, '24', 'AO', 'AGO', 0, 0, NOW(), NOW()),
(8, 5, '28', 'AG', 'ATG', 0, 0, NOW(), NOW()),
(9, 4, '682', 'SA', 'SAU', 0, 0, NOW(), NOW()),
(10, 5, '32', 'AR', 'ARG', 0, 0, NOW(), NOW()),
(11, 3, '51', 'AM', 'ARM', 0, 0, NOW(), NOW()),
(12, 5, '36', 'AU', 'AUS', 0, 0, NOW(), NOW()),
(13, 2, '40', 'AT', 'AUT', 0, 0, NOW(), NOW()),
(14, 3, '31', 'AZ', 'AZE', 0, 0, NOW(), NOW()),
(15, 5, '44', 'BS', 'BHS', 0, 0, NOW(), NOW()),
(16, 4, '48', 'BR', 'BHR', 0, 0, NOW(), NOW()),
(17, 5, '50', 'BD', 'BGD', 0, 0, NOW(), NOW()),
(18, 5, '52', 'BB', 'BRB', 0, 0, NOW(), NOW()),
(19, 3, '585', 'PW', 'PLW', 0, 0, NOW(), NOW()),
(20, 5, '56', 'BE', 'BEL', 0, 0, NOW(), NOW()),
(21, 5, '84', 'BL', 'BLZ', 0, 0, NOW(), NOW()),
(22, 4, '204', 'BJ', 'BEN', 0, 0, NOW(), NOW()),
(23, NULL, '64', 'BT', 'BTN', 0, 0, NOW(), NOW()),
(24, NULL, '112', 'BY', 'BLR', 0, 0, NOW(), NOW()),
(25, NULL, '104', 'MM', 'MMR', 0, 0, NOW(), NOW()),
(26, NULL, '68', 'BO', 'BOL', 0, 0, NOW(), NOW()),
(27, NULL, '70', 'BA', 'BIH', 0, 0, NOW(), NOW()),
(28, NULL, '72', 'BW', 'BWA', 0, 0, NOW(), NOW()),
(29, NULL, '76', 'BR', 'BRA', 0, 0, NOW(), NOW()),
(30, NULL, '96', 'BN', 'BRN', 0, 0, NOW(), NOW()),
(31, NULL, '100', 'BG', 'BGR', 0, 0, NOW(), NOW()),
(32, NULL, '854', 'BF', 'BFA', 0, 0, NOW(), NOW()),
(33, NULL, '108', 'BI', 'BDI', 0, 0, NOW(), NOW()),
(34, NULL, '116', 'KH', 'KHM', 0, 0, NOW(), NOW()),
(35, NULL, '120', 'CM', 'CMR', 0, 0, NOW(), NOW()),
(37, NULL, '132', 'CV', 'CPV', 0, 0, NOW(), NOW()),
(38, NULL, '152', 'CL', 'CHL', 0, 0, NOW(), NOW()),
(39, NULL, '156', 'CN', 'CHN', 0, 0, NOW(), NOW()),
(40, NULL, '196', 'CY', 'CYP', 0, 0, NOW(), NOW()),
(41, NULL, '170', 'CO', 'COL', 0, 0, NOW(), NOW()),
(42, NULL, '174', 'KM', 'COM', 0, 0, NOW(), NOW()),
(43, NULL, '178', 'CG', 'COG', 0, 0, NOW(), NOW()),
(44, NULL, '184', 'CK', 'COK', 0, 0, NOW(), NOW()),
(45, NULL, '408', 'KP', 'PRK', 0, 0, NOW(), NOW()),
(46, NULL, '410', 'KR', 'KOR', 0, 0, NOW(), NOW()),
(47, NULL, '188', 'CR', 'CRI', 0, 0, NOW(), NOW()),
(48, NULL, '384', 'CI', 'CIV', 0, 0, NOW(), NOW()),
(49, NULL, '191', 'HR', 'HRV', 0, 0, NOW(), NOW()),
(50, NULL, '192', 'CU', 'CUB', 0, 0, NOW(), NOW()),
(51, NULL, '208', 'DK', 'DNK', 0, 0, NOW(), NOW()),
(52, NULL, '262', 'DJ', 'DJI', 0, 0, NOW(), NOW()),
(53, NULL, '212', 'DM', 'DMA', 0, 0, NOW(), NOW()),
(54, NULL, '818', 'EG', 'EGY', 0, 0, NOW(), NOW()),
(55, NULL, '784', 'AE', 'ARE', 0, 0, NOW(), NOW()),
(56, NULL, '218', 'EC', 'ECU', 0, 0, NOW(), NOW()),
(57, NULL, '232', 'ER', 'ERI', 0, 0, NOW(), NOW()),
(58, NULL, '724', 'ES', 'ESP', 0, 0, NOW(), NOW()),
(59, NULL, '233', 'EE', 'EST', 0, 0, NOW(), NOW()),
(61, NULL, '231', 'ET', 'ETH', 0, 0, NOW(), NOW()),
(62, NULL, '242', 'FJ', 'FJI', 0, 0, NOW(), NOW()),
(63, NULL, '246', 'FI', 'FIN', 0, 0, NOW(), NOW()),
(24, 3, '112', 'BY', 'BLR', 0, 0, NOW(), NOW()),
(25, 5, '104', 'MM', 'MMR', 0, 0, NOW(), NOW()),
(26, 5, '68', 'BO', 'BOL', 0, 0, NOW(), NOW()),
(27, 3, '70', 'BA', 'BIH', 0, 0, NOW(), NOW()),
(28, 4, '72', 'BW', 'BWA', 0, 0, NOW(), NOW()),
(29, 5, '76', 'BR', 'BRA', 0, 0, NOW(), NOW()),
(30, 5, '96', 'BN', 'BRN', 0, 0, NOW(), NOW()),
(31, 3, '100', 'BG', 'BGR', 0, 0, NOW(), NOW()),
(32, 5, '854', 'BF', 'BFA', 0, 0, NOW(), NOW()),
(33, 4, '108', 'BI', 'BDI', 0, 0, NOW(), NOW()),
(34, 5, '116', 'KH', 'KHM', 0, 0, NOW(), NOW()),
(35, 4, '120', 'CM', 'CMR', 0, 0, NOW(), NOW()),
(37, 4, '132', 'CV', 'CPV', 0, 0, NOW(), NOW()),
(38, 5, '152', 'CL', 'CHL', 0, 0, NOW(), NOW()),
(39, 5, '156', 'CN', 'CHN', 0, 0, NOW(), NOW()),
(40, 2, '196', 'CY', 'CYP', 0, 0, NOW(), NOW()),
(41, 5, '170', 'CO', 'COL', 0, 0, NOW(), NOW()),
(42, 4, '174', 'KM', 'COM', 0, 0, NOW(), NOW()),
(43, 4, '178', 'CG', 'COG', 0, 0, NOW(), NOW()),
(44, 5, '184', 'CK', 'COK', 0, 0, NOW(), NOW()),
(45, 5, '408', 'KP', 'PRK', 0, 0, NOW(), NOW()),
(46, 5, '410', 'KR', 'KOR', 0, 0, NOW(), NOW()),
(47, 5, '188', 'CR', 'CRI', 0, 0, NOW(), NOW()),
(48, 4, '384', 'CI', 'CIV', 0, 0, NOW(), NOW()),
(49, 2, '191', 'HR', 'HRV', 0, 0, NOW(), NOW()),
(50, 5, '192', 'CU', 'CUB', 0, 0, NOW(), NOW()),
(51, 2, '208', 'DK', 'DNK', 0, 0, NOW(), NOW()),
(52, 5, '262', 'DJ', 'DJI', 0, 0, NOW(), NOW()),
(53, 5, '212', 'DM', 'DMA', 0, 0, NOW(), NOW()),
(54, 4, '818', 'EG', 'EGY', 0, 0, NOW(), NOW()),
(55, 4, '784', 'AE', 'ARE', 0, 0, NOW(), NOW()),
(56, 5, '218', 'EC', 'ECU', 0, 0, NOW(), NOW()),
(57, 4, '232', 'ER', 'ERI', 0, 0, NOW(), NOW()),
(58, 2, '724', 'ES', 'ESP', 0, 0, NOW(), NOW()),
(59, 2, '233', 'EE', 'EST', 0, 0, NOW(), NOW()),
(61, 4, '231', 'ET', 'ETH', 0, 0, NOW(), NOW()),
(62, 5, '242', 'FJ', 'FJI', 0, 0, NOW(), NOW()),
(63, 2, '246', 'FI', 'FIN', 0, 0, NOW(), NOW()),
(64, 1, '250', 'FR', 'FRA', 1, 1, NOW(), NOW()),
(65, NULL, '266', 'GA', 'GAB', 0, 0, NOW(), NOW()),
(66, NULL, '270', 'GM', 'GMB', 0, 0, NOW(), NOW()),
(67, NULL, '268', 'GE', 'GEO', 0, 0, NOW(), NOW()),
(68, NULL, '288', 'GH', 'GHA', 0, 0, NOW(), NOW()),
(69, NULL, '300', 'GR', 'GRC', 0, 0, NOW(), NOW()),
(70, NULL, '308', 'GD', 'GRD', 0, 0, NOW(), NOW()),
(71, NULL, '320', 'GT', 'GTM', 0, 0, NOW(), NOW()),
(72, NULL, '324', 'GN', 'GIN', 0, 0, NOW(), NOW()),
(73, NULL, '624', 'GW', 'GNB', 0, 0, NOW(), NOW()),
(74, NULL, '226', 'GQ', 'GNQ', 0, 0, NOW(), NOW()),
(75, NULL, '328', 'GY', 'GUY', 0, 0, NOW(), NOW()),
(76, NULL, '332', 'HT', 'HTI', 0, 0, NOW(), NOW()),
(77, NULL, '340', 'HN', 'HND', 0, 0, NOW(), NOW()),
(78, NULL, '348', 'HU', 'HUN', 0, 0, NOW(), NOW()),
(79, NULL, '356', 'IN', 'IND', 0, 0, NOW(), NOW()),
(80, NULL, '360', 'ID', 'IDN', 0, 0, NOW(), NOW()),
(81, NULL, '364', 'IR', 'IRN', 0, 0, NOW(), NOW()),
(82, NULL, '368', 'IQ', 'IRQ', 0, 0, NOW(), NOW()),
(83, NULL, '372', 'IE', 'IRL', 0, 0, NOW(), NOW()),
(84, NULL, '352', 'IS', 'ISL', 0, 0, NOW(), NOW()),
(85, NULL, '376', 'IL', 'ISR', 0, 0, NOW(), NOW()),
(86, NULL, '380', 'IT', 'ITA', 0, 0, NOW(), NOW()),
(87, NULL, '388', 'JM', 'JAM', 0, 0, NOW(), NOW()),
(88, NULL, '392', 'JP', 'JPN', 0, 0, NOW(), NOW()),
(89, NULL, '400', 'JO', 'JOR', 0, 0, NOW(), NOW()),
(90, NULL, '398', 'KZ', 'KAZ', 0, 0, NOW(), NOW()),
(91, NULL, '404', 'KE', 'KEN', 0, 0, NOW(), NOW()),
(92, NULL, '417', 'KG', 'KGZ', 0, 0, NOW(), NOW()),
(93, NULL, '296', 'KI', 'KIR', 0, 0, NOW(), NOW()),
(94, NULL, '414', 'KW', 'KWT', 0, 0, NOW(), NOW()),
(95, NULL, '418', 'LA', 'LAO', 0, 0, NOW(), NOW()),
(96, NULL, '426', 'LS', 'LSO', 0, 0, NOW(), NOW()),
(97, NULL, '428', 'LV', 'LVA', 0, 0, NOW(), NOW()),
(98, NULL, '422', 'LB', 'LBN', 0, 0, NOW(), NOW()),
(99, NULL, '430', 'LR', 'LBR', 0, 0, NOW(), NOW()),
(100, NULL, '343', 'LY', 'LBY', 0, 0, NOW(), NOW()),
(101, NULL, '438', 'LI', 'LIE', 0, 0, NOW(), NOW()),
(102, NULL, '440', 'LT', 'LTU', 0, 0, NOW(), NOW()),
(103, NULL, '442', 'LU', 'LUX', 0, 0, NOW(), NOW()),
(104, NULL, '807', 'MK', 'MKD', 0, 0, NOW(), NOW()),
(105, NULL, '450', 'MD', 'MDG', 0, 0, NOW(), NOW()),
(106, NULL, '458', 'MY', 'MYS', 0, 0, NOW(), NOW()),
(107, NULL, '454', 'MW', 'MWI', 0, 0, NOW(), NOW()),
(108, NULL, '462', 'MV', 'MDV', 0, 0, NOW(), NOW()),
(109, NULL, '466', 'ML', 'MLI', 0, 0, NOW(), NOW()),
(110, NULL, '470', 'MT', 'MLT', 0, 0, NOW(), NOW()),
(111, NULL, '504', 'MA', 'MAR', 0, 0, NOW(), NOW()),
(112, NULL, '584', 'MH', 'MHL', 0, 0, NOW(), NOW()),
(113, NULL, '480', 'MU', 'MUS', 0, 0, NOW(), NOW()),
(114, NULL, '478', 'MR', 'MRT', 0, 0, NOW(), NOW()),
(115, NULL, '484', 'MX', 'MEX', 0, 0, NOW(), NOW()),
(65, 4, '266', 'GA', 'GAB', 0, 0, NOW(), NOW()),
(66, 4, '270', 'GM', 'GMB', 0, 0, NOW(), NOW()),
(67, 3, '268', 'GE', 'GEO', 0, 0, NOW(), NOW()),
(68, 4, '288', 'GH', 'GHA', 0, 0, NOW(), NOW()),
(69, 2, '300', 'GR', 'GRC', 0, 0, NOW(), NOW()),
(70, 5, '308', 'GD', 'GRD', 0, 0, NOW(), NOW()),
(71, 5, '320', 'GT', 'GTM', 0, 0, NOW(), NOW()),
(72, 4, '324', 'GN', 'GIN', 0, 0, NOW(), NOW()),
(73, 4, '624', 'GW', 'GNB', 0, 0, NOW(), NOW()),
(74, 4, '226', 'GQ', 'GNQ', 0, 0, NOW(), NOW()),
(75, 5, '328', 'GY', 'GUY', 0, 0, NOW(), NOW()),
(76, 5, '332', 'HT', 'HTI', 0, 0, NOW(), NOW()),
(77, 5, '340', 'HN', 'HND', 0, 0, NOW(), NOW()),
(78, 2, '348', 'HU', 'HUN', 0, 0, NOW(), NOW()),
(79, 5, '356', 'IN', 'IND', 0, 0, NOW(), NOW()),
(80, 5, '360', 'ID', 'IDN', 0, 0, NOW(), NOW()),
(81, 4, '364', 'IR', 'IRN', 0, 0, NOW(), NOW()),
(82, 4, '368', 'IQ', 'IRQ', 0, 0, NOW(), NOW()),
(83, 2, '372', 'IE', 'IRL', 0, 0, NOW(), NOW()),
(84, 3, '352', 'IS', 'ISL', 0, 0, NOW(), NOW()),
(85, 4, '376', 'IL', 'ISR', 0, 0, NOW(), NOW()),
(86, 2, '380', 'IT', 'ITA', 0, 0, NOW(), NOW()),
(87, 5, '388', 'JM', 'JAM', 0, 0, NOW(), NOW()),
(88, 5, '392', 'JP', 'JPN', 0, 0, NOW(), NOW()),
(89, 4, '400', 'JO', 'JOR', 0, 0, NOW(), NOW()),
(90, 5, '398', 'KZ', 'KAZ', 0, 0, NOW(), NOW()),
(91, 4, '404', 'KE', 'KEN', 0, 0, NOW(), NOW()),
(92, 5, '417', 'KG', 'KGZ', 0, 0, NOW(), NOW()),
(93, 5, '296', 'KI', 'KIR', 0, 0, NOW(), NOW()),
(94, 4, '414', 'KW', 'KWT', 0, 0, NOW(), NOW()),
(95, 5, '418', 'LA', 'LAO', 0, 0, NOW(), NOW()),
(96, 4, '426', 'LS', 'LSO', 0, 0, NOW(), NOW()),
(97, 2, '428', 'LV', 'LVA', 0, 0, NOW(), NOW()),
(98, 4, '422', 'LB', 'LBN', 0, 0, NOW(), NOW()),
(99, 4, '430', 'LR', 'LBR', 0, 0, NOW(), NOW()),
(100, 4, '343', 'LY', 'LBY', 0, 0, NOW(), NOW()),
(101, 2, '438', 'LI', 'LIE', 0, 0, NOW(), NOW()),
(102, 2, '440', 'LT', 'LTU', 0, 0, NOW(), NOW()),
(103, 2, '442', 'LU', 'LUX', 0, 0, NOW(), NOW()),
(104, 3, '807', 'MK', 'MKD', 0, 0, NOW(), NOW()),
(105, 4, '450', 'MD', 'MDG', 0, 0, NOW(), NOW()),
(106, 5, '458', 'MY', 'MYS', 0, 0, NOW(), NOW()),
(107, 4, '454', 'MW', 'MWI', 0, 0, NOW(), NOW()),
(108, 5, '462', 'MV', 'MDV', 0, 0, NOW(), NOW()),
(109, 4, '466', 'ML', 'MLI', 0, 0, NOW(), NOW()),
(110, 2, '470', 'MT', 'MLT', 0, 0, NOW(), NOW()),
(111, 3, '504', 'MA', 'MAR', 0, 0, NOW(), NOW()),
(112, 5, '584', 'MH', 'MHL', 0, 0, NOW(), NOW()),
(113, 4, '480', 'MU', 'MUS', 0, 0, NOW(), NOW()),
(114, 4, '478', 'MR', 'MRT', 0, 0, NOW(), NOW()),
(115, 5, '484', 'MX', 'MEX', 0, 0, NOW(), NOW()),
(116, NULL, '583', 'FM', 'FSM', 0, 0, NOW(), NOW()),
(117, NULL, '498', 'MD', 'MDA', 0, 0, NOW(), NOW()),
(118, NULL, '492', 'MC', 'MCO', 0, 0, NOW(), NOW()),
(119, NULL, '496', 'MN', 'MNG', 0, 0, NOW(), NOW()),
(120, NULL, '508', 'MZ', 'MOZ', 0, 0, NOW(), NOW()),
(121, NULL, '516', 'NA', 'NAM', 0, 0, NOW(), NOW()),
(122, NULL, '520', 'NR', 'NRU', 0, 0, NOW(), NOW()),
(123, NULL, '524', 'NP', 'NPL', 0, 0, NOW(), NOW()),
(124, NULL, '558', 'NI', 'NIC', 0, 0, NOW(), NOW()),
(125, NULL, '562', 'NE', 'NER', 0, 0, NOW(), NOW()),
(126, NULL, '566', 'NG', 'NGA', 0, 0, NOW(), NOW()),
(117, 3, '498', 'MD', 'MDA', 0, 0, NOW(), NOW()),
(118, 1, '492', 'MC', 'MCO', 0, 0, NOW(), NOW()),
(119, 5, '496', 'MN', 'MNG', 0, 0, NOW(), NOW()),
(120, 4, '508', 'MZ', 'MOZ', 0, 0, NOW(), NOW()),
(121, 4, '516', 'NA', 'NAM', 0, 0, NOW(), NOW()),
(122, 5, '520', 'NR', 'NRU', 0, 0, NOW(), NOW()),
(123, 5, '524', 'NP', 'NPL', 0, 0, NOW(), NOW()),
(124, 5, '558', 'NI', 'NIC', 0, 0, NOW(), NOW()),
(125, 4, '562', 'NE', 'NER', 0, 0, NOW(), NOW()),
(126, 4, '566', 'NG', 'NGA', 0, 0, NOW(), NOW()),
(127, NULL, '570', 'NU', 'NIU', 0, 0, NOW(), NOW()),
(128, NULL, '578', 'NO', 'NOR', 0, 0, NOW(), NOW()),
(129, NULL, '554', 'NZ', 'NZL', 0, 0, NOW(), NOW()),
(130, NULL, '512', 'OM', 'OMN', 0, 0, NOW(), NOW()),
(131, NULL, '800', 'UG', 'UGA', 0, 0, NOW(), NOW()),
(132, NULL, '860', 'UZ', 'UZB', 0, 0, NOW(), NOW()),
(133, NULL, '586', 'PK', 'PAK', 0, 0, NOW(), NOW()),
(134, NULL, '591', 'PA', 'PAN', 0, 0, NOW(), NOW()),
(135, NULL, '598', 'PG', 'PNG', 0, 0, NOW(), NOW()),
(136, NULL, '600', 'PY', 'PRY', 0, 0, NOW(), NOW()),
(137, NULL, '528', 'NL', 'NLD', 0, 0, NOW(), NOW()),
(138, NULL, '604', 'PE', 'PER', 0, 0, NOW(), NOW()),
(139, NULL, '608', 'PH', 'PHL', 0, 0, NOW(), NOW()),
(140, NULL, '616', 'PL', 'POL', 0, 0, NOW(), NOW()),
(141, NULL, '620', 'PT', 'PRT', 0, 0, NOW(), NOW()),
(142, NULL, '634', 'QA', 'QAT', 0, 0, NOW(), NOW()),
(143, NULL, '140', 'CF', 'CAF', 0, 0, NOW(), NOW()),
(144, NULL, '214', 'DO', 'DOM', 0, 0, NOW(), NOW()),
(145, NULL, '203', 'CZ', 'CZE', 0, 0, NOW(), NOW()),
(146, NULL, '642', 'RO', 'ROU', 0, 0, NOW(), NOW()),
(147, NULL, '826', 'GB', 'GBR', 0, 0, NOW(), NOW()),
(148, NULL, '643', 'RU', 'RUS', 0, 0, NOW(), NOW()),
(149, NULL, '646', 'RW', 'RWA', 0, 0, NOW(), NOW()),
(150, NULL, '659', 'KN', 'KNA', 0, 0, NOW(), NOW()),
(151, NULL, '662', 'LC', 'LCA', 0, 0, NOW(), NOW()),
(152, NULL, '674', 'SM', 'SMR', 0, 0, NOW(), NOW()),
(153, NULL, '670', 'VC', 'VCT', 0, 0, NOW(), NOW()),
(154, NULL, '90', 'SB', 'SLB', 0, 0, NOW(), NOW()),
(128, 3, '578', 'NO', 'NOR', 0, 0, NOW(), NOW()),
(129, 5, '554', 'NZ', 'NZL', 0, 0, NOW(), NOW()),
(130, 4, '512', 'OM', 'OMN', 0, 0, NOW(), NOW()),
(131, 4, '800', 'UG', 'UGA', 0, 0, NOW(), NOW()),
(132, 5, '860', 'UZ', 'UZB', 0, 0, NOW(), NOW()),
(133, 5, '586', 'PK', 'PAK', 0, 0, NOW(), NOW()),
(134, 5, '591', 'PA', 'PAN', 0, 0, NOW(), NOW()),
(135, 5, '598', 'PG', 'PNG', 0, 0, NOW(), NOW()),
(136, 5, '600', 'PY', 'PRY', 0, 0, NOW(), NOW()),
(137, 2, '528', 'NL', 'NLD', 0, 0, NOW(), NOW()),
(138, 5, '604', 'PE', 'PER', 0, 0, NOW(), NOW()),
(139, 5, '608', 'PH', 'PHL', 0, 0, NOW(), NOW()),
(140, 2, '616', 'PL', 'POL', 0, 0, NOW(), NOW()),
(141, 2, '620', 'PT', 'PRT', 0, 0, NOW(), NOW()),
(142, 4, '634', 'QA', 'QAT', 0, 0, NOW(), NOW()),
(143, 4, '140', 'CF', 'CAF', 0, 0, NOW(), NOW()),
(144, 5, '214', 'DO', 'DOM', 0, 0, NOW(), NOW()),
(145, 2, '203', 'CZ', 'CZE', 0, 0, NOW(), NOW()),
(146, 2, '642', 'RO', 'ROU', 0, 0, NOW(), NOW()),
(147, 2, '826', 'GB', 'GBR', 0, 0, NOW(), NOW()),
(148, 3, '643', 'RU', 'RUS', 0, 0, NOW(), NOW()),
(149, 4, '646', 'RW', 'RWA', 0, 0, NOW(), NOW()),
(150, 5, '659', 'KN', 'KNA', 0, 0, NOW(), NOW()),
(151, 5, '662', 'LC', 'LCA', 0, 0, NOW(), NOW()),
(152, 2, '674', 'SM', 'SMR', 0, 0, NOW(), NOW()),
(153, 5, '670', 'VC', 'VCT', 0, 0, NOW(), NOW()),
(154, 5, '90', 'SB', 'SLB', 0, 0, NOW(), NOW()),
(155, NULL, '222', 'SV', 'SLV', 0, 0, NOW(), NOW()),
(156, NULL, '882', 'WS', 'WSM', 0, 0, NOW(), NOW()),
(157, NULL, '678', 'ST', 'STP', 0, 0, NOW(), NOW()),
(158, NULL, '686', 'SN', 'SEN', 0, 0, NOW(), NOW()),
(159, NULL, '690', 'SC', 'SYC', 0, 0, NOW(), NOW()),
(160, NULL, '694', 'SL', 'SLE', 0, 0, NOW(), NOW()),
(161, NULL, '702', 'SG', 'SGP', 0, 0, NOW(), NOW()),
(162, NULL, '703', 'SK', 'SVK', 0, 0, NOW(), NOW()),
(163, NULL, '705', 'SI', 'SVN', 0, 0, NOW(), NOW()),
(164, NULL, '706', 'SO', 'SOM', 0, 0, NOW(), NOW()),
(165, NULL, '729', 'SD', 'SDN', 0, 0, NOW(), NOW()),
(166, NULL, '144', 'LK', 'LKA', 0, 0, NOW(), NOW()),
(167, NULL, '752', 'SE', 'SWE', 0, 0, NOW(), NOW()),
(168, NULL, '756', 'CH', 'CHE', 0, 0, NOW(), NOW()),
(169, NULL, '740', 'SR', 'SUR', 0, 0, NOW(), NOW()),
(170, NULL, '748', 'SZ', 'SWZ', 0, 0, NOW(), NOW()),
(171, NULL, '760', 'SY', 'SYR', 0, 0, NOW(), NOW()),
(172, NULL, '762', 'TJ', 'TJK', 0, 0, NOW(), NOW()),
(173, NULL, '834', 'TZ', 'TZA', 0, 0, NOW(), NOW()),
(174, NULL, '148', 'TD', 'TCD', 0, 0, NOW(), NOW()),
(175, NULL, '764', 'TH', 'THA', 0, 0, NOW(), NOW()),
(176, NULL, '768', 'TG', 'TGO', 0, 0, NOW(), NOW()),
(177, NULL, '776', 'TO', 'TON', 0, 0, NOW(), NOW()),
(178, NULL, '780', 'TT', 'TTO', 0, 0, NOW(), NOW()),
(179, NULL, '788', 'TN', 'TUN', 0, 0, NOW(), NOW()),
(180, NULL, '795', 'TM', 'TKM', 0, 0, NOW(), NOW()),
(181, NULL, '792', 'TR', 'TUR', 0, 0, NOW(), NOW()),
(182, NULL, '798', 'TV', 'TUV', 0, 0, NOW(), NOW()),
(183, NULL, '804', 'UA', 'UKR', 0, 0, NOW(), NOW()),
(184, NULL, '858', 'UY', 'URY', 0, 0, NOW(), NOW()),
(185, NULL, '336', 'VA', 'VAT', 0, 0, NOW(), NOW()),
(186, NULL, '548', 'VU', 'VUT', 0, 0, NOW(), NOW()),
(187, NULL, '862', 'VE', 'VEN', 0, 0, NOW(), NOW()),
(188, NULL, '704', 'VN', 'VNM', 0, 0, NOW(), NOW()),
(189, NULL, '887', 'YE', 'YEM', 0, 0, NOW(), NOW()),
(190, NULL, '807', 'MK', 'MKD', 0, 0, NOW(), NOW()),
(191, NULL, '180', 'CD', 'COD', 0, 0, NOW(), NOW()),
(192, NULL, '894', 'ZM', 'ZMB', 0, 0, NOW(), NOW()),
(193, NULL, '716', 'ZW', 'ZWE', 0, 0, NOW(), NOW()),
(196, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(197, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(198, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(199, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(200, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(201, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(202, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(203, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(204, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(205, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(206, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(207, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(208, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(209, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(210, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(211, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(212, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(213, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(214, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(215, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(216, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(217, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(218, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(219, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(220, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(221, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(222, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(223, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(224, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(225, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(226, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(227, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(228, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(229, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(230, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(231, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(232, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(233, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(234, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(235, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(236, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(237, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(238, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(239, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(240, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(241, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(242, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(243, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(244, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(245, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(246, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(247, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(248, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(249, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(250, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(251, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(252, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(253, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(254, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(255, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(256, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(257, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(258, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(259, NULL, '312', 'GP', 'GLP', 0, 0, NOW(), NOW()),
(260, NULL, '254', 'GF', 'GUF', 0, 0, NOW(), NOW()),
(261, NULL, '474', 'MQ', 'MTQ', 0, 0, NOW(), NOW()),
(262, NULL, '175', 'YT', 'MYT', 0, 0, NOW(), NOW()),
(263, NULL, '638', 'RE', 'REU', 0, 0, NOW(), NOW()),
(264, NULL, '666', 'PM', 'SPM', 0, 0, NOW(), NOW()),
(265, NULL, '540', 'NC', 'NCL', 0, 0, NOW(), NOW()),
(266, NULL, '258', 'PF', 'PYF', 0, 0, NOW(), NOW()),
(267, NULL, '876', 'WF', 'WLF', 0, 0, NOW(), NOW()),
(268, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW());
(156, 5, '882', 'WS', 'WSM', 0, 0, NOW(), NOW()),
(157, 4, '678', 'ST', 'STP', 0, 0, NOW(), NOW()),
(158, 4, '686', 'SN', 'SEN', 0, 0, NOW(), NOW()),
(159, 4, '690', 'SC', 'SYC', 0, 0, NOW(), NOW()),
(160, 4, '694', 'SL', 'SLE', 0, 0, NOW(), NOW()),
(161, 5, '702', 'SG', 'SGP', 0, 0, NOW(), NOW()),
(162, 2, '703', 'SK', 'SVK', 0, 0, NOW(), NOW()),
(163, 2, '705', 'SI', 'SVN', 0, 0, NOW(), NOW()),
(164, 4, '706', 'SO', 'SOM', 0, 0, NOW(), NOW()),
(165, 4, '729', 'SD', 'SDN', 0, 0, NOW(), NOW()),
(166, 5, '144', 'LK', 'LKA', 0, 0, NOW(), NOW()),
(167, 2, '752', 'SE', 'SWE', 0, 0, NOW(), NOW()),
(168, 2, '756', 'CH', 'CHE', 0, 0, NOW(), NOW()),
(169, 5, '740', 'SR', 'SUR', 0, 0, NOW(), NOW()),
(170, 4, '748', 'SZ', 'SWZ', 0, 0, NOW(), NOW()),
(171, 4, '760', 'SY', 'SYR', 0, 0, NOW(), NOW()),
(172, 5, '762', 'TJ', 'TJK', 0, 0, NOW(), NOW()),
(173, 5, '834', 'TZ', 'TZA', 0, 0, NOW(), NOW()),
(174, 4, '148', 'TD', 'TCD', 0, 0, NOW(), NOW()),
(175, 5, '764', 'TH', 'THA', 0, 0, NOW(), NOW()),
(176, 4, '768', 'TG', 'TGO', 0, 0, NOW(), NOW()),
(177, 5, '776', 'TO', 'TON', 0, 0, NOW(), NOW()),
(178, 5, '780', 'TT', 'TTO', 0, 0, NOW(), NOW()),
(179, 3, '788', 'TN', 'TUN', 0, 0, NOW(), NOW()),
(180, 5, '795', 'TM', 'TKM', 0, 0, NOW(), NOW()),
(181, 3, '792', 'TR', 'TUR', 0, 0, NOW(), NOW()),
(182, 5, '798', 'TV', 'TUV', 0, 0, NOW(), NOW()),
(183, 2, '804', 'UA', 'UKR', 0, 0, NOW(), NOW()),
(184, 5, '858', 'UY', 'URY', 0, 0, NOW(), NOW()),
(185, 2, '336', 'VA', 'VAT', 0, 0, NOW(), NOW()),
(186, 5, '548', 'VU', 'VUT', 0, 0, NOW(), NOW()),
(187, 5, '862', 'VE', 'VEN', 0, 0, NOW(), NOW()),
(188, 5, '704', 'VN', 'VNM', 0, 0, NOW(), NOW()),
(189, 4, '887', 'YE', 'YEM', 0, 0, NOW(), NOW()),
(191, 4, '180', 'CD', 'COD', 0, 0, NOW(), NOW()),
(192, 4, '894', 'ZM', 'ZMB', 0, 0, NOW(), NOW()),
(193, 4, '716', 'ZW', 'ZWE', 0, 0, NOW(), NOW()),
(196, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(197, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(198, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(199, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(200, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(201, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(202, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(203, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(204, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(205, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(206, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(207, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(208, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(209, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(210, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(211, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(212, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(213, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(214, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(215, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(216, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(217, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(218, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(219, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(220, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(221, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(222, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(223, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(224, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(225, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(226, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(227, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(228, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(229, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(230, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(231, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(232, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(233, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(234, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(235, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(236, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(237, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(238, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(239, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(240, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(241, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(242, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(243, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(244, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(245, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
(246, 4, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(247, 4, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(248, 4, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(249, 4, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(250, 4, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(251, 4, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(252, 4, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(253, 4, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(254, 4, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(255, 4, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(256, 4, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(257, 4, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(258, 4, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
(259, 6, '312', 'GP', 'GLP', 0, 0, NOW(), NOW()),
(260, 6, '254', 'GF', 'GUF', 0, 0, NOW(), NOW()),
(261, 6, '474', 'MQ', 'MTQ', 0, 0, NOW(), NOW()),
(262, 6, '175', 'YT', 'MYT', 0, 0, NOW(), NOW()),
(263, 6, '638', 'RE', 'REU', 0, 0, NOW(), NOW()),
(264, 6, '666', 'PM', 'SPM', 0, 0, NOW(), NOW()),
(265, 7, '540', 'NC', 'NCL', 0, 0, NOW(), NOW()),
(266, 7, '258', 'PF', 'PYF', 0, 0, NOW(), NOW()),
(267, 7, '876', 'WF', 'WLF', 0, 0, NOW(), NOW()),
(268, 4, '840', 'US', 'USA', 0, 0, NOW(), NOW());
INSERT INTO `country_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES
(1, 'en_US', 'Afghanistan', '', '', ''),
@@ -423,7 +426,7 @@ INSERT INTO `country_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `po
(18, 'fr_FR', 'Barbade', '', '', ''),
(19, 'en_US', 'Belarus', '', '', ''),
(19, 'es_ES', 'Belarús', '', '', ''),
(19, 'fr_FR', 'Belau', '', '', ''),
(19, 'fr_FR', 'Belarus', '', '', ''),
(20, 'en_US', 'Belgium', '', '', ''),
(20, 'es_ES', 'Bélgica', '', '', ''),
(20, 'fr_FR', 'Belgique', '', '', ''),

View File

@@ -0,0 +1,87 @@
<div class="row">
<div class="col-md-12">
<div class="alert alert-info">
<p>{intl l="Colissimo Module allows to send your products all around the world with La Poste."}</p>
</div>
<div class="alert alert-danger">
<p>{intl l="Prices are not dynamically editable yet."}</p>
<p>{intl l="Prices below can be edited in local/modules/Colissimo/Config/prices.json file."}</p>
</div>
<div class="general-block-decorator">
{loop type="area" name="list area" backend_context=true}
<div class="table-responsive">
<table class="table table-striped table-condensed table-left-aligned">
<caption class="clearfix">
{intl l="Area : "}{$NAME}
{loop type="auth" name="can_create" role="ADMIN" module="colissimo" access="CREATE"}
<a class="btn btn-default btn-primary pull-right" title="{intl l='Create a new price slice'}" href="#price_slice_create_dialog" data-toggle="modal">
<span class="glyphicon glyphicon-plus"></span>
</a>
{/loop}
</caption>
<thead>
<tr>
<th class="col-md-3">{intl l="Weight lower than ... (kg)"}</th>
<th class="col-md-5">{intl l="Price (€)"}</th>
<th class="col-md-1">{intl l="Actions"}</th>
</tr>
</thead>
<tbody>
{loop type="colissimo" name="colissimo" area=$ID}
<tr>
<td>{$MAX_WEIGHT}</td>
<td>{$PRICE}</td>
<td>
<div class="btn-group">
{loop type="auth" name="can_change" role="ADMIN" module="colissimo" access="UPDATE"}
<a class="btn btn-default btn-xs" title="{intl l='Delete this price slice'}" href="#price_slice_delete_dialog" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
{/loop}
</div>
</td>
</tr>
{/loop}
</tbody>
</table>
</div>
{/loop}
</div>
</div>
</div>
{* -- Add price slice confirmation dialog ----------------------------------- *}
{include
file = "includes/generic-create-dialog.html"
dialog_id = "price_slice_create_dialog"
dialog_title = {intl l="Create a price slice"}
dialog_body = "Not available yet."
dialog_ok_label = {intl l="Create"}
dialog_cancel_label = {intl l="Cancel"}
}
{* -- Delete price slice confirmation dialog ----------------------------------- *}
{include
file = "includes/generic-confirm-dialog.html"
dialog_id = "price_slice_delete_dialog"
dialog_title = {intl l="Delete a price slice"}
dialog_message = "Not available yet."
dialog_ok_label = {intl l="Delete"}
dialog_cancel_label = {intl l="Cancel"}
}
<script type="text/javascript">
jQuery(function($) {
})
</script>

View File

@@ -25,6 +25,7 @@ namespace Colissimo;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Thelia\Exception\OrderException;
use Thelia\Model\Country;
use Thelia\Module\BaseModule;
use Thelia\Module\DeliveryModuleInterface;
@@ -34,6 +35,58 @@ class Colissimo extends BaseModule implements DeliveryModuleInterface
protected $request;
protected $dispatcher;
private static $prices = null;
const JSON_PRICE_RESOURCE = "prices.json";
public static function getPrices()
{
if(null === self::$prices) {
self::$prices = json_decode(file_get_contents(sprintf('%s/Config/%s', __DIR__, self::JSON_PRICE_RESOURCE)), true);
}
return self::$prices;
}
/**
* @param $areaId
* @param $weight
*
* @return mixed
* @throws \Thelia\Exception\OrderException
*/
public static function getPostageAmount($areaId, $weight)
{
$prices = self::getPrices();
/* check if Colissimo delivers the asked area */
if(!isset($prices[$areaId]) || !isset($prices[$areaId]["slices"])) {
throw new OrderException("Colissimo delivery unavailable for the chosen delivery country", OrderException::DELIVERY_MODULE_UNAVAILABLE);
}
$areaPrices = $prices[$areaId]["slices"];
ksort($areaPrices);
/* check this weight is not too much */
end($areaPrices);
$maxWeight = key($areaPrices);
if($weight > $maxWeight) {
throw new OrderException(sprintf("Colissimo delivery unavailable for this cart weight (%s kg)", $weight), OrderException::DELIVERY_MODULE_UNAVAILABLE);
}
$postage = current($areaPrices);
while(prev($areaPrices)) {
if($weight > key($areaPrices)) {
break;
}
$postage = current($areaPrices);
}
return $postage;
}
public function setRequest(Request $request)
{
$this->request = $request;
@@ -60,11 +113,18 @@ class Colissimo extends BaseModule implements DeliveryModuleInterface
*
* @param Country $country
* @return mixed
* @throws \Thelia\Exception\OrderException
*/
public function getPostage(Country $country)
{
// TODO: Implement getPostage() method.
return 2;
$cartWeight = $this->getContainer()->get('request')->getSession()->getCart()->getWeight();
$postage = self::getPostageAmount(
$country->getAreaId(),
$cartWeight
);
return $postage;
}
public function getCode()

View File

@@ -5,9 +5,7 @@
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
<loops>
<!-- sample definition
<loop name="MySuperLoop" class="MyModule\Loop\MySuperLoop" />
-->
<loop class="Colissimo\Loop\Price" name="colissimo"/>
</loops>
<forms>

View File

@@ -0,0 +1,128 @@
{
"1": {
"_info": "area 1 : France",
"slices": {
"0.25": 5.23,
"0.5": 5.8,
"0.75": 6.56,
"1": 7.13,
"2": 8.08,
"3": 9.22,
"5": 11.31,
"7": 13.4,
"10": 16.53,
"15": 19.14,
"30": 26.93
}
},
"2": {
"_info": "area 2 : A Zone - Union Européenne et Suisse",
"slices": {
"1": 15.34,
"2": 16.96,
"3": 20.47,
"4": 23.99,
"5": 27.5,
"6": 31.02,
"7": 34.53,
"8": 38.05,
"9": 41.56,
"10": 45.08,
"15": 51.92,
"20": 58.76,
"25": 65.6,
"30": 72.44
}
},
"3": {
"_info": "area 3 : B Zone - Pays de lEurope de lEst (hors Union Européenne), Norvège, Maghreb",
"slices": {
"1": 18.81,
"2": 20.62,
"3": 24.94,
"4": 29.26,
"5": 33.58,
"6": 37.91,
"7": 42.23,
"8": 46.55,
"9": 50.87,
"10": 55.2,
"15": 65.08,
"20": 74.96
}
},
"4": {
"_info": "area 4 : C Zone - Pays dAfrique hors Maghreb, Canada, Etats-Unis, Proche et Moyen Orient",
"slices": {
"1": 22.04,
"2": 29.55,
"3": 38.86,
"4": 48.17,
"5": 57.48,
"6": 66.79,
"7": 76.1,
"8": 85.41,
"9": 94.72,
"10": 104.03,
"15": 126.92,
"20": 149.82
}
},
"5": {
"_info": "area 5 : D Zone - Autres destinations",
"slices": {
"1": 25.08,
"2": 37.72,
"3": 50.26,
"4": 62.8,
"5": 75.34,
"6": 87.88,
"7": 100.42,
"8": 112.96,
"9": 125.5,
"10": 138.04,
"15": 162.74,
"20": 187.44
}
},
"6": {
"_info": "area 6 : France OM1",
"slices": {
"0.5": 8.27,
"1": 12.49,
"2": 17.05,
"3": 21.61,
"4": 26.17,
"5": 30.73,
"6": 35.29,
"7": 39.85,
"8": 44.41,
"9": 48.97,
"10": 53.53,
"15": 76.33,
"20": 99.13,
"25": 121.93,
"30": 144.73
}
},
"7": {
"_info": "area 7 : France OM2",
"slices": {
"0.5": 9.88,
"1": 14.92,
"2": 26.32,
"3": 37.72,
"4": 49.12,
"5": 60.52,
"6": 71.92,
"7": 83.32,
"8": 94.72,
"9": 106.12,
"10": 117.52,
"15": 174.52,
"20": 231.52,
"25": 288.52,
"30": 345.52
}
}
}

View File

@@ -0,0 +1,88 @@
<?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 Colissimo\Loop;
use Colissimo\Colissimo;
use Thelia\Core\Template\Element\ArraySearchLoopInterface;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
/**
*
* Price loop
*
*
* Class Price
* @package Colissimo\Loop
* @author Etienne Roudeix <eroudeix@openstudio.fr>
*/
class Price extends BaseLoop implements ArraySearchLoopInterface
{
/* set countable to false since we need to preserve keys */
protected $countable = false;
/**
* @return ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntTypeArgument('area', null, true)
);
}
public function buildArray()
{
$area = $this->getArea();
$prices = Colissimo::getPrices();
if(!isset($prices[$area]) || !isset($prices[$area]["slices"])) {
return array();
}
$areaPrices = $prices[$area]["slices"];
ksort($areaPrices);
return $areaPrices;
}
public function parseResults(LoopResult $loopResult)
{
foreach ($loopResult->getResultDataCollection() as $maxWeight => $price) {
$loopResultRow = new LoopResultRow();
$loopResultRow->set("MAX_WEIGHT", $maxWeight)
->set("PRICE", $price);
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}

View File

@@ -0,0 +1,3 @@
Colissimo prices based on April 2013 pdf.
TarifsAvril2013.pdf is available in this module documentation folder.
You may update prices in Config/prices.json file.

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?>
<config xmlns="http://thelia.net/schema/dic/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
<forms>
<!--
<form name="MyFormName" class="MyModule\Form\MySuperForm" />
-->
</forms>
<services>
<service id="router.front" class="%router.class%">
<argument type="service" id="router.module.xmlLoader"/>
<argument>Front/Config/front.xml</argument>
<argument type="collection">
<argument key="cache_dir">%kernel.cache_dir%</argument>
<argument key="debug">%kernel.debug%</argument>
</argument>
<argument type="service" id="request.context"/>
<tag name="router.register" priority="128"/>
</service>
</services>
</config>

View File

@@ -16,51 +16,51 @@
<!-- Register -->
<route id="customer.create.process" path="/register" methods="post">
<default key="_controller">Thelia\Controller\Front\CustomerController::createAction</default>
<default key="_controller">Front\Controller\CustomerController::createAction</default>
<default key="_view">register</default>
</route>
<!-- Login -->
<route id="customer.login.process" path="/login" methods="post">
<default key="_controller">Thelia\Controller\Front\CustomerController::loginAction</default>
<default key="_controller">Front\Controller\CustomerController::loginAction</default>
<default key="_view">login</default>
</route>
<!-- Forgot Password -->
<route id="customer.password.retrieve.process" path="/password" methods="post">
<default key="_controller">Thelia\Controller\Front\CustomerController::newPasswordAction</default>
<default key="_controller">Front\Controller\CustomerController::newPasswordAction</default>
<default key="_view">password</default>
</route>
<!-- Logout -->
<route id="customer.logout.process" path="/logout">
<default key="_controller">Thelia\Controller\Front\CustomerController::logoutAction</default>
<default key="_controller">Front\Controller\CustomerController::logoutAction</default>
</route>
<!-- Account -->
<route id="customer.update.view" path="/account/update" methods="get">
<default key="_controller">Thelia\Controller\Front\CustomerController::viewAction</default>
<default key="_controller">Front\Controller\CustomerController::viewAction</default>
<default key="_view">account-update</default>
</route>
<route id="customer.update.process" path="/account/update" methods="post">
<default key="_controller">Thelia\Controller\Front\CustomerController::updateAction</default>
<default key="_controller">Front\Controller\CustomerController::updateAction</default>
<default key="_view">account-update</default>
</route>
<route id="customer.password.change.process" path="/account/password" methods="post">
<default key="_controller">Thelia\Controller\Front\CustomerController::updatePasswordAction</default>
<default key="_controller">Front\Controller\CustomerController::updatePasswordAction</default>
<default key="_view">account-password</default>
</route>
<route id="customer.password.change.view" path="/account/password" methods="get">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_controller">Front\Controller\DefaultController::noAction</default>
<default key="_view">account-password</default>
</route>
<route id="customer.order.pdf.delivery" path="/account/order/pdf/delivery/{order_id}">
<default key="_controller">Thelia\Controller\Front\OrderController::generateDeliveryPdf</default>
<default key="_controller">Front\Controller\OrderController::generateDeliveryPdf</default>
<requirement key="order_id">\d+</requirement>
</route>
<!-- end customer routes -->
@@ -72,27 +72,27 @@
</route>
<route id="address.create" path="/address/create" methods="post" >
<default key="_controller">Thelia\Controller\Front\AddressController::createAction</default>
<default key="_controller">Front\Controller\AddressController::createAction</default>
<default key="_view">address</default>
</route>
<route id="address.edit" path="/address/update/{address_id}" methods="get">
<default key="_controller">Thelia\Controller\Front\AddressController::updateViewAction</default>
<default key="_controller">Front\Controller\AddressController::updateViewAction</default>
<default key="_view">address-update</default>
</route>
<route id="address.update" path="/address/update/{address_id}" methods="post" >
<default key="_controller">Thelia\Controller\Front\AddressController::processUpdateAction</default>
<default key="_controller">Front\Controller\AddressController::processUpdateAction</default>
<default key="_view">address-update</default>
</route>
<route id="address.delete" path="/address/delete/{address_id}">
<default key="_controller">Thelia\Controller\Front\AddressController::deleteAction</default>
<default key="_controller">Front\Controller\AddressController::deleteAction</default>
<default key="_view">account</default>
</route>
<route id="address.generateModal" path="/address/modal/{address_id}" methods="get">
<default key="_controller">Thelia\Controller\Front\AddressController::generateModalAction</default>
<default key="_controller">Front\Controller\AddressController::generateModalAction</default>
<default key="_view">modal-address</default>
<requirement key="address_id">\d+</requirement>
</route>
@@ -106,24 +106,23 @@
</route>
<route id="cart.add.process" path="/cart/add">
<default key="_controller">Thelia\Controller\Front\CartController::addItem</default>
<default key="_controller">Front\Controller\CartController::addItem</default>
</route>
<route id="cart.delete.process" path="/cart/delete/{cart_item}">
<default key="_controller">Thelia\Controller\Front\CartController::deleteItem</default>
<default key="_controller">Front\Controller\CartController::deleteItem</default>
<default key="_view">cart</default>
</route>
<route id="cart.update.quantity" path="/cart/update">
<default key="_controller">Thelia\Controller\Front\CartController::changeItem</default>
<default key="_controller">Thelia\Controller\Front\CartController::changeItem</default>
<default key="_controller">Front\Controller\CartController::changeItem</default>
<default key="_view">cart</default>
</route>
<!-- end cart routes -->
<!-- order management process -->
<route id="order.delivery.process" path="/order/delivery" methods="post">
<default key="_controller">Thelia\Controller\Front\OrderController::deliver</default>
<default key="_controller">Front\Controller\OrderController::deliver</default>
<default key="_view">order-delivery</default>
</route>
@@ -133,7 +132,7 @@
</route>
<route id="order.invoice.process" path="/order/invoice" methods="post">
<default key="_controller">Thelia\Controller\Front\OrderController::invoice</default>
<default key="_controller">Front\Controller\OrderController::invoice</default>
<default key="_view">order-invoice</default>
</route>
@@ -143,23 +142,23 @@
</route>
<route id="order.coupon.process" path="/order/coupon" methods="post">
<default key="_controller">Thelia\Controller\Front\CouponController::consumeAction</default>
<default key="_controller">Front\Controller\CouponController::consumeAction</default>
<default key="_view">order-invoice</default>
</route>
<route id="order.payment.process" path="/order/pay">
<default key="_controller">Thelia\Controller\Front\OrderController::pay</default>
<default key="_controller">Front\Controller\OrderController::pay</default>
</route>
<route id="order.placed" path="/order/placed/{order_id}">
<default key="_controller">Thelia\Controller\Front\OrderController::orderPlaced</default>
<default key="_controller">Front\Controller\OrderController::orderPlaced</default>
<default key="_view">order-placed</default>
</route>
<!-- end order management process -->
<!-- contact management -->
<route id="contact.send" path="/contact" methods="post">
<default key="_controller">Thelia\Controller\Front\ContactController::sendAction</default>
<default key="_controller">Front\Controller\ContactController::sendAction</default>
<default key="_view">contact</default>
</route>
@@ -171,7 +170,7 @@
<!-- newsletter management -->
<route id="newsletter.process" path="/newsletter" methods="post">
<default key="_controller">Thelia\Controller\Front\NewsletterController::subscribeAction</default>
<default key="_controller">Front\Controller\NewsletterController::subscribeAction</default>
<default key="_view">newsletter</default>
</route>
<!-- end newsletter management -->

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<module>
<fullnamespace>Front\Front</fullnamespace>
<descriptive locale="en_US">
<title>front integration</title>
<description></description>
</descriptive>
<descriptive locale="fr_FR">
<title>front office module</title>
<description></description>
</descriptive>
<version>0.1</version>
<author>
<name>Thelia team</name>
<email>info@thelia.net</email>
</author>
<type>classic</type>
<thelia>2.0.0</thelia>
<stability>alpha</stability>
</module>

View File

@@ -21,7 +21,8 @@
/* */
/*************************************************************************************/
namespace Thelia\Controller\Front;
namespace Front\Controller;
use Thelia\Controller\Front\BaseFrontController;
use Thelia\Core\Event\Address\AddressCreateOrUpdateEvent;
use Thelia\Core\Event\Address\AddressEvent;
use Thelia\Core\Event\TheliaEvents;

View File

@@ -20,9 +20,10 @@
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Controller\Front;
namespace Front\Controller;
use Propel\Runtime\Exception\PropelException;
use Thelia\Controller\Front\BaseFrontController;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Core\Event\Cart\CartEvent;
use Thelia\Core\Event\TheliaEvents;

View File

@@ -21,7 +21,8 @@
/* */
/*************************************************************************************/
namespace Thelia\Controller\Front;
namespace Front\Controller;
use Thelia\Controller\Front\BaseFrontController;
use Thelia\Form\ContactForm;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Model\ConfigQuery;

View File

@@ -20,9 +20,10 @@
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Controller\Front;
namespace Front\Controller;
use Propel\Runtime\Exception\PropelException;
use Thelia\Controller\Front\BaseFrontController;
use Thelia\Core\Event\Coupon\CouponConsumeEvent;
use Thelia\Form\CouponCode;
use Thelia\Form\Exception\FormValidationException;

View File

@@ -20,8 +20,9 @@
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Controller\Front;
namespace Front\Controller;
use Thelia\Controller\Front\BaseFrontController;
use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
use Thelia\Core\Event\Customer\CustomerLoginEvent;
use Thelia\Core\Event\LostPasswordEvent;

View File

@@ -21,8 +21,9 @@
/* */
/*************************************************************************************/
namespace Thelia\Controller\Front;
namespace Front\Controller;
use Thelia\Controller\Front\BaseFrontController;
use Thelia\Core\Event\Newsletter\NewsletterEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Form\NewsletterForm;

View File

@@ -20,9 +20,10 @@
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Controller\Front;
namespace Front\Controller;
use Propel\Runtime\Exception\PropelException;
use Thelia\Controller\Front\BaseFrontController;
use Thelia\Core\Event\PdfEvent;
use Thelia\Core\HttpFoundation\Response;
use Thelia\Core\Template\TemplateHelper;
@@ -84,8 +85,7 @@ class OrderController extends BaseFrontController
}
/* get postage amount */
$moduleReflection = new \ReflectionClass($deliveryModule->getFullNamespace());
$moduleInstance = $moduleReflection->newInstance();
$moduleInstance = $this->container->get(sprintf('module.%s', $deliveryModule->getCode()));
$postage = $moduleInstance->getPostage($deliveryAddress->getCountry());
$orderEvent = $this->getOrderEvent();

View File

@@ -0,0 +1,35 @@
<?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 Front;
use Thelia\Module\BaseModule;
class Front extends BaseModule
{
/**
* YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class
* Like install and destroy
*/
}

View File

@@ -0,0 +1 @@
Hello World

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<phpdoc>
<title><![CDATA[<b>Thelia</b> e-commerce Project]]></title>
<parser>
<target>documentation/api</target>
</parser>
<transformer>
<target>documentation/api</target>
</transformer>
<files>
<ignore>core/lib/Thelia/Tests/*</ignore>
<directory>core/lib/Thelia</directory>
</files>
</phpdoc>

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View File

Before

Width:  |  Height:  |  Size: 509 B

After

Width:  |  Height:  |  Size: 509 B

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Some files were not shown because too many files have changed in this diff Show More