Merge branch 'master' of https://github.com/thelia/thelia
This commit is contained in:
@@ -84,7 +84,7 @@ class RegisterRouterPass implements CompilerPassInterface
|
||||
|
||||
$container->setDefinition("router.".$moduleCode, $definition);
|
||||
|
||||
$chainRouter->addMethodCall("add", array(new Reference("router.".$moduleCode), -1));
|
||||
$chainRouter->addMethodCall("add", array(new Reference("router.".$moduleCode), 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
267
core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php
Normal file
267
core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php
Normal file
@@ -0,0 +1,267 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Thelia\Model\Address;
|
||||
use Thelia\Model\Customer;
|
||||
|
||||
|
||||
/**
|
||||
* Class AddressCreateOrUpdateEvent
|
||||
* @package Thelia\Core\Event
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class AddressCreateOrUpdateEvent extends Event
|
||||
{
|
||||
/**
|
||||
* @var string address label
|
||||
*/
|
||||
protected $label;
|
||||
|
||||
/**
|
||||
* @var int title id
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* @var string|null company name
|
||||
*/
|
||||
protected $company;
|
||||
|
||||
/**
|
||||
* @var string first name
|
||||
*/
|
||||
protected $firstname;
|
||||
|
||||
/**
|
||||
* @var string last name
|
||||
*/
|
||||
protected $lastname;
|
||||
|
||||
/**
|
||||
* @var string address
|
||||
*/
|
||||
protected $address1;
|
||||
|
||||
/**
|
||||
* @var string address line 2
|
||||
*/
|
||||
protected $address2;
|
||||
|
||||
/**
|
||||
* @var string address line 3
|
||||
*/
|
||||
protected $address3;
|
||||
|
||||
/**
|
||||
* @var string zipcode
|
||||
*/
|
||||
protected $zipcode;
|
||||
|
||||
/**
|
||||
* @var string city
|
||||
*/
|
||||
protected $city;
|
||||
|
||||
/**
|
||||
* @var int country id
|
||||
*/
|
||||
protected $country;
|
||||
|
||||
/**
|
||||
* @var string cell phone
|
||||
*/
|
||||
protected $cellphone;
|
||||
|
||||
/**
|
||||
* @var string phone
|
||||
*/
|
||||
protected $phone;
|
||||
|
||||
/**
|
||||
* @var \Thelia\Model\Customer
|
||||
*/
|
||||
protected $customer;
|
||||
|
||||
/**
|
||||
* @var \Thelia\Model\Address
|
||||
*/
|
||||
protected $address;
|
||||
|
||||
function __construct($label, $title, $firstname, $lastname, $address1, $address2, $address3, $zipcode, $city, $country, $cellphone, $phone, $company)
|
||||
{
|
||||
$this->address1 = $address1;
|
||||
$this->address2 = $address2;
|
||||
$this->address3 = $address3;
|
||||
$this->cellphone = $cellphone;
|
||||
$this->city = $city;
|
||||
$this->company = $company;
|
||||
$this->country = $country;
|
||||
$this->firstname = $firstname;
|
||||
$this->label = $label;
|
||||
$this->lastname = $lastname;
|
||||
$this->phone = $phone;
|
||||
$this->title = $title;
|
||||
$this->zipcode = $zipcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAddress1()
|
||||
{
|
||||
return $this->address1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAddress2()
|
||||
{
|
||||
return $this->address2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAddress3()
|
||||
{
|
||||
return $this->address3;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCellphone()
|
||||
{
|
||||
return $this->cellphone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCity()
|
||||
{
|
||||
return $this->city;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getCompany()
|
||||
{
|
||||
return $this->company;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getCountry()
|
||||
{
|
||||
return $this->country;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFirstname()
|
||||
{
|
||||
return $this->firstname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLastname()
|
||||
{
|
||||
return $this->lastname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPhone()
|
||||
{
|
||||
return $this->phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getZipcode()
|
||||
{
|
||||
return $this->zipcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Thelia\Model\Customer $customer
|
||||
*/
|
||||
public function setCustomer(Customer $customer)
|
||||
{
|
||||
$this->customer = $customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Thelia\Model\Customer
|
||||
*/
|
||||
public function getCustomer()
|
||||
{
|
||||
return $this->customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Thelia\Model\Address $address
|
||||
*/
|
||||
public function setAddress(Address $address)
|
||||
{
|
||||
$this->address = $address;
|
||||
$this->setCustomer($address->getCustomer());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Thelia\Model\Address
|
||||
*/
|
||||
public function getAddress()
|
||||
{
|
||||
return $this->address;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -64,7 +64,7 @@ final class TheliaEvents
|
||||
/**
|
||||
* sent on customer account update
|
||||
*/
|
||||
const CUSTOMER_UPDATEACCOUNT = "action.modifyCustomer";
|
||||
const CUSTOMER_UPDATEACCOUNT = "action.updateCustomer";
|
||||
|
||||
/**
|
||||
* Sent before the logout of the administrator.
|
||||
@@ -88,12 +88,21 @@ final class TheliaEvents
|
||||
/**
|
||||
* Sent once the customer change form has been successfully validated, and before customer update in the database.
|
||||
*/
|
||||
const BEFORE_CHANGECUSTOMER = "action.before_changecustomer";
|
||||
const BEFORE_CHANGECUSTOMER = "action.before_updateCustomer";
|
||||
/**
|
||||
* Sent just after a successful update of a customer in the database.
|
||||
*/
|
||||
const AFTER_CHANGECUSTOMER = "action.after_changecustomer";
|
||||
const AFTER_CHANGECUSTOMER = "action.after_updateCustomer";
|
||||
|
||||
/**
|
||||
* sent for address creation
|
||||
*/
|
||||
const ADDRESS_CREATE = "action.createAddress";
|
||||
|
||||
/**
|
||||
* sent for address creation
|
||||
*/
|
||||
const ADDRESS_UPDATE = "action.updateAddress";
|
||||
|
||||
/**
|
||||
* Sent once the category creation form has been successfully validated, and before category insertion in the database.
|
||||
@@ -104,7 +113,7 @@ final class TheliaEvents
|
||||
* Create, change or delete a category
|
||||
*/
|
||||
const CATEGORY_CREATE = "action.createCategory";
|
||||
const CATEGORY_MODIFY = "action.modifyCategory";
|
||||
const CATEGORY_UPDATE = "action.updateCategory";
|
||||
const CATEGORY_DELETE = "action.deleteCategory";
|
||||
|
||||
/**
|
||||
@@ -134,12 +143,12 @@ final class TheliaEvents
|
||||
/**
|
||||
* Sent just before a successful change of a category in the database.
|
||||
*/
|
||||
const BEFORE_CHANGECATEGORY = "action.before_changecategory";
|
||||
const BEFORE_UPDATECATEGORY = "action.before_updateCategory";
|
||||
|
||||
/**
|
||||
* Sent just after a successful change of a category in the database.
|
||||
*/
|
||||
const AFTER_CHANGECATEGORY = "action.after_changecategory";
|
||||
const AFTER_UPDATECATEGORY = "action.after_updateCategory";
|
||||
|
||||
/**
|
||||
* sent when a new existing cat id duplicated. This append when current customer is different from current cart
|
||||
@@ -154,7 +163,7 @@ final class TheliaEvents
|
||||
/**
|
||||
* sent when a cart item is modify
|
||||
*/
|
||||
const AFTER_CARTCHANGEITEM = "cart.modifyItem";
|
||||
const AFTER_CARTUPDATEITEM = "cart.updateItem";
|
||||
|
||||
/**
|
||||
* sent for addArticle action
|
||||
@@ -164,7 +173,7 @@ final class TheliaEvents
|
||||
/**
|
||||
* sent on modify article action
|
||||
*/
|
||||
const CART_CHANGEITEM = "action.changeArticle";
|
||||
const CART_UPDATEITEM = "action.updateArticle";
|
||||
|
||||
const CART_DELETEITEM = "action.deleteArticle";
|
||||
|
||||
@@ -182,14 +191,14 @@ final class TheliaEvents
|
||||
|
||||
const CONFIG_CREATE = "action.createConfig";
|
||||
const CONFIG_SETVALUE = "action.setConfigValue";
|
||||
const CONFIG_MODIFY = "action.changeConfig";
|
||||
const CONFIG_UPDATE = "action.updateConfig";
|
||||
const CONFIG_DELETE = "action.deleteConfig";
|
||||
|
||||
const BEFORE_CREATECONFIG = "action.before_createConfig";
|
||||
const AFTER_CREATECONFIG = "action.after_createConfig";
|
||||
|
||||
const BEFORE_CHANGECONFIG = "action.before_changeConfig";
|
||||
const AFTER_CHANGECONFIG = "action.after_changeConfig";
|
||||
const BEFORE_UPDATECONFIG = "action.before_updateConfig";
|
||||
const AFTER_UPDATECONFIG = "action.after_updateConfig";
|
||||
|
||||
const BEFORE_DELETECONFIG = "action.before_deleteConfig";
|
||||
const AFTER_DELETECONFIG = "action.after_deleteConfig";
|
||||
@@ -197,14 +206,14 @@ final class TheliaEvents
|
||||
// -- Messages management ---------------------------------------------
|
||||
|
||||
const MESSAGE_CREATE = "action.createMessage";
|
||||
const MESSAGE_MODIFY = "action.changeMessage";
|
||||
const MESSAGE_UPDATE = "action.updateMessage";
|
||||
const MESSAGE_DELETE = "action.deleteMessage";
|
||||
|
||||
const BEFORE_CREATEMESSAGE = "action.before_createMessage";
|
||||
const AFTER_CREATEMESSAGE = "action.after_createMessage";
|
||||
|
||||
const BEFORE_CHANGEMESSAGE = "action.before_changeMessage";
|
||||
const AFTER_CHANGEMESSAGE = "action.after_changeMessage";
|
||||
const BEFORE_UPDATEMESSAGE = "action.before_updateMessage";
|
||||
const AFTER_UPDATEMESSAGE = "action.after_updateMessage";
|
||||
|
||||
const BEFORE_DELETEMESSAGE = "action.before_deleteMessage";
|
||||
const AFTER_DELETEMESSAGE = "action.after_deleteMessage";
|
||||
@@ -212,17 +221,20 @@ final class TheliaEvents
|
||||
// -- Currencies management ---------------------------------------------
|
||||
|
||||
const CURRENCY_CREATE = "action.createCurrency";
|
||||
const CURRENCY_MODIFY = "action.changeCurrency";
|
||||
const CURRENCY_UPDATE = "action.updateCurrency";
|
||||
const CURRENCY_DELETE = "action.deleteCurrency";
|
||||
const CURRENCY_SET_DEFAULT = "action.setDefaultCurrency";
|
||||
const CURRENCY_UPDATE_RATES = "action.updateCurrencyRates";
|
||||
|
||||
|
||||
const BEFORE_CREATECURRENCY = "action.before_createCurrency";
|
||||
const AFTER_CREATECURRENCY = "action.after_createCurrency";
|
||||
|
||||
const BEFORE_CHANGECURRENCY = "action.before_changeCurrency";
|
||||
const AFTER_CHANGECURRENCY = "action.after_changeCurrency";
|
||||
const BEFORE_UPDATECURRENCY = "action.before_updateCurrency";
|
||||
const AFTER_UPDATECURRENCY = "action.after_updateCurrency";
|
||||
|
||||
const BEFORE_DELETECURRENCY = "action.before_deleteCurrency";
|
||||
const AFTER_DELETECURRENCY = "action.after_deleteCurrency";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ class ViewListener implements EventSubscriberInterface
|
||||
} catch (AuthenticationException $ex) {
|
||||
|
||||
// Redirect to the login template
|
||||
$event->setResponse(Redirect::exec(URL::viewUrl($ex->getLoginTemplate())));
|
||||
Redirect::exec(URL::viewUrl($ex->getLoginTemplate()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ class SecurityContext
|
||||
*/
|
||||
public function hasAdminUser()
|
||||
{
|
||||
return $this->getSession()->getAdminUser() != null;
|
||||
return $this->getSession()->getAdminUser() !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ class SecurityContext
|
||||
*/
|
||||
public function hasCustomerUser()
|
||||
{
|
||||
return $this->getSession()->getCustomerUser() != null;
|
||||
return $this->getSession()->getCustomerUser() !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,6 +36,7 @@ class SmartyParser extends Smarty implements ParserInterface
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param EventDispatcherInterface $dispatcher
|
||||
* @param ParserContext $parserContext
|
||||
* @param bool $template
|
||||
* @param string $env
|
||||
* @param bool $debug
|
||||
|
||||
Reference in New Issue
Block a user