@@ -32,6 +32,5 @@ if (!file_exists(THELIA_CONF_DIR . 'database.yml') && !defined('THELIA_INSTALL_M
|
|||||||
} else {
|
} else {
|
||||||
$request = \Thelia\Core\HttpFoundation\Request::createFromGlobals();
|
$request = \Thelia\Core\HttpFoundation\Request::createFromGlobals();
|
||||||
header('Location: '.$request->getUriForPath('/install'));
|
header('Location: '.$request->getUriForPath('/install'));
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ use Thelia\Model\ConfigQuery;
|
|||||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||||
use Thelia\Core\Security\Exception\AuthenticationException;
|
use Thelia\Core\Security\Exception\AuthenticationException;
|
||||||
use Thelia\Tools\URL;
|
use Thelia\Tools\URL;
|
||||||
use Thelia\Tools\Redirect;
|
|
||||||
use Thelia\Model\AdminLog;
|
use Thelia\Model\AdminLog;
|
||||||
|
|
||||||
use Thelia\Model\LangQuery;
|
use Thelia\Model\LangQuery;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ use Thelia\Core\Event\TheliaEvents;
|
|||||||
use Thelia\Core\Security\AccessManager;
|
use Thelia\Core\Security\AccessManager;
|
||||||
use Thelia\Form\CountryCreationForm;
|
use Thelia\Form\CountryCreationForm;
|
||||||
use Thelia\Form\CountryModificationForm;
|
use Thelia\Form\CountryModificationForm;
|
||||||
|
use Thelia\Log\Tlog;
|
||||||
use Thelia\Model\CountryQuery;
|
use Thelia\Model\CountryQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -228,7 +229,7 @@ class CountryController extends AbstractCrudController
|
|||||||
public function toggleDefaultAction()
|
public function toggleDefaultAction()
|
||||||
{
|
{
|
||||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), 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')) {
|
if (null !== $country_id = $this->getRequest()->get('country_id')) {
|
||||||
$toogleDefaultEvent = new CountryToggleDefaultEvent($country_id);
|
$toogleDefaultEvent = new CountryToggleDefaultEvent($country_id);
|
||||||
try {
|
try {
|
||||||
@@ -238,7 +239,7 @@ class CountryController extends AbstractCrudController
|
|||||||
return $this->nullResponse();
|
return $this->nullResponse();
|
||||||
}
|
}
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
$content = $ex->getMessage();
|
Tlog::getInstance()->error($ex->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
namespace Thelia\Controller\Admin;
|
namespace Thelia\Controller\Admin;
|
||||||
|
|
||||||
use Symfony\Component\Form\Form;
|
use Symfony\Component\Form\Form;
|
||||||
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Router;
|
use Symfony\Component\Routing\Router;
|
||||||
@@ -35,6 +36,7 @@ use Thelia\Model\CouponModule;
|
|||||||
use Thelia\Model\CouponQuery;
|
use Thelia\Model\CouponQuery;
|
||||||
use Thelia\Model\LangQuery;
|
use Thelia\Model\LangQuery;
|
||||||
use Thelia\Tools\Rest\ResponseRest;
|
use Thelia\Tools\Rest\ResponseRest;
|
||||||
|
use Thelia\Tools\URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Control View and Action (Model) via Events
|
* Control View and Action (Model) via Events
|
||||||
@@ -78,11 +80,13 @@ class CouponController extends BaseAdminController
|
|||||||
$eventToDispatch = TheliaEvents::COUPON_CREATE;
|
$eventToDispatch = TheliaEvents::COUPON_CREATE;
|
||||||
|
|
||||||
if ($this->getRequest()->isMethod('POST')) {
|
if ($this->getRequest()->isMethod('POST')) {
|
||||||
$this->validateCreateOrUpdateForm(
|
if(null !== $response = $this->validateCreateOrUpdateForm(
|
||||||
$eventToDispatch,
|
$eventToDispatch,
|
||||||
'created',
|
'created',
|
||||||
'creation'
|
'creation'
|
||||||
);
|
)){
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// If no input for expirationDate, now + 2 months
|
// If no input for expirationDate, now + 2 months
|
||||||
$defaultDate = new \DateTime();
|
$defaultDate = new \DateTime();
|
||||||
@@ -137,12 +141,14 @@ class CouponController extends BaseAdminController
|
|||||||
|
|
||||||
// Update
|
// Update
|
||||||
if ($this->getRequest()->isMethod('POST')) {
|
if ($this->getRequest()->isMethod('POST')) {
|
||||||
$this->validateCreateOrUpdateForm(
|
if (null !== $response = $this->validateCreateOrUpdateForm(
|
||||||
$eventToDispatch,
|
$eventToDispatch,
|
||||||
'updated',
|
'updated',
|
||||||
'update',
|
'update',
|
||||||
$coupon
|
$coupon
|
||||||
);
|
)) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Display
|
// Display
|
||||||
// Prepare the data that will hydrate the form
|
// Prepare the data that will hydrate the form
|
||||||
@@ -474,7 +480,7 @@ class CouponController extends BaseAdminController
|
|||||||
{
|
{
|
||||||
// Create the form from the request
|
// Create the form from the request
|
||||||
$couponForm = new CouponCreationForm($this->getRequest());
|
$couponForm = new CouponCreationForm($this->getRequest());
|
||||||
|
$response = null;
|
||||||
$message = false;
|
$message = false;
|
||||||
try {
|
try {
|
||||||
// Check the form against conditions violations
|
// Check the form against conditions violations
|
||||||
@@ -498,20 +504,19 @@ class CouponController extends BaseAdminController
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($this->getRequest()->get('save_mode') == 'stay') {
|
if ($this->getRequest()->get('save_mode') == 'stay') {
|
||||||
$this->redirect(
|
$response = RedirectResponse::create(str_replace(
|
||||||
str_replace(
|
'{id}',
|
||||||
'{id}',
|
$couponEvent->getCouponModel()->getId(),
|
||||||
$couponEvent->getCouponModel()->getId(),
|
$couponForm->getSuccessUrl()
|
||||||
$couponForm->getSuccessUrl()
|
));
|
||||||
)
|
|
||||||
|
} else {
|
||||||
|
// Redirect to the success URL
|
||||||
|
$response = RedirectResponse::create(
|
||||||
|
URL::getInstance()->absoluteUrl($this->getRoute('admin.coupon.list'))
|
||||||
);
|
);
|
||||||
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redirect to the success URL
|
|
||||||
$this->redirectToRoute('admin.coupon.list');
|
|
||||||
|
|
||||||
} catch (FormValidationException $ex) {
|
} catch (FormValidationException $ex) {
|
||||||
// Invalid data entered
|
// Invalid data entered
|
||||||
$message = $this->createStandardFormValidationErrorMessage($ex);
|
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
@@ -533,7 +538,7 @@ class CouponController extends BaseAdminController
|
|||||||
->setGeneralError($message);
|
->setGeneralError($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ use Thelia\Core\Template\Exception\ResourceNotFoundException;
|
|||||||
|
|
||||||
use Thelia\Core\Template\TemplateHelper;
|
use Thelia\Core\Template\TemplateHelper;
|
||||||
use Thelia\Exception\OrderException;
|
use Thelia\Exception\OrderException;
|
||||||
use Thelia\Tools\Redirect;
|
|
||||||
|
|
||||||
use Thelia\Core\Security\Exception\AuthenticationException;
|
use Thelia\Core\Security\Exception\AuthenticationException;
|
||||||
|
|
||||||
|
|||||||
@@ -154,8 +154,6 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface
|
|||||||
|
|
||||||
/** @var Request $request */
|
/** @var Request $request */
|
||||||
$request = $this->container->get('request');
|
$request = $this->container->get('request');
|
||||||
/** @var Lang $lang */
|
|
||||||
$lang = $request->getSession()->getLang();
|
|
||||||
|
|
||||||
/** @var MCoupon $coupon */
|
/** @var MCoupon $coupon */
|
||||||
foreach ($loopResult->getResultDataCollection() as $coupon) {
|
foreach ($loopResult->getResultDataCollection() as $coupon) {
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
|
|||||||
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
|
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use Symfony\Component\HttpFoundation\Session;
|
|
||||||
|
|
||||||
use Thelia\Core\Event\Currency\CurrencyChangeEvent;
|
use Thelia\Core\Event\Currency\CurrencyChangeEvent;
|
||||||
use Thelia\Core\Event\SessionEvent;
|
use Thelia\Core\Event\SessionEvent;
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ namespace Thelia\Core\Translation;
|
|||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Symfony\Component\Translation\Translator as BaseTranslator;
|
use Symfony\Component\Translation\Translator as BaseTranslator;
|
||||||
use Thelia\Log\Tlog;
|
|
||||||
|
|
||||||
class Translator extends BaseTranslator
|
class Translator extends BaseTranslator
|
||||||
{
|
{
|
||||||
@@ -74,14 +73,9 @@ class Translator extends BaseTranslator
|
|||||||
$this->loadCatalogue($locale);
|
$this->loadCatalogue($locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $this->catalogues[$locale]->has((string) $id, $domain)) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->catalogues[$locale]->has((string) $id, $domain)) {
|
if ($this->catalogues[$locale]->has((string) $id, $domain)) {
|
||||||
return parent::trans($id, $parameters, $domain, $locale);
|
return parent::trans($id, $parameters, $domain, $locale);
|
||||||
} else {
|
} else {
|
||||||
//Tlog::getInstance()->addWarning("Undefined translation: locale: $locale, domain: $domain, ID: $id");
|
|
||||||
|
|
||||||
if ($return_default_if_not_available)
|
if ($return_default_if_not_available)
|
||||||
return strtr($id, $parameters);
|
return strtr($id, $parameters);
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ class Update
|
|||||||
$logger = Tlog::getInstance();
|
$logger = Tlog::getInstance();
|
||||||
$logger->setLevel(Tlog::DEBUG);
|
$logger->setLevel(Tlog::DEBUG);
|
||||||
|
|
||||||
$success = true;
|
|
||||||
$updatedVersions = array();
|
$updatedVersions = array();
|
||||||
|
|
||||||
$currentVersion = ConfigQuery::read('thelia_version');
|
$currentVersion = ConfigQuery::read('thelia_version');
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ class Cart extends BaseCart
|
|||||||
}
|
}
|
||||||
|
|
||||||
$cart->save();
|
$cart->save();
|
||||||
$currentDateTime = new \DateTime();
|
|
||||||
foreach ($cartItems as $cartItem) {
|
foreach ($cartItems as $cartItem) {
|
||||||
|
|
||||||
$product = $cartItem->getProduct();
|
$product = $cartItem->getProduct();
|
||||||
|
|||||||
@@ -75,8 +75,6 @@ class Message extends BaseMessage
|
|||||||
{
|
{
|
||||||
$body = false;
|
$body = false;
|
||||||
|
|
||||||
//$mail_template_path = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath() . DS;
|
|
||||||
|
|
||||||
// Try to get the body from template file, if a file is defined
|
// Try to get the body from template file, if a file is defined
|
||||||
if (! empty($template)) {
|
if (! empty($template)) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user