Merge branch 'master' of https://github.com/thelia/thelia into coupon
# By Manuel Raynaud (19) and others # Via Manuel Raynaud (8) and others * 'master' of https://github.com/thelia/thelia: (47 commits) tax engine tax engine - Add orders view route - Add view & action for orders index Removed a redondant "use" Add tooltip - Add creation address form - Add addresses list - Add update address form Added process_assets config variable Change breadcrumb separator color Add breadcrumb to customers view - Change boolean type to integer type for update_logged_in_user field - Create view for customer modification syntax use ROUTER::ABSOLUTE_URL by default PSE loop todo currency management in PSE loop Add customer view finish Add modal for create/delete customer Update body background fixed typo searching route return relative path pse loop currency ... Conflicts: core/lib/Thelia/Controller/Admin/CouponController.php core/lib/Thelia/Core/Event/TheliaEvents.php web/index_dev.php
This commit is contained in:
@@ -23,18 +23,6 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\MessageDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Core\Event\MessageUpdateEvent;
|
||||
use Thelia\Core\Event\MessageCreateEvent;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Core\Security\Exception\AuthorizationException;
|
||||
use Thelia\Model\MessageQuery;
|
||||
use Thelia\Form\MessageModificationForm;
|
||||
use Thelia\Form\MessageCreationForm;
|
||||
|
||||
/**
|
||||
* Manages messages sent by mail
|
||||
*
|
||||
@@ -47,17 +35,15 @@ class AttributeController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function defaultAction() {
|
||||
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.attributes.view")) return $response;
|
||||
|
||||
return $this->render('product-attributes');
|
||||
}
|
||||
|
||||
public function updateAction() {
|
||||
|
||||
public function updateAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.attributes.update")) return $response;
|
||||
|
||||
return $this->render('product-attributes-edit');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,13 +33,13 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Thelia\Core\Security\Exception\AuthenticationException;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Tools\Redirect;
|
||||
use Thelia\Core\Security\SecurityContext;
|
||||
use Thelia\Model\AdminLog;
|
||||
use Thelia\Model\Lang;
|
||||
use Thelia\Model\LangQuery;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Log\Tlog;
|
||||
use Symfony\Component\Routing\Router;
|
||||
|
||||
class BaseAdminController extends BaseController
|
||||
{
|
||||
@@ -50,14 +50,15 @@ class BaseAdminController extends BaseController
|
||||
*
|
||||
* @param unknown $message
|
||||
*/
|
||||
public function adminLogAppend($message) {
|
||||
public function adminLogAppend($message)
|
||||
{
|
||||
AdminLog::append($message, $this->getRequest(), $this->getSecurityContext()->getAdminUser());
|
||||
}
|
||||
|
||||
/**
|
||||
* This method process the rendering of view called from an admin page
|
||||
*
|
||||
* @param unknown $template
|
||||
* @param unknown $template
|
||||
* @return Response the reponse which contains the rendered view
|
||||
*/
|
||||
public function processTemplateAction($template)
|
||||
@@ -66,12 +67,10 @@ class BaseAdminController extends BaseController
|
||||
if (! empty($template)) {
|
||||
// If we have a view in the URL, render this view
|
||||
return $this->render($template);
|
||||
}
|
||||
elseif (null != $view = $this->getRequest()->get('view')) {
|
||||
} elseif (null != $view = $this->getRequest()->get('view')) {
|
||||
return $this->render($view);
|
||||
}
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
return $this->errorPage($ex->getMessage());
|
||||
}
|
||||
|
||||
@@ -135,7 +134,8 @@ class BaseAdminController extends BaseController
|
||||
/*
|
||||
* Create the standard message displayed to the user when the form cannot be validated.
|
||||
*/
|
||||
protected function createStandardFormValidationErrorMessage(FormValidationException $exception) {
|
||||
protected function createStandardFormValidationErrorMessage(FormValidationException $exception)
|
||||
{
|
||||
return $this->getTranslator()->trans(
|
||||
"Please check your input: %error",
|
||||
array(
|
||||
@@ -147,13 +147,13 @@ class BaseAdminController extends BaseController
|
||||
/**
|
||||
* Setup the error context when an error occurs in a action method.
|
||||
*
|
||||
* @param string $action the action that caused the error (category modification, variable creation, currency update, etc.)
|
||||
* @param BaseForm $form the form where the error occured, or null if no form was involved
|
||||
* @param string $error_message the error message
|
||||
* @param Exception $exception the exception or null if no exception
|
||||
* @param string $action the action that caused the error (category modification, variable creation, currency update, etc.)
|
||||
* @param BaseForm $form the form where the error occured, or null if no form was involved
|
||||
* @param string $error_message the error message
|
||||
* @param Exception $exception the exception or null if no exception
|
||||
*/
|
||||
protected function setupFormErrorContext($action, $error_message, BaseForm $form = null, \Exception $exception = null) {
|
||||
|
||||
protected function setupFormErrorContext($action, $error_message, BaseForm $form = null, \Exception $exception = null)
|
||||
{
|
||||
if ($error_message !== false) {
|
||||
|
||||
// Log the error message
|
||||
@@ -214,7 +214,7 @@ class BaseAdminController extends BaseController
|
||||
/**
|
||||
* Return the route path defined for the givent route ID
|
||||
*
|
||||
* @param string $routeId a route ID, as defines in Config/Resources/routing/admin.xml
|
||||
* @param string $routeId a route ID, as defines in Config/Resources/routing/admin.xml
|
||||
* @param mixed $parameters An array of parameters
|
||||
* @param Boolean|string $referenceType The type of reference to be generated (one of the constants)
|
||||
*
|
||||
@@ -222,12 +222,13 @@ class BaseAdminController extends BaseController
|
||||
* @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route
|
||||
* @throws InvalidParameterException When a parameter value for a placeholder is not correct because
|
||||
* it does not match the requirement
|
||||
* @throws \InvalidArgumentException When the router doesn't exist
|
||||
* @return string The generated URL
|
||||
* @throws \InvalidArgumentException When the router doesn't exist
|
||||
* @return string The generated URL
|
||||
*
|
||||
* @see \Thelia\Controller\BaseController::getRouteFromRouter()
|
||||
*/
|
||||
protected function getRoute($routeId, $parameters = array(), $referenceType = Router::ABSOLUTE_PATH) {
|
||||
protected function getRoute($routeId, $parameters = array(), $referenceType = Router::ABSOLUTE_URL)
|
||||
{
|
||||
return $this->getRouteFromRouter(
|
||||
'router.admin',
|
||||
$routeId,
|
||||
@@ -239,18 +240,19 @@ class BaseAdminController extends BaseController
|
||||
/**
|
||||
* Redirect to à route ID related URL
|
||||
*
|
||||
* @param unknown $routeId the route ID, as found in Config/Resources/routing/admin.xml
|
||||
* @param unknown $routeId the route ID, as found in Config/Resources/routing/admin.xml
|
||||
* @param unknown $urlParameters the URL parametrs, as a var/value pair array
|
||||
*/
|
||||
public function redirectToRoute($routeId, $urlParameters = array()) {
|
||||
public function redirectToRoute($routeId, $urlParameters = array())
|
||||
{
|
||||
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute($routeId), $urlParameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current edition lang ID, checking if a change was requested in the current request.
|
||||
*/
|
||||
protected function getCurrentEditionLang() {
|
||||
|
||||
protected function getCurrentEditionLang()
|
||||
{
|
||||
// Return the new language if a change is required.
|
||||
if (null !== $edit_language_id = $this->getRequest()->get('edit_language_id', null)) {
|
||||
|
||||
@@ -266,7 +268,8 @@ class BaseAdminController extends BaseController
|
||||
/**
|
||||
* A simple helper to get the current edition locale.
|
||||
*/
|
||||
protected function getCurrentEditionLocale() {
|
||||
protected function getCurrentEditionLocale()
|
||||
{
|
||||
return $this->getCurrentEditionLang()->getLocale();
|
||||
}
|
||||
|
||||
@@ -322,13 +325,11 @@ class BaseAdminController extends BaseController
|
||||
$data = $this->getParser()->render($templateName, $args);
|
||||
|
||||
return $data;
|
||||
}
|
||||
catch (AuthenticationException $ex) {
|
||||
} catch (AuthenticationException $ex) {
|
||||
// User is not authenticated, and templates requires authentication -> redirect to login page
|
||||
// We user login_tpl as a path, not a template.
|
||||
Redirect::exec(URL::getInstance()->absoluteUrl($ex->getLoginTemplate()));
|
||||
}
|
||||
catch (AuthorizationException $ex) {
|
||||
} catch (AuthorizationException $ex) {
|
||||
// User is not allowed to perform the required action. Return the error page instead of the requested page.
|
||||
return $this->errorPage($this->getTranslator()->trans("Sorry, you are not allowed to perform this action."));
|
||||
}
|
||||
|
||||
@@ -23,18 +23,10 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Security\Exception\AuthenticationException;
|
||||
use Thelia\Core\Security\Exception\AuthorizationException;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\CategoryCreateEvent;
|
||||
use Thelia\Form\CategoryCreationForm;
|
||||
use Thelia\Core\Event\CategoryDeleteEvent;
|
||||
use Thelia\Core\Event\CategoryToggleVisibilityEvent;
|
||||
use Thelia\Core\Event\CategoryChangePositionEvent;
|
||||
use Thelia\Form\CategoryDeletionForm;
|
||||
use Thelia\Model\Lang;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Core\Event\CategoryUpdatePositionEvent;
|
||||
use Thelia\Model\CategoryQuery;
|
||||
use Thelia\Form\CategoryModificationForm;
|
||||
@@ -46,12 +38,13 @@ class CategoryController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
protected function renderList() {
|
||||
protected function renderList()
|
||||
{
|
||||
return $this->render('categories', $this->getTemplateArgs());
|
||||
}
|
||||
|
||||
protected function getTemplateArgs() {
|
||||
|
||||
protected function getTemplateArgs()
|
||||
{
|
||||
// Get the category ID
|
||||
$category_id = $this->getRequest()->get('category_id', 0);
|
||||
|
||||
@@ -77,10 +70,9 @@ class CategoryController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function defaultAction() {
|
||||
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.categories.view")) return $response;
|
||||
|
||||
return $this->renderList();
|
||||
}
|
||||
|
||||
@@ -89,8 +81,8 @@ class CategoryController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function createAction() {
|
||||
|
||||
public function createAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.categories.create")) return $response;
|
||||
|
||||
@@ -126,12 +118,10 @@ class CategoryController extends BaseAdminController
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($successUrl);
|
||||
}
|
||||
catch (FormValidationException $ex) {
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$error_msg = $ex->getMessage();
|
||||
}
|
||||
@@ -147,8 +137,8 @@ class CategoryController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function changeAction() {
|
||||
|
||||
public function changeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
||||
|
||||
@@ -189,8 +179,8 @@ class CategoryController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function saveChangeAction() {
|
||||
|
||||
public function saveChangeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
||||
|
||||
@@ -241,12 +231,10 @@ class CategoryController extends BaseAdminController
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($changeForm->getSuccessUrl());
|
||||
}
|
||||
catch (FormValidationException $ex) {
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$error_msg = $ex->getMessage();
|
||||
}
|
||||
@@ -260,7 +248,8 @@ class CategoryController extends BaseAdminController
|
||||
/**
|
||||
* Online status toggle category
|
||||
*/
|
||||
public function setToggleVisibilityAction() {
|
||||
public function setToggleVisibilityAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
||||
|
||||
@@ -271,8 +260,7 @@ class CategoryController extends BaseAdminController
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::CATEGORY_SET_DEFAULT, $changeEvent);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
@@ -283,7 +271,8 @@ class CategoryController extends BaseAdminController
|
||||
/**
|
||||
* Update categoryposition
|
||||
*/
|
||||
public function updatePositionAction() {
|
||||
public function updatePositionAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
||||
|
||||
@@ -306,8 +295,7 @@ class CategoryController extends BaseAdminController
|
||||
);
|
||||
|
||||
$this->dispatch(TheliaEvents::CATEGORY_UPDATE_POSITION, $event);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
@@ -320,8 +308,8 @@ class CategoryController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function deleteAction() {
|
||||
|
||||
public function deleteAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.categories.delete")) return $response;
|
||||
|
||||
@@ -335,4 +323,4 @@ class CategoryController extends BaseAdminController
|
||||
|
||||
$this->redirectToRoute('admin.categories.default');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,7 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Core\Event\ConfigUpdateEvent;
|
||||
use Thelia\Core\Event\ConfigCreateEvent;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Core\Security\Exception\AuthorizationException;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Form\ConfigModificationForm;
|
||||
use Thelia\Form\ConfigCreationForm;
|
||||
@@ -47,8 +45,8 @@ class ConfigController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
protected function renderList() {
|
||||
|
||||
protected function renderList()
|
||||
{
|
||||
// Find the current order
|
||||
$order = $this->getRequest()->get(
|
||||
'order',
|
||||
@@ -66,10 +64,9 @@ class ConfigController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function defaultAction() {
|
||||
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.view")) return $response;
|
||||
|
||||
return $this->renderList();
|
||||
}
|
||||
|
||||
@@ -78,8 +75,8 @@ class ConfigController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function createAction() {
|
||||
|
||||
public function createAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.create")) return $response;
|
||||
|
||||
@@ -120,12 +117,10 @@ class ConfigController extends BaseAdminController
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($successUrl);
|
||||
}
|
||||
catch (FormValidationException $ex) {
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$message = $ex->getMessage();
|
||||
}
|
||||
@@ -141,8 +136,8 @@ class ConfigController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function changeAction() {
|
||||
|
||||
public function changeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response;
|
||||
|
||||
@@ -183,8 +178,8 @@ class ConfigController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function saveChangeAction() {
|
||||
|
||||
public function saveChangeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response;
|
||||
|
||||
@@ -240,12 +235,10 @@ class ConfigController extends BaseAdminController
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($changeForm->getSuccessUrl());
|
||||
}
|
||||
catch (FormValidationException $ex) {
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$message = $ex->getMessage();
|
||||
}
|
||||
@@ -261,15 +254,15 @@ class ConfigController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function changeValuesAction() {
|
||||
|
||||
public function changeValuesAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response;
|
||||
|
||||
$variables = $this->getRequest()->get('variable', array());
|
||||
|
||||
// Process all changed variables
|
||||
foreach($variables as $id => $value) {
|
||||
foreach ($variables as $id => $value) {
|
||||
$event = new ConfigUpdateEvent($id);
|
||||
$event->setValue($value);
|
||||
|
||||
@@ -284,8 +277,8 @@ class ConfigController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function deleteAction() {
|
||||
|
||||
public function deleteAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.delete")) return $response;
|
||||
|
||||
@@ -299,4 +292,4 @@ class ConfigController extends BaseAdminController
|
||||
|
||||
$this->redirectToRoute('admin.configuration.variables.default');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,7 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Core\Event\CurrencyUpdateEvent;
|
||||
use Thelia\Core\Event\CurrencyCreateEvent;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Core\Security\Exception\AuthorizationException;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
use Thelia\Form\CurrencyModificationForm;
|
||||
use Thelia\Form\CurrencyCreationForm;
|
||||
@@ -48,8 +46,8 @@ class CurrencyController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
protected function renderList() {
|
||||
|
||||
protected function renderList()
|
||||
{
|
||||
// Find the current order
|
||||
$order = $this->getRequest()->get(
|
||||
'order',
|
||||
@@ -67,10 +65,9 @@ class CurrencyController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function defaultAction() {
|
||||
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.view")) return $response;
|
||||
|
||||
return $this->renderList();
|
||||
}
|
||||
|
||||
@@ -79,8 +76,8 @@ class CurrencyController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function createAction() {
|
||||
|
||||
public function createAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.create")) return $response;
|
||||
|
||||
@@ -120,12 +117,10 @@ class CurrencyController extends BaseAdminController
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($successUrl);
|
||||
}
|
||||
catch (FormValidationException $ex) {
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$error_msg = $ex->getMessage();
|
||||
}
|
||||
@@ -141,8 +136,8 @@ class CurrencyController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function changeAction() {
|
||||
|
||||
public function changeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||
|
||||
@@ -179,8 +174,8 @@ class CurrencyController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function saveChangeAction() {
|
||||
|
||||
public function saveChangeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||
|
||||
@@ -231,12 +226,10 @@ class CurrencyController extends BaseAdminController
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($changeForm->getSuccessUrl());
|
||||
}
|
||||
catch (FormValidationException $ex) {
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$error_msg = $ex->getMessage();
|
||||
}
|
||||
@@ -250,7 +243,8 @@ class CurrencyController extends BaseAdminController
|
||||
/**
|
||||
* Sets the default currency
|
||||
*/
|
||||
public function setDefaultAction() {
|
||||
public function setDefaultAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||
|
||||
@@ -261,8 +255,7 @@ class CurrencyController extends BaseAdminController
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::CURRENCY_SET_DEFAULT, $changeEvent);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
@@ -273,14 +266,14 @@ class CurrencyController extends BaseAdminController
|
||||
/**
|
||||
* Update currencies rates
|
||||
*/
|
||||
public function updateRatesAction() {
|
||||
public function updateRatesAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::CURRENCY_UPDATE_RATES);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
@@ -291,7 +284,8 @@ class CurrencyController extends BaseAdminController
|
||||
/**
|
||||
* Update currencyposition
|
||||
*/
|
||||
public function updatePositionAction() {
|
||||
public function updatePositionAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||
|
||||
@@ -314,8 +308,7 @@ class CurrencyController extends BaseAdminController
|
||||
);
|
||||
|
||||
$this->dispatch(TheliaEvents::CURRENCY_UPDATE_POSITION, $event);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
@@ -323,14 +316,13 @@ class CurrencyController extends BaseAdminController
|
||||
$this->redirectToRoute('admin.configuration.currencies.default');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete a currency object
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function deleteAction() {
|
||||
|
||||
public function deleteAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.delete")) return $response;
|
||||
|
||||
@@ -344,4 +336,4 @@ class CurrencyController extends BaseAdminController
|
||||
|
||||
$this->redirectToRoute('admin.configuration.currencies.default');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
|
||||
/**
|
||||
* Class CustomerController
|
||||
* @package Thelia\Controller\Admin
|
||||
@@ -34,7 +33,14 @@ class CustomerController extends BaseAdminController
|
||||
public function indexAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.customers.view")) return $response;
|
||||
|
||||
return $this->render("customers", array("display_customer" => 20));
|
||||
}
|
||||
|
||||
public function viewAction($customer_id)
|
||||
{
|
||||
|
||||
return $this->render("customer-edit", array(
|
||||
"customer_id" => $customer_id
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -28,9 +28,7 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Core\Event\MessageUpdateEvent;
|
||||
use Thelia\Core\Event\MessageCreateEvent;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Core\Security\Exception\AuthorizationException;
|
||||
use Thelia\Model\MessageQuery;
|
||||
use Thelia\Form\MessageModificationForm;
|
||||
use Thelia\Form\MessageCreationForm;
|
||||
@@ -47,7 +45,8 @@ class MessageController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
protected function renderList() {
|
||||
protected function renderList()
|
||||
{
|
||||
return $this->render('messages');
|
||||
}
|
||||
|
||||
@@ -56,10 +55,9 @@ class MessageController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function defaultAction() {
|
||||
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.view")) return $response;
|
||||
|
||||
return $this->renderList();
|
||||
}
|
||||
|
||||
@@ -68,8 +66,8 @@ class MessageController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function createAction() {
|
||||
|
||||
public function createAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.create")) return $response;
|
||||
|
||||
@@ -107,12 +105,10 @@ class MessageController extends BaseAdminController
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($successUrl);
|
||||
}
|
||||
catch (FormValidationException $ex) {
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$message = $ex->getMessage();
|
||||
}
|
||||
@@ -128,8 +124,8 @@ class MessageController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function changeAction() {
|
||||
|
||||
public function changeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.update")) return $response;
|
||||
|
||||
@@ -168,8 +164,8 @@ class MessageController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function saveChangeAction() {
|
||||
|
||||
public function saveChangeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.update")) return $response;
|
||||
|
||||
@@ -221,12 +217,10 @@ class MessageController extends BaseAdminController
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($changeForm->getSuccessUrl());
|
||||
}
|
||||
catch (FormValidationException $ex) {
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$message = $ex->getMessage();
|
||||
}
|
||||
@@ -242,8 +236,8 @@ class MessageController extends BaseAdminController
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function deleteAction() {
|
||||
|
||||
public function deleteAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.delete")) return $response;
|
||||
|
||||
@@ -257,4 +251,4 @@ class MessageController extends BaseAdminController
|
||||
|
||||
$this->redirectToRoute('admin.configuration.messages.default');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
39
core/lib/Thelia/Controller/Admin/OrderController.php
Normal file
39
core/lib/Thelia/Controller/Admin/OrderController.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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\Controller\Admin;
|
||||
|
||||
/**
|
||||
* Class OrderController
|
||||
* @package Thelia\Controller\Admin
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class OrderController extends BaseAdminController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.orders.view")) return $response;
|
||||
return $this->render("orders", array("display_order" => 20));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,7 +27,6 @@ use Thelia\Form\AdminLogin;
|
||||
use Thelia\Core\Security\Authentication\AdminUsernamePasswordFormAuthenticator;
|
||||
use Thelia\Model\AdminLog;
|
||||
use Thelia\Core\Security\Exception\AuthenticationException;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Tools\Redirect;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
@@ -74,20 +73,17 @@ class SessionController extends BaseAdminController
|
||||
// Redirect to the success URL
|
||||
return Redirect::exec($adminLoginForm->getSuccessUrl());
|
||||
|
||||
}
|
||||
catch (FormValidationException $ex) {
|
||||
} catch (FormValidationException $ex) {
|
||||
|
||||
// Validation problem
|
||||
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||
}
|
||||
catch (AuthenticationException $ex) {
|
||||
} catch (AuthenticationException $ex) {
|
||||
|
||||
// Log authentication failure
|
||||
AdminLog::append(sprintf("Authentication failure for username '%s'", $authenticator->getUsername()), $request);
|
||||
|
||||
$message = $this->getTranslator()->trans("Login failed. Please check your username and password.");
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
|
||||
// Log authentication failure
|
||||
AdminLog::append(sprintf("Undefined error: %s", $ex->getMessage()), $request);
|
||||
@@ -103,4 +99,4 @@ class SessionController extends BaseAdminController
|
||||
// Display the login form again
|
||||
return $this->render("login");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user