Revert "Revert "Merge branch 'cleanmaster' into modules""
This reverts commit b3ac365b45.
Conflicts:
Readme.md
core/lib/Thelia/Controller/Admin/AbstractCrudController.php
core/lib/Thelia/Core/Template/Assets/AssetManagerInterface.php
core/lib/Thelia/Core/Template/Assets/AsseticAssetManager.php
core/lib/Thelia/Core/Template/Smarty/SmartyParser.php
core/lib/Thelia/Core/Template/TemplateDefinition.php
core/lib/Thelia/Model/Base/Coupon.php
core/lib/Thelia/Model/Base/CouponQuery.php
core/lib/Thelia/Model/Base/CouponVersion.php
core/lib/Thelia/Model/Base/CouponVersionQuery.php
core/lib/Thelia/Model/Base/OrderCouponQuery.php
This commit is contained in:
@@ -443,7 +443,6 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
$ex
|
||||
);
|
||||
|
||||
|
||||
return $this->renderEditionTemplate();
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ abstract class AbstractSeoCrudController extends AbstractCrudController
|
||||
*
|
||||
* @param string $visibilityToggleEventIdentifier the dispatched visibility toggle TheliaEvent identifier, or null if the object has no visible options. Example: TheliaEvents::MESSAGE_TOGGLE_VISIBILITY
|
||||
* @param string $changePositionEventIdentifier the dispatched position change TheliaEvent identifier, or null if the object has no position. Example: TheliaEvents::MESSAGE_UPDATE_POSITION
|
||||
* @param string $updateSeoEventIdentifier the dispatched update SEO change TheliaEvent identifier, or null if the object has no SEO. Example: TheliaEvents::MESSAGE_UPDATE_SEO
|
||||
* @param string $updateSeoEventIdentifier the dispatched update SEO change TheliaEvent identifier, or null if the object has no SEO. Example: TheliaEvents::MESSAGE_UPDATE_SEO
|
||||
*/
|
||||
public function __construct(
|
||||
$objectName,
|
||||
@@ -134,7 +134,8 @@ abstract class AbstractSeoCrudController extends AbstractCrudController
|
||||
*
|
||||
* @param unknown $object
|
||||
*/
|
||||
protected function hydrateSeoForm($object){
|
||||
protected function hydrateSeoForm($object)
|
||||
{
|
||||
// The "SEO" tab form
|
||||
$locale = $object->getLocale();
|
||||
$data = array(
|
||||
@@ -227,8 +228,6 @@ abstract class AbstractSeoCrudController extends AbstractCrudController
|
||||
$ex
|
||||
);
|
||||
|
||||
|
||||
|
||||
// At this point, the form has errors, and should be redisplayed.
|
||||
return $this->renderEditionTemplate();
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ class AddressController extends AbstractCrudController
|
||||
/**
|
||||
* Fills in the form data array
|
||||
*
|
||||
* @param unknown $object
|
||||
* @param unknown $object
|
||||
* @return multitype:NULL
|
||||
*/
|
||||
protected function createFormDataArray($object)
|
||||
@@ -309,7 +309,8 @@ class AddressController extends AbstractCrudController
|
||||
$this->redirectToEditionTemplate();
|
||||
}
|
||||
|
||||
protected function getCustomerId() {
|
||||
protected function getCustomerId()
|
||||
{
|
||||
if (null !== $address = $this->getExistingObject())
|
||||
return $address->getCustomerId();
|
||||
else
|
||||
|
||||
@@ -34,7 +34,6 @@ use Thelia\Form\AttributeModificationForm;
|
||||
use Thelia\Form\AttributeCreationForm;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Model\AttributeAv;
|
||||
use Thelia\Model\AttributeAvQuery;
|
||||
use Thelia\Core\Event\Attribute\AttributeAvUpdateEvent;
|
||||
use Thelia\Core\Event\Attribute\AttributeEvent;
|
||||
|
||||
|
||||
@@ -309,6 +309,7 @@ class BaseAdminController extends BaseController
|
||||
{
|
||||
// Check if the functionality is activated
|
||||
if(!ConfigQuery::read("one_domain_foreach_lang", false))
|
||||
|
||||
return;
|
||||
|
||||
// If we don't have a locale value, use the locale value in the session
|
||||
@@ -390,8 +391,8 @@ class BaseAdminController extends BaseController
|
||||
* Render the given template, and returns the result as an Http Response.
|
||||
*
|
||||
* @param $templateName the complete template name, with extension
|
||||
* @param array $args the template arguments
|
||||
* @param int $status http code status
|
||||
* @param array $args the template arguments
|
||||
* @param int $status http code status
|
||||
* @return \Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
protected function render($templateName, $args = array(), $status = 200)
|
||||
|
||||
@@ -201,15 +201,12 @@ class CategoryController extends AbstractSeoCrudController
|
||||
|
||||
protected function redirectToListTemplateWithId($category_id)
|
||||
{
|
||||
if($category_id > 0)
|
||||
{
|
||||
if ($category_id > 0) {
|
||||
$this->redirectToRoute(
|
||||
'admin.categories.default',
|
||||
array('category_id' => $category_id)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->redirectToRoute(
|
||||
'admin.catalog'
|
||||
);
|
||||
|
||||
@@ -23,11 +23,9 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Form\ConfigStoreForm;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
/**
|
||||
* Class ConfigStoreController
|
||||
@@ -80,7 +78,7 @@ class ConfigStoreController extends BaseAdminController
|
||||
$data = $form->getData();
|
||||
|
||||
// Update store
|
||||
foreach($data as $name => $value) {
|
||||
foreach ($data as $name => $value) {
|
||||
if(! in_array($name , array('success_url', 'error_message')))
|
||||
ConfigQuery::write($name, $value, false);
|
||||
}
|
||||
|
||||
@@ -23,19 +23,14 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Customer\CustomerEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Form\CustomerCreateForm;
|
||||
use Thelia\Form\CustomerUpdateForm;
|
||||
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;
|
||||
|
||||
/**
|
||||
@@ -208,4 +203,4 @@ class CustomerController extends AbstractCrudController
|
||||
{
|
||||
$this->redirectToRoute("admin.customer.update.view", $this->getEditionArguments());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ use Thelia\Form\FeatureModificationForm;
|
||||
use Thelia\Form\FeatureCreationForm;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Model\FeatureAv;
|
||||
use Thelia\Model\FeatureAvQuery;
|
||||
use Thelia\Core\Event\Feature\FeatureAvUpdateEvent;
|
||||
use Thelia\Core\Event\Feature\FeatureEvent;
|
||||
|
||||
|
||||
@@ -584,7 +584,7 @@ class FileController extends BaseAdminController
|
||||
);
|
||||
}
|
||||
|
||||
if(null === $message) {
|
||||
if (null === $message) {
|
||||
$message = $this->getTranslator()
|
||||
->trans(
|
||||
'Images deleted successfully',
|
||||
@@ -638,7 +638,7 @@ class FileController extends BaseAdminController
|
||||
) . $e->getMessage();
|
||||
}
|
||||
|
||||
if(null === $message) {
|
||||
if (null === $message) {
|
||||
$message = $this->getTranslator()
|
||||
->trans(
|
||||
'Image position updated',
|
||||
@@ -692,7 +692,7 @@ class FileController extends BaseAdminController
|
||||
) . $e->getMessage();
|
||||
}
|
||||
|
||||
if(null === $message) {
|
||||
if (null === $message) {
|
||||
$message = $this->getTranslator()
|
||||
->trans(
|
||||
'Document position updated',
|
||||
|
||||
@@ -42,7 +42,7 @@ class HomeController extends BaseAdminController
|
||||
public function loadStatsAjaxAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW)) return $response;
|
||||
|
||||
|
||||
$data = new \stdClass();
|
||||
|
||||
$data->title = "Stats on " . $this->getRequest()->query->get('month', date('m')) . "/" . $this->getRequest()->query->get('year', date('Y'));
|
||||
@@ -88,7 +88,6 @@ class HomeController extends BaseAdminController
|
||||
array(5)
|
||||
);
|
||||
|
||||
|
||||
$data->series = array(
|
||||
$saleSeries,
|
||||
$newCustomerSeries,
|
||||
|
||||
@@ -31,7 +31,6 @@ use Thelia\Model\MessageQuery;
|
||||
use Thelia\Form\MessageModificationForm;
|
||||
use Thelia\Form\MessageCreationForm;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Core\Template\TemplateHelper;
|
||||
|
||||
/**
|
||||
@@ -164,8 +163,8 @@ class MessageController extends AbstractCrudController
|
||||
return $this->render('messages');
|
||||
}
|
||||
|
||||
protected function listDirectoryContent($requiredExtension) {
|
||||
|
||||
protected function listDirectoryContent($requiredExtension)
|
||||
{
|
||||
$list = array();
|
||||
|
||||
$dir = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath();
|
||||
|
||||
@@ -149,7 +149,6 @@ class ModuleController extends AbstractCrudController
|
||||
->findOneById($this->getRequest()->get('module_id'));
|
||||
}
|
||||
|
||||
|
||||
protected function getObjectLabel($object)
|
||||
{
|
||||
return $object->getTitle();
|
||||
@@ -218,12 +217,11 @@ class ModuleController extends AbstractCrudController
|
||||
{
|
||||
$module = ModuleQuery::create()->findOneByCode($module_code);
|
||||
|
||||
if(null === $module) {
|
||||
if (null === $module) {
|
||||
throw new \InvalidArgumentException(sprintf("Module `%s` does not exists", $module_code));
|
||||
}
|
||||
|
||||
if (null !== $response = $this->checkAuth(array(), $module_code, AccessManager::VIEW)) return $response;
|
||||
|
||||
return $this->render(
|
||||
"module-configure",
|
||||
array(
|
||||
|
||||
@@ -27,7 +27,6 @@ use Thelia\Core\HttpFoundation\Response;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Order\OrderAddressEvent;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\PdfEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Form\OrderUpdateAddress;
|
||||
@@ -36,7 +35,6 @@ use Thelia\Model\Base\OrderAddressQuery;
|
||||
use Thelia\Model\OrderQuery;
|
||||
use Thelia\Model\OrderStatusQuery;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Core\Template\TemplateHelper;
|
||||
|
||||
/**
|
||||
* Class OrderController
|
||||
@@ -203,20 +201,18 @@ class OrderController extends BaseAdminController
|
||||
public function generateInvoicePdf($order_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
return $this->generateBackOfficeOrderPdf($order_id, ConfigQuery::read('pdf_invoice_file', 'invoice'));
|
||||
}
|
||||
|
||||
public function generateDeliveryPdf($order_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
return $this->generateBackOfficeOrderPdf($order_id, ConfigQuery::read('pdf_delivery_file', 'delivery'));
|
||||
}
|
||||
|
||||
private function generateBackOfficeOrderPdf($order_id, $fileName)
|
||||
{
|
||||
if(null === $response = $this->generateOrderPdf($order_id, $fileName)){
|
||||
if (null === $response = $this->generateOrderPdf($order_id, $fileName)) {
|
||||
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute("admin.order.update.view", array(
|
||||
'order_id' => $order_id
|
||||
))));
|
||||
@@ -225,5 +221,4 @@ class OrderController extends BaseAdminController
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -72,7 +72,6 @@ use Thelia\Form\ProductCombinationGenerationForm;
|
||||
use Thelia\TaxEngine\Calculator;
|
||||
use Thelia\Tools\NumberFormat;
|
||||
|
||||
|
||||
/**
|
||||
* Manages products
|
||||
*
|
||||
@@ -1037,17 +1036,18 @@ class ProductController extends AbstractSeoCrudController
|
||||
}
|
||||
|
||||
// Create combinations
|
||||
protected function combine($input, &$output, &$tmp) {
|
||||
protected function combine($input, &$output, &$tmp)
|
||||
{
|
||||
$current = array_shift($input);
|
||||
|
||||
if (count($input) > 0) {
|
||||
foreach($current as $element) {
|
||||
foreach ($current as $element) {
|
||||
$tmp[] = $element;
|
||||
$this->combine($input, $output, $tmp);
|
||||
array_pop($tmp);
|
||||
}
|
||||
} else {
|
||||
foreach($current as $element) {
|
||||
foreach ($current as $element) {
|
||||
$tmp[] = $element;
|
||||
$output[] = $tmp;
|
||||
array_pop($tmp);
|
||||
@@ -1058,8 +1058,8 @@ class ProductController extends AbstractSeoCrudController
|
||||
/**
|
||||
* Build combinations from the combination output builder
|
||||
*/
|
||||
public function buildCombinationsAction() {
|
||||
|
||||
public function buildCombinationsAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
@@ -1082,7 +1082,7 @@ class ProductController extends AbstractSeoCrudController
|
||||
// from the list of attribute_id:attributes_av ID from the form.
|
||||
$combinations = $attributes_av_list = array();
|
||||
|
||||
foreach($data['attribute_av'] as $item) {
|
||||
foreach ($data['attribute_av'] as $item) {
|
||||
list($attribute_id, $attribute_av_id) = explode(':', $item);
|
||||
|
||||
if (! isset($attributes_av_list[$attribute_id]))
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Form\SystemLogConfigurationForm;
|
||||
@@ -43,7 +42,7 @@ class SystemLogController extends BaseAdminController
|
||||
|
||||
$destination_directories = Tlog::getInstance()->getDestinationsDirectories();
|
||||
|
||||
foreach($destination_directories as $dir) {
|
||||
foreach ($destination_directories as $dir) {
|
||||
$this->loadDefinedDestinations($dir, $destinations);
|
||||
}
|
||||
|
||||
@@ -58,8 +57,8 @@ class SystemLogController extends BaseAdminController
|
||||
);
|
||||
}
|
||||
|
||||
protected function loadDefinedDestinations($directory, &$destinations) {
|
||||
|
||||
protected function loadDefinedDestinations($directory, &$destinations)
|
||||
{
|
||||
try {
|
||||
foreach (new \DirectoryIterator($directory) as $fileInfo) {
|
||||
|
||||
@@ -144,7 +143,7 @@ class SystemLogController extends BaseAdminController
|
||||
|
||||
$active_destinations = array();
|
||||
|
||||
foreach($destinations as $classname => $destination) {
|
||||
foreach ($destinations as $classname => $destination) {
|
||||
|
||||
if (isset($destination['active'])) {
|
||||
$active_destinations[] = $destination['classname'];
|
||||
@@ -153,7 +152,7 @@ class SystemLogController extends BaseAdminController
|
||||
if (isset($configs[$classname])) {
|
||||
|
||||
// Update destinations configuration
|
||||
foreach($configs[$classname] as $var => $value) {
|
||||
foreach ($configs[$classname] as $var => $value) {
|
||||
ConfigQuery::write($var, $value, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,12 +23,8 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Form\SystemLogConfigurationForm;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
use Thelia\Core\Template\TemplateHelper;
|
||||
use Thelia\Core\Template\TemplateDefinition;
|
||||
@@ -67,7 +63,7 @@ class TranslationsController extends BaseAdminController
|
||||
|
||||
if (! empty($item_id) || $item_to_translate == 'co') {
|
||||
|
||||
switch($item_to_translate) {
|
||||
switch ($item_to_translate) {
|
||||
|
||||
case 'mo' :
|
||||
if (null !== $module = ModuleQuery::create()->findPk($item_id)) {
|
||||
@@ -149,8 +145,7 @@ class TranslationsController extends BaseAdminController
|
||||
$templateArguments['max_input_vars_warning'] = true;
|
||||
$templateArguments['required_max_input_vars'] = $stringsCount;
|
||||
$templateArguments['current_max_input_vars'] = ini_get('max_input_vars');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$templateArguments['all_strings'] = $all_strings;
|
||||
}
|
||||
}
|
||||
@@ -162,14 +157,12 @@ class TranslationsController extends BaseAdminController
|
||||
public function defaultAction()
|
||||
{
|
||||
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, array(), AccessManager::UPDATE)) return $response;
|
||||
|
||||
return $this->renderTemplate();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user