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