Merge branch 'master' into frontend
Conflicts: core/lib/Thelia/Controller/Admin/OrderController.php
This commit is contained in:
@@ -5,13 +5,13 @@
|
||||
* @file
|
||||
* Functions needed for Thelia bootstrap
|
||||
*/
|
||||
define('THELIA_ROOT' , rtrim(realpath(__DIR__ .'/../'),'/') . "/");
|
||||
define('THELIA_LOCAL_DIR' , THELIA_ROOT . 'local/');
|
||||
define('THELIA_CONF_DIR' , THELIA_LOCAL_DIR . 'config/');
|
||||
define('THELIA_MODULE_DIR' , THELIA_LOCAL_DIR . 'modules/');
|
||||
define('THELIA_WEB_DIR' , THELIA_ROOT . 'web/');
|
||||
define('THELIA_TEMPLATE_DIR' , THELIA_ROOT . 'templates/');
|
||||
define('DS' , DIRECTORY_SEPARATOR);
|
||||
define('THELIA_ROOT' , rtrim(realpath(dirname(__DIR__)), DS) . DS);
|
||||
define('THELIA_LOCAL_DIR' , THELIA_ROOT . 'local' . DS);
|
||||
define('THELIA_CONF_DIR' , THELIA_LOCAL_DIR . 'config' . DS);
|
||||
define('THELIA_MODULE_DIR' , THELIA_LOCAL_DIR . 'modules' . DS);
|
||||
define('THELIA_WEB_DIR' , THELIA_ROOT . 'web' . DS);
|
||||
define('THELIA_TEMPLATE_DIR' , THELIA_ROOT . 'templates' . DS);
|
||||
|
||||
$loader = require __DIR__ . "/vendor/autoload.php";
|
||||
|
||||
|
||||
@@ -83,9 +83,10 @@ class Customer extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
public function delete(CustomerEvent $event)
|
||||
{
|
||||
$customer = $event->getCustomer();
|
||||
if (null !== $customer = $event->getCustomer()) {
|
||||
|
||||
$customer->delete();
|
||||
$customer->delete();
|
||||
}
|
||||
}
|
||||
|
||||
private function createOrUpdateCustomer(CustomerModel $customer, CustomerCreateOrUpdateEvent $event)
|
||||
|
||||
@@ -109,19 +109,17 @@
|
||||
<!-- Customer rule management -->
|
||||
|
||||
<route id="admin.customers" path="/admin/customers">
|
||||
<default key="_controller">Thelia\Controller\Admin\CustomerController::indexAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\CustomerController::defaultAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.customer.update.view" path="/admin/customer/update/{customer_id}" methods="get">
|
||||
<default key="_controller">Thelia\Controller\Admin\CustomerController::viewAction</default>
|
||||
<requirement key="customer_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="admin.customer.update.process" path="/admin/customer/update/{customer_id}" methods="post">
|
||||
<route id="admin.customer.update.view" path="/admin/customer/update">
|
||||
<default key="_controller">Thelia\Controller\Admin\CustomerController::updateAction</default>
|
||||
<requirement key="customer_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="admin.customer.update.process" path="/admin/customer/save">
|
||||
<default key="_controller">Thelia\Controller\Admin\CustomerController::processUpdateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.customer.delete" path="/admin/customer/delete">
|
||||
<default key="_controller">Thelia\Controller\Admin\CustomerController::deleteAction</default>
|
||||
</route>
|
||||
@@ -146,14 +144,12 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\AddressController::createAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.address.update.view" path="/admin/address/update/{address_id}">
|
||||
<route id="admin.address.update.view" path="/admin/address/update">
|
||||
<default key="_controller">Thelia\Controller\Admin\AddressController::updateAction</default>
|
||||
<requirement key="address_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="admin.address.save" path="/admin/address/save/{address_id}">
|
||||
<route id="admin.address.save" path="/admin/address/save">
|
||||
<default key="_controller">Thelia\Controller\Admin\AddressController::processUpdateAction</default>
|
||||
<requirement key="address_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<!-- end address management -->
|
||||
|
||||
@@ -4,23 +4,21 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<services>
|
||||
|
||||
<!-- URL maganement -->
|
||||
|
||||
|
||||
<!-- The assets manager -->
|
||||
<service id="assetic.asset.manager" class="Thelia\Core\Template\Assets\AsseticAssetManager" >
|
||||
<argument>%kernel.environment%</argument>
|
||||
</service>
|
||||
|
||||
<!-- Smarty parser plugins -->
|
||||
|
||||
<service id="smarty.plugin.assetic" class="Thelia\Core\Template\Smarty\Plugins\Assetic" >
|
||||
<service id="smarty.plugin.assets" class="Thelia\Core\Template\Smarty\Plugins\Assets" >
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
<argument>%kernel.environment%</argument>
|
||||
|
||||
<argument type="service" id="assetic.asset.manager" />
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.theliasyntax" class="Thelia\Core\Template\Smarty\Plugins\TheliaSyntax" >
|
||||
|
||||
@@ -267,7 +267,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
*/
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::VIEW)) return $response;
|
||||
return $this->renderList();
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
public function createAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::CREATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::CREATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
@@ -340,7 +340,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
public function updateAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
// Load the object
|
||||
$object = $this->getExistingObject();
|
||||
@@ -366,7 +366,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
public function processUpdateAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
@@ -431,7 +431,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
public function updatePositionAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
try {
|
||||
$mode = $this->getRequest()->get('mode', null);
|
||||
@@ -465,7 +465,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
protected function genericUpdatePositionAction($object, $eventName, $doFinalRedirect = true)
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
if ($object != null) {
|
||||
|
||||
@@ -499,7 +499,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
public function setToggleVisibilityAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$changeEvent = $this->createToggleVisibilityEvent($this->getRequest());
|
||||
|
||||
@@ -521,7 +521,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
public function deleteAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::DELETE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::DELETE)) return $response;
|
||||
|
||||
// Get the currency id, and dispatch the delet request
|
||||
$deleteEvent = $this->getDeleteEvent();
|
||||
|
||||
@@ -42,7 +42,7 @@ class AddressController extends AbstractCrudController
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
'address',
|
||||
'registration_date',
|
||||
null,
|
||||
null,
|
||||
|
||||
@@ -50,16 +50,13 @@ class AddressController extends AbstractCrudController
|
||||
|
||||
TheliaEvents::ADDRESS_CREATE,
|
||||
TheliaEvents::ADDRESS_UPDATE,
|
||||
TheliaEvents::ADDRESS_DELETE,
|
||||
null,
|
||||
null
|
||||
|
||||
TheliaEvents::ADDRESS_DELETE
|
||||
);
|
||||
}
|
||||
|
||||
public function useAddressAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$address_id = $this->getRequest()->request->get('address_id');
|
||||
|
||||
@@ -79,7 +76,7 @@ class AddressController extends AbstractCrudController
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("error during address setting as default with message %s", $e->getMessage()));
|
||||
}
|
||||
|
||||
$this->redirectToRoute('admin.customer.update.view', array(), array('customer_id' => $address->getCustomerId()));
|
||||
$this->redirectToEditionTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,13 +96,14 @@ class AddressController extends AbstractCrudController
|
||||
}
|
||||
|
||||
/**
|
||||
* Hydrate the update form for this object, before passing it to the update template
|
||||
* Fills in the form data array
|
||||
*
|
||||
* @param \Thelia\Model\Address $object
|
||||
* @param unknown $object
|
||||
* @return multitype:NULL
|
||||
*/
|
||||
protected function hydrateObjectForm($object)
|
||||
protected function createFormDataArray($object)
|
||||
{
|
||||
$data = array(
|
||||
return array(
|
||||
"label" => $object->getLabel(),
|
||||
"title" => $object->getTitleId(),
|
||||
"firstname" => $object->getFirstname(),
|
||||
@@ -120,8 +118,16 @@ class AddressController extends AbstractCrudController
|
||||
"phone" => $object->getPhone(),
|
||||
"company" => $object->getCompany()
|
||||
);
|
||||
}
|
||||
|
||||
return new AddressUpdateForm($this->getRequest(), "form", $data);
|
||||
/**
|
||||
* Hydrate the update form for this object, before passing it to the update template
|
||||
*
|
||||
* @param \Thelia\Model\Address $object
|
||||
*/
|
||||
protected function hydrateObjectForm($object)
|
||||
{
|
||||
return new AddressUpdateForm($this->getRequest(), "form", $this->createFormDataArray($object));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,7 +246,8 @@ class AddressController extends AbstractCrudController
|
||||
*/
|
||||
protected function renderListTemplate($currentOrder)
|
||||
{
|
||||
// TODO: Implement renderListTemplate() method.
|
||||
// We render here the customer edit template.
|
||||
return $this->renderEditionTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -248,9 +255,10 @@ class AddressController extends AbstractCrudController
|
||||
*/
|
||||
protected function renderEditionTemplate()
|
||||
{
|
||||
return $this->render('ajax/address-update-modal', array(
|
||||
"address_id" => $this->getRequest()->get('address_id'),
|
||||
"customer_id" => $this->getExistingObject()->getCustomerId()
|
||||
return $this->render('customer-edit', array(
|
||||
"address_id" => $this->getRequest()->get('address_id'),
|
||||
"page" => $this->getRequest()->get('page'),
|
||||
"customer_id" => $this->getCustomerId()
|
||||
));
|
||||
}
|
||||
|
||||
@@ -259,8 +267,11 @@ class AddressController extends AbstractCrudController
|
||||
*/
|
||||
protected function redirectToEditionTemplate()
|
||||
{
|
||||
$address = $this->getExistingObject();
|
||||
$this->redirectToRoute('admin.customer.update.view', array(), array('customer_id' => $address->getCustomerId()));
|
||||
// We display here the custromer edition template
|
||||
$this->redirectToRoute('admin.customer.update.view', array(
|
||||
"page" => $this->getRequest()->get('page'),
|
||||
"customer_id" => $this->getCustomerId()
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -279,8 +290,7 @@ class AddressController extends AbstractCrudController
|
||||
*/
|
||||
protected function performAdditionalDeleteAction($deleteEvent)
|
||||
{
|
||||
$address = $deleteEvent->getAddress();
|
||||
$this->redirectToRoute('admin.customer.update.view', array(), array('customer_id' => $address->getCustomerId()));
|
||||
$this->redirectToEditionTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -298,4 +308,11 @@ class AddressController extends AbstractCrudController
|
||||
{
|
||||
$this->redirectToEditionTemplate();
|
||||
}
|
||||
|
||||
protected function getCustomerId() {
|
||||
if (null !== $address = $this->getExistingObject())
|
||||
return $address->getCustomerId();
|
||||
else
|
||||
return $this->getRequest()->get('customer_id', 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class AdminLogsController extends BaseAdminController
|
||||
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, AccessManager::VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW)) return $response;
|
||||
|
||||
// Render the edition template.
|
||||
return $this->render('admin-logs');
|
||||
|
||||
@@ -231,7 +231,7 @@ class AreaController extends AbstractCrudController
|
||||
public function addCountry()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$areaCountryForm = new AreaCountryForm($this->getRequest());
|
||||
$error_msg = null;
|
||||
@@ -273,7 +273,7 @@ class AreaController extends AbstractCrudController
|
||||
public function removeCountry()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
$request = $this->getRequest();
|
||||
$removeCountryEvent = new AreaRemoveCountryEvent($request->request->get('areai_id', 0), $request->request->get('country_id', 0));
|
||||
|
||||
@@ -284,7 +284,7 @@ class AreaController extends AbstractCrudController
|
||||
|
||||
public function updatePostageAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$areaUpdateForm = new AreaPostageForm($this->getRequest());
|
||||
$error_msg = null;
|
||||
|
||||
@@ -235,7 +235,7 @@ class AttributeController extends AbstractCrudController
|
||||
protected function addRemoveFromAllTemplates($eventType)
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
try {
|
||||
if (null !== $object = $this->getExistingObject()) {
|
||||
|
||||
@@ -118,17 +118,18 @@ class BaseAdminController extends BaseController
|
||||
* Check current admin user authorisations. An ADMIN role is assumed.
|
||||
*
|
||||
* @param mixed $resources a single resource or an array of resources.
|
||||
* @param mixed $modules a single module or an array of modules.
|
||||
* @param mixed $accesses a single access or an array of accesses.
|
||||
*
|
||||
* @return mixed null if authorization is granted, or a Response object which contains the error page otherwise
|
||||
*
|
||||
*/
|
||||
protected function checkAuth($resources, $accesses)
|
||||
protected function checkAuth($resources, $modules, $accesses)
|
||||
{
|
||||
$resources = is_array($resources) ? $resources : array($resources);
|
||||
$modules = is_array($modules) ? $modules : array($modules);
|
||||
$accesses = is_array($accesses) ? $accesses : array($accesses);
|
||||
|
||||
if ($this->getSecurityContext()->isGranted(array("ADMIN"), $resources, $accesses)) {
|
||||
if ($this->getSecurityContext()->isGranted(array("ADMIN"), $resources, $modules, $accesses)) {
|
||||
// Okay !
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ class CategoryController extends AbstractCrudController
|
||||
public function setToggleVisibilityAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$event = new CategoryToggleVisibilityEvent($this->getExistingObject());
|
||||
|
||||
@@ -295,7 +295,7 @@ class CategoryController extends AbstractCrudController
|
||||
public function addRelatedContentAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$content_id = intval($this->getRequest()->get('content_id'));
|
||||
|
||||
@@ -325,7 +325,7 @@ class CategoryController extends AbstractCrudController
|
||||
public function addRelatedPictureAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) {
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ class CategoryController extends AbstractCrudController
|
||||
public function deleteRelatedContentAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$content_id = intval($this->getRequest()->get('content_id'));
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ class ConfigController extends AbstractCrudController
|
||||
public function changeValuesAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$variables = $this->getRequest()->get('variable', array());
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ class ContentController extends AbstractCrudController
|
||||
public function addAdditionalFolderAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$folder_id = intval($this->getRequest()->request->get('additional_folder_id'));
|
||||
|
||||
@@ -97,7 +97,7 @@ class ContentController extends AbstractCrudController
|
||||
public function removeAdditionalFolderAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$folder_id = intval($this->getRequest()->request->get('additional_folder_id'));
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ class CountryController extends AbstractCrudController
|
||||
|
||||
public function toggleDefaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
$content = null;
|
||||
if (null !== $country_id = $this->getRequest()->get('country_id')) {
|
||||
$toogleDefaultEvent = new CountryToggleDefaultEvent($country_id);
|
||||
|
||||
@@ -62,7 +62,7 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function browseAction()
|
||||
{
|
||||
$this->checkAuth(AdminResources::COUPON, AccessManager::VIEW);
|
||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||
|
||||
$args['urlReadCoupon'] = $this->getRoute(
|
||||
'admin.coupon.read',
|
||||
@@ -94,7 +94,7 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function readAction($couponId)
|
||||
{
|
||||
$this->checkAuth(AdminResources::COUPON, AccessManager::VIEW);
|
||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||
|
||||
// Database request repeated in the loop but cached
|
||||
$search = CouponQuery::create();
|
||||
@@ -122,7 +122,7 @@ class CouponController extends BaseAdminController
|
||||
public function createAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
$response = $this->checkAuth(AdminResources::COUPON, AccessManager::CREATE);
|
||||
$response = $this->checkAuth(AdminResources::COUPON, array(), AccessManager::CREATE);
|
||||
if ($response !== null) {
|
||||
return $response;
|
||||
}
|
||||
@@ -170,7 +170,7 @@ class CouponController extends BaseAdminController
|
||||
public function updateAction($couponId)
|
||||
{
|
||||
// Check current user authorization
|
||||
$response = $this->checkAuth(AdminResources::COUPON, AccessManager::UPDATE);
|
||||
$response = $this->checkAuth(AdminResources::COUPON, array(), AccessManager::UPDATE);
|
||||
if ($response !== null) {
|
||||
return $response;
|
||||
}
|
||||
@@ -274,7 +274,7 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function getConditionInputAction($conditionId)
|
||||
{
|
||||
$this->checkAuth(AdminResources::COUPON, AccessManager::VIEW);
|
||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
@@ -304,7 +304,7 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function updateConditionsAction($couponId)
|
||||
{
|
||||
$this->checkAuth(AdminResources::COUPON, AccessManager::VIEW);
|
||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ class CurrencyController extends AbstractCrudController
|
||||
public function updateRatesAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::CURRENCY_UPDATE_RATES);
|
||||
@@ -203,7 +203,7 @@ class CurrencyController extends AbstractCrudController
|
||||
public function setDefaultAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$changeEvent = new CurrencyUpdateEvent($this->getRequest()->get('currency_id', 0));
|
||||
|
||||
|
||||
@@ -35,171 +35,99 @@ use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Model\CustomerQuery;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Tools\Password;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\Address;
|
||||
|
||||
/**
|
||||
* Class CustomerController
|
||||
* @package Thelia\Controller\Admin
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class CustomerController extends BaseAdminController
|
||||
class CustomerController extends AbstractCrudController
|
||||
{
|
||||
public function indexAction()
|
||||
public function __construct()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::CUSTOMER, AccessManager::VIEW)) return $response;
|
||||
return $this->render("customers", array("display_customer" => 20));
|
||||
|
||||
parent::__construct(
|
||||
'customer',
|
||||
'lastname',
|
||||
'customer_order',
|
||||
|
||||
AdminResources::CUSTOMER,
|
||||
|
||||
TheliaEvents::CUSTOMER_CREATEACCOUNT,
|
||||
TheliaEvents::CUSTOMER_UPDATEACCOUNT,
|
||||
TheliaEvents::CUSTOMER_DELETEACCOUNT
|
||||
);
|
||||
}
|
||||
|
||||
public function viewAction($customer_id)
|
||||
protected function getCreationForm()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::CUSTOMER, AccessManager::VIEW)) return $response;
|
||||
return $this->render("customer-edit", array(
|
||||
"customer_id" => $customer_id
|
||||
));
|
||||
return new CustomerCreateForm($this->getRequest());
|
||||
}
|
||||
|
||||
/**
|
||||
* update customer action
|
||||
*
|
||||
* @param $customer_id
|
||||
* @return mixed|\Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function updateAction($customer_id)
|
||||
protected function getUpdateForm()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::CUSTOMER, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$message = false;
|
||||
|
||||
$customerUpdateForm = new CustomerUpdateForm($this->getRequest());
|
||||
|
||||
try {
|
||||
$customer = CustomerQuery::create()->findPk($customer_id);
|
||||
|
||||
if (null === $customer) {
|
||||
throw new \InvalidArgumentException(sprintf("%d customer id does not exist", $customer_id));
|
||||
}
|
||||
|
||||
$form = $this->validateForm($customerUpdateForm);
|
||||
|
||||
$event = $this->createEventInstance($form->getData());
|
||||
$event->setCustomer($customer);
|
||||
|
||||
$this->dispatch(TheliaEvents::CUSTOMER_UPDATEACCOUNT, $event);
|
||||
|
||||
$customerUpdated = $event->getCustomer();
|
||||
|
||||
$this->adminLogAppend(AdminResources::CUSTOMER, AccessManager::UPDATE, sprintf("Customer with Ref %s (ID %d) modified", $customerUpdated->getRef() , $customerUpdated->getId()));
|
||||
|
||||
if ($this->getRequest()->get("save_mode") == "close") {
|
||||
$this->redirectToRoute("admin.customers");
|
||||
} else {
|
||||
$this->redirectSuccess($customerUpdateForm);
|
||||
}
|
||||
|
||||
} catch (FormValidationException $e) {
|
||||
$message = sprintf("Please check your input: %s", $e->getMessage());
|
||||
} catch (PropelException $e) {
|
||||
$message = $e->getMessage();
|
||||
} catch (\Exception $e) {
|
||||
$message = sprintf("Sorry, an error occured: %s", $e->getMessage()." ".$e->getFile());
|
||||
}
|
||||
|
||||
if ($message !== false) {
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("Error during customer update process : %s.", $message));
|
||||
|
||||
$customerUpdateForm->setErrorMessage($message);
|
||||
|
||||
$this->getParserContext()
|
||||
->addForm($customerUpdateForm)
|
||||
->setGeneralError($message)
|
||||
;
|
||||
}
|
||||
|
||||
return $this->render("customer-edit", array(
|
||||
"customer_id" => $customer_id
|
||||
));
|
||||
return new CustomerUpdateForm($this->getRequest());
|
||||
}
|
||||
|
||||
public function createAction()
|
||||
protected function getCreationEvent($formData)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::CUSTOMER, AccessManager::CREATE)) return $response;
|
||||
|
||||
$message = null;
|
||||
|
||||
$customerCreateForm = new CustomerCreateForm($this->getRequest());
|
||||
|
||||
try {
|
||||
|
||||
$form = $this->validateForm($customerCreateForm);
|
||||
|
||||
$data = $form->getData();
|
||||
$data["password"] = Password::generateRandom();
|
||||
|
||||
$event = $this->createEventInstance($form->getData());
|
||||
|
||||
|
||||
|
||||
$this->dispatch(TheliaEvents::CUSTOMER_CREATEACCOUNT, $event);
|
||||
|
||||
$successUrl = $customerCreateForm->getSuccessUrl();
|
||||
|
||||
$successUrl = str_replace('_ID_', $event->getCustomer()->getId(), $successUrl);
|
||||
|
||||
$this->redirect($successUrl);
|
||||
|
||||
|
||||
}catch (FormValidationException $e) {
|
||||
$message = sprintf("Please check your input: %s", $e->getMessage());
|
||||
} catch (PropelException $e) {
|
||||
$message = $e->getMessage();
|
||||
} catch (\Exception $e) {
|
||||
$message = sprintf("Sorry, an error occured: %s", $e->getMessage()." ".$e->getFile());
|
||||
}
|
||||
|
||||
if ($message !== false) {
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("Error during customer creation process : %s.", $message));
|
||||
|
||||
$customerCreateForm->setErrorMessage($message);
|
||||
|
||||
$this->getParserContext()
|
||||
->addForm($customerCreateForm)
|
||||
->setGeneralError($message)
|
||||
;
|
||||
}
|
||||
|
||||
return $this->render("customers", array("display_customer" => 20));
|
||||
return $this->createEventInstance($formData);
|
||||
}
|
||||
|
||||
public function deleteAction()
|
||||
protected function getUpdateEvent($formData)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::CUSTOMER, AccessManager::DELETE)) return $response;
|
||||
$event = $this->createEventInstance($formData);
|
||||
|
||||
$message = null;
|
||||
$event->setCustomer($this->getExistingObject());
|
||||
|
||||
try {
|
||||
$customer_id = $this->getRequest()->get("customer_id");
|
||||
$customer = CustomerQuery::create()->findPk($customer_id);
|
||||
return $event;
|
||||
}
|
||||
|
||||
if (null === $customer) {
|
||||
throw new \InvalidArgumentException(Translator::getInstance("The customer you want to delete does not exist"));
|
||||
}
|
||||
protected function getDeleteEvent()
|
||||
{
|
||||
return new CustomerEvent($this->getExistingObject());
|
||||
}
|
||||
|
||||
$event = new CustomerEvent($customer);
|
||||
protected function eventContainsObject($event)
|
||||
{
|
||||
return $event->hasCustomer();
|
||||
}
|
||||
|
||||
$this->dispatch(TheliaEvents::CUSTOMER_DELETEACCOUNT, $event);
|
||||
} catch (\Exception $e) {
|
||||
$message = $e->getMessage();
|
||||
}
|
||||
protected function hydrateObjectForm($object)
|
||||
{
|
||||
// Get default adress of the customer
|
||||
$address = $object->getDefaultAddress();
|
||||
|
||||
$params = array(
|
||||
"customer_page" => $this->getRequest()->get("customer_page", 1)
|
||||
// Prepare the data that will hydrate the form
|
||||
$data = array(
|
||||
'id' => $object->getId(),
|
||||
'firstname' => $object->getFirstname(),
|
||||
'lastname' => $object->getLastname(),
|
||||
'email' => $object->getEmail(),
|
||||
'title' => $object->getTitleId(),
|
||||
);
|
||||
|
||||
if ($message) {
|
||||
$params["delete_error_message"] = $message;
|
||||
if ($address !== null) {
|
||||
$data['company'] = $address->getCompany();
|
||||
$data['address1'] = $address->getAddress1();
|
||||
$data['address2'] = $address->getAddress2();
|
||||
$data['address3'] = $address->getAddress3();
|
||||
$data['phone'] = $address->getPhone();
|
||||
$data['cellphone'] = $address->getCellphone();
|
||||
$data['zipcode'] = $address->getZipcode();
|
||||
$data['city'] = $address->getCity();
|
||||
$data['country'] = $address->getCountryId();
|
||||
}
|
||||
|
||||
$this->redirectToRoute("admin.customers", $params);
|
||||
// A loop is used in the template
|
||||
return new CustomerUpdateForm($this->getRequest(), 'form', $data);
|
||||
}
|
||||
|
||||
protected function getObjectFromEvent($event)
|
||||
{
|
||||
return $event->hasCustomer() ? $event->getCustomer() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,26 +137,75 @@ class CustomerController extends BaseAdminController
|
||||
private function createEventInstance($data)
|
||||
{
|
||||
$customerCreateEvent = new CustomerCreateOrUpdateEvent(
|
||||
$data["title"],
|
||||
$data["firstname"],
|
||||
$data["lastname"],
|
||||
$data["address1"],
|
||||
$data["address2"],
|
||||
$data["address3"],
|
||||
$data["phone"],
|
||||
$data["cellphone"],
|
||||
$data["zipcode"],
|
||||
$data["city"],
|
||||
$data["country"],
|
||||
isset($data["email"])?$data["email"]:null,
|
||||
isset($data["password"]) ? $data["password"]:null,
|
||||
$this->getRequest()->getSession()->getLang()->getId(),
|
||||
isset($data["reseller"])?$data["reseller"]:null,
|
||||
isset($data["sponsor"])?$data["sponsor"]:null,
|
||||
isset($data["discount"])?$data["discount"]:null,
|
||||
isset($data["company"])?$data["company"]:null
|
||||
$data["title"],
|
||||
$data["firstname"],
|
||||
$data["lastname"],
|
||||
$data["address1"],
|
||||
$data["address2"],
|
||||
$data["address3"],
|
||||
$data["phone"],
|
||||
$data["cellphone"],
|
||||
$data["zipcode"],
|
||||
$data["city"],
|
||||
$data["country"],
|
||||
isset($data["email"])?$data["email"]:null,
|
||||
isset($data["password"]) && ! empty($data["password"]) ? $data["password"]:null,
|
||||
$this->getRequest()->getSession()->getLang()->getId(),
|
||||
isset($data["reseller"])?$data["reseller"]:null,
|
||||
isset($data["sponsor"])?$data["sponsor"]:null,
|
||||
isset($data["discount"])?$data["discount"]:null,
|
||||
isset($data["company"])?$data["company"]:null
|
||||
);
|
||||
|
||||
return $customerCreateEvent;
|
||||
}
|
||||
}
|
||||
|
||||
protected function getExistingObject()
|
||||
{
|
||||
return CustomerQuery::create()->findPk($this->getRequest()->get('customer_id', 0));
|
||||
}
|
||||
|
||||
protected function getObjectLabel($object)
|
||||
{
|
||||
return $object->getRef() . "(".$object->getLastname()." ".$object->getFirstname().")";
|
||||
}
|
||||
|
||||
protected function getObjectId($object)
|
||||
{
|
||||
return $object->getId();
|
||||
}
|
||||
|
||||
protected function getEditionArguments()
|
||||
{
|
||||
return array(
|
||||
'customer_id' => $this->getRequest()->get('customer_id', 0),
|
||||
'page' => $this->getRequest()->get('page', 1)
|
||||
);
|
||||
}
|
||||
|
||||
protected function renderListTemplate($currentOrder)
|
||||
{
|
||||
return $this->render('customers', array(
|
||||
'customer_order' => $currentOrder,
|
||||
'display_customer' => 20,
|
||||
'page' => $this->getRequest()->get('page', 1)
|
||||
));
|
||||
}
|
||||
|
||||
protected function redirectToListTemplate()
|
||||
{
|
||||
$this->redirectToRoute('admin.customers', array(
|
||||
'page' => $this->getRequest()->get('page', 1))
|
||||
);
|
||||
}
|
||||
|
||||
protected function renderEditionTemplate()
|
||||
{
|
||||
return $this->render('customer-edit', $this->getEditionArguments());
|
||||
}
|
||||
|
||||
protected function redirectToEditionTemplate()
|
||||
{
|
||||
$this->redirectToRoute("admin.customer.update.view", $this->getEditionArguments());
|
||||
}
|
||||
}
|
||||
@@ -235,7 +235,7 @@ class FeatureController extends AbstractCrudController
|
||||
protected function addRemoveFromAllTemplates($eventType)
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
try {
|
||||
if (null !== $object = $this->getExistingObject()) {
|
||||
|
||||
@@ -71,7 +71,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function saveImageAjaxAction($parentId, $parentType)
|
||||
{
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE);
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), array(), AccessManager::UPDATE);
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
if ($this->isParentTypeValid($parentType)) {
|
||||
@@ -161,7 +161,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function saveDocumentAjaxAction($parentId, $parentType)
|
||||
{
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE);
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), array(), AccessManager::UPDATE);
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
if ($this->isParentTypeValid($parentType)) {
|
||||
@@ -239,7 +239,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function getImageListAjaxAction($parentId, $parentType)
|
||||
{
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE);
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), array(), AccessManager::UPDATE);
|
||||
$this->checkXmlHttpRequest();
|
||||
$args = array('imageType' => $parentType, 'parentId' => $parentId);
|
||||
|
||||
@@ -256,7 +256,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function getDocumentListAjaxAction($parentId, $parentType)
|
||||
{
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE);
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), array(), AccessManager::UPDATE);
|
||||
$this->checkXmlHttpRequest();
|
||||
$args = array('documentType' => $parentType, 'parentId' => $parentId);
|
||||
|
||||
@@ -273,7 +273,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function getImageFormAjaxAction($parentId, $parentType)
|
||||
{
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE);
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), array(), AccessManager::UPDATE);
|
||||
$this->checkXmlHttpRequest();
|
||||
$args = array('imageType' => $parentType, 'parentId' => $parentId);
|
||||
|
||||
@@ -290,7 +290,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function getDocumentFormAjaxAction($parentId, $parentType)
|
||||
{
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE);
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), array(), AccessManager::UPDATE);
|
||||
$this->checkXmlHttpRequest();
|
||||
$args = array('documentType' => $parentType, 'parentId' => $parentId);
|
||||
|
||||
@@ -307,7 +307,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function viewImageAction($imageId, $parentType)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE)) {
|
||||
if (null !== $response = $this->checkAuth(AdminResources::retrieve($parentType), array(), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
try {
|
||||
@@ -336,7 +336,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function viewDocumentAction($documentId, $parentType)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE)) {
|
||||
if (null !== $response = $this->checkAuth(AdminResources::retrieve($parentType), array(), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
try {
|
||||
@@ -365,7 +365,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function updateImageAction($imageId, $parentType)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE)) {
|
||||
if (null !== $response = $this->checkAuth(AdminResources::retrieve($parentType), array(), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -442,7 +442,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function updateDocumentAction($documentId, $parentType)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE)) {
|
||||
if (null !== $response = $this->checkAuth(AdminResources::retrieve($parentType), array(), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -519,7 +519,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function deleteImageAction($imageId, $parentType)
|
||||
{
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE);
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), array(), AccessManager::UPDATE);
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
$fileManager = new FileManager($this->container);
|
||||
@@ -591,7 +591,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function deleteDocumentAction($documentId, $parentType)
|
||||
{
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE);
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), array(), AccessManager::UPDATE);
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
$fileManager = new FileManager($this->container);
|
||||
|
||||
@@ -33,7 +33,7 @@ class HomeController extends BaseAdminController
|
||||
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, AccessManager::VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW)) return $response;
|
||||
|
||||
// Render the edition template.
|
||||
return $this->render('home');
|
||||
|
||||
@@ -51,7 +51,7 @@ class LangController extends BaseAdminController
|
||||
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, array(), AccessManager::VIEW)) return $response;
|
||||
return $this->renderDefault();
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ class LangController extends BaseAdminController
|
||||
|
||||
public function updateAction($lang_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
@@ -96,7 +96,7 @@ class LangController extends BaseAdminController
|
||||
|
||||
public function processUpdateAction($lang_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
@@ -138,7 +138,7 @@ class LangController extends BaseAdminController
|
||||
|
||||
public function toggleDefaultAction($lang_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
$error = false;
|
||||
@@ -169,7 +169,7 @@ class LangController extends BaseAdminController
|
||||
|
||||
public function addAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::CREATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, array(), AccessManager::CREATE)) return $response;
|
||||
|
||||
$createForm = new LangCreateForm($this->getRequest());
|
||||
|
||||
@@ -211,7 +211,7 @@ class LangController extends BaseAdminController
|
||||
|
||||
public function deleteAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::DELETE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, array(), AccessManager::DELETE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
@@ -235,7 +235,7 @@ class LangController extends BaseAdminController
|
||||
|
||||
public function defaultBehaviorAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
@@ -267,7 +267,7 @@ class LangController extends BaseAdminController
|
||||
|
||||
public function domainAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
$langUrlForm = new LangUrlForm($this->getRequest());
|
||||
@@ -314,7 +314,7 @@ class LangController extends BaseAdminController
|
||||
|
||||
private function domainActivation($activate)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class LanguageController extends BaseAdminController
|
||||
{
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, array(), AccessManager::VIEW)) return $response;
|
||||
return $this->render("languages");
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class MailingSystemController extends BaseAdminController
|
||||
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, AccessManager::VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW)) return $response;
|
||||
|
||||
// Hydrate the form abd pass it to the parser
|
||||
$data = array(
|
||||
@@ -64,7 +64,7 @@ class MailingSystemController extends BaseAdminController
|
||||
public function updateAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ class ModuleController extends AbstractCrudController
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, AccessManager::VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, array(), AccessManager::VIEW)) return $response;
|
||||
|
||||
$moduleManagement = new ModuleManagement();
|
||||
$moduleManagement->updateModules();
|
||||
@@ -190,7 +190,7 @@ class ModuleController extends AbstractCrudController
|
||||
|
||||
public function toggleActivationAction($module_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, array(), AccessManager::UPDATE)) return $response;
|
||||
$message = null;
|
||||
try {
|
||||
$event = new ModuleToggleActivationEvent($module_id);
|
||||
@@ -222,7 +222,7 @@ class ModuleController extends AbstractCrudController
|
||||
|
||||
public function deleteAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, AccessManager::DELETE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, array(), AccessManager::DELETE)) return $response;
|
||||
|
||||
$message = null;
|
||||
try {
|
||||
|
||||
@@ -47,7 +47,7 @@ class OrderController extends BaseAdminController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER, AccessManager::VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER, array(), AccessManager::VIEW)) return $response;
|
||||
return $this->render("orders", array("display_order" => 20));
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class OrderController extends BaseAdminController
|
||||
|
||||
public function updateStatus($order_id = null)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$message = null;
|
||||
|
||||
@@ -111,7 +111,7 @@ class OrderController extends BaseAdminController
|
||||
|
||||
public function updateDeliveryRef($order_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$message = null;
|
||||
|
||||
@@ -146,7 +146,7 @@ class OrderController extends BaseAdminController
|
||||
|
||||
public function updateAddress($order_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$message = null;
|
||||
|
||||
|
||||
@@ -407,7 +407,7 @@ class ProductController extends AbstractCrudController
|
||||
public function setToggleVisibilityAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$event = new ProductToggleVisibilityEvent($this->getExistingObject());
|
||||
|
||||
@@ -483,7 +483,7 @@ class ProductController extends AbstractCrudController
|
||||
{
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$content_id = intval($this->getRequest()->get('content_id'));
|
||||
|
||||
@@ -509,7 +509,7 @@ class ProductController extends AbstractCrudController
|
||||
{
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$content_id = intval($this->getRequest()->get('content_id'));
|
||||
|
||||
@@ -561,7 +561,7 @@ class ProductController extends AbstractCrudController
|
||||
public function addAccessoryAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$accessory_id = intval($this->getRequest()->get('accessory_id'));
|
||||
|
||||
@@ -586,7 +586,7 @@ class ProductController extends AbstractCrudController
|
||||
public function deleteAccessoryAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$accessory_id = intval($this->getRequest()->get('accessory_id'));
|
||||
|
||||
@@ -642,7 +642,7 @@ class ProductController extends AbstractCrudController
|
||||
public function setProductTemplateAction($productId)
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$product = ProductQuery::create()->findPk($productId);
|
||||
|
||||
@@ -739,7 +739,7 @@ class ProductController extends AbstractCrudController
|
||||
public function addAdditionalCategoryAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$category_id = intval($this->getRequest()->request->get('additional_category_id'));
|
||||
|
||||
@@ -764,7 +764,7 @@ class ProductController extends AbstractCrudController
|
||||
public function deleteAdditionalCategoryAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$category_id = intval($this->getRequest()->get('additional_category_id'));
|
||||
|
||||
@@ -861,7 +861,7 @@ class ProductController extends AbstractCrudController
|
||||
public function addProductSaleElementAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$event = new ProductSaleElementCreateEvent(
|
||||
$this->getExistingObject(),
|
||||
@@ -885,7 +885,7 @@ class ProductController extends AbstractCrudController
|
||||
public function deleteProductSaleElementAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$event = new ProductSaleElementDeleteEvent(
|
||||
$this->getRequest()->get('product_sale_element_id',0),
|
||||
@@ -944,7 +944,7 @@ class ProductController extends AbstractCrudController
|
||||
protected function processProductSaleElementUpdate($changeForm)
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
@@ -1053,7 +1053,7 @@ class ProductController extends AbstractCrudController
|
||||
public function buildCombinationsAction() {
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ class ProfileController extends AbstractCrudController
|
||||
|
||||
public function updateAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$object = $this->getExistingObject();
|
||||
|
||||
@@ -306,7 +306,7 @@ class ProfileController extends AbstractCrudController
|
||||
public function processUpdateResourceAccess()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
@@ -355,7 +355,7 @@ class ProfileController extends AbstractCrudController
|
||||
public function processUpdateModuleAccess()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
|
||||
@@ -42,13 +42,13 @@ class ShippingZoneController extends BaseAdminController
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE, AccessManager::VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE, array(), AccessManager::VIEW)) return $response;
|
||||
return $this->render("shipping-zones", array("display_shipping_zone" => 20));
|
||||
}
|
||||
|
||||
public function updateAction($shipping_zones_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE, AccessManager::VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE, array(), AccessManager::VIEW)) return $response;
|
||||
return $this->render("shipping-zones-edit", array(
|
||||
"shipping_zones_id" => $shipping_zones_id
|
||||
));
|
||||
@@ -59,7 +59,7 @@ class ShippingZoneController extends BaseAdminController
|
||||
*/
|
||||
public function addArea()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$shippingAreaForm = new ShippingZoneAddArea($this->getRequest());
|
||||
$error_msg = null;
|
||||
@@ -94,7 +94,7 @@ class ShippingZoneController extends BaseAdminController
|
||||
|
||||
public function removeArea()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$shippingAreaForm = new ShippingZoneRemoveArea($this->getRequest());
|
||||
$error_msg = null;
|
||||
|
||||
@@ -86,7 +86,7 @@ class SystemLogController extends BaseAdminController
|
||||
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SYSTEM_LOG, AccessManager::VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SYSTEM_LOG, array(), AccessManager::VIEW)) return $response;
|
||||
|
||||
/*
|
||||
const VAR_LEVEL = "tlog_level";
|
||||
@@ -121,7 +121,7 @@ class SystemLogController extends BaseAdminController
|
||||
|
||||
public function saveAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ class TaxRuleController extends AbstractCrudController
|
||||
|
||||
public function updateAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$object = $this->getExistingObject();
|
||||
|
||||
@@ -237,7 +237,7 @@ class TaxRuleController extends AbstractCrudController
|
||||
|
||||
public function setDefaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$setDefaultEvent = new TaxRuleEvent();
|
||||
|
||||
@@ -255,7 +255,7 @@ class TaxRuleController extends AbstractCrudController
|
||||
public function processUpdateTaxesAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ class TemplateController extends AbstractCrudController
|
||||
public function addAttributeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$attribute_id = intval($this->getRequest()->get('attribute_id'));
|
||||
|
||||
@@ -235,7 +235,7 @@ class TemplateController extends AbstractCrudController
|
||||
public function deleteAttributeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$event = new TemplateDeleteAttributeEvent(
|
||||
$this->getExistingObject(),
|
||||
@@ -270,7 +270,7 @@ class TemplateController extends AbstractCrudController
|
||||
public function addFeatureAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$feature_id = intval($this->getRequest()->get('feature_id'));
|
||||
|
||||
@@ -294,7 +294,7 @@ class TemplateController extends AbstractCrudController
|
||||
public function deleteFeatureAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
$event = new TemplateDeleteFeatureEvent(
|
||||
$this->getExistingObject(),
|
||||
|
||||
@@ -161,14 +161,14 @@ class TranslationsController extends BaseAdminController
|
||||
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TRANSLATIONS, AccessManager::VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TRANSLATIONS, array(), AccessManager::VIEW)) return $response;
|
||||
|
||||
return $this->renderTemplate();
|
||||
}
|
||||
|
||||
public function updateAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
return $this->renderTemplate();
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
|
||||
interface NullControllerInterface
|
||||
{
|
||||
/**
|
||||
* Nothing to do
|
||||
*/
|
||||
public function noAction(Request $request);
|
||||
|
||||
}
|
||||
@@ -31,7 +31,7 @@ use Thelia\Model\Customer;
|
||||
* @package Thelia\Core\Event
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class CustomerCreateOrUpdateEvent extends ActionEvent
|
||||
class CustomerCreateOrUpdateEvent extends CustomerEvent
|
||||
{
|
||||
//base parameters for creating new customer
|
||||
protected $title;
|
||||
@@ -53,11 +53,6 @@ class CustomerCreateOrUpdateEvent extends ActionEvent
|
||||
protected $discount;
|
||||
protected $company;
|
||||
|
||||
/**
|
||||
* @var \Thelia\Model\Customer
|
||||
*/
|
||||
protected $customer;
|
||||
|
||||
/**
|
||||
* @param int $title the title customer id
|
||||
* @param string $firstname
|
||||
@@ -242,21 +237,4 @@ class CustomerCreateOrUpdateEvent extends ActionEvent
|
||||
{
|
||||
return $this->sponsor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Customer $customer
|
||||
*/
|
||||
public function setCustomer(Customer $customer)
|
||||
{
|
||||
$this->customer = $customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Customer
|
||||
*/
|
||||
public function getCustomer()
|
||||
{
|
||||
return $this->customer;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,13 +28,23 @@ use Thelia\Core\Event\ActionEvent;
|
||||
|
||||
class CustomerEvent extends ActionEvent
|
||||
{
|
||||
public $customer;
|
||||
public $customer = null;
|
||||
|
||||
public function __construct(Customer $customer)
|
||||
public function __construct(Customer $customer = null)
|
||||
{
|
||||
$this->customer = $customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Customer $customer
|
||||
*/
|
||||
public function setCustomer(Customer $customer)
|
||||
{
|
||||
$this->customer = $customer;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Thelia\Model\Customer
|
||||
*/
|
||||
@@ -43,4 +53,12 @@ class CustomerEvent extends ActionEvent
|
||||
return $this->customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasCustomer()
|
||||
{
|
||||
return $this->customer != null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,17 +26,7 @@ namespace Thelia\Core\Event\Customer;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
use Thelia\Model\Customer;
|
||||
|
||||
class CustomerLoginEvent extends ActionEvent
|
||||
class CustomerLoginEvent extends CustomerEvent
|
||||
{
|
||||
protected $customer;
|
||||
|
||||
public function __construct(Customer $customer)
|
||||
{
|
||||
$this->customer = $customer;
|
||||
}
|
||||
|
||||
public function getCustomer()
|
||||
{
|
||||
return $this->customer;
|
||||
}
|
||||
// Nothing specific :)
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ class SecurityContext
|
||||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
final public function isGranted(array $roles, array $resources, array $accesses)
|
||||
final public function isGranted(array $roles, array $resources, array $modules, array $accesses)
|
||||
{
|
||||
// Find a user which matches the required roles.
|
||||
$user = $this->getCustomerUser();
|
||||
@@ -140,7 +140,7 @@ class SecurityContext
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($resources) || empty($accesses)) {
|
||||
if ((empty($resources) && empty($modules)) || empty($accesses)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -172,6 +172,28 @@ class SecurityContext
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($modules as $module) {
|
||||
if ($module === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!array_key_exists('module', $userPermissions)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$module = strtolower($module);
|
||||
|
||||
if (!array_key_exists($module, $userPermissions['module'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($accesses as $access) {
|
||||
if (!$userPermissions['module'][$module]->can($access)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
<?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\Template\Assets;
|
||||
|
||||
interface AssetManagerInterface {
|
||||
/**
|
||||
* Prepare an asset directory.
|
||||
*
|
||||
* @param string $source_assets_directory the full path to the source asstes directory
|
||||
* @param string $web_assets_directory_base the base directory of the web based asset directory
|
||||
* @throws \RuntimeException if something goes wrong.
|
||||
*/
|
||||
public function prepareAssets($source_assets_directory, $web_assets_directory_base);
|
||||
|
||||
/**
|
||||
* Generates assets from $asset_path in $output_path, using $filters.
|
||||
*
|
||||
* @param string $asset_path the full path to the asset file (or file collection, e.g. *.less)
|
||||
*
|
||||
* @param string $web_assets_directory_base the full disk path to the base assets output directory in the web space
|
||||
* @param string $output_url the URL to the base assets output directory in the web space
|
||||
*
|
||||
* @param string $asset_type the asset type: css, js, ... The generated files will have this extension. Pass an empty string to use the asset source extension.
|
||||
* @param array $filters a list of filters, as defined below (see switch($filter_name) ...)
|
||||
*
|
||||
* @param boolean $debug the debug mode, true or false
|
||||
*
|
||||
* @throws \InvalidArgumentException if an invalid filter name is found
|
||||
* @return string The URL to the generated asset file.
|
||||
*/
|
||||
public function processAsset($asset_path, $web_assets_directory_base, $output_url, $asset_type, $filters, $debug);
|
||||
}
|
||||
350
core/lib/Thelia/Core/Template/Assets/AsseticAssetManager.php
Executable file
350
core/lib/Thelia/Core/Template/Assets/AsseticAssetManager.php
Executable file
@@ -0,0 +1,350 @@
|
||||
<?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\Template\Assets;
|
||||
|
||||
use Assetic\AssetManager;
|
||||
use Assetic\FilterManager;
|
||||
use Assetic\Filter;
|
||||
use Assetic\Factory\AssetFactory;
|
||||
use Assetic\AssetWriter;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Log\Tlog;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\Filesystem\Exception\IOException;
|
||||
|
||||
/**
|
||||
* This class is a simple helper for generating assets using Assetic.
|
||||
*
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class AsseticAssetManager implements AssetManagerInterface
|
||||
{
|
||||
protected $developmentMode;
|
||||
|
||||
protected $source_file_extensions = array('less', 'js', 'coffee', 'html', 'tpl', 'htm', 'xml');
|
||||
|
||||
public function __construct($developmentMode)
|
||||
{
|
||||
$this->developmentMode = $developmentMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a stamp form the modification time of the content of the given directory and all of its subdirectories
|
||||
*
|
||||
* @param string $directory ther directory name
|
||||
* @return string the stamp of this directory
|
||||
*/
|
||||
protected function getStamp($directory)
|
||||
{
|
||||
$stamp = '';
|
||||
|
||||
$iterator = new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator($directory, \RecursiveDirectoryIterator::SKIP_DOTS),
|
||||
\RecursiveIteratorIterator::LEAVES_ONLY);
|
||||
|
||||
foreach ($iterator as $file) {
|
||||
$stamp .= $file->getMTime();
|
||||
}
|
||||
|
||||
return md5($stamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a file is a source asset file
|
||||
*
|
||||
* @param \DirectoryIterator $fileInfo
|
||||
*/
|
||||
protected function isSourceFile(\SplFileInfo $fileInfo) {
|
||||
return in_array($fileInfo->getExtension(), $this->source_file_extensions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively copy assets from the source directory to the destination
|
||||
* directory in the web space, ommiting source files.
|
||||
*
|
||||
* @param string $from_directory the source
|
||||
* @param string $to_directory the destination
|
||||
* @throws \RuntimeException if a problem occurs.
|
||||
*/
|
||||
protected function copyAssets(Filesystem $fs, $from_directory, $to_directory)
|
||||
{
|
||||
Tlog::getInstance()->addDebug("Copying assets from ", $from_directory, " to ", $to_directory);
|
||||
|
||||
$iterator = new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator($from_directory, \RecursiveDirectoryIterator::SKIP_DOTS),
|
||||
\RecursiveIteratorIterator::SELF_FIRST);
|
||||
|
||||
foreach ($iterator as $item) {
|
||||
if ($item->isDir()) {
|
||||
$dest_dir = $to_directory . DS . $iterator->getSubPathName();
|
||||
|
||||
if (! is_dir($dest_dir)) {
|
||||
if ($fs->exists($dest_dir)) {
|
||||
$fs->remove($dest_dir);
|
||||
}
|
||||
|
||||
$fs->mkdir($dest_dir, 0777);
|
||||
}
|
||||
}
|
||||
// We don't copy source files
|
||||
else if (! $this->isSourceFile($item)) {
|
||||
|
||||
$dest_file = $to_directory . DS . $iterator->getSubPathName();
|
||||
|
||||
if ($fs->exists($dest_file)) {
|
||||
$fs->remove($dest_file);
|
||||
}
|
||||
|
||||
$fs->copy($item, $dest_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compite the assets path relative to the base template directory
|
||||
*
|
||||
* @param string $source_assets_directory the source directory
|
||||
* @param string $web_assets_directory_base base directory of the web assets
|
||||
* @return the full path of the destination directory
|
||||
*/
|
||||
protected function getRelativeDirectoryPath($source_assets_directory, $web_assets_directory_base)
|
||||
{
|
||||
$source_assets_directory = realpath($source_assets_directory);
|
||||
|
||||
// Remove base path from asset source path to get a path relative to the template base
|
||||
// and use it to create the destination path.
|
||||
return str_replace(
|
||||
realpath(THELIA_ROOT),
|
||||
'',
|
||||
$source_assets_directory
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the destination directory path, from the source directory and the
|
||||
* base directory of the web assets
|
||||
*
|
||||
* @param string $source_assets_directory the source directory
|
||||
* @param string $web_assets_directory_base base directory of the web assets
|
||||
* @return the full path of the destination directory
|
||||
*/
|
||||
protected function getDestinationDirectory($source_assets_directory, $web_assets_directory_base)
|
||||
{
|
||||
// Compute the absolute path of the output directory
|
||||
return $web_assets_directory_base . $this->getRelativeDirectoryPath($source_assets_directory, $web_assets_directory_base);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an asset directory by checking that no changes occured in
|
||||
* the source directory. If any change is detected, the whole asset directory
|
||||
* is copied in the web space.
|
||||
*
|
||||
* @param string $source_assets_directory the full path to the source asstes directory
|
||||
* @param string $web_assets_directory_base the base directory of the web based asset directory
|
||||
* @throws \RuntimeException if something goes wrong.
|
||||
*/
|
||||
public function prepareAssets($source_assets_directory, $web_assets_directory_base) {
|
||||
|
||||
// Compute the absolute path of the output directory
|
||||
$to_directory = $this->getDestinationDirectory($source_assets_directory, $web_assets_directory_base);
|
||||
|
||||
// Get a path to the stamp file
|
||||
$stamp_file_path = $to_directory . DS . '.source-stamp';
|
||||
|
||||
// Get the last stamp of source assets directory
|
||||
$prev_stamp = @file_get_contents($stamp_file_path);
|
||||
|
||||
// Get the current stamp of the source directory
|
||||
$curr_stamp = $this->getStamp($source_assets_directory);
|
||||
|
||||
if ($prev_stamp !== $curr_stamp) {
|
||||
|
||||
$fs = new Filesystem();
|
||||
|
||||
// FIXME: locking or not locking ?
|
||||
/*
|
||||
$lock_file = "$web_assets_directory_base/assets-".md5($source_assets_directory)."-generation-lock.txt";
|
||||
|
||||
if (! $fp = fopen($lock_file, "w")) {
|
||||
throw new IOException(sprintf('Failed to open lock file %s', $lock_file));
|
||||
}
|
||||
|
||||
if (flock($fp, LOCK_EX|LOCK_NB)) { // do an exclusive lock
|
||||
*/
|
||||
$tmp_dir = "$to_directory.tmp";
|
||||
|
||||
$fs->remove($tmp_dir);
|
||||
|
||||
// Copy the whole source dir in a temp directory
|
||||
$this->copyAssets($fs, $source_assets_directory, $tmp_dir);
|
||||
|
||||
// Remove existing directory
|
||||
if ($fs->exists($to_directory)) $fs->remove($to_directory);
|
||||
|
||||
// Put in place the new directory
|
||||
$fs->rename($tmp_dir, $to_directory);
|
||||
/*
|
||||
// Release the lock
|
||||
flock($fp, LOCK_UN);
|
||||
|
||||
// Remove the lock file
|
||||
@fclose($fp);
|
||||
|
||||
$fs->remove($lock_file);
|
||||
*/
|
||||
if (false === @file_put_contents($stamp_file_path, $curr_stamp)) {
|
||||
throw new \RuntimeException(
|
||||
"Failed to create asset stamp file $stamp_file_path. Please check that your web server has the proper access rights to do that.");
|
||||
}
|
||||
/* }
|
||||
else {
|
||||
@fclose($fp);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode the filters names, and initialize the Assetic FilterManager
|
||||
*
|
||||
* @param FilterManager $filterManager the Assetic filter manager
|
||||
* @param string $filters a comma separated list of filter names
|
||||
* @throws \InvalidArgumentException if a wrong filter is passed
|
||||
* @return an array of filter names
|
||||
*/
|
||||
protected function decodeAsseticFilters(FilterManager $filterManager, $filters) {
|
||||
|
||||
if (!empty($filters)) {
|
||||
|
||||
$filter_list = explode(',', $filters);
|
||||
|
||||
foreach ($filter_list as $filter_name) {
|
||||
|
||||
$filter_name = trim($filter_name);
|
||||
|
||||
switch ($filter_name) {
|
||||
case 'less':
|
||||
$filterManager->set('less', new Filter\LessphpFilter());
|
||||
break;
|
||||
|
||||
case 'sass':
|
||||
$filterManager->set('sass', new Filter\Sass\SassFilter());
|
||||
break;
|
||||
|
||||
case 'cssembed':
|
||||
$filterManager->set('cssembed', new Filter\PhpCssEmbedFilter());
|
||||
break;
|
||||
|
||||
case 'cssrewrite':
|
||||
$filterManager->set('cssrewrite', new Filter\CssRewriteFilter());
|
||||
break;
|
||||
|
||||
case 'cssimport':
|
||||
$filterManager->set('cssimport', new Filter\CssImportFilter());
|
||||
break;
|
||||
|
||||
case 'compass':
|
||||
$filterManager->set('compass', new Filter\CompassFilter());
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new \InvalidArgumentException("Unsupported Assetic filter: '$filter_name'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$filter_list = array();
|
||||
}
|
||||
|
||||
return $filter_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates assets from $asset_path in $output_path, using $filters.
|
||||
*
|
||||
* @param string $asset_path the full path to the asset file (or file collection, e.g. *.less)
|
||||
*
|
||||
* @param string $web_assets_directory_base the full disk path to the base assets output directory in the web space
|
||||
* @param string $output_url the URL to the base assets output directory in the web space
|
||||
*
|
||||
* @param string $asset_type the asset type: css, js, ... The generated files will have this extension. Pass an empty string to use the asset source extension.
|
||||
* @param array $filters a list of filters, as defined below (see switch($filter_name) ...)
|
||||
*
|
||||
* @param boolean $debug true / false
|
||||
* @throws \InvalidArgumentException if an invalid filter name is found
|
||||
* @return string The URL to the generated asset file.
|
||||
*/
|
||||
public function processAsset($asset_path, $web_assets_directory_base, $output_url, $asset_type, $filters, $debug)
|
||||
{
|
||||
$asset_name = basename($asset_path);
|
||||
$input_directory = realpath(dirname($asset_path));
|
||||
|
||||
$am = new AssetManager();
|
||||
$fm = new FilterManager();
|
||||
|
||||
// Get the filter list
|
||||
$filter_list = $this->decodeAsseticFilters($fm, $filters);
|
||||
|
||||
// Factory setup
|
||||
$factory = new AssetFactory($input_directory);
|
||||
|
||||
$factory->setAssetManager($am);
|
||||
$factory->setFilterManager($fm);
|
||||
|
||||
$factory->setDefaultOutput('*' . (!empty($asset_type) ? '.' : '') . $asset_type);
|
||||
|
||||
$factory->setDebug($debug);
|
||||
|
||||
$asset = $factory->createAsset($asset_name, $filter_list);
|
||||
|
||||
$input_directory = realpath(dirname($asset_path));
|
||||
|
||||
$output_directory = $this->getDestinationDirectory($input_directory, $web_assets_directory_base);
|
||||
|
||||
// Get the URL part from the relative path
|
||||
$output_relative_path = $this->getRelativeDirectoryPath($input_directory, $web_assets_directory_base);
|
||||
|
||||
$output_relative_web_path = rtrim(str_replace('\\', '/', $output_relative_path), '/') . '/';
|
||||
|
||||
$asset_target_filename = $asset->getTargetPath();
|
||||
|
||||
// This is the final name of the generated asset
|
||||
$asset_destination_path = $output_directory . DS . $asset_target_filename;
|
||||
|
||||
Tlog::getInstance()->addDebug("Asset destination name: ", $asset_destination_path);
|
||||
|
||||
// We generate an asset only if it does not exists, or if the asset processing is forced in development mode
|
||||
if (! file_exists($asset_destination_path) || ($this->developmentMode && ConfigQuery::read('process_assets', true)) ) {
|
||||
|
||||
$writer = new AssetWriter($output_directory);
|
||||
|
||||
Tlog::getInstance()->addDebug("Writing asset to $output_directory");
|
||||
|
||||
$writer->writeAsset($asset);
|
||||
}
|
||||
|
||||
return rtrim($output_url, '/') . '/' . $output_relative_web_path . $asset_target_filename;
|
||||
}
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
<?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\Template\Assets;
|
||||
|
||||
use Assetic\AssetManager;
|
||||
use Assetic\FilterManager;
|
||||
use Assetic\Filter;
|
||||
use Assetic\Factory\AssetFactory;
|
||||
use Assetic\Factory\Worker\CacheBustingWorker;
|
||||
use Assetic\AssetWriter;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
|
||||
/**
|
||||
* This class is a simple helper for generating assets using Assetic.
|
||||
*
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class AsseticHelper
|
||||
{
|
||||
/**
|
||||
* Generates assets from $asset_path in $output_path, using $filters.
|
||||
*
|
||||
* @param string $asset_path the full path to the asset file (or file collection)
|
||||
* @param string $output_path the full disk path to the output directory (shoud be visible to web server)
|
||||
* @param string $output_url the URL to the generated asset directory
|
||||
* @param string $asset_type the asset type: css, js, ... The generated files will have this extension. Pass an empty string to use the asset source extension.
|
||||
* @param array $filters a list of filters, as defined below (see switch($filter_name) ...)
|
||||
* @param boolean $debug true / false
|
||||
* @param boolean $dev_mode true / false. If true, assets are not cached and always compiled.
|
||||
* @throws \InvalidArgumentException if an invalid filter name is found
|
||||
* @return string The URL to the generated asset file.
|
||||
*/
|
||||
public function asseticize($asset_path, $output_path, $output_url, $asset_type, $filters, $debug, $dev_mode = false)
|
||||
{
|
||||
$asset_name = basename($asset_path);
|
||||
$asset_dir = dirname($asset_path);
|
||||
|
||||
$am = new AssetManager();
|
||||
$fm = new FilterManager();
|
||||
|
||||
if (! empty($filters)) {
|
||||
$filter_list = explode(',', $filters);
|
||||
|
||||
foreach ($filter_list as $filter_name) {
|
||||
|
||||
$filter_name = trim($filter_name);
|
||||
|
||||
switch ($filter_name) {
|
||||
case 'less' :
|
||||
$fm->set('less', new Filter\LessphpFilter());
|
||||
break;
|
||||
|
||||
case 'sass' :
|
||||
$fm->set('sass', new Filter\Sass\SassFilter());
|
||||
break;
|
||||
|
||||
case 'cssembed' :
|
||||
$fm->set('cssembed', new Filter\PhpCssEmbedFilter());
|
||||
break;
|
||||
|
||||
case 'cssrewrite':
|
||||
$fm->set('cssrewrite', new Filter\CssRewriteFilter());
|
||||
break;
|
||||
|
||||
case 'cssimport':
|
||||
$fm->set('cssimport', new Filter\CssImportFilter());
|
||||
break;
|
||||
|
||||
case 'compass':
|
||||
$fm->set('compass', new Filter\CompassFilter());
|
||||
break;
|
||||
|
||||
default :
|
||||
throw new \InvalidArgumentException("Unsupported Assetic filter: '$filter_name'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$filter_list = array();
|
||||
}
|
||||
|
||||
// Factory setup
|
||||
$factory = new AssetFactory($asset_dir);
|
||||
|
||||
$factory->setAssetManager($am);
|
||||
$factory->setFilterManager($fm);
|
||||
|
||||
$factory->setDefaultOutput('*'.(! empty($asset_type) ? '.' : '').$asset_type);
|
||||
|
||||
$factory->setDebug($debug);
|
||||
|
||||
$factory->addWorker(new CacheBustingWorker('-'));
|
||||
|
||||
// We do not pass the filter list here, juste to get the asset file name
|
||||
$asset = $factory->createAsset($asset_name);
|
||||
|
||||
$asset_target_path = $asset->getTargetPath();
|
||||
|
||||
$target_file = sprintf("%s/%s", $output_path, $asset_target_path);
|
||||
|
||||
// As it seems that assetic cannot handle a real file cache, let's do the job ourselves.
|
||||
// It works only if the CacheBustingWorker is used, as a new file name is generated for each version.
|
||||
//
|
||||
// the previous version of the file is deleted, by getting the first part of the ouput file name
|
||||
// (the one before '-'), and delete aby file beginning with the same string. Example:
|
||||
// old name: 3bc974a-dfacc1f.css
|
||||
// new name: 3bc974a-ad3ef47.css
|
||||
//
|
||||
// before generating 3bc974a-ad3ef47.css, delete 3bc974a-* files.
|
||||
//
|
||||
if ($dev_mode == true || ! file_exists($target_file)) {
|
||||
|
||||
if (ConfigQuery::read('process_assets', true)) {
|
||||
|
||||
// Delete previous version of the file
|
||||
list($commonPart, $dummy) = explode('-', $asset_target_path);
|
||||
|
||||
foreach (glob("$output_path/$commonPart-*") as $filename) {
|
||||
@unlink($filename);
|
||||
}
|
||||
|
||||
// Apply filters now
|
||||
foreach ($filter_list as $filter) {
|
||||
if ('?' != $filter[0]) {
|
||||
$asset->ensureFilter($fm->get($filter));
|
||||
} elseif (!$debug) {
|
||||
$asset->ensureFilter($fm->get(substr($filter, 1)));
|
||||
}
|
||||
}
|
||||
|
||||
$writer = new AssetWriter($output_path);
|
||||
|
||||
$writer->writeAsset($asset);
|
||||
}
|
||||
}
|
||||
|
||||
return rtrim($output_url, '/').'/'.$asset_target_path;
|
||||
}
|
||||
}
|
||||
@@ -60,6 +60,12 @@ class Auth extends BaseLoop implements ArraySearchLoopInterface
|
||||
new AlphaNumStringListType()
|
||||
)
|
||||
),
|
||||
new Argument(
|
||||
'module',
|
||||
new TypeCollection(
|
||||
new AlphaNumStringListType()
|
||||
)
|
||||
),
|
||||
new Argument(
|
||||
'access',
|
||||
new TypeCollection(
|
||||
@@ -79,10 +85,20 @@ class Auth extends BaseLoop implements ArraySearchLoopInterface
|
||||
{
|
||||
$roles = $this->getRole();
|
||||
$resource = $this->getResource();
|
||||
$module = $this->getModule();
|
||||
$access = $this->getAccess();
|
||||
|
||||
if(null !== $module) {
|
||||
$in = true;
|
||||
}
|
||||
|
||||
try {
|
||||
if (true === $this->securityContext->isGranted($roles, $resource === null ? array() : $resource, $access === null ? array() : $access)) {
|
||||
if (true === $this->securityContext->isGranted(
|
||||
$roles,
|
||||
$resource === null ? array() : $resource,
|
||||
$module === null ? array() : $module,
|
||||
$access === null ? array() : $access)
|
||||
) {
|
||||
|
||||
// Create an empty row: loop is no longer empty :)
|
||||
$loopResult->addRow(new LoopResultRow());
|
||||
|
||||
@@ -36,6 +36,9 @@ use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Model\CustomerQuery;
|
||||
use Thelia\Type\TypeCollection;
|
||||
use Thelia\Type;
|
||||
use Thelia\Model\OrderQuery;
|
||||
use Thelia\Model\Map\OrderAddressTableMap;
|
||||
use Thelia\Model\Map\OrderTableMap;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -65,7 +68,22 @@ class Customer extends BaseLoop implements SearchLoopInterface, PropelSearchLoop
|
||||
)
|
||||
),
|
||||
Argument::createBooleanTypeArgument('reseller'),
|
||||
Argument::createIntTypeArgument('sponsor')
|
||||
Argument::createIntTypeArgument('sponsor'),
|
||||
new Argument(
|
||||
'order',
|
||||
new TypeCollection(
|
||||
new Type\EnumListType(array(
|
||||
'id', 'id_reverse',
|
||||
'reference', 'reference_reverse',
|
||||
'firstname', 'firstname_reverse',
|
||||
'lastname', 'lastname_reverse',
|
||||
'last_order', 'last_order_reverse',
|
||||
'order_amount', 'order_amount_reverse',
|
||||
'registration_date', 'registration_date_reverse'
|
||||
))
|
||||
),
|
||||
'lastname'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -151,6 +169,49 @@ class Customer extends BaseLoop implements SearchLoopInterface, PropelSearchLoop
|
||||
$search->filterBySponsor($sponsor, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
$orders = $this->getOrder();
|
||||
|
||||
foreach ($orders as $order) {
|
||||
switch ($order) {
|
||||
case 'id':
|
||||
$search->orderById(Criteria::ASC);
|
||||
break;
|
||||
case 'id_reverse':
|
||||
$search->orderById(Criteria::DESC);
|
||||
break;
|
||||
|
||||
case 'reference':
|
||||
$search->orderByRef(Criteria::ASC);
|
||||
break;
|
||||
case 'reference_reverse':
|
||||
$search->orderByRef(Criteria::DESC);
|
||||
break;
|
||||
|
||||
case 'lastname':
|
||||
$search->orderByLastname(Criteria::ASC);
|
||||
break;
|
||||
case 'lastname_reverse':
|
||||
$search->orderByLastname(Criteria::DESC);
|
||||
break;
|
||||
|
||||
case 'firstname':
|
||||
$search->orderByFirstname(Criteria::ASC);
|
||||
break;
|
||||
case 'firstname_reverse':
|
||||
$search->orderByFirstname(Criteria::DESC);
|
||||
break;
|
||||
|
||||
case 'registration_date':
|
||||
$search->orderByCreatedAt(Criteria::ASC);
|
||||
break;
|
||||
case 'registration_date_reverse':
|
||||
$search->orderByCreatedAt(Criteria::DESC);
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $search;
|
||||
|
||||
}
|
||||
@@ -158,16 +219,24 @@ class Customer extends BaseLoop implements SearchLoopInterface, PropelSearchLoop
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
foreach ($loopResult->getResultDataCollection() as $customer) {
|
||||
|
||||
$loopResultRow = new LoopResultRow($customer);
|
||||
$loopResultRow->set("ID", $customer->getId());
|
||||
$loopResultRow->set("REF", $customer->getRef());
|
||||
$loopResultRow->set("TITLE", $customer->getTitleId());
|
||||
$loopResultRow->set("FIRSTNAME", $customer->getFirstname());
|
||||
$loopResultRow->set("LASTNAME", $customer->getLastname());
|
||||
$loopResultRow->set("EMAIL", $customer->getEmail());
|
||||
$loopResultRow->set("RESELLER", $customer->getReseller());
|
||||
$loopResultRow->set("SPONSOR", $customer->getSponsor());
|
||||
$loopResultRow->set("DISCOUNT", $customer->getDiscount());
|
||||
|
||||
$loopResultRow
|
||||
->set("ID" , $customer->getId())
|
||||
->set("REF" , $customer->getRef())
|
||||
->set("TITLE" , $customer->getTitleId())
|
||||
->set("FIRSTNAME" , $customer->getFirstname())
|
||||
->set("LASTNAME" , $customer->getLastname())
|
||||
->set("EMAIL" , $customer->getEmail())
|
||||
->set("RESELLER" , $customer->getReseller())
|
||||
->set("SPONSOR" , $customer->getSponsor())
|
||||
->set("DISCOUNT" , $customer->getDiscount())
|
||||
|
||||
->set("LAST_ORDER_DATE" , $lastOrder != null ? $lastOrder->getCreatedAt() : '')
|
||||
->set("LAST_ORDER_AMOUNT" , $lastOrder != null ? $lastOrder->getCreatedAt() : '')
|
||||
->set("LAST_ORDER_CURRENCY" , $lastOrder != null ? $lastOrder->getCreatedAt() : '')
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
@@ -25,32 +25,44 @@ namespace Thelia\Core\Template\Smarty\Assets;
|
||||
|
||||
use Thelia\Core\Template\Assets\AsseticHelper;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Core\Template\Assets\AssetManagerInterface;
|
||||
|
||||
class SmartyAssetsManager
|
||||
{
|
||||
const ASSET_TYPE_AUTO = '';
|
||||
|
||||
private $assetic_manager;
|
||||
private $assetsManager;
|
||||
|
||||
private $web_root;
|
||||
private $path_relative_to_web_root;
|
||||
private $developmentMode;
|
||||
|
||||
/**
|
||||
* Creates a new SmartyAssetsManager instance
|
||||
*
|
||||
* @param string $web_root the disk path to the web root
|
||||
* @param string $path_relative_to_web_root the path (relative to web root) where the assets will be generated
|
||||
* @param boolean $developmentMode true / false. If true, assets are not cached, and always generated.
|
||||
* @param AssetManagerInterface $assetsManager an asset manager instance
|
||||
* @param string $web_root the disk path to the web root (with final /)
|
||||
* @param string $path_relative_to_web_root the path (relative to web root) where the assets will be generated
|
||||
*/
|
||||
public function __construct($web_root, $path_relative_to_web_root, $developmentMode)
|
||||
public function __construct(AssetManagerInterface $assetsManager, $web_root, $path_relative_to_web_root)
|
||||
{
|
||||
$this->web_root = $web_root;
|
||||
$this->path_relative_to_web_root = $path_relative_to_web_root;
|
||||
|
||||
$this->developmentMode = $developmentMode;
|
||||
$this->assetsManager = $assetsManager;
|
||||
}
|
||||
|
||||
$this->assetic_manager = new AsseticHelper();
|
||||
public function prepareAssets($assets_directory, \Smarty_Internal_Template $template) {
|
||||
|
||||
$tpl_dir = dirname($template->source->filepath);
|
||||
|
||||
$asset_dir_absolute_path = realpath($tpl_dir . DS . $assets_directory);
|
||||
|
||||
if ($asset_dir_absolute_path === false) throw new \Exception("Failed to get real path of '".$tpl_dir . DS . $assets_directory."'");
|
||||
|
||||
$this->assetsManager->prepareAssets(
|
||||
$asset_dir_absolute_path,
|
||||
$this->web_root . $this->path_relative_to_web_root
|
||||
);
|
||||
}
|
||||
|
||||
public function computeAssetUrl($assetType, $params, \Smarty_Internal_Template $template)
|
||||
@@ -66,19 +78,18 @@ class SmartyAssetsManager
|
||||
$tpl_dir = dirname($tpl_path);
|
||||
|
||||
// Create absolute dir path
|
||||
$asset_dir = realpath($tpl_dir.'/'.dirname($file));
|
||||
$asset_dir = realpath($tpl_dir) . DS . dirname($file);
|
||||
$asset_file = basename($file);
|
||||
|
||||
if ($asset_dir === false) throw new \Exception("Failed to get real path of '".$tpl_dir.'/'.dirname($file)."'");
|
||||
|
||||
$url = $this->assetic_manager->asseticize(
|
||||
$asset_dir.'/'.$asset_file,
|
||||
$this->web_root."/".$this->path_relative_to_web_root,
|
||||
$url = $this->assetsManager->processAsset(
|
||||
$asset_dir . DS . $asset_file,
|
||||
$this->web_root . $this->path_relative_to_web_root,
|
||||
URL::getInstance()->absoluteUrl($this->path_relative_to_web_root, null, URL::PATH_TO_FILE /* path only */),
|
||||
$assetType,
|
||||
$filters,
|
||||
$debug,
|
||||
$this->developmentMode
|
||||
$debug
|
||||
);
|
||||
|
||||
return $url;
|
||||
|
||||
@@ -69,6 +69,7 @@ class AdminUtilities extends AbstractSmartyPlugin
|
||||
{
|
||||
// The required permissions
|
||||
$resource = $this->getParam($params, 'resource');
|
||||
$module = $this->getParam($params, 'module');
|
||||
$access = $this->getParam($params, 'access');
|
||||
|
||||
// The base position change path
|
||||
@@ -92,7 +93,12 @@ class AdminUtilities extends AbstractSmartyPlugin
|
||||
<a href="{url path='/admin/configuration/currencies/positionDown' currency_id=$ID}"><i class="icon-arrow-down"></i></a>
|
||||
*/
|
||||
|
||||
if ($permissions == null || $this->securityContext->isGranted("ADMIN", array($resource), array($access))) {
|
||||
if ($permissions == null || $this->securityContext->isGranted(
|
||||
"ADMIN",
|
||||
$resource === null ? array() : array($resource),
|
||||
$module === null ? array() : array($module),
|
||||
array($access))
|
||||
) {
|
||||
|
||||
return $this->fetch_snippet($smarty, 'includes/admin-utilities-position-block', array(
|
||||
'admin_utilities_go_up_url' => URL::getInstance()->absoluteUrl($path, array('mode' => 'up', $url_parameter => $id)),
|
||||
|
||||
@@ -27,18 +27,29 @@ use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
|
||||
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
||||
use Thelia\Core\Template\Smarty\Assets\SmartyAssetsManager;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Core\Template\Assets\AssetManagerInterface;
|
||||
|
||||
class Assetic extends AbstractSmartyPlugin
|
||||
class Assets extends AbstractSmartyPlugin
|
||||
{
|
||||
public $assetManager;
|
||||
|
||||
public function __construct($developmentMode)
|
||||
public function __construct(AssetManagerInterface $assetsManager)
|
||||
{
|
||||
$web_root = THELIA_WEB_DIR;
|
||||
$asset_dir_from_web_root = ConfigQuery::read('asset_dir_from_web_root', 'assets');
|
||||
|
||||
$asset_dir_from_web_root = ConfigQuery::read('asset_dir_from_web_root', 'assets/');
|
||||
$this->assetManager = new SmartyAssetsManager($assetsManager, THELIA_WEB_DIR, $asset_dir_from_web_root);
|
||||
}
|
||||
|
||||
$this->assetManager = new SmartyAssetsManager($web_root, $asset_dir_from_web_root, $developmentMode == 'dev');
|
||||
public function declareAssets($params, \Smarty_Internal_Template $template)
|
||||
{
|
||||
if (false !== $asset_dir = $this->getParam($params, 'directory', false)) {
|
||||
|
||||
$this->assetManager->prepareAssets($asset_dir, $template);
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException('declare_assets: parameter "directory" is required');
|
||||
}
|
||||
|
||||
public function blockJavascripts($params, $content, \Smarty_Internal_Template $template, &$repeat)
|
||||
@@ -79,10 +90,11 @@ class Assetic extends AbstractSmartyPlugin
|
||||
public function getPluginDescriptors()
|
||||
{
|
||||
return array(
|
||||
new SmartyPluginDescriptor('block' , 'stylesheets', $this, 'blockStylesheets'),
|
||||
new SmartyPluginDescriptor('block' , 'javascripts', $this, 'blockJavascripts'),
|
||||
new SmartyPluginDescriptor('block' , 'images' , $this, 'blockImages'),
|
||||
new SmartyPluginDescriptor('function', 'image' , $this, 'functionImage')
|
||||
new SmartyPluginDescriptor('block' , 'stylesheets' , $this, 'blockStylesheets'),
|
||||
new SmartyPluginDescriptor('block' , 'javascripts' , $this, 'blockJavascripts'),
|
||||
new SmartyPluginDescriptor('block' , 'images' , $this, 'blockImages'),
|
||||
new SmartyPluginDescriptor('function', 'image' , $this, 'functionImage'),
|
||||
new SmartyPluginDescriptor('function', 'declare_assets' , $this, 'declareAssets')
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -55,9 +55,10 @@ class Security extends AbstractSmartyPlugin
|
||||
{
|
||||
$roles = $this->_explode($this->getParam($params, 'role'));
|
||||
$resources = $this->_explode($this->getParam($params, 'resource'));
|
||||
$modules = $this->_explode($this->getParam($params, 'module'));
|
||||
$accesses = $this->_explode($this->getParam($params, 'access'));
|
||||
|
||||
if (! $this->securityContext->isGranted($roles, $resources, $accesses)) {
|
||||
if (! $this->securityContext->isGranted($roles, $resources, $modules, $accesses)) {
|
||||
|
||||
$ex = new AuthenticationException(
|
||||
sprintf("User not granted for roles '%s', to access resources '%s' with %s in context '%s'.",
|
||||
|
||||
@@ -82,6 +82,21 @@ class CustomerUpdateForm extends BaseForm
|
||||
"for" => "lastname"
|
||||
)
|
||||
))
|
||||
->add("email", "email", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Email address"),
|
||||
"label_attr" => array(
|
||||
"for" => "email"
|
||||
)
|
||||
))
|
||||
->add("password", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Password"),
|
||||
"label_attr" => array(
|
||||
"for" => "email"
|
||||
)
|
||||
))
|
||||
->add("address1", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
@@ -89,7 +104,7 @@ class CustomerUpdateForm extends BaseForm
|
||||
"label_attr" => array(
|
||||
"for" => "address"
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Street Address")
|
||||
"label" => Translator::getInstance()->trans("Street Address ")
|
||||
))
|
||||
->add("address2", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Address Line 2"),
|
||||
|
||||
@@ -35,15 +35,24 @@ class Admin extends BaseAdmin implements UserInterface
|
||||
return AdminResources::SUPERADMINISTRATOR;
|
||||
}
|
||||
|
||||
$userPermissionsQuery = ProfileResourceQuery::create()
|
||||
$userResourcePermissionsQuery = ProfileResourceQuery::create()
|
||||
->joinResource("resource", Criteria::LEFT_JOIN)
|
||||
->withColumn('resource.code', 'code')
|
||||
->filterByProfileId($profileId)
|
||||
->find();
|
||||
|
||||
$userModulePermissionsQuery = ProfileModuleQuery::create()
|
||||
->joinModule("module", Criteria::LEFT_JOIN)
|
||||
->withColumn('module.code', 'code')
|
||||
->filterByProfileId($profileId)
|
||||
->find();
|
||||
|
||||
$userPermissions = array();
|
||||
foreach($userPermissionsQuery as $userPermission) {
|
||||
$userPermissions[$userPermission->getVirtualColumn('code')] = new AccessManager($userPermission->getAccess());
|
||||
foreach($userResourcePermissionsQuery as $userResourcePermission) {
|
||||
$userPermissions[$userResourcePermission->getVirtualColumn('code')] = new AccessManager($userResourcePermission->getAccess());
|
||||
}
|
||||
foreach($userModulePermissionsQuery as $userModulePermission) {
|
||||
$userPermissions['module'][strtolower($userModulePermission->getVirtualColumn('code'))] = new AccessManager($userModulePermission->getAccess());
|
||||
}
|
||||
|
||||
return $userPermissions;
|
||||
|
||||
@@ -47,8 +47,7 @@ INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updat
|
||||
INSERT INTO `module` (`id`, `code`, `type`, `activate`, `position`, `full_namespace`, `created_at`, `updated_at`) VALUES
|
||||
(1, 'TheliaDebugBar', 1, 1, 1, 'TheliaDebugBar\\TheliaDebugBar', NOW(), NOW()),
|
||||
(2, 'Colissimo', 2, 0, 1, 'Colissimo\\Colissimo', NOW(), NOW()),
|
||||
(3, 'Cheque', 3, 0, 1, 'Cheque\\Cheque', NOW(), NOW()),
|
||||
(4, 'FakeCB', 3, 0, 2, 'FakeCB\\FakeCB', NOW(), NOW());
|
||||
(3, 'Cheque', 3, 0, 1, 'Cheque\\Cheque', NOW(), NOW());
|
||||
|
||||
INSERT INTO `module_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES
|
||||
('1', 'en_US', 'Debug bar', NULL, NULL, NULL),
|
||||
@@ -1225,7 +1224,7 @@ INSERT INTO resource (`id`, `code`, `created_at`, `updated_at`) VALUES
|
||||
(14, 'admin.configuration.language', NOW(), NOW()),
|
||||
(15, 'admin.configuration.mailing-system', NOW(), NOW()),
|
||||
(16, 'admin.configuration.message', NOW(), NOW()),
|
||||
(17, 'admin.configuration.module', NOW(), NOW()),
|
||||
(17, 'admin.module', NOW(), NOW()),
|
||||
(18, 'admin.order', NOW(), NOW()),
|
||||
(19, 'admin.product', NOW(), NOW()),
|
||||
(20, 'admin.configuration.profile', NOW(), NOW()),
|
||||
|
||||
@@ -42,6 +42,5 @@ php Thelia module:activate Colissimo
|
||||
|
||||
echo -e "\n\033[01;34m[INFO] Activating Payment Module(s)\033[00m\n"
|
||||
php Thelia module:activate Cheque
|
||||
php Thelia module:activate FakeCB
|
||||
|
||||
echo -e "\n\033[00;32m[SUCCESS] Reset done\033[00m\n"
|
||||
echo -e "\n\033[00;32m[SUCCESS] Reset done\033[00m\n"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,9 +4,12 @@
|
||||
{check_auth role="ADMIN" resource="{block name="check-resource"}{/block}" access="{block name="check-access"}{/block}" login_tpl="/admin/login"}
|
||||
{/block}
|
||||
|
||||
{* -- Define some stuff for Smarty ----------------------------------------- *}
|
||||
{* -- Define some stuff for Smarty ------------------------------------------ *}
|
||||
{config_load file='variables.conf'}
|
||||
|
||||
{* -- Declare assets directory, relative to template base directory --------- *}
|
||||
{declare_assets directory='assets'}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="{$lang_code}">
|
||||
<head>
|
||||
@@ -22,7 +25,7 @@
|
||||
|
||||
{block name="before-bootstrap-css"}{/block}
|
||||
|
||||
{stylesheets file='assets/less/*' filters='less,cssembed'}
|
||||
{stylesheets file='assets/less/main.less' filters='less'}
|
||||
<link rel="stylesheet" href="{$asset_url}">
|
||||
{/stylesheets}
|
||||
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
{* Update an Address *}
|
||||
|
||||
{form name="thelia.admin.address.update"}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "edit_address_dialog"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='label'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l={$label}} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l={$label} }" placeholder="{intl l='Label'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='company'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l={$label}} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l={$label}}" placeholder="{intl l='Company'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l={$label}} : </label>
|
||||
|
||||
<select name="{$name}" id="{$label_attr.for}" class="form-control">
|
||||
{loop type="title" name="title1"}
|
||||
<option value="{$ID}" {if $value == $ID}selected{/if}>{$LONG}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='firstname'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l={$label}} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l={$label}}" placeholder="{intl l='Firstname'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='lastname'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l={$label}} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l={$label}}" placeholder="{intl l='Lastname'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='address1'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l={$label}} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l={$label}}" placeholder="{intl l='Address'}">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{form_field form=$form field='address2'}
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l={$label}}" placeholder="{intl l='Additional address'}">
|
||||
{/form_field}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{form_field form=$form field='address3'}
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l={$label}}" placeholder="{intl l='Additional address'}">
|
||||
{/form_field}
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='zipcode'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l={$label}} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l={$label}}" placeholder="{intl l='Zip code'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='city'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l={$label}} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l={$label}}" placeholder="{intl l='City'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='country'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l={$label}} : </label>
|
||||
<select name="{$name}" id="{$label_attr.for}" class="form-control">
|
||||
{loop type="country" name="country1"}
|
||||
<option value="{$ID}" {if $value == $ID}selected{/if}>{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "edit_address_dialog"
|
||||
dialog_title = {intl l="Edit an address"}
|
||||
dialog_body = {$smarty.capture.edit_address_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Edit this address"}
|
||||
dialog_cancel_label = {intl l="Cancel"}
|
||||
|
||||
form_action = {url path="/admin/address/save/{$address_id}"}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
|
||||
{/form}
|
||||
@@ -2,4 +2,4 @@
|
||||
@import "bootstrap/bootstrap.less";
|
||||
|
||||
/* Thelia Admin */
|
||||
@import "thelia/thelia.less";
|
||||
@import "thelia/thelia.less";
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
<div class="customers edit-customer">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
{loop name="customer_edit" type="customer" current="false" id="$customer_id" backend_context="1" lang="$edit_language_id"}
|
||||
|
||||
<ul class="breadcrumb">
|
||||
@@ -30,18 +29,21 @@
|
||||
<div class="col-md-12">
|
||||
|
||||
{form name="thelia.admin.customer.update"}
|
||||
<form method="POST" action="{url path="/admin/customer/update/{$ID}"}" {form_enctype form=$form} class="clearfix">
|
||||
<form method="POST" action="{url path='/admin/customer/save'}" {form_enctype form=$form} class="clearfix">
|
||||
|
||||
<div class="row inner-toolbar clearfix">
|
||||
<div class="col-md-6 inner-actions pull-right">
|
||||
<button type="submit" name="save_mode" value="stay" class="btn btn-default btn-primary" title="{intl l='Save'}">{intl l='Save'} <span class="glyphicon glyphicon-ok"></span></button>
|
||||
<button type="submit" name="save_mode" value="close" class="btn btn-default btn-info" title="{intl l='Save and close'}">{intl l='Save and close'} <span class="glyphicon glyphicon-remove"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
{form_hidden_fields form=$form}
|
||||
{include
|
||||
file="includes/inner-form-toolbar.html"
|
||||
hide_flags = true
|
||||
close_url = {url path='/admin/customers'}
|
||||
}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
<input type="hidden" name="page" value="{$page}" />
|
||||
<input type="hidden" name="customer_id" value="{$customer_id}" />
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path="/admin/customer/update/{$ID}"}" />
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/customers' page=$page}" />
|
||||
{/form_field}
|
||||
|
||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
@@ -51,7 +53,7 @@
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
|
||||
<select name="{$name}" id="{$label_attr.for}" class="form-control">
|
||||
{loop type="title" name="title1" backend_context="1"}
|
||||
@@ -63,15 +65,29 @@
|
||||
|
||||
{form_field form=$form field='firstname'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$FIRSTNAME}" title="{$label}" placeholder="{intl l='Firstname'}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Firstname'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='lastname'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$LASTNAME}" title="{$label}" placeholder="{intl l='Lastname'}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Lastname'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='email'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Lastname'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='password'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} (leave blank to keep current customer password) {if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Password'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
@@ -81,50 +97,50 @@
|
||||
|
||||
{form_field form=$form field='company'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$COMPANY}" title="{$label}" placeholder="{intl l='Company'}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Company'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='address1'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$ADDRESS1}" title="{$label}" placeholder="{intl l='Address'}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Address'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='address2'}
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$ADDRESS2}" title="{$label}" placeholder="{intl l='Additional address'}">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Additional address'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='address3'}
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$ADDRESS3}" title="{$label}" placeholder="{intl l='Additional address'}">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Additional address'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='zipcode'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$ZIPCODE}" title="{$label}" placeholder="{intl l='Zip code'}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Zip code'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='city'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$CITY}" title="{$label}" placeholder="{intl l='City'}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='City'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='country'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<select name="{$name}" id="{$label_attr.for}" class="form-control">
|
||||
{loop type="country" name="country1"}
|
||||
<option value="{$ID}" {if $ID == $COUNTRY}selected{/if}>{$TITLE}</option>
|
||||
<option value="{$ID}" {if {$value} == $ID}selected{/if}>{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
@@ -149,13 +165,14 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l="Address"}</th>
|
||||
<th>{intl l="Actions"}</th>
|
||||
<th class="text-center">{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{loop name="address" type="address" customer="$customer_id" backend_context="1" default="0"}
|
||||
<tr>
|
||||
<td>
|
||||
{$LABEL}
|
||||
<address>
|
||||
<strong>{loop name="address.title" type="title" id=$TITLE}{$SHORT}{/loop} {$FIRSTNAME} {$LASTNAME}</strong><br>
|
||||
{$ADDRESS1}
|
||||
@@ -166,21 +183,21 @@
|
||||
<br>{$TITLE}
|
||||
{/loop}
|
||||
{if $PHONE}
|
||||
<br> <abbr title="{intl l="Phone"}">P:</abbr>{$PHONE}
|
||||
<br>{intl l="Phone"}: {$PHONE}
|
||||
{/if}
|
||||
{if $CELLPHONE}
|
||||
<br> <abbr title="{intl l="cell phone"}">P:</abbr>{$CELLPHONE}
|
||||
<br>{intl l="Cellular phone"}: {$CELLPHONE}
|
||||
{/if}
|
||||
</address>
|
||||
</td>
|
||||
<td>
|
||||
<td class="text-center">
|
||||
<div class="btn-group">
|
||||
|
||||
<a class="btn btn-default btn-xs customer-update-address" title="{intl l='Edit this address'}" href="#" data-id="{$ID}">
|
||||
<a class="btn btn-default btn-xs customer-update-address" title="{intl l='Edit this address'}" href="{url path='/admin/address/update' address_id=$ID}">
|
||||
<span class="glyphicon glyphicon-edit"></span>
|
||||
</a>
|
||||
|
||||
<a class="btn btn-default btn-xs customer-address-use" title="{intl l='Use this address by default'}" href="#use_address_dialog" data-id="{$ID}" data-toggle="modal" rel="tooltip">
|
||||
<a class="btn btn-default btn-xs customer-address-use" title="{intl l='Use this address by default'}" href="#use_address_dialog" data-toggle="modal" data-id="{$ID}" data-toggle="modal" rel="tooltip">
|
||||
<span class="glyphicon glyphicon-pushpin"></span>
|
||||
</a>
|
||||
|
||||
@@ -262,168 +279,117 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="address-update-modal"></div>
|
||||
{* Add an Address *}
|
||||
{* -- Add an Address -------------------------------------------------------- *}
|
||||
|
||||
{form name="thelia.admin.address.create"}
|
||||
{form name="thelia.admin.address.create"}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "address_creation_dialog"}
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "address_creation_dialog"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
<input type="hidden" name="customer_id" value="{$customer_id}">
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path="/admin/customer/update/{$customer_id}"}" />
|
||||
{/form_field}
|
||||
{form_field form=$form field='label'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Label'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
{include file='includes/customer_address_form_fields.html' customer_id=$customer_id page=$page}
|
||||
|
||||
{form_field form=$form field='company'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Company'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
|
||||
<select name="{$name}" id="{$label_attr.for}" class="form-control" required>
|
||||
{loop type="title" name="title1"}
|
||||
<option value="{$ID}">{$LONG}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='firstname'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Firstname'}" required>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='lastname'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Lastname'}" required>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='address1'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Address'}" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{form_field form=$form field='address2'}
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Additional address'}">
|
||||
{/form_field}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{form_field form=$form field='address3'}
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Additional address'}">
|
||||
{/form_field}
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='zipcode'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Zip code'}" required>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='city'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='City'}" required>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='country'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<select name="{$name}" id="{$label_attr.for}" class="form-control" required>
|
||||
{loop type="country" name="country1"}
|
||||
<option value="{$ID}">{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "address_creation_dialog"
|
||||
dialog_title = {intl l="Create an address"}
|
||||
dialog_body = {$smarty.capture.address_creation_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create this address"}
|
||||
dialog_cancel_label = {intl l="Cancel"}
|
||||
|
||||
form_action = {url path='/admin/address/create'}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
|
||||
{/form}
|
||||
|
||||
|
||||
|
||||
|
||||
{* Default confirmation dialog *}
|
||||
|
||||
{capture "use_address_dialog"}
|
||||
<input type="hidden" name="address_id" id="address_use_id" value="" />
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "use_address_dialog"
|
||||
dialog_title = {intl l="Use address by default"}
|
||||
dialog_message = {intl l="Do you really want to use this address by default ?"}
|
||||
dialog_id = "address_creation_dialog"
|
||||
dialog_title = {intl l="Create a customer address"}
|
||||
dialog_body = {$smarty.capture.address_creation_dialog nofilter}
|
||||
|
||||
form_action = {url path='/admin/address/use'}
|
||||
form_content = {$smarty.capture.use_address_dialog nofilter}
|
||||
dialog_ok_label = {intl l="Create this address"}
|
||||
dialog_cancel_label = {intl l="Cancel"}
|
||||
|
||||
form_action = {url path='/admin/address/create'}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
|
||||
{* Delete confirmation dialog *}
|
||||
{/form}
|
||||
|
||||
{capture "delete_address_dialog"}
|
||||
<input type="hidden" name="address_id" id="address_delete_id" value="" />
|
||||
{/capture}
|
||||
{* -- Update an Address ----------------------------------------------------- *}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
{if $address_id > 0}
|
||||
{form name="thelia.admin.address.update"}
|
||||
|
||||
dialog_id = "delete_address_dialog"
|
||||
dialog_title = {intl l="Delete address"}
|
||||
dialog_message = {intl l="Do you really want to delete this address ?"}
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
|
||||
form_action = {url path='/admin/address/delete'}
|
||||
form_content = {$smarty.capture.delete_address_dialog nofilter}
|
||||
}
|
||||
{capture "address_update_dialog"}
|
||||
<input type="hidden" name="address_id" id="address_update_id" value="{$address_id}" />
|
||||
|
||||
{include file='includes/customer_address_form_fields.html' customer_id=$customer_id page=$page}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "address_update_dialog"
|
||||
dialog_title = {intl l="Edit a customer address"}
|
||||
dialog_body = {$smarty.capture.address_update_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Save this address"}
|
||||
dialog_cancel_label = {intl l="Cancel"}
|
||||
|
||||
form_action = {url path="/admin/address/save"}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
|
||||
{/form}
|
||||
{/if}
|
||||
|
||||
{* -- Confirm making an address the default --------------------------------- *}
|
||||
|
||||
{capture "use_address_dialog"}
|
||||
<input type="hidden" name="address_id" id="address_use_id" value="" />
|
||||
|
||||
<input type="hidden" name="customer_id" value="{$customer_id}">
|
||||
<input type="hidden" name="page" value="{$page}">
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "use_address_dialog"
|
||||
dialog_title = {intl l="Use address by default"}
|
||||
dialog_message = {intl l="Do you really want to use this address by default ?"}
|
||||
|
||||
form_action = {url path='/admin/address/use'}
|
||||
form_content = {$smarty.capture.use_address_dialog nofilter}
|
||||
}
|
||||
|
||||
{* -- Delete confirmation dialog -------------------------------------------- *}
|
||||
|
||||
{capture "delete_address_dialog"}
|
||||
<input type="hidden" name="address_id" id="address_delete_id" value="" />
|
||||
|
||||
<input type="hidden" name="customer_id" value="{$customer_id}">
|
||||
<input type="hidden" name="page" value="{$page}">
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "delete_address_dialog"
|
||||
dialog_title = {intl l="Delete address"}
|
||||
dialog_message = {intl l="Do you really want to delete this address ?"}
|
||||
|
||||
form_action = {url path='/admin/address/delete'}
|
||||
form_content = {$smarty.capture.delete_address_dialog nofilter}
|
||||
}
|
||||
{/block}
|
||||
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
|
||||
{javascripts file='assets/js/main.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
<script>
|
||||
(function($) {
|
||||
$(document).ready(function(){
|
||||
$(function() {
|
||||
|
||||
$("a.customer-address-delete").click(function(e){
|
||||
$("#address_delete_id").val($(this).data("id"));
|
||||
});
|
||||
@@ -432,23 +398,29 @@
|
||||
$("#address_use_id").val($(this).data("id"));
|
||||
});
|
||||
|
||||
$("a.customer-update-address").click(function(e){
|
||||
var baseUrl = "{url path="/admin/address/update/"}";
|
||||
$('body').append('<div class="modal-backdrop fade in" id="loading-event"><div class="loading"></div></div>');
|
||||
$.ajax({
|
||||
method: 'get',
|
||||
url: baseUrl+$(this).data('id')
|
||||
}).done(function(data){
|
||||
$("#loading-event").remove();
|
||||
$("#address-update-modal").html(data);
|
||||
$("#edit_address_dialog").modal("show");
|
||||
});
|
||||
});
|
||||
// JS stuff for creation form
|
||||
{include
|
||||
file = "includes/generic-js-dialog.html"
|
||||
dialog_id = "address_creation_dialog"
|
||||
form_name = "thelia.admin.address.create"
|
||||
}
|
||||
|
||||
$(document).on("hidden.bs.modal", "#edit_address_dialog", function(ev){
|
||||
$("#edit_address_dialog").remove();
|
||||
});
|
||||
|
||||
// If $address_id is defined, show the edit dialog
|
||||
{if $address_id > 0}
|
||||
|
||||
// JS stuff for update form
|
||||
{include
|
||||
file = "includes/generic-js-dialog.html"
|
||||
dialog_id = "address_update_dialog"
|
||||
form_name = "thelia.admin.address.update"
|
||||
}
|
||||
|
||||
$('#address_update_dialog').modal();
|
||||
{/if}
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
{/block}
|
||||
@@ -7,9 +7,6 @@
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
{assign var=customer_page value={$smarty.get.page|default:1}}
|
||||
|
||||
|
||||
<div class="customer">
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
@@ -41,27 +38,83 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="object-title">
|
||||
{intl l="customer ref"}
|
||||
{admin_sortable_header
|
||||
current_order=$customer_order
|
||||
order='reference'
|
||||
reverse_order='reference_reverse'
|
||||
path={url path='/admin/customers'}
|
||||
request_parameter_name='customer_order'
|
||||
label="{intl l='Reference'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
{module_include location='category_list_header'}
|
||||
{module_include location='customer_list_header'}
|
||||
|
||||
<th>
|
||||
{intl l="firstname & lastname"}
|
||||
<th class="object-title">
|
||||
{admin_sortable_header
|
||||
current_order=$customer_order
|
||||
order='lastname'
|
||||
reverse_order='lastname_reverse'
|
||||
path={url path='/admin/customers'}
|
||||
request_parameter_name='customer_order'
|
||||
label="{intl l='Last name'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th>
|
||||
{intl l="last order"}
|
||||
<th class="object-title">
|
||||
{admin_sortable_header
|
||||
current_order=$customer_order
|
||||
order='firstname'
|
||||
reverse_order='firstname_reverse'
|
||||
path={url path='/admin/customers'}
|
||||
request_parameter_name='customer_order'
|
||||
label="{intl l='First name'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th>{intl l='order amount'}</th>
|
||||
<th class="object-title">
|
||||
{admin_sortable_header
|
||||
current_order=$customer_order
|
||||
order='registration_date'
|
||||
reverse_order='registration_date_reverse'
|
||||
path={url path='/admin/customers'}
|
||||
request_parameter_name='customer_order'
|
||||
label="{intl l='Registration date'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th class="object-title">{intl l='Date of last order'}</th>
|
||||
<th class="object-title">{intl l='Last order amount'}</th>
|
||||
|
||||
{* TODO
|
||||
<th class="object-title">
|
||||
{admin_sortable_header
|
||||
current_order=$customer_order
|
||||
order='last_order'
|
||||
reverse_order='last_order_reverse'
|
||||
path={url path='/admin/customers'}
|
||||
request_parameter_name='customer_order'
|
||||
label="{intl l='Date of last order'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th class="object-title">
|
||||
{admin_sortable_header
|
||||
current_order=$customer_order
|
||||
order='order_amount'
|
||||
reverse_order='order_amount_reverse'
|
||||
path={url path='/admin/customers'}
|
||||
request_parameter_name='customer_order'
|
||||
label="{intl l='Last order amount'}"
|
||||
}
|
||||
</th>
|
||||
*}
|
||||
<th class="actions">{intl l='Actions'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="customer_list" type="customer" current="false" visible="*" backend_context="1" page={$customer_page} limit={$display_customer}}
|
||||
{loop name="customer_list" type="customer" current="false" visible="*" order=$customer_order backend_context="1" page=$page limit=$display_customer}
|
||||
{assign "lastOrderDate" ''}
|
||||
{assign "lastOrderAmount" ''}
|
||||
{assign "lastOrderCurrency" ''}
|
||||
@@ -75,14 +128,23 @@
|
||||
{/loop}
|
||||
|
||||
<tr>
|
||||
<td><a href="{url path="/admin/customer/update/{$ID}"}">{$REF}</a></td>
|
||||
<td><a href="{url path="/admin/customer/update" customer_id=$ID page=$page}">{$REF}</a></td>
|
||||
|
||||
<td class="object-title">
|
||||
{$FIRSTNAME} {$LASTNAME}
|
||||
{$LASTNAME}
|
||||
</td>
|
||||
|
||||
<td class="object-title">
|
||||
{$FIRSTNAME}
|
||||
</td>
|
||||
|
||||
|
||||
{module_include location='customer_list_row'}
|
||||
|
||||
<td>
|
||||
{format_date date=$CREATE_DATE}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{$lastOrderDate}
|
||||
</td>
|
||||
@@ -94,7 +156,7 @@
|
||||
<div class="btn-group">
|
||||
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.customer" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this customer'}" href="{url path="/admin/customer/update/{$ID}" }"><i class="glyphicon glyphicon-edit"></i></a>
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this customer'}" href="{url path='/admin/customer/update' customer_id=$ID page=$page}"><i class="glyphicon glyphicon-edit"></i></a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_send_mail" role="ADMIN" resource="admin.customer" access="VIEW"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l="Send a mail to this customer"}" href="mailto:{$EMAIL}"><span class="glyphicon glyphicon-envelope"></span></a>
|
||||
@@ -111,10 +173,10 @@
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
|
||||
|
||||
<div class="text-center">
|
||||
<ul class="pagination pagination-centered">
|
||||
{if $customer_page != 1}
|
||||
{if $page != 1}
|
||||
<li><a href="{url path="/admin/customers" page="1"}">«</a></li>
|
||||
{else}
|
||||
<li class="disabled"><a href="#">«</a></li>
|
||||
@@ -137,7 +199,7 @@
|
||||
{/if}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
@@ -163,7 +225,7 @@
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/customer/update/_ID_'}" />
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/customer/update' customer_id='_ID_'}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="password"}
|
||||
@@ -283,7 +345,7 @@
|
||||
{* Delete confirmation dialog *}
|
||||
|
||||
{capture "delete_customer_dialog"}
|
||||
<input type="hidden" name="customer_page" value="{$customer_page}">
|
||||
<input type="hidden" name="page" value="{$page}">
|
||||
<input type="hidden" name="customer_id" id="delete_customer_id">
|
||||
{/capture}
|
||||
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
{* Customer address creation / modification fields, used in the customer-edit.html template *}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
<input type="hidden" name="customer_id" value="{$customer_id}">
|
||||
<input type="hidden" name="page" value="{$page}">
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/customer/update'} customer_id=$customer_id page=$page" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='label'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input {if $required}required{/if} type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{$label}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='company'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input {if $required}required{/if} type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Company'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
|
||||
<select {if $required}required{/if} name="{$name}" id="{$label_attr.for}" class="form-control">
|
||||
{loop type="title" name="title1"}
|
||||
<option value="{$ID}" {if $value == $ID}selected{/if}>{$LONG}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{form_field form=$form field='firstname'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input {if $required}required{/if} type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Firstname'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
{form_field form=$form field='lastname'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input {if $required}required{/if} type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Lastname'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{form_field form=$form field='address1'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input {if $required}required{/if} type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Address'}">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{form_field form=$form field='address2'}
|
||||
<input {if $required}required{/if} type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Additional address'}">
|
||||
{/form_field}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{form_field form=$form field='address3'}
|
||||
<input {if $required}required{/if} type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Additional address'}">
|
||||
{/form_field}
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
{form_field form=$form field='zipcode'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input {if $required}required{/if} type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Zip code'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
{form_field form=$form field='city'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input {if $required}required{/if} type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='City'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{form_field form=$form field='country'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<select {if $required}required{/if} name="{$name}" id="{$label_attr.for}" class="form-control">
|
||||
{loop type="country" name="country1"}
|
||||
<option value="{$ID}" {if $value == $ID}selected{/if}>{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{form_field form=$form field='phone'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input {if $required}required{/if} type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Phone number'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
{form_field form=$form field='cellphone'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input {if $required}required{/if} type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Cellular phone number'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
</div>
|
||||
@@ -39,15 +39,22 @@
|
||||
<td class="text-right">
|
||||
<div class="btn-group">
|
||||
|
||||
{* {loop type="auth" name="can_change" role="ADMIN" resource="admin.modules" access="VIEW"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Read the documentation of this module'}" href="{url path="/admin/module/documentation/$ID"}"><span class="glyphicon glyphicon-book"></span></a>
|
||||
{/loop}*}
|
||||
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.modules" access="UPDATE"}
|
||||
|
||||
|
||||
{loop type="auth" name="can_change" role="ADMIN" module=$CODE access="VIEW"}
|
||||
<a class="btn btn-primary btn-xs" title="{intl l='Configure this module'}" href="{url path="/admin/module/update/$CODE"}">{intl l="Configure"}</a>
|
||||
{/loop}
|
||||
|
||||
{*loop type="auth" name="can_change" role="ADMIN" resource="admin.modules" access="VIEW"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Read the documentation of this module'}" href="{url path="/admin/module/documentation/$ID"}"><span class="glyphicon glyphicon-book"></span></a>
|
||||
{/loop*}
|
||||
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.module" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this module'}" href="{url path="/admin/module/update/$ID"}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.modules" access="DELETE"}
|
||||
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.module" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs module-delete-action" title="{intl l='Delete this module'}" href="#delete_module_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
<td><a href="{url path="/admin/order/update/$ID"}">{$REF}</a></td>
|
||||
<td>{format_date date=$CREATE_DATE}</td>
|
||||
<td>{$orderInvoiceCompany}</td>
|
||||
<td><a href="{url path="/admin/customer/update/$CUSTOMER"}">{$orderInvoiceFirstName|ucwords} {$orderInvoiceLastName|upper}</a></td>
|
||||
<td><a href="{url path='/admin/customer/update' customer_id=$CUSTOMER}">{$orderInvoiceFirstName|ucwords} {$orderInvoiceLastName|upper}</a></td>
|
||||
<td>{$TOTAL_TAXED_AMOUNT}</td>
|
||||
<td><span class="label label-{#$orderStatusLabel#}">{$orderStatus}</span></td>
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
</tfoot>
|
||||
|
||||
{/ifloop}
|
||||
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="modules">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
|
||||
<div class="clearfix">
|
||||
<ul class="breadcrumb pull-left">
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
@@ -68,7 +68,7 @@
|
||||
{/loop}
|
||||
|
||||
<tr>
|
||||
<td><a href="{url path="/admin/customer/update/{$ID}"}">{$REF}</a></td>
|
||||
<td><a href="{url path='/admin/customer/update' customer_id=$ID}">{$REF}</a></td>
|
||||
|
||||
<td>
|
||||
{$COMPANY}
|
||||
@@ -91,7 +91,7 @@
|
||||
<div class="btn-group">
|
||||
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.customer" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this customer'}" href="{url path="/admin/customer/update/{$ID}" }"><i class="glyphicon glyphicon-edit"></i></a>
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this customer'}" href="{url path='/admin/customer/update' customer_id=$ID }"><i class="glyphicon glyphicon-edit"></i></a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_send_mail" role="ADMIN" resource="admin.customer" access="VIEW"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l="Send a mail to this customer"}" href="mailto:{$EMAIL}"><span class="glyphicon glyphicon-envelope"></span></a>
|
||||
@@ -148,7 +148,7 @@
|
||||
<td><a href="{url path="/admin/order/update/$ID"}">{$REF}</a></td>
|
||||
<td>{format_date date=$CREATE_DATE}</td>
|
||||
<td>{$orderInvoiceCompany}</td>
|
||||
<td><a href="{url path="/admin/customer/update/$CUSTOMER"}">{$orderInvoiceFirstName|ucwords} {$orderInvoiceLastName|upper}</a></td>
|
||||
<td><a href="{url path='/admin/customer/update' customer_id=$CUSTOMER}">{$orderInvoiceFirstName|ucwords} {$orderInvoiceLastName|upper}</a></td>
|
||||
<td>{$TOTAL_TAXED_AMOUNT}</td>
|
||||
<td><span class="label label-{#$orderStatusLabel#}">{$orderStatus}</span></td>
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/* Bootstrap */
|
||||
@import "bootstrap/bootstrap.less";
|
||||
|
||||
@@ -9,4 +8,4 @@
|
||||
@import "thelia/import.less";
|
||||
|
||||
/* Theme */
|
||||
@import "../themes/default/less/import.less";
|
||||
@import "../themes/default/less/import.less";
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
{* Declare assets directory, relative to template base directory *}
|
||||
{declare_assets directory='assets'}
|
||||
{block name="no-return-functions"}{/block}
|
||||
{assign var="company_name" value="{config key="company_name"}"}
|
||||
{if not $company_name}
|
||||
@@ -47,7 +49,7 @@ GNU General Public License : http://www.gnu.org/licenses/
|
||||
{/block}
|
||||
|
||||
{* Stylesheets *}
|
||||
{stylesheets file='assets/less/styles.less' filters='less,cssembed'}
|
||||
{stylesheets file='assets/less/styles.less' filters='less'}
|
||||
<link rel="stylesheet" href="{$asset_url}">
|
||||
{/stylesheets}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user