Inital commit
This commit is contained in:
@@ -15,12 +15,20 @@
|
||||
</route>
|
||||
|
||||
<!-- Register -->
|
||||
<route id="customer.create.view" path="/register" methods="get">
|
||||
<default key="_controller">Front\Controller\CustomerController::viewRegisterAction</default>
|
||||
</route>
|
||||
|
||||
<route id="customer.create.process" path="/register" methods="post">
|
||||
<default key="_controller">Front\Controller\CustomerController::createAction</default>
|
||||
<default key="_view">register</default>
|
||||
</route>
|
||||
|
||||
<!-- Login -->
|
||||
<route id="customer.login.view" path="/login" methods="get">
|
||||
<default key="_controller">Front\Controller\CustomerController::viewLoginAction</default>
|
||||
</route>
|
||||
|
||||
<route id="customer.login.process" path="/login" methods="post">
|
||||
<default key="_controller">Front\Controller\CustomerController::loginAction</default>
|
||||
<default key="_view">login</default>
|
||||
@@ -32,12 +40,28 @@
|
||||
<default key="_view">password</default>
|
||||
</route>
|
||||
|
||||
<route id="customer.password.retrieve.sent" path="/password-sent">
|
||||
<default key="_controller">Front\Controller\CustomerController::newPasswordSentAction</default>
|
||||
<default key="_view">password</default>
|
||||
</route>
|
||||
|
||||
<!-- Logout -->
|
||||
<route id="customer.logout.process" path="/logout">
|
||||
<default key="_controller">Front\Controller\CustomerController::logoutAction</default>
|
||||
</route>
|
||||
|
||||
<!-- Confirm customer -->
|
||||
<route id="customer.confirm.token" path="/customer/confirm/{token}">
|
||||
<default key="_controller">Front\Controller\CustomerController::confirmCustomerAction</default>
|
||||
</route>
|
||||
|
||||
<!-- Account -->
|
||||
|
||||
<route id="customer.home" path="/account" methods="get">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_view">account</default>
|
||||
</route>
|
||||
|
||||
<route id="customer.update.view" path="/account/update" methods="get">
|
||||
<default key="_controller">Front\Controller\CustomerController::viewAction</default>
|
||||
<default key="_view">account-update</default>
|
||||
@@ -59,6 +83,11 @@
|
||||
<default key="_view">account-password</default>
|
||||
</route>
|
||||
|
||||
<route id="customer.order" path="/account/order/{order_id}">
|
||||
<default key="_controller">Front\Controller\OrderController::viewAction</default>
|
||||
<requirement key="order_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="customer.order.pdf.delivery" path="/account/order/pdf/delivery/{order_id}">
|
||||
<default key="_controller">Front\Controller\OrderController::generateDeliveryPdf</default>
|
||||
<requirement key="order_id">\d+</requirement>
|
||||
@@ -68,6 +97,11 @@
|
||||
<default key="_controller">Front\Controller\OrderController::generateInvoicePdf</default>
|
||||
<requirement key="order_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="customer.order.product.download" path="/account/download/{order_product_id}">
|
||||
<default key="_controller">Front\Controller\OrderController::downloadVirtualProduct</default>
|
||||
<requirement key="order_product_id">\d+</requirement>
|
||||
</route>
|
||||
<!-- end customer routes -->
|
||||
|
||||
<!-- customer address routes -->
|
||||
@@ -102,6 +136,11 @@
|
||||
<requirement key="address_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="address.make.default" path="/address/default/{addressId}" methods="get">
|
||||
<default key="_controller">Front:Address:makeAddressDefault</default>
|
||||
<requirement key="addressId">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<!-- end customer address routes -->
|
||||
|
||||
<!-- cart routes -->
|
||||
@@ -137,7 +176,7 @@
|
||||
</route>
|
||||
|
||||
<route id="order.delivery" path="/order/delivery">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_controller">Front\Controller\OrderController::deliverView</default>
|
||||
<default key="_view">order-delivery</default>
|
||||
</route>
|
||||
|
||||
@@ -197,6 +236,12 @@
|
||||
<default key="_controller">Front\Controller\NewsletterController::subscribeAction</default>
|
||||
<default key="_view">newsletter</default>
|
||||
</route>
|
||||
|
||||
<route id="newsletter.unsubscribe" path="/newsletter-unsubscribe" methods="post">
|
||||
<default key="_controller">Front\Controller\NewsletterController::unsubscribeAction</default>
|
||||
<default key="_view">newsletter-unsubscribe</default>
|
||||
</route>
|
||||
|
||||
<!-- end newsletter management -->
|
||||
|
||||
<!-- sitemap generator -->
|
||||
@@ -214,11 +259,15 @@
|
||||
</route>
|
||||
<!-- end feed generator -->
|
||||
|
||||
<!-- Route used to check if the rewrite engine is activated -->
|
||||
<route id="empty" path="/empty">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::emptyRoute</default>
|
||||
</route>
|
||||
|
||||
<!-- Default Route -->
|
||||
<route id="default" path="/{_view}">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_view">index</default>
|
||||
<requirement key="_view">^(?!admin)[^/]+</requirement>
|
||||
<requirement key="_view">^(?!admin|api)[^/]+</requirement>
|
||||
</route>
|
||||
|
||||
</routes>
|
||||
|
||||
@@ -1,20 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module>
|
||||
<module xmlns="http://thelia.net/schema/dic/module"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_2.xsd">
|
||||
<fullnamespace>Front\Front</fullnamespace>
|
||||
<descriptive locale="en_US">
|
||||
<title>front integration</title>
|
||||
<title>Front integration</title>
|
||||
<description></description>
|
||||
</descriptive>
|
||||
<descriptive locale="fr_FR">
|
||||
<title>front office module</title>
|
||||
<title>Front office module</title>
|
||||
<description></description>
|
||||
</descriptive>
|
||||
<version>0.1</version>
|
||||
<author>
|
||||
<name>Thelia team</name>
|
||||
<email>info@thelia.net</email>
|
||||
</author>
|
||||
<languages>
|
||||
<language>en_US</language>
|
||||
<language>fr_FR</language>
|
||||
</languages>
|
||||
<version>2.3.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Thelia team</name>
|
||||
<email>info@thelia.net</email>
|
||||
</author>
|
||||
</authors>
|
||||
<type>classic</type>
|
||||
<thelia>2.0.0</thelia>
|
||||
<thelia>2.2.0</thelia>
|
||||
<stability>alpha</stability>
|
||||
<hidden>1</hidden>
|
||||
</module>
|
||||
|
||||
@@ -1,227 +1,273 @@
|
||||
<?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\Controller;
|
||||
use Front\Front;
|
||||
use Thelia\Controller\Front\BaseFrontController;
|
||||
use Thelia\Core\Event\Address\AddressCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Address\AddressEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Form\AddressCreateForm;
|
||||
use Thelia\Form\AddressUpdateForm;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\Customer;
|
||||
|
||||
/**
|
||||
* Class AddressController
|
||||
* @package Thelia\Controller\Front
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class AddressController extends BaseFrontController
|
||||
{
|
||||
|
||||
/**
|
||||
* Controller for generate modal containing update form
|
||||
* Check if request is a XmlHttpRequest and address owner is the current customer
|
||||
* @param $address_id
|
||||
*/
|
||||
public function generateModalAction($address_id)
|
||||
{
|
||||
|
||||
$this->checkAuth();
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create controller.
|
||||
* Check if customer is logged in
|
||||
*
|
||||
* Dispatch TheliaEvents::ADDRESS_CREATE event
|
||||
*/
|
||||
public function createAction()
|
||||
{
|
||||
|
||||
$this->checkAuth();
|
||||
|
||||
$addressCreate = new AddressCreateForm($this->getRequest());
|
||||
|
||||
try {
|
||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||
|
||||
$form = $this->validateForm($addressCreate, "post");
|
||||
$event = $this->createAddressEvent($form);
|
||||
$event->setCustomer($customer);
|
||||
|
||||
$this->dispatch(TheliaEvents::ADDRESS_CREATE, $event);
|
||||
$this->redirectSuccess($addressCreate);
|
||||
|
||||
} catch (FormValidationException $e) {
|
||||
$message = Translator::getInstance()->trans("Please check your input: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
|
||||
} catch (\Exception $e) {
|
||||
$message = Translator::getInstance()->trans("Sorry, an error occured: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
|
||||
}
|
||||
|
||||
if ($message !== false) {
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("Error during address creation process : %s", $message));
|
||||
|
||||
$addressCreate->setErrorMessage($message);
|
||||
|
||||
$this->getParserContext()
|
||||
->addForm($addressCreate)
|
||||
->setGeneralError($message)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
public function updateViewAction($address_id)
|
||||
{
|
||||
$this->checkAuth();
|
||||
|
||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||
$address = AddressQuery::create()->findPk($address_id);
|
||||
|
||||
if (!$address || $customer->getId() != $address->getCustomerId()) {
|
||||
$this->redirectToRoute('default');
|
||||
}
|
||||
|
||||
$this->getParserContext()->set("address_id", $address_id);
|
||||
}
|
||||
|
||||
public function processUpdateAction($address_id)
|
||||
{
|
||||
$this->checkAuth();
|
||||
$request = $this->getRequest();
|
||||
|
||||
$addressUpdate = new AddressUpdateForm($request);
|
||||
|
||||
try {
|
||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||
|
||||
$form = $this->validateForm($addressUpdate);
|
||||
|
||||
$address = AddressQuery::create()->findPk($address_id);
|
||||
|
||||
if (null === $address) {
|
||||
$this->redirectToRoute('default');
|
||||
}
|
||||
|
||||
if ($address->getCustomer()->getId() != $customer->getId()) {
|
||||
$this->redirectToRoute('default');
|
||||
}
|
||||
|
||||
$event = $this->createAddressEvent($form);
|
||||
$event->setAddress($address);
|
||||
|
||||
$this->dispatch(TheliaEvents::ADDRESS_UPDATE, $event);
|
||||
|
||||
$this->redirectSuccess($addressUpdate);
|
||||
} catch (FormValidationException $e) {
|
||||
$message = Translator::getInstance()->trans("Please check your input: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
|
||||
} catch (\Exception $e) {
|
||||
$message = Translator::getInstance()->trans("Sorry, an error occured: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
|
||||
}
|
||||
$this->getParserContext()->set("address_id", $address_id);
|
||||
if ($message !== false) {
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("Error during address creation process : %s", $message));
|
||||
|
||||
$addressUpdate->setErrorMessage($message);
|
||||
|
||||
$this->getParserContext()
|
||||
->addForm($addressUpdate)
|
||||
->setGeneralError($message)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteAction($address_id)
|
||||
{
|
||||
$this->checkAuth();
|
||||
$error_message = false;
|
||||
|
||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||
$address = AddressQuery::create()->findPk($address_id);
|
||||
|
||||
if (!$address || $customer->getId() != $address->getCustomerId()) {
|
||||
// If Ajax Request
|
||||
if ($this->getRequest()->isXmlHttpRequest()) {
|
||||
return $this->jsonResponse(json_encode(array(
|
||||
"success" => false,
|
||||
"message" => "Error during address deletion process"
|
||||
)));
|
||||
} else {
|
||||
$this->redirectToRoute('default');
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::ADDRESS_DELETE, new AddressEvent($address));
|
||||
} catch (\Exception $e) {
|
||||
$error_message = $e->getMessage();
|
||||
}
|
||||
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf('Error during address deletion : %s', $error_message));
|
||||
|
||||
// If Ajax Request
|
||||
if ($this->getRequest()->isXmlHttpRequest()) {
|
||||
if ($error_message) {
|
||||
$response = $this->jsonResponse(json_encode(array(
|
||||
"success" => false,
|
||||
"message" => $error_message
|
||||
)));
|
||||
} else {
|
||||
$response = $this->jsonResponse(json_encode(array(
|
||||
"success" => true,
|
||||
"message" => ""
|
||||
)));;
|
||||
}
|
||||
|
||||
return $response;
|
||||
|
||||
} else {
|
||||
$this->redirectToRoute('default', array('view'=>'account'));
|
||||
}
|
||||
}
|
||||
|
||||
protected function createAddressEvent($form)
|
||||
{
|
||||
return new AddressCreateOrUpdateEvent(
|
||||
$form->get("label")->getData(),
|
||||
$form->get("title")->getData(),
|
||||
$form->get("firstname")->getData(),
|
||||
$form->get("lastname")->getData(),
|
||||
$form->get("address1")->getData(),
|
||||
$form->get("address2")->getData(),
|
||||
$form->get("address3")->getData(),
|
||||
$form->get("zipcode")->getData(),
|
||||
$form->get("city")->getData(),
|
||||
$form->get("country")->getData(),
|
||||
$form->get("cellphone")->getData(),
|
||||
$form->get("phone")->getData(),
|
||||
$form->get("company")->getData(),
|
||||
$form->get("is_default")->getData()
|
||||
);
|
||||
}
|
||||
}
|
||||
<?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\Controller;
|
||||
|
||||
use Front\Front;
|
||||
use Symfony\Component\Form\Form;
|
||||
use Thelia\Controller\Front\BaseFrontController;
|
||||
use Thelia\Core\Event\Address\AddressCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Address\AddressEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Form\Definition\FrontForm;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\Customer;
|
||||
|
||||
/**
|
||||
* Class AddressController
|
||||
* @package Thelia\Controller\Front
|
||||
* @author Manuel Raynaud <manu@raynaud.io>
|
||||
*/
|
||||
class AddressController extends BaseFrontController
|
||||
{
|
||||
|
||||
/**
|
||||
* Controller for generate modal containing update form
|
||||
* Check if request is a XmlHttpRequest and address owner is the current customer
|
||||
*
|
||||
* @param $address_id
|
||||
*/
|
||||
public function generateModalAction($address_id)
|
||||
{
|
||||
|
||||
$this->checkAuth();
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create controller.
|
||||
* Check if customer is logged in
|
||||
*
|
||||
* Dispatch TheliaEvents::ADDRESS_CREATE event
|
||||
*/
|
||||
public function createAction()
|
||||
{
|
||||
$this->checkAuth();
|
||||
|
||||
$addressCreate = $this->createForm(FrontForm::ADDRESS_CREATE);
|
||||
|
||||
try {
|
||||
/** @var Customer $customer */
|
||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||
|
||||
$form = $this->validateForm($addressCreate, "post");
|
||||
$event = $this->createAddressEvent($form);
|
||||
$event->setCustomer($customer);
|
||||
|
||||
$this->dispatch(TheliaEvents::ADDRESS_CREATE, $event);
|
||||
|
||||
return $this->generateSuccessRedirect($addressCreate);
|
||||
} catch (FormValidationException $e) {
|
||||
$message = $this->getTranslator()->trans("Please check your input: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
|
||||
} catch (\Exception $e) {
|
||||
$message = $this->getTranslator()->trans("Sorry, an error occured: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
|
||||
}
|
||||
|
||||
Tlog::getInstance()->error(sprintf("Error during address creation process : %s", $message));
|
||||
|
||||
$addressCreate->setErrorMessage($message);
|
||||
|
||||
$this->getParserContext()
|
||||
->addForm($addressCreate)
|
||||
->setGeneralError($message)
|
||||
;
|
||||
|
||||
// Redirect to error URL if defined
|
||||
if ($addressCreate->hasErrorUrl()) {
|
||||
return $this->generateErrorRedirect($addressCreate);
|
||||
}
|
||||
}
|
||||
|
||||
protected function createAddressEvent(Form $form)
|
||||
{
|
||||
return new AddressCreateOrUpdateEvent(
|
||||
$form->get("label")->getData(),
|
||||
$form->get("title")->getData(),
|
||||
$form->get("firstname")->getData(),
|
||||
$form->get("lastname")->getData(),
|
||||
$form->get("address1")->getData(),
|
||||
$form->get("address2")->getData(),
|
||||
$form->get("address3")->getData(),
|
||||
$form->get("zipcode")->getData(),
|
||||
$form->get("city")->getData(),
|
||||
$form->get("country")->getData(),
|
||||
$form->get("cellphone")->getData(),
|
||||
$form->get("phone")->getData(),
|
||||
$form->get("company")->getData(),
|
||||
$form->get("is_default")->getData(),
|
||||
$form->get("state")->getData()
|
||||
);
|
||||
}
|
||||
|
||||
public function updateViewAction($address_id)
|
||||
{
|
||||
$this->checkAuth();
|
||||
|
||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||
$address = AddressQuery::create()->findPk($address_id);
|
||||
|
||||
if (!$address || $customer->getId() != $address->getCustomerId()) {
|
||||
return $this->generateRedirectFromRoute('default');
|
||||
}
|
||||
|
||||
$this->getParserContext()->set("address_id", $address_id);
|
||||
}
|
||||
|
||||
public function processUpdateAction($address_id)
|
||||
{
|
||||
$this->checkAuth();
|
||||
|
||||
$addressUpdate = $this->createForm(FrontForm::ADDRESS_UPDATE);
|
||||
|
||||
try {
|
||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||
|
||||
$form = $this->validateForm($addressUpdate);
|
||||
|
||||
$address = AddressQuery::create()->findPk($address_id);
|
||||
|
||||
if (null === $address) {
|
||||
return $this->generateRedirectFromRoute('default');
|
||||
}
|
||||
|
||||
if ($address->getCustomer()->getId() != $customer->getId()) {
|
||||
return $this->generateRedirectFromRoute('default');
|
||||
}
|
||||
|
||||
$event = $this->createAddressEvent($form);
|
||||
$event->setAddress($address);
|
||||
|
||||
$this->dispatch(TheliaEvents::ADDRESS_UPDATE, $event);
|
||||
|
||||
return $this->generateSuccessRedirect($addressUpdate);
|
||||
} catch (FormValidationException $e) {
|
||||
$message = $this->getTranslator()->trans("Please check your input: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
|
||||
} catch (\Exception $e) {
|
||||
$message = $this->getTranslator()->trans("Sorry, an error occured: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
|
||||
}
|
||||
|
||||
$this->getParserContext()->set("address_id", $address_id);
|
||||
|
||||
Tlog::getInstance()->error(sprintf("Error during address creation process : %s", $message));
|
||||
|
||||
$addressUpdate->setErrorMessage($message);
|
||||
|
||||
$this->getParserContext()
|
||||
->addForm($addressUpdate)
|
||||
->setGeneralError($message)
|
||||
;
|
||||
|
||||
if ($addressUpdate->hasErrorUrl()) {
|
||||
return $this->generateErrorRedirect($addressUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteAction($address_id)
|
||||
{
|
||||
$this->checkAuth();
|
||||
$error_message = false;
|
||||
|
||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||
$address = AddressQuery::create()->findPk($address_id);
|
||||
|
||||
if (!$address || $customer->getId() != $address->getCustomerId()) {
|
||||
// If Ajax Request
|
||||
if ($this->getRequest()->isXmlHttpRequest()) {
|
||||
return $this->jsonResponse(
|
||||
json_encode(
|
||||
array(
|
||||
"success" => false,
|
||||
"message" => $this->getTranslator()->trans(
|
||||
"Error during address deletion process",
|
||||
[],
|
||||
Front::MESSAGE_DOMAIN
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return $this->generateRedirectFromRoute('default');
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::ADDRESS_DELETE, new AddressEvent($address));
|
||||
} catch (\Exception $e) {
|
||||
$error_message = $e->getMessage();
|
||||
}
|
||||
|
||||
Tlog::getInstance()->error(sprintf('Error during address deletion : %s', $error_message));
|
||||
|
||||
// If Ajax Request
|
||||
if ($this->getRequest()->isXmlHttpRequest()) {
|
||||
if ($error_message) {
|
||||
$response = $this->jsonResponse(json_encode(array(
|
||||
"success" => false,
|
||||
"message" => $error_message
|
||||
)));
|
||||
} else {
|
||||
$response = $this->jsonResponse(
|
||||
json_encode([
|
||||
"success" => true,
|
||||
"message" => ""
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
return $response;
|
||||
|
||||
} else {
|
||||
return $this->generateRedirectFromRoute('default', array('view'=>'account'));
|
||||
}
|
||||
}
|
||||
|
||||
public function makeAddressDefaultAction($addressId)
|
||||
{
|
||||
$this->checkAuth();
|
||||
|
||||
$address = AddressQuery::create()
|
||||
->filterByCustomerId($this->getSecurityContext()->getCustomerUser()->getId())
|
||||
->findPk($addressId)
|
||||
;
|
||||
|
||||
if (null === $address) {
|
||||
$this->pageNotFound();
|
||||
}
|
||||
|
||||
try {
|
||||
$event = new AddressEvent($address);
|
||||
$this->dispatch(TheliaEvents::ADDRESS_DEFAULT, $event);
|
||||
} catch (\Exception $e) {
|
||||
$this->getParserContext()
|
||||
->setGeneralError($e->getMessage())
|
||||
;
|
||||
|
||||
return $this->render("account");
|
||||
}
|
||||
|
||||
return $this->generateRedirectFromRoute('default', array('view'=>'account'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
/*************************************************************************************/
|
||||
namespace Front\Controller;
|
||||
|
||||
use Front\Front;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Symfony\Component\HttpFoundation\Cookie;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -30,17 +31,17 @@ use Thelia\Core\Event\Cart\CartEvent;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Form\CartAdd;
|
||||
use Thelia\Form\Definition\FrontForm;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\OrderPostage;
|
||||
use Thelia\Module\Exception\DeliveryException;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
class CartController extends BaseFrontController
|
||||
{
|
||||
use \Thelia\Cart\CartTrait;
|
||||
|
||||
public function addItem()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
@@ -52,31 +53,31 @@ class CartController extends BaseFrontController
|
||||
$form = $this->validateForm($cartAdd);
|
||||
|
||||
$cartEvent = $this->getCartEvent();
|
||||
$cartEvent->setNewness($form->get("newness")->getData());
|
||||
$cartEvent->setAppend($form->get("append")->getData());
|
||||
$cartEvent->setQuantity($form->get("quantity")->getData());
|
||||
$cartEvent->setProductSaleElementsId($form->get("product_sale_elements_id")->getData());
|
||||
$cartEvent->setProduct($form->get("product")->getData());
|
||||
|
||||
$cartEvent->bindForm($form);
|
||||
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::CART_ADDITEM, $cartEvent);
|
||||
|
||||
$this->afterModifyCart();
|
||||
|
||||
$this->redirectSuccess();
|
||||
|
||||
if ($this->getRequest()->isXmlHttpRequest()) {
|
||||
$this->changeViewForAjax();
|
||||
} elseif (null !== $response = $this->generateSuccessRedirect($cartAdd)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
} catch (PropelException $e) {
|
||||
Tlog::getInstance()->error(sprintf("Failed to add item to cart with message : %s", $e->getMessage()));
|
||||
$message = "Failed to add this article to your cart, please try again";
|
||||
$message = $this->getTranslator()->trans(
|
||||
"Failed to add this article to your cart, please try again",
|
||||
[],
|
||||
Front::MESSAGE_DOMAIN
|
||||
);
|
||||
} catch (FormValidationException $e) {
|
||||
$message = $e->getMessage();
|
||||
}
|
||||
|
||||
// If Ajax Request
|
||||
if ($this->getRequest()->isXmlHttpRequest()) {
|
||||
$request = $this->getRequest();
|
||||
$request->attributes->set('_view', "includes/mini-cart");
|
||||
}
|
||||
|
||||
if ($message) {
|
||||
$cartAdd->setErrorMessage($message);
|
||||
$this->getParserContext()->addForm($cartAdd);
|
||||
@@ -86,37 +87,67 @@ class CartController extends BaseFrontController
|
||||
public function changeItem()
|
||||
{
|
||||
$cartEvent = $this->getCartEvent();
|
||||
$cartEvent->setCartItem($this->getRequest()->get("cart_item"));
|
||||
$cartEvent->setCartItemId($this->getRequest()->get("cart_item"));
|
||||
$cartEvent->setQuantity($this->getRequest()->get("quantity"));
|
||||
|
||||
try {
|
||||
$this->getTokenProvider()->checkToken(
|
||||
$this->getRequest()->query->get('_token')
|
||||
);
|
||||
|
||||
$this->dispatch(TheliaEvents::CART_UPDATEITEM, $cartEvent);
|
||||
|
||||
$this->afterModifyCart();
|
||||
|
||||
$this->redirectSuccess();
|
||||
} catch (PropelException $e) {
|
||||
if ($this->getRequest()->isXmlHttpRequest()) {
|
||||
$this->changeViewForAjax();
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Tlog::getInstance()->error(sprintf("Failed to change cart item quantity: %s", $e->getMessage()));
|
||||
|
||||
$this->getParserContext()->setGeneralError($e->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function deleteItem()
|
||||
{
|
||||
$cartEvent = $this->getCartEvent();
|
||||
$cartEvent->setCartItem($this->getRequest()->get("cart_item"));
|
||||
$cartEvent->setCartItemId($this->getRequest()->get("cart_item"));
|
||||
|
||||
try {
|
||||
$this->getTokenProvider()->checkToken(
|
||||
$this->getRequest()->query->get('_token')
|
||||
);
|
||||
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::CART_DELETEITEM, $cartEvent);
|
||||
|
||||
$this->afterModifyCart();
|
||||
|
||||
$this->redirectSuccess();
|
||||
} catch (PropelException $e) {
|
||||
} catch (\Exception $e) {
|
||||
Tlog::getInstance()->error(sprintf("error during deleting cartItem with message : %s", $e->getMessage()));
|
||||
$this->getParserContext()->setGeneralError($e->getMessage());
|
||||
}
|
||||
|
||||
$this->changeViewForAjax();
|
||||
|
||||
if (null != $successUrl = $this->getRequest()->query->get('success_url')) {
|
||||
$response = $this->generateRedirect(
|
||||
URL::getInstance()->absoluteUrl($successUrl)
|
||||
);
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
protected function changeViewForAjax()
|
||||
{
|
||||
// If Ajax Request
|
||||
if ($this->getRequest()->isXmlHttpRequest()) {
|
||||
$request = $this->getRequest();
|
||||
|
||||
$view = $request->get('ajax-view', "includes/mini-cart");
|
||||
|
||||
$request->attributes->set('_view', $view);
|
||||
}
|
||||
}
|
||||
|
||||
public function changeCountry()
|
||||
@@ -129,17 +160,18 @@ class CartController extends BaseFrontController
|
||||
|
||||
$cookie = new Cookie($cookieName, $deliveryId, time() + $cookieExpires, '/');
|
||||
|
||||
$this->redirect($redirectUrl, 302, array($cookie));
|
||||
$response = $this->generateRedirect($redirectUrl);
|
||||
$response->headers->setCookie($cookie);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* use Thelia\Cart\CartTrait for searching current cart or create a new one
|
||||
*
|
||||
* @return \Thelia\Core\Event\Cart\CartEvent
|
||||
*/
|
||||
protected function getCartEvent()
|
||||
{
|
||||
$cart = $this->getCart($this->getDispatcher(), $this->getRequest());
|
||||
$cart = $this->getSession()->getSessionCart($this->getDispatcher());
|
||||
|
||||
return new CartEvent($cart);
|
||||
}
|
||||
@@ -153,15 +185,16 @@ class CartController extends BaseFrontController
|
||||
private function getAddCartForm(Request $request)
|
||||
{
|
||||
if ($request->isMethod("post")) {
|
||||
$cartAdd = new CartAdd($request);
|
||||
$cartAdd = $this->createForm(FrontForm::CART_ADD);
|
||||
} else {
|
||||
$cartAdd = new CartAdd(
|
||||
$request,
|
||||
$cartAdd = $this->createForm(
|
||||
FrontForm::CART_ADD,
|
||||
"form",
|
||||
array(),
|
||||
array(
|
||||
'csrf_protection' => false,
|
||||
)
|
||||
),
|
||||
$this->container
|
||||
);
|
||||
}
|
||||
|
||||
@@ -177,18 +210,21 @@ class CartController extends BaseFrontController
|
||||
$deliveryAddress = AddressQuery::create()->findPk($order->getChoosenDeliveryAddress());
|
||||
|
||||
if (null !== $deliveryModule && null !== $deliveryAddress) {
|
||||
$moduleInstance = $deliveryModule->getModuleInstance($this->container);
|
||||
$moduleInstance = $deliveryModule->getDeliveryModuleInstance($this->container);
|
||||
|
||||
$orderEvent = new OrderEvent($order);
|
||||
|
||||
try {
|
||||
$postage = $moduleInstance->getPostage($deliveryAddress->getCountry());
|
||||
$postage = OrderPostage::loadFromPostage(
|
||||
$moduleInstance->getPostage($deliveryAddress->getCountry())
|
||||
);
|
||||
|
||||
$orderEvent->setPostage($postage);
|
||||
$orderEvent->setPostage($postage->getAmount());
|
||||
$orderEvent->setPostageTax($postage->getAmountTax());
|
||||
$orderEvent->setPostageTaxRuleTitle($postage->getTaxRuleTitle());
|
||||
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_POSTAGE, $orderEvent);
|
||||
}
|
||||
catch (DeliveryException $ex) {
|
||||
} catch (DeliveryException $ex) {
|
||||
// The postage has been chosen, but changes in the cart causes an exception.
|
||||
// Reset the postage data in the order
|
||||
$orderEvent->setDeliveryModule(0);
|
||||
|
||||
@@ -22,15 +22,17 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Front\Controller;
|
||||
|
||||
use Thelia\Controller\Front\BaseFrontController;
|
||||
use Thelia\Form\ContactForm;
|
||||
use Thelia\Form\Definition\FrontForm;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
|
||||
/**
|
||||
* Class ContactController
|
||||
* @package Thelia\Controller\Front
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
* @author Manuel Raynaud <manu@raynaud.io>
|
||||
*/
|
||||
class ContactController extends BaseFrontController
|
||||
{
|
||||
@@ -39,36 +41,44 @@ class ContactController extends BaseFrontController
|
||||
*/
|
||||
public function sendAction()
|
||||
{
|
||||
$error_message = false;
|
||||
$contactForm = new ContactForm($this->getRequest());
|
||||
|
||||
$contactForm = $this->createForm(FrontForm::CONTACT);
|
||||
|
||||
try {
|
||||
$form = $this->validateForm($contactForm);
|
||||
|
||||
$message = \Swift_Message::newInstance($form->get('subject')->getData())
|
||||
->addFrom(ConfigQuery::read("store_email"), $form->get('name')->getData())
|
||||
->addReplyTo($form->get('email')->getData(), $form->get('name')->getData())
|
||||
->addTo(ConfigQuery::read('store_email'), ConfigQuery::read('store_name'))
|
||||
->setBody($form->get('message')->getData())
|
||||
;
|
||||
|
||||
$this->getMailer()->send($message);
|
||||
|
||||
|
||||
$this->getMailer()->sendSimpleEmailMessage(
|
||||
[ ConfigQuery::getStoreEmail() => $form->get('name')->getData() ],
|
||||
[ ConfigQuery::getStoreEmail() => ConfigQuery::getStoreName() ],
|
||||
$form->get('subject')->getData(),
|
||||
'',
|
||||
$form->get('message')->getData(),
|
||||
[],
|
||||
[],
|
||||
[ $form->get('email')->getData() => $form->get('name')->getData() ]
|
||||
);
|
||||
|
||||
if ($contactForm->hasSuccessUrl()) {
|
||||
return $this->generateSuccessRedirect($contactForm);
|
||||
}
|
||||
|
||||
return $this->generateRedirectFromRoute('contact.success');
|
||||
|
||||
} catch (FormValidationException $e) {
|
||||
$error_message = $e->getMessage();
|
||||
}
|
||||
|
||||
if ($error_message !== false) {
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf('Error during sending contact mail : %s', $error_message));
|
||||
|
||||
$contactForm->setErrorMessage($error_message);
|
||||
|
||||
$this->getParserContext()
|
||||
->addForm($contactForm)
|
||||
->setGeneralError($error_message)
|
||||
;
|
||||
} else {
|
||||
$this->redirectToRoute('contact.success');
|
||||
|
||||
Tlog::getInstance()->error(sprintf('Error during sending contact mail : %s', $error_message));
|
||||
|
||||
$contactForm->setErrorMessage($error_message);
|
||||
|
||||
$this->getParserContext()
|
||||
->addForm($contactForm)
|
||||
->setGeneralError($error_message)
|
||||
;
|
||||
|
||||
// Redirect to error URL if defined
|
||||
if ($contactForm->hasErrorUrl()) {
|
||||
return $this->generateErrorRedirect($contactForm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,15 +22,18 @@
|
||||
/*************************************************************************************/
|
||||
namespace Front\Controller;
|
||||
|
||||
use Front\Front;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Thelia\Controller\Front\BaseFrontController;
|
||||
use Thelia\Core\Event\Coupon\CouponConsumeEvent;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Form\CouponCode;
|
||||
use Thelia\Exception\UnmatchableConditionException;
|
||||
use Thelia\Form\Definition\FrontForm;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\OrderPostage;
|
||||
use Thelia\Module\Exception\DeliveryException;
|
||||
|
||||
/**
|
||||
@@ -43,7 +46,8 @@ class CouponController extends BaseFrontController
|
||||
/**
|
||||
* Clear all coupons.
|
||||
*/
|
||||
public function clearAllCouponsAction() {
|
||||
public function clearAllCouponsAction()
|
||||
{
|
||||
// Dispatch Event to the Action
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::COUPON_CLEAR_ALL);
|
||||
}
|
||||
@@ -53,11 +57,10 @@ class CouponController extends BaseFrontController
|
||||
*/
|
||||
public function consumeAction()
|
||||
{
|
||||
$this->checkAuth();
|
||||
$this->checkCartNotEmpty();
|
||||
|
||||
$message = false;
|
||||
$couponCodeForm = new CouponCode($this->getRequest());
|
||||
$couponCodeForm = $this->createForm(FrontForm::COUPON_CONSUME);
|
||||
|
||||
try {
|
||||
$form = $this->validateForm($couponCodeForm, 'post');
|
||||
@@ -66,7 +69,13 @@ class CouponController extends BaseFrontController
|
||||
|
||||
if (null === $couponCode || empty($couponCode)) {
|
||||
$message = true;
|
||||
throw new \Exception('Coupon code can\'t be empty');
|
||||
throw new \Exception(
|
||||
$this->getTranslator()->trans(
|
||||
'Coupon code can\'t be empty',
|
||||
[],
|
||||
Front::MESSAGE_DOMAIN
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$couponConsumeEvent = new CouponConsumeEvent($couponCode);
|
||||
@@ -82,19 +91,21 @@ class CouponController extends BaseFrontController
|
||||
$deliveryAddress = AddressQuery::create()->findPk($order->getChoosenDeliveryAddress());
|
||||
|
||||
if (null !== $deliveryModule && null !== $deliveryAddress) {
|
||||
|
||||
$moduleInstance = $deliveryModule->getModuleInstance($this->container);
|
||||
$moduleInstance = $deliveryModule->getDeliveryModuleInstance($this->container);
|
||||
|
||||
$orderEvent = new OrderEvent($order);
|
||||
|
||||
try {
|
||||
$postage = $moduleInstance->getPostage($deliveryAddress->getCountry());
|
||||
$postage = OrderPostage::loadFromPostage(
|
||||
$moduleInstance->getPostage($deliveryAddress->getCountry())
|
||||
);
|
||||
|
||||
$orderEvent->setPostage($postage);
|
||||
$orderEvent->setPostage($postage->getAmount());
|
||||
$orderEvent->setPostageTax($postage->getAmountTax());
|
||||
$orderEvent->setPostageTaxRuleTitle($postage->getTaxRuleTitle());
|
||||
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_POSTAGE, $orderEvent);
|
||||
}
|
||||
catch (DeliveryException $ex) {
|
||||
} catch (DeliveryException $ex) {
|
||||
// The postage has been chosen, but changes dues to coupon causes an exception.
|
||||
// Reset the postage data in the order
|
||||
$orderEvent->setDeliveryModule(0);
|
||||
@@ -104,18 +115,37 @@ class CouponController extends BaseFrontController
|
||||
}
|
||||
}
|
||||
|
||||
$this->redirect($couponCodeForm->getSuccessUrl());
|
||||
return $this->generateSuccessRedirect($couponCodeForm);
|
||||
|
||||
} catch (FormValidationException $e) {
|
||||
$message = sprintf('Please check your coupon code: %s', $e->getMessage());
|
||||
$message = $this->getTranslator()->trans(
|
||||
'Please check your coupon code: %message',
|
||||
["%message" => $e->getMessage()],
|
||||
Front::MESSAGE_DOMAIN
|
||||
);
|
||||
} catch (UnmatchableConditionException $e) {
|
||||
$message = $this->getTranslator()->trans(
|
||||
'You should <a href="%sign">sign in</a> or <a href="%register">register</a> to use this coupon',
|
||||
[
|
||||
'%sign' => $this->retrieveUrlFromRouteId('customer.login.view'),
|
||||
'%register' => $this->retrieveUrlFromRouteId('customer.create.view'),
|
||||
],
|
||||
Front::MESSAGE_DOMAIN
|
||||
);
|
||||
} catch (PropelException $e) {
|
||||
$this->getParserContext()->setGeneralError($e->getMessage());
|
||||
} catch (\Exception $e) {
|
||||
$message = sprintf('Sorry, an error occurred: %s', $e->getMessage());
|
||||
$message = $this->getTranslator()->trans(
|
||||
'Sorry, an error occurred: %message',
|
||||
["%message" => $e->getMessage()],
|
||||
Front::MESSAGE_DOMAIN
|
||||
);
|
||||
}
|
||||
|
||||
if ($message !== false) {
|
||||
Tlog::getInstance()->error(sprintf("Error during order delivery process : %s. Exception was %s", $message, $e->getMessage()));
|
||||
Tlog::getInstance()->error(
|
||||
sprintf("Error during order delivery process : %s. Exception was %s", $message, $e->getMessage())
|
||||
);
|
||||
|
||||
$couponCodeForm->setErrorMessage($message);
|
||||
|
||||
@@ -123,5 +153,7 @@ class CouponController extends BaseFrontController
|
||||
->addForm($couponCodeForm)
|
||||
->setGeneralError($message);
|
||||
}
|
||||
|
||||
return $this->generateErrorRedirect($couponCodeForm);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,12 +17,10 @@ use Doctrine\Common\Cache\FilesystemCache;
|
||||
use Thelia\Controller\Front\BaseFrontController;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Model\BrandQuery;
|
||||
use Thelia\Model\FolderQuery;
|
||||
use Thelia\Model\CategoryQuery;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\Folder;
|
||||
use Thelia\Model\Lang;
|
||||
use Thelia\Model\LangQuery;
|
||||
|
||||
|
||||
@@ -23,26 +23,89 @@
|
||||
|
||||
namespace Front\Controller;
|
||||
|
||||
use Front\Front;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Thelia\Controller\Front\BaseFrontController;
|
||||
use Thelia\Core\Event\Newsletter\NewsletterEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Form\NewsletterForm;
|
||||
use Thelia\Form\Definition\FrontForm;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Model\Customer;
|
||||
use Thelia\Model\NewsletterQuery;
|
||||
|
||||
/**
|
||||
* Class NewsletterController
|
||||
* @package Thelia\Controller\Front
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
* @author Manuel Raynaud <manu@raynaud.io>, Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class NewsletterController extends BaseFrontController
|
||||
{
|
||||
/**
|
||||
* @since 2.3.0-alpha2
|
||||
*/
|
||||
public function unsubscribeAction()
|
||||
{
|
||||
$errorMessage = false;
|
||||
|
||||
$newsletterForm = $this->createForm(FrontForm::NEWSLETTER_UNSUBSCRIBE);
|
||||
|
||||
try {
|
||||
$form = $this->validateForm($newsletterForm);
|
||||
|
||||
$email = $form->get('email')->getData();
|
||||
|
||||
if (null !== $newsletter = NewsletterQuery::create()->findOneByEmail($email)) {
|
||||
$event = new NewsletterEvent(
|
||||
$email,
|
||||
$this->getRequest()->getSession()->getLang()->getLocale()
|
||||
);
|
||||
|
||||
$event->setId($newsletter->getId());
|
||||
|
||||
$this->dispatch(TheliaEvents::NEWSLETTER_UNSUBSCRIBE, $event);
|
||||
|
||||
// If a success URL is defined in the form, redirect to it, otherwise use the defaut view
|
||||
if ($newsletterForm->hasSuccessUrl() && !$this->getRequest()->isXmlHttpRequest()) {
|
||||
return $this->generateSuccessRedirect($newsletterForm);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$errorMessage = $e->getMessage();
|
||||
|
||||
Tlog::getInstance()->error(sprintf('Error during newsletter unsubscription : %s', $errorMessage));
|
||||
|
||||
$newsletterForm->setErrorMessage($errorMessage);
|
||||
}
|
||||
|
||||
// If Ajax Request
|
||||
if ($this->getRequest()->isXmlHttpRequest()) {
|
||||
return new JsonResponse([
|
||||
"success" => ($errorMessage) ? false : true,
|
||||
"message" => ($errorMessage) ? $errorMessage : $this->getTranslator()->trans(
|
||||
"Your subscription to our newsletter has been canceled.",
|
||||
[],
|
||||
Front::MESSAGE_DOMAIN
|
||||
)
|
||||
], ($errorMessage) ? 500 : 200);
|
||||
}
|
||||
|
||||
$this->getParserContext()
|
||||
->setGeneralError($errorMessage)
|
||||
->addForm($newsletterForm);
|
||||
|
||||
// If an error URL is defined in the form, redirect to it, otherwise use the defaut view
|
||||
if ($errorMessage && $newsletterForm->hasErrorUrl()) {
|
||||
return $this->generateErrorRedirect($newsletterForm);
|
||||
}
|
||||
}
|
||||
|
||||
public function subscribeAction()
|
||||
{
|
||||
$error_message = false;
|
||||
$newsletterForm = new NewsletterForm($this->getRequest());
|
||||
$errorMessage = false;
|
||||
|
||||
$newsletterForm = $this->createForm(FrontForm::NEWSLETTER);
|
||||
|
||||
try {
|
||||
|
||||
$form = $this->validateForm($newsletterForm);
|
||||
|
||||
$event = new NewsletterEvent(
|
||||
@@ -50,43 +113,52 @@ class NewsletterController extends BaseFrontController
|
||||
$this->getRequest()->getSession()->getLang()->getLocale()
|
||||
);
|
||||
|
||||
/** @var Customer $customer */
|
||||
if (null !== $customer = $this->getSecurityContext()->getCustomerUser()) {
|
||||
$event->setFirstname($customer->getFirstname());
|
||||
$event->setLastname($customer->getLastname());
|
||||
$event
|
||||
->setFirstname($customer->getFirstname())
|
||||
->setLastname($customer->getLastname())
|
||||
;
|
||||
} else {
|
||||
$event
|
||||
->setFirstname($form->get('firstname')->getData())
|
||||
->setLastname($form->get('lastname')->getData())
|
||||
;
|
||||
}
|
||||
|
||||
$this->dispatch(TheliaEvents::NEWSLETTER_SUBSCRIBE, $event);
|
||||
|
||||
// If a success URL is defined in the form, redirect to it, otherwise use the defaut view
|
||||
if ($newsletterForm->hasSuccessUrl() && ! $this->getRequest()->isXmlHttpRequest()) {
|
||||
return $this->generateSuccessRedirect($newsletterForm);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$error_message = $e->getMessage();
|
||||
}
|
||||
$errorMessage = $e->getMessage();
|
||||
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf('Error during newsletter subscription : %s', $error_message));
|
||||
Tlog::getInstance()->error(sprintf('Error during newsletter subscription : %s', $errorMessage));
|
||||
|
||||
$newsletterForm->setErrorMessage($errorMessage);
|
||||
}
|
||||
|
||||
// If Ajax Request
|
||||
if ($this->getRequest()->isXmlHttpRequest()) {
|
||||
if ($error_message) {
|
||||
$response = $this->jsonResponse(json_encode(array(
|
||||
"success" => false,
|
||||
"message" => $error_message
|
||||
)));
|
||||
} else {
|
||||
$response = $this->jsonResponse(json_encode(array(
|
||||
"success" => true,
|
||||
"message" => "Thanks for signing up! We'll keep you posted whenever we have any new updates."
|
||||
)));;
|
||||
}
|
||||
|
||||
return $response;
|
||||
|
||||
} else {
|
||||
$newsletterForm->setErrorMessage($error_message);
|
||||
|
||||
$this->getParserContext()
|
||||
->addForm($newsletterForm)
|
||||
->setGeneralError($error_message)
|
||||
;
|
||||
return new JsonResponse([
|
||||
"success" => ($errorMessage) ? false : true,
|
||||
"message" => ($errorMessage) ? $errorMessage : $this->getTranslator()->trans(
|
||||
"Thanks for signing up! We'll keep you posted whenever we have any new updates.",
|
||||
[],
|
||||
Front::MESSAGE_DOMAIN
|
||||
)
|
||||
], ($errorMessage) ? 500 : 200);
|
||||
}
|
||||
|
||||
$this->getParserContext()
|
||||
->setGeneralError($errorMessage)
|
||||
->addForm($newsletterForm);
|
||||
|
||||
// If an error URL is defined in the form, redirect to it, otherwise use the defaut view
|
||||
if ($errorMessage && $newsletterForm->hasErrorUrl()) {
|
||||
return $this->generateErrorRedirect($newsletterForm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,27 +23,30 @@
|
||||
namespace Front\Controller;
|
||||
|
||||
use Front\Front;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Symfony\Component\HttpFoundation\Response as BaseResponse;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Thelia\Cart\CartTrait;
|
||||
use Thelia\Controller\Front\BaseFrontController;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Exception\TheliaProcessException;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Core\Event\Delivery\DeliveryPostageEvent;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\Product\VirtualProductOrderDownloadResponseEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Thelia\Form\OrderDelivery;
|
||||
use Thelia\Form\OrderPayment;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Exception\TheliaProcessException;
|
||||
use Thelia\Form\Definition\FrontForm;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Model\Address;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\AreaDeliveryModuleQuery;
|
||||
use Thelia\Model\OrderQuery;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
use Thelia\Model\Order;
|
||||
use Thelia\TaxEngine\TaxEngine;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Model\OrderProductQuery;
|
||||
use Thelia\Model\OrderQuery;
|
||||
use Thelia\Module\AbstractDeliveryModule;
|
||||
use Thelia\Module\Exception\DeliveryException;
|
||||
|
||||
/**
|
||||
* Class OrderController
|
||||
@@ -52,7 +55,78 @@ use Thelia\Tools\URL;
|
||||
*/
|
||||
class OrderController extends BaseFrontController
|
||||
{
|
||||
use CartTrait;
|
||||
/**
|
||||
* Check if the cart contains only virtual products.
|
||||
*/
|
||||
public function deliverView()
|
||||
{
|
||||
$this->checkAuth();
|
||||
$this->checkCartNotEmpty();
|
||||
|
||||
// check if the cart contains only virtual products
|
||||
$cart = $this->getSession()->getSessionCart($this->getDispatcher());
|
||||
|
||||
$deliveryAddress = $this->getCustomerAddress();
|
||||
|
||||
if ($cart->isVirtual()) {
|
||||
if (null !== $deliveryAddress) {
|
||||
$deliveryModule = ModuleQuery::create()->retrieveVirtualProductDelivery($this->container);
|
||||
|
||||
if (false === $deliveryModule) {
|
||||
Tlog::getInstance()->error(
|
||||
$this->getTranslator()->trans(
|
||||
"To enable the virtual product feature, the VirtualProductDelivery module should be activated",
|
||||
[],
|
||||
Front::MESSAGE_DOMAIN
|
||||
)
|
||||
);
|
||||
} elseif (count($deliveryModule) == 1) {
|
||||
return $this->registerVirtualProductDelivery($deliveryModule[0], $deliveryAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
'order-delivery',
|
||||
[
|
||||
'delivery_address_id' => (null !== $deliveryAddress) ? $deliveryAddress->getId() : null
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AbstractDeliveryModule $moduleInstance
|
||||
* @param Address $deliveryAddress
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
private function registerVirtualProductDelivery($moduleInstance, $deliveryAddress)
|
||||
{
|
||||
/* get postage amount */
|
||||
$deliveryModule = $moduleInstance->getModuleModel();
|
||||
$cart = $this->getSession()->getSessionCart($this->getDispatcher());
|
||||
$deliveryPostageEvent = new DeliveryPostageEvent($moduleInstance, $cart, $deliveryAddress);
|
||||
|
||||
$this->getDispatcher()->dispatch(
|
||||
TheliaEvents::MODULE_DELIVERY_GET_POSTAGE,
|
||||
$deliveryPostageEvent
|
||||
);
|
||||
|
||||
$postage = $deliveryPostageEvent->getPostage();
|
||||
|
||||
$orderEvent = $this->getOrderEvent();
|
||||
$orderEvent->setDeliveryAddress($deliveryAddress->getId());
|
||||
$orderEvent->setDeliveryModule($deliveryModule->getId());
|
||||
$orderEvent->setPostage($postage->getAmount());
|
||||
$orderEvent->setPostageTax($postage->getAmountTax());
|
||||
$orderEvent->setPostageTaxRuleTitle($postage->getTaxRuleTitle());
|
||||
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_ADDRESS, $orderEvent);
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_MODULE, $orderEvent);
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_POSTAGE, $orderEvent);
|
||||
|
||||
return $this->generateRedirectFromRoute("order.invoice");
|
||||
}
|
||||
|
||||
/**
|
||||
* set delivery address
|
||||
* set delivery module
|
||||
@@ -64,7 +138,7 @@ class OrderController extends BaseFrontController
|
||||
|
||||
$message = false;
|
||||
|
||||
$orderDelivery = new OrderDelivery($this->getRequest());
|
||||
$orderDelivery = $this->createForm(FrontForm::ORDER_DELIVER);
|
||||
|
||||
try {
|
||||
$form = $this->validateForm($orderDelivery, "post");
|
||||
@@ -76,43 +150,81 @@ class OrderController extends BaseFrontController
|
||||
|
||||
/* check that the delivery address belongs to the current customer */
|
||||
if ($deliveryAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) {
|
||||
throw new \Exception("Delivery address does not belong to the current customer");
|
||||
throw new \Exception(
|
||||
$this->getTranslator()->trans(
|
||||
"Delivery address does not belong to the current customer",
|
||||
[],
|
||||
Front::MESSAGE_DOMAIN
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/* check that the delivery module fetches the delivery address area */
|
||||
if(AreaDeliveryModuleQuery::create()
|
||||
->filterByAreaId($deliveryAddress->getCountry()->getAreaId())
|
||||
->filterByDeliveryModuleId($deliveryModuleId)
|
||||
->count() == 0) {
|
||||
throw new \Exception("Delivery module cannot be use with selected delivery address");
|
||||
if (null === AreaDeliveryModuleQuery::create()->findByCountryAndModule(
|
||||
$deliveryAddress->getCountry(),
|
||||
$deliveryModule
|
||||
)) {
|
||||
throw new \Exception(
|
||||
$this->getTranslator()->trans(
|
||||
"Delivery module cannot be use with selected delivery address",
|
||||
[],
|
||||
Front::MESSAGE_DOMAIN
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/* get postage amount */
|
||||
$moduleInstance = $deliveryModule->getModuleInstance($this->container);
|
||||
$moduleInstance = $deliveryModule->getDeliveryModuleInstance($this->container);
|
||||
|
||||
$postage = $moduleInstance->getPostage($deliveryAddress->getCountry());
|
||||
$cart = $this->getSession()->getSessionCart($this->getDispatcher());
|
||||
$deliveryPostageEvent = new DeliveryPostageEvent($moduleInstance, $cart, $deliveryAddress);
|
||||
|
||||
$this->getDispatcher()->dispatch(
|
||||
TheliaEvents::MODULE_DELIVERY_GET_POSTAGE,
|
||||
$deliveryPostageEvent
|
||||
);
|
||||
|
||||
if (!$deliveryPostageEvent->isValidModule() || null === $deliveryPostageEvent->getPostage()) {
|
||||
throw new DeliveryException(
|
||||
$this->getTranslator()->trans('The delivery module is not valid.', [], Front::MESSAGE_DOMAIN)
|
||||
);
|
||||
}
|
||||
|
||||
$postage = $deliveryPostageEvent->getPostage();
|
||||
|
||||
$orderEvent = $this->getOrderEvent();
|
||||
$orderEvent->setDeliveryAddress($deliveryAddressId);
|
||||
$orderEvent->setDeliveryModule($deliveryModuleId);
|
||||
$orderEvent->setPostage($postage);
|
||||
$orderEvent->setPostage($postage->getAmount());
|
||||
$orderEvent->setPostageTax($postage->getAmountTax());
|
||||
$orderEvent->setPostageTaxRuleTitle($postage->getTaxRuleTitle());
|
||||
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_ADDRESS, $orderEvent);
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_MODULE, $orderEvent);
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_POSTAGE, $orderEvent);
|
||||
|
||||
$this->redirectToRoute("order.invoice");
|
||||
return $this->generateRedirectFromRoute("order.invoice");
|
||||
|
||||
} catch (FormValidationException $e) {
|
||||
$message = Translator::getInstance()->trans("Please check your input: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
|
||||
$message = $this->getTranslator()->trans(
|
||||
"Please check your input: %s",
|
||||
['%s' => $e->getMessage()],
|
||||
Front::MESSAGE_DOMAIN
|
||||
);
|
||||
} catch (PropelException $e) {
|
||||
$this->getParserContext()->setGeneralError($e->getMessage());
|
||||
} catch (\Exception $e) {
|
||||
$message = Translator::getInstance()->trans("Sorry, an error occured: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
|
||||
$message = $this->getTranslator()->trans(
|
||||
"Sorry, an error occured: %s",
|
||||
['%s' => $e->getMessage()],
|
||||
Front::MESSAGE_DOMAIN
|
||||
);
|
||||
}
|
||||
|
||||
if ($message !== false) {
|
||||
Tlog::getInstance()->error(sprintf("Error during order delivery process : %s. Exception was %s", $message, $e->getMessage()));
|
||||
Tlog::getInstance()->error(
|
||||
sprintf("Error during order delivery process : %s. Exception was %s", $message, $e->getMessage())
|
||||
);
|
||||
|
||||
$orderDelivery->setErrorMessage($message);
|
||||
|
||||
@@ -121,7 +233,6 @@ class OrderController extends BaseFrontController
|
||||
->setGeneralError($message)
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,7 +247,7 @@ class OrderController extends BaseFrontController
|
||||
|
||||
$message = false;
|
||||
|
||||
$orderPayment = new OrderPayment($this->getRequest());
|
||||
$orderPayment = $this->createForm(FrontForm::ORDER_PAYMENT);
|
||||
|
||||
try {
|
||||
$form = $this->validateForm($orderPayment, "post");
|
||||
@@ -147,7 +258,13 @@ class OrderController extends BaseFrontController
|
||||
/* check that the invoice address belongs to the current customer */
|
||||
$invoiceAddress = AddressQuery::create()->findPk($invoiceAddressId);
|
||||
if ($invoiceAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) {
|
||||
throw new \Exception("Invoice address does not belong to the current customer");
|
||||
throw new \Exception(
|
||||
$this->getTranslator()->trans(
|
||||
"Invoice address does not belong to the current customer",
|
||||
[],
|
||||
Front::MESSAGE_DOMAIN
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$orderEvent = $this->getOrderEvent();
|
||||
@@ -157,18 +274,28 @@ class OrderController extends BaseFrontController
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_INVOICE_ADDRESS, $orderEvent);
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_PAYMENT_MODULE, $orderEvent);
|
||||
|
||||
$this->redirectToRoute("order.payment.process");
|
||||
return $this->generateRedirectFromRoute("order.payment.process");
|
||||
|
||||
} catch (FormValidationException $e) {
|
||||
$message = Translator::getInstance()->trans("Please check your input: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
|
||||
$message = $this->getTranslator()->trans(
|
||||
"Please check your input: %s",
|
||||
['%s' => $e->getMessage()],
|
||||
Front::MESSAGE_DOMAIN
|
||||
);
|
||||
} catch (PropelException $e) {
|
||||
$this->getParserContext()->setGeneralError($e->getMessage());
|
||||
} catch (\Exception $e) {
|
||||
$message = Translator::getInstance()->trans("Sorry, an error occured: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
|
||||
$message = $this->getTranslator()->trans(
|
||||
"Sorry, an error occured: %s",
|
||||
['%s' => $e->getMessage()],
|
||||
Front::MESSAGE_DOMAIN
|
||||
);
|
||||
}
|
||||
|
||||
if ($message !== false) {
|
||||
Tlog::getInstance()->error(sprintf("Error during order payment process : %s. Exception was %s", $message, $e->getMessage()));
|
||||
Tlog::getInstance()->error(
|
||||
sprintf("Error during order payment process : %s. Exception was %s", $message, $e->getMessage())
|
||||
);
|
||||
|
||||
$orderPayment->setErrorMessage($message);
|
||||
|
||||
@@ -178,6 +305,7 @@ class OrderController extends BaseFrontController
|
||||
;
|
||||
}
|
||||
|
||||
return $this->generateErrorRedirect($orderPayment);
|
||||
}
|
||||
|
||||
public function pay()
|
||||
@@ -188,6 +316,13 @@ class OrderController extends BaseFrontController
|
||||
/* check cart count */
|
||||
$this->checkCartNotEmpty();
|
||||
|
||||
/* check stock not empty */
|
||||
if (true === ConfigQuery::checkAvailableStock()) {
|
||||
if (null !== $response = $this->checkStockNotEmpty()) {
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
/* check delivery address and module */
|
||||
$this->checkValidDelivery();
|
||||
|
||||
@@ -205,11 +340,15 @@ class OrderController extends BaseFrontController
|
||||
if ($orderEvent->hasResponse()) {
|
||||
return $orderEvent->getResponse();
|
||||
} else {
|
||||
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute('order.placed', array('order_id' => $orderEvent->getPlacedOrder()->getId()))));
|
||||
return $this->generateRedirectFromRoute(
|
||||
'order.placed',
|
||||
[],
|
||||
['order_id' => $orderEvent->getPlacedOrder()->getId()]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
/* order has not been placed */
|
||||
$this->redirectToRoute('cart.view');
|
||||
return $this->generateRedirectFromRoute('cart.view');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,41 +360,66 @@ class OrderController extends BaseFrontController
|
||||
);
|
||||
|
||||
if (null === $placedOrder) {
|
||||
throw new TheliaProcessException("No placed order", TheliaProcessException::NO_PLACED_ORDER, $placedOrder);
|
||||
throw new TheliaProcessException(
|
||||
$this->getTranslator()->trans(
|
||||
"No placed order",
|
||||
[],
|
||||
Front::MESSAGE_DOMAIN
|
||||
),
|
||||
TheliaProcessException::NO_PLACED_ORDER,
|
||||
$placedOrder
|
||||
);
|
||||
}
|
||||
|
||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||
|
||||
if (null === $customer || $placedOrder->getCustomerId() !== $customer->getId()) {
|
||||
throw new TheliaProcessException("Received placed order id does not belong to the current customer", TheliaProcessException::PLACED_ORDER_ID_BAD_CURRENT_CUSTOMER, $placedOrder);
|
||||
throw new TheliaProcessException(
|
||||
$this->getTranslator()->trans(
|
||||
"Received placed order id does not belong to the current customer",
|
||||
[],
|
||||
Front::MESSAGE_DOMAIN
|
||||
),
|
||||
TheliaProcessException::PLACED_ORDER_ID_BAD_CURRENT_CUSTOMER,
|
||||
$placedOrder
|
||||
);
|
||||
}
|
||||
$session = $this->getRequest()->getSession();
|
||||
$this->createCart($this->getRequest()->getSession());
|
||||
|
||||
$session->setOrder(new Order());
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_CART_CLEAR, $this->getOrderEvent());
|
||||
|
||||
$this->getParserContext()->set("placed_order_id", $placedOrder->getId());
|
||||
}
|
||||
|
||||
|
||||
public function orderFailed($order_id, $message)
|
||||
{
|
||||
/* check if the placed order matched the customer */
|
||||
$failedOrder = OrderQuery::create()->findPk(
|
||||
$this->getRequest()->attributes->get('order_id')
|
||||
);
|
||||
|
||||
if (null === $failedOrder) {
|
||||
throw new TheliaProcessException("No failed order", TheliaProcessException::NO_PLACED_ORDER, $failedOrder);
|
||||
if (empty($order_id)) {
|
||||
// Fallback to request parameter if the method parameter is empty.
|
||||
$order_id = $this->getRequest()->get('order_id');
|
||||
}
|
||||
|
||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||
$failedOrder = OrderQuery::create()->findPk($order_id);
|
||||
|
||||
if (null === $customer || $failedOrder->getCustomerId() !== $customer->getId()) {
|
||||
throw new TheliaProcessException("Received failed order id does not belong to the current customer", TheliaProcessException::PLACED_ORDER_ID_BAD_CURRENT_CUSTOMER, $placedOrder);
|
||||
if (null !== $failedOrder) {
|
||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||
|
||||
if (null === $customer || $failedOrder->getCustomerId() !== $customer->getId()) {
|
||||
throw new TheliaProcessException(
|
||||
$this->getTranslator()->trans(
|
||||
"Received failed order id does not belong to the current customer",
|
||||
[],
|
||||
Front::MESSAGE_DOMAIN
|
||||
),
|
||||
TheliaProcessException::PLACED_ORDER_ID_BAD_CURRENT_CUSTOMER,
|
||||
$failedOrder
|
||||
);
|
||||
}
|
||||
} else {
|
||||
Tlog::getInstance()->warning("Failed order ID '$order_id' not found.");
|
||||
}
|
||||
|
||||
$this->getParserContext()
|
||||
->set("failed_order_id", $failedOrder->getId())
|
||||
->set("failed_order_id", $order_id)
|
||||
->set("failed_order_message", $message)
|
||||
;
|
||||
}
|
||||
@@ -282,6 +446,14 @@ class OrderController extends BaseFrontController
|
||||
return $order;
|
||||
}
|
||||
|
||||
|
||||
public function viewAction($order_id)
|
||||
{
|
||||
$this->checkOrderCustomer($order_id);
|
||||
|
||||
return $this->render('account-order', ['order_id' => $order_id]);
|
||||
}
|
||||
|
||||
public function generateInvoicePdf($order_id)
|
||||
{
|
||||
$this->checkOrderCustomer($order_id);
|
||||
@@ -297,6 +469,35 @@ class OrderController extends BaseFrontController
|
||||
return $this->generateOrderPdf($order_id, ConfigQuery::read('pdf_delivery_file', 'delivery'));
|
||||
}
|
||||
|
||||
public function downloadVirtualProduct($order_product_id)
|
||||
{
|
||||
if (null !== $orderProduct = OrderProductQuery::create()->findPk($order_product_id)) {
|
||||
$order = $orderProduct->getOrder();
|
||||
|
||||
if ($order->isPaid(false)) {
|
||||
// check customer
|
||||
$this->checkOrderCustomer($order->getId());
|
||||
|
||||
$virtualProductEvent = new VirtualProductOrderDownloadResponseEvent($orderProduct);
|
||||
$this->getDispatcher()->dispatch(
|
||||
TheliaEvents::VIRTUAL_PRODUCT_ORDER_DOWNLOAD_RESPONSE,
|
||||
$virtualProductEvent
|
||||
);
|
||||
|
||||
$response = $virtualProductEvent->getResponse();
|
||||
|
||||
if (!$response instanceof BaseResponse) {
|
||||
throw new \RuntimeException('A Response must be added in the event TheliaEvents::VIRTUAL_PRODUCT_ORDER_DOWNLOAD_RESPONSE');
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
throw new AccessDeniedHttpException();
|
||||
|
||||
}
|
||||
|
||||
private function checkOrderCustomer($order_id)
|
||||
{
|
||||
$this->checkAuth();
|
||||
@@ -321,15 +522,83 @@ class OrderController extends BaseFrontController
|
||||
|
||||
public function getDeliveryModuleListAjaxAction()
|
||||
{
|
||||
$country = $this->getRequest()->get(
|
||||
'country_id',
|
||||
$this->container->get('thelia.taxEngine')->getDeliveryCountry()->getId()
|
||||
);
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
$args = array('country' => $country);
|
||||
|
||||
// Change the delivery address if customer has changed it
|
||||
$address = null;
|
||||
$session = $this->getSession();
|
||||
$addressId = $this->getRequest()->get('address_id', null);
|
||||
if (null !== $addressId && $addressId !== $session->getOrder()->getChoosenDeliveryAddress()) {
|
||||
$address = AddressQuery::create()->findPk($addressId);
|
||||
if (null !== $address && $address->getCustomerId() === $session->getCustomerUser()->getId()) {
|
||||
$session->getOrder()->setChoosenDeliveryAddress($addressId);
|
||||
}
|
||||
}
|
||||
|
||||
$address = AddressQuery::create()->findPk($session->getOrder()->getChoosenDeliveryAddress());
|
||||
|
||||
$countryId = $address->getCountryId();
|
||||
$stateId = $address->getStateId();
|
||||
|
||||
$args = array(
|
||||
'country' => $countryId,
|
||||
'state' => $stateId,
|
||||
'address' => $session->getOrder()->getChoosenDeliveryAddress()
|
||||
);
|
||||
|
||||
return $this->render('ajax/order-delivery-module-list', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect to cart view if at least one non product is out of stock
|
||||
*
|
||||
* @return null|BaseResponse
|
||||
*/
|
||||
private function checkStockNotEmpty()
|
||||
{
|
||||
$cart = $this->getSession()->getSessionCart($this->getDispatcher());
|
||||
|
||||
$cartItems = $cart->getCartItems();
|
||||
|
||||
foreach ($cartItems as $cartItem) {
|
||||
$pse = $cartItem->getProductSaleElements();
|
||||
|
||||
$product = $cartItem->getProduct();
|
||||
|
||||
if ($pse->getQuantity() <= 0 && $product->getVirtual() !== 1) {
|
||||
return $this->generateRedirectFromRoute('cart.view');
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the chosen delivery address for a cart or the default customer address if not exists
|
||||
*
|
||||
* @return null|Address
|
||||
*/
|
||||
protected function getCustomerAddress()
|
||||
{
|
||||
$deliveryAddress = null;
|
||||
$addressId = $this->getSession()->getOrder()->getChoosenDeliveryAddress();
|
||||
if (null === $addressId) {
|
||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||
|
||||
$deliveryAddress = AddressQuery::create()
|
||||
->filterByCustomerId($customer->getId())
|
||||
->orderByIsDefault(Criteria::DESC)
|
||||
->findOne();
|
||||
|
||||
if (null !== $deliveryAddress) {
|
||||
$this->getSession()->getOrder()->setChoosenDeliveryAddress(
|
||||
$deliveryAddress->getId()
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$deliveryAddress = AddressQuery::create()->findPk($addressId);
|
||||
}
|
||||
|
||||
return $deliveryAddress;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ use Doctrine\Common\Cache\FilesystemCache;
|
||||
use Thelia\Controller\Front\BaseFrontController;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\LangQuery;
|
||||
|
||||
@@ -55,7 +54,6 @@ class SitemapController extends BaseFrontController {
|
||||
*/
|
||||
public function generateAction()
|
||||
{
|
||||
|
||||
/** @var Request $request */
|
||||
$request = $this->getRequest();
|
||||
|
||||
|
||||
22
local/modules/Front/I18n/de_DE.php
Normal file
22
local/modules/Front/I18n/de_DE.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Coupon code can\'t be empty' => 'Gutschein-Code darf nicht leer sein',
|
||||
'Delivery address does not belong to the current customer' => 'Lieferadresse gehört nicht zum aktuellen Kunden',
|
||||
'Delivery module cannot be use with selected delivery address' => 'Lieferung-Modul kann nicht mit ausgewählten Lieferadresse verwendet werden',
|
||||
'Error during address deletion process' => 'Fehler beim Löschen der Adresse',
|
||||
'Failed to add this article to your cart, please try again' => 'Der Artikel konnte nicht zum Warenkorb hinzugefügt werden, bitte versuchen Sie es erneut',
|
||||
'Invoice address does not belong to the current customer' => 'Rechnungsadresse gehört nicht zum aktuellen Kunden',
|
||||
'No placed order' => 'Keine Bestellungen',
|
||||
'Please check your coupon code: %message' => 'Bitte überprüfen Sie Ihren Gutschein-Code: %message',
|
||||
'Please check your input: %s' => 'Bitte überprüfen Sie Ihre Eingabe: %s',
|
||||
'Received failed order id does not belong to the current customer' => 'Empfangene Id einer fehlgeschlagenen Bestellung gehört nicht zum aktuellen Kunden',
|
||||
'Received placed order id does not belong to the current customer' => 'Empfangene Bestellungs-Id gehört nicht zum aktuellen Kunden',
|
||||
'Sorry, an error occured: %s' => 'Leider ist ein Fehler aufgetreten: %s',
|
||||
'Sorry, an error occurred: %message' => 'Leider ist ein Fehler aufgetreten: %message',
|
||||
'Sorry, an error occurred: %s' => 'Es tut uns Leid, aber ein Fehler ist aufgetreten: %s',
|
||||
'Thanks for signing up! We\'ll keep you posted whenever we have any new updates.' => 'Vielen Dank für Ihre Anmeldung! Wir halten Ihnen auf dem Laufenden über neuen Updates.',
|
||||
'To enable the virtual product feature, the VirtualProductDelivery module should be activated' => 'Um das virtuelle Produkt-Feature zu aktivieren, sollte das VirtualProductDelivery-Modul aktiviert werden',
|
||||
'Wrong email or password. Please try again' => 'E-Mail oder Passwort falsch. Bitte erneut versuchen',
|
||||
'You\'re currently logged in. Please log out before requesting a new password.' => 'Sie sind derzeit angemeldet. Bitte melden Sie sich ab, bevor Sie ein neues Passwort anfordern.',
|
||||
];
|
||||
24
local/modules/Front/I18n/en_US.php
Normal file
24
local/modules/Front/I18n/en_US.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Coupon code can\'t be empty' => 'Coupon code can\'t be empty',
|
||||
'Delivery address does not belong to the current customer' => 'Delivery address does not belong to the current customer',
|
||||
'Delivery module cannot be use with selected delivery address' => 'Delivery module cannot be use with selected delivery address',
|
||||
'Error during address deletion process' => 'Error during address deletion process',
|
||||
'Failed to add this article to your cart, please try again' => 'Failed to add this article to your cart, please try again',
|
||||
'Invoice address does not belong to the current customer' => 'Invoice address does not belong to the current customer',
|
||||
'No placed order' => 'No placed order',
|
||||
'Please check your coupon code: %message' => 'Please check your coupon code: %message',
|
||||
'Please check your input: %s' => 'Please check your input: %s',
|
||||
'Received failed order id does not belong to the current customer' => 'Received failed order id does not belong to the current customer',
|
||||
'Received placed order id does not belong to the current customer' => 'Received placed order id does not belong to the current customer',
|
||||
'Sorry, an error occured: %s' => 'Sorry, an error occured: %s',
|
||||
'Sorry, an error occurred: %message' => 'Sorry, an error occurred: %message',
|
||||
'Sorry, an error occurred: %s' => 'Sorry, an error occurred: %s',
|
||||
'Thanks for signing up! We\'ll keep you posted whenever we have any new updates.' => 'Thanks for signing up! We\'ll keep you posted whenever we have any new updates.',
|
||||
'To enable the virtual product feature, the VirtualProductDelivery module should be activated' => 'To enable the virtual product feature, the VirtualProductDelivery module should be activated',
|
||||
'Wrong email or password. Please try again' => 'Wrong email or password. Please try again',
|
||||
'You should <a href="%sign">sign in</a> or <a href="%register">register</a> to use this coupon' => 'You should <a href="%sign">sign in</a> or <a href="%register">register</a> to use this coupon',
|
||||
'You\'re currently logged in. Please log out before requesting a new password.' => 'You\'re currently logged in. Please log out before requesting a new password.',
|
||||
'Your account is not yet confirmed check out your mailbox' => 'Your account is not yet confirmed check out your mailbox',
|
||||
);
|
||||
23
local/modules/Front/I18n/fr_FR.php
Normal file
23
local/modules/Front/I18n/fr_FR.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Coupon code can\'t be empty' => 'Le code promo ne peut être vide',
|
||||
'Delivery address does not belong to the current customer' => 'L\'adresse de livraison n\'appartient pas au client en cours',
|
||||
'Delivery module cannot be use with selected delivery address' => 'Le module de livraison ne peut pas être utilisé avec cette adresse de livraison',
|
||||
'Error during address deletion process' => 'Désolé. Une erreur s\'est produite lors de la suppression de l\'adresse',
|
||||
'Failed to add this article to your cart, please try again' => 'Impossible d\'ajouter cet article à votre panier. Merci de ré-essayer.',
|
||||
'Invoice address does not belong to the current customer' => 'L\'adresse de facturation n\'appartient pas au client en cours',
|
||||
'No placed order' => 'Aucune commande passée',
|
||||
'Please check your coupon code: %message' => 'Merci de vérifier votre code promo : %message',
|
||||
'Please check your input: %s' => 'Merci de vérifier les informations indiquées : %s',
|
||||
'Received failed order id does not belong to the current customer' => 'L\'id de commande refusée n\'appartient pas au client en cours',
|
||||
'Received placed order id does not belong to the current customer' => 'L\'id de commande passée n\'appartient pas au client en cours',
|
||||
'Sorry, an error occured: %s' => 'Désolé. Une erreur s\'est produite : %s',
|
||||
'Sorry, an error occurred: %message' => 'Désolé. Une erreur s\'est produite : %message',
|
||||
'Sorry, an error occurred: %s' => 'Désolé, une erreur est survenue : %s',
|
||||
'Thanks for signing up! We\'ll keep you posted whenever we have any new updates.' => 'Merci de votre inscription ! Nous vous tiendrons informé dès qu\'il y aura des nouveautés.',
|
||||
'To enable the virtual product feature, the VirtualProductDelivery module should be activated' => 'Pour activer les produits virtuels, le module VirtualProductDelivery doit être activé',
|
||||
'Wrong email or password. Please try again' => 'Adresse email ou mot de passe incorrect. Merci de ré-essayer.',
|
||||
'You should <a href="%sign">sign in</a> or <a href="%register">register</a> to use this coupon' => 'Vous devez <a href="%sign"> vous connecter</a> ou <a href="%register"> vous inscrire</a> pour utiliser ce coupon',
|
||||
'You\'re currently logged in. Please log out before requesting a new password.' => 'Vous être actuellement connecté au site. Vous devez vous déconnecter pour demander un nouveau mot de passe.',
|
||||
];
|
||||
7
local/modules/Front/I18n/it_IT.php
Normal file
7
local/modules/Front/I18n/it_IT.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Coupon code can\'t be empty' => 'Il codice di sconto non può essere vuoto',
|
||||
'Thanks for signing up! We\'ll keep you posted whenever we have any new updates.' => 'Grazie per l\'inscrizione! Ti terremo aggiornato ogni volta che abbiamo eventuali nuovi aggiornamenti.',
|
||||
'You should <a href="%sign">sign in</a> or <a href="%register">register</a> to use this coupon' => 'Dovresti <a href="%sign"> accedere</a> o <a href="%register"> registrarti</a> per utilizzare questo coupon',
|
||||
];
|
||||
22
local/modules/Front/I18n/tr_TR.php
Normal file
22
local/modules/Front/I18n/tr_TR.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Coupon code can\'t be empty' => 'Kupon şifre boş olamaz',
|
||||
'Delivery address does not belong to the current customer' => 'Teslimat adresi geçerli müşteriye ait değil',
|
||||
'Delivery module cannot be use with selected delivery address' => 'Teslim modülü seçili teslimat adresi kullanılamaz',
|
||||
'Error during address deletion process' => 'Adres silme işlemi sırasında bir hata oluştu',
|
||||
'Failed to add this article to your cart, please try again' => 'Sepetinize Bu ürün eklenemedi, lütfen tekrar deneyin',
|
||||
'Invoice address does not belong to the current customer' => 'Fatura adresi geçerli müşteriye ait değil',
|
||||
'No placed order' => 'Yerleştirilen hiçbir sipariş',
|
||||
'Please check your coupon code: %message' => 'Kupon kodunuzu gözden geçirin: %message',
|
||||
'Please check your input: %s' => 'Lütfen girişinizi denetleyin: %s',
|
||||
'Received failed order id does not belong to the current customer' => 'Alınan başarısız sipariş kimliği geçerli müşteriye ait değil',
|
||||
'Received placed order id does not belong to the current customer' => 'Alınmış yerleştirilmiş sipariş kimliği geçerli müşteriye ait değil',
|
||||
'Sorry, an error occured: %s' => 'Üzgünüz, bir hata oluştu: %s',
|
||||
'Sorry, an error occurred: %message' => 'Üzgünüz, bir hata oluştu: %message',
|
||||
'Sorry, an error occurred: %s' => 'Üzgünüz, bir hata oluştu: %s',
|
||||
'Thanks for signing up! We\'ll keep you posted whenever we have any new updates.' => 'Teşekkürler. Yeni güncelleştirmeler olduğunda sizi haberdar edeceğiz.',
|
||||
'To enable the virtual product feature, the VirtualProductDelivery module should be activated' => 'Sanal ürün özelliği etkinleştirmek için VirtualProductDelivery modülü etkinleştirilmesi',
|
||||
'Wrong email or password. Please try again' => 'Email adresi veya şifre hatalı. Lütfen tekrar deneyiniz',
|
||||
'You\'re currently logged in. Please log out before requesting a new password.' => 'Şu anda logged içinde. Lütfen yeni bir parola istemeden önce çıkış.',
|
||||
];
|
||||
165
local/modules/Front/LICENSE.txt
Normal file
165
local/modules/Front/LICENSE.txt
Normal file
@@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
11
local/modules/Front/composer.json
Normal file
11
local/modules/Front/composer.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "thelia/front-module",
|
||||
"license": "LGPL-3.0+",
|
||||
"type": "thelia-module",
|
||||
"require": {
|
||||
"thelia/installer": "~1.1"
|
||||
},
|
||||
"extra": {
|
||||
"installer-name": "Front"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user