Revert "Merge branch 'cleanmaster' into modules"

This reverts commit d0ff5260f7, reversing
changes made to 67d0101dbe.
This commit is contained in:
Etienne Roudeix
2013-12-20 11:16:42 +01:00
parent d0ff5260f7
commit b3ac365b45
332 changed files with 3575 additions and 4787 deletions

View File

@@ -443,6 +443,7 @@ abstract class AbstractCrudController extends BaseAdminController
$ex
);
//return $this->renderEditionTemplate();
}

View File

@@ -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,8 +134,7 @@ 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(
@@ -228,6 +227,8 @@ abstract class AbstractSeoCrudController extends AbstractCrudController
$ex
);
// At this point, the form has errors, and should be redisplayed.
return $this->renderEditionTemplate();
}

View File

@@ -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,8 +309,7 @@ class AddressController extends AbstractCrudController
$this->redirectToEditionTemplate();
}
protected function getCustomerId()
{
protected function getCustomerId() {
if (null !== $address = $this->getExistingObject())
return $address->getCustomerId();
else

View File

@@ -34,6 +34,7 @@ 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;

View File

@@ -309,7 +309,6 @@ 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
@@ -391,8 +390,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)

View File

@@ -201,12 +201,15 @@ 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'
);

View File

@@ -23,9 +23,11 @@
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
@@ -78,7 +80,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);
}

View File

@@ -23,14 +23,19 @@
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;
/**
@@ -203,4 +208,4 @@ class CustomerController extends AbstractCrudController
{
$this->redirectToRoute("admin.customer.update.view", $this->getEditionArguments());
}
}
}

View File

@@ -34,6 +34,7 @@ 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;

View File

@@ -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',

View File

@@ -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,6 +88,7 @@ class HomeController extends BaseAdminController
array(5)
);
$data->series = array(
$saleSeries,
$newCustomerSeries,

View File

@@ -31,6 +31,7 @@ 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;
/**
@@ -163,8 +164,8 @@ class MessageController extends AbstractCrudController
return $this->render('messages');
}
protected function listDirectoryContent($requiredExtension)
{
protected function listDirectoryContent($requiredExtension) {
$list = array();
$dir = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath();

View File

@@ -149,6 +149,7 @@ class ModuleController extends AbstractCrudController
->findOneById($this->getRequest()->get('module_id'));
}
protected function getObjectLabel($object)
{
return $object->getTitle();
@@ -217,11 +218,12 @@ 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(

View File

@@ -27,6 +27,7 @@ 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;
@@ -35,6 +36,7 @@ use Thelia\Model\Base\OrderAddressQuery;
use Thelia\Model\OrderQuery;
use Thelia\Model\OrderStatusQuery;
use Thelia\Tools\URL;
use Thelia\Core\Template\TemplateHelper;
/**
* Class OrderController
@@ -201,18 +203,20 @@ 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
))));
@@ -221,4 +225,5 @@ class OrderController extends BaseAdminController
return $response;
}
}

View File

@@ -72,6 +72,7 @@ use Thelia\Form\ProductCombinationGenerationForm;
use Thelia\TaxEngine\Calculator;
use Thelia\Tools\NumberFormat;
/**
* Manages products
*
@@ -1036,18 +1037,17 @@ 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]))

View File

@@ -23,6 +23,7 @@
namespace Thelia\Controller\Admin;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Security\AccessManager;
use Thelia\Form\SystemLogConfigurationForm;
@@ -42,7 +43,7 @@ class SystemLogController extends BaseAdminController
$destination_directories = Tlog::getInstance()->getDestinationsDirectories();
foreach ($destination_directories as $dir) {
foreach($destination_directories as $dir) {
$this->loadDefinedDestinations($dir, $destinations);
}
@@ -57,8 +58,8 @@ class SystemLogController extends BaseAdminController
);
}
protected function loadDefinedDestinations($directory, &$destinations)
{
protected function loadDefinedDestinations($directory, &$destinations) {
try {
foreach (new \DirectoryIterator($directory) as $fileInfo) {
@@ -143,7 +144,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'];
@@ -152,7 +153,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);
}
}

View File

@@ -23,8 +23,12 @@
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;
@@ -63,7 +67,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)) {
@@ -145,7 +149,8 @@ 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;
}
}
@@ -157,12 +162,14 @@ 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();
}
}

View File

@@ -61,7 +61,7 @@ abstract class BaseController extends ContainerAware
/**
* Return an empty response (after an ajax request, for example)
* @param int $status
* @param int $status
* @return \Thelia\Core\HttpFoundation\Response
*/
protected function nullResponse($status = 200)
@@ -252,6 +252,7 @@ abstract class BaseController extends ContainerAware
}
}
/**
@@ -366,8 +367,8 @@ abstract class BaseController extends ContainerAware
* 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
*/
abstract protected function render($templateName, $args = array(), $status = 200);

View File

@@ -25,8 +25,10 @@ namespace Thelia\Controller\Front;
use Symfony\Component\Routing\Router;
use Thelia\Controller\BaseController;
use Thelia\Core\HttpFoundation\Response;
use Thelia\Core\Security\Exception\AuthenticationException;
use Thelia\Core\Template\TemplateHelper;
use Thelia\Model\AddressQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Model\ModuleQuery;
use Thelia\Tools\Redirect;
use Thelia\Tools\URL;
@@ -104,8 +106,8 @@ class BaseFrontController 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)