fix minor bug

This commit is contained in:
Manuel Raynaud
2014-05-09 10:55:50 +02:00
parent d9d350ea24
commit 85d80d1d77
31 changed files with 243 additions and 309 deletions

View File

@@ -59,8 +59,6 @@ class Currency extends BaseAction implements EventSubscriberInterface
*/
public function update(CurrencyUpdateEvent $event)
{
$search = CurrencyQuery::create();
if (null !== $currency = CurrencyQuery::create()->findPk($event->getCurrencyId())) {
$currency

View File

@@ -302,7 +302,7 @@ class Order extends BaseAction implements EventSubscriberInterface
*/
public function createManual(OrderManualEvent $event)
{
$placedOrder = $this->createOrder(
$this->createOrder(
$event->getDispatcher(),
$event->getOrder(),
$event->getCurrency(),

0
core/lib/Thelia/Command/ModuleDeactivateCommand.php Executable file → Normal file
View File

View File

@@ -33,9 +33,7 @@ use Thelia\Form\Exception\FormValidationException;
use Thelia\Log\Tlog;
use Thelia\Model\Coupon;
use Thelia\Model\CouponQuery;
use Thelia\Model\Lang;
use Thelia\Model\LangQuery;
use Thelia\Tools\I18n;
use Thelia\Tools\Rest\ResponseRest;
/**
@@ -263,8 +261,7 @@ class CouponController extends BaseAdminController
$html = $condition->drawBackOfficeInputs();
$serviceId = $condition->getServiceId();
}
else {
} else {
$html = '';
$serviceId = '';
}

View File

@@ -38,6 +38,7 @@ use Thelia\Core\Event\ProductSaleElement\ProductSaleElementCreateEvent;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Security\AccessManager;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Model\AccessoryQuery;
use Thelia\Model\CategoryQuery;
use Thelia\Model\FeatureQuery;

View File

@@ -16,6 +16,7 @@ use Thelia\Core\Security\AccessManager;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Event\Profile\ProfileEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Form\ProfileCreationForm;
use Thelia\Form\ProfileModificationForm;
use Thelia\Form\ProfileUpdateModuleAccessForm;

View File

@@ -113,7 +113,7 @@ class SessionController extends BaseAdminController
/**
* we have tou find a way to send cookie
*/
if (intval($adminLoginForm->getForm()->get('remember_me')->getData()) > 0) {
if (intval($form->get('remember_me')->getData()) > 0) {
// If a remember me field if present and set in the form, create
// the cookie thant store "remember me" information
$this->createAdminRememberMeCookie($user);

View File

@@ -16,6 +16,7 @@ use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Event\Tax\TaxRuleEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Security\AccessManager;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Form\TaxRuleCreationForm;
use Thelia\Form\TaxRuleModificationForm;
use Thelia\Form\TaxRuleTaxListUpdateForm;

View File

@@ -182,6 +182,4 @@ class LangCreateEvent extends LangEvent
return $this->thousands_separator;
}
}

View File

@@ -19,7 +19,7 @@ class ProductSaleElementEvent extends ActionEvent
{
public $product_sale_element = null;
public function __construct(ProductSaleElement $product_sale_element = null)
public function __construct(ProductSaleElements $product_sale_element = null)
{
$this->product_sale_element = $product_sale_element;
}

View File

@@ -1,71 +0,0 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Factory;
use Symfony\Component\HttpFoundation\Request;
/**
* *
* try to instanciate the good action class
*
* Class ActionEventFactory
* @package Thelia\Core\Factory
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class ActionEventFactory
{
/**
* @var \Symfony\Component\HttpFoundation\Request
*/
protected $request;
/**
* @var string
*/
protected $action;
/**
* array(
* "action.addCart" => "Thelia\Core\Event\CartAction"
* )
*
* @var array key are action name and value the Event class to dispatch
*/
protected $className;
protected $defaultClassName = "Thelia\Core\Event\DefaultActionEvent";
public function __construct(Request $request, $action, $className)
{
$this->request = $request;
$this->action = $action;
$this->className = $className;
}
public function createActionEvent()
{
if (array_key_exists($this->action, $this->className)) {
$class = new \ReflectionClass($this->className[$this->action]);
// return $class->newInstance($this->request, $this->action);
} else {
$class = new \ReflectionClass($this->defaultClassName);
}
if ($class->isSubclassOf("Thelia\Core\Event\ActionEvent") === false) {
throw new \RuntimeException("%s must be a subclass of Thelia\Core\Event\ActionEvent", $class->getName());
}
return $class->newInstance($this->request, $this->action);
}
}

View File

@@ -62,7 +62,7 @@ class OrderCoupon extends BaseLoop implements PropelSearchLoopInterface
public function parseResults(LoopResult $loopResult)
{
$conditionFactory = $this->container->get('thelia.condition.factory');
$this->container->get('thelia.condition.factory');
/** @var OrderCoupon $orderCoupon */
foreach ($loopResult->getResultDataCollection() as $orderCoupon) {

View File

@@ -857,7 +857,7 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
$visible = $this->getVisible();
if ($visible !== BooleanOrBothType::ANY) $search->filterByVisible($visible ? 1 : 0);
if ($visible !== Type\BooleanOrBothType::ANY) $search->filterByVisible($visible ? 1 : 0);
$exclude = $this->getExclude();

View File

@@ -96,8 +96,6 @@ class TheliaLoop extends AbstractSmartyPlugin
$loop = $this->createLoopInstance($params);
$dummy = null;
return $loop->count();
}

View File

@@ -354,7 +354,8 @@ abstract class CouponAbstract implements CouponInterface
*
* @return string HTML string
*/
public function drawBackOfficeInputs() {
public function drawBackOfficeInputs()
{
return $this->facade->getParser()->render('coupon/type-fragments/remove-x.html', [
'label' => $this->getInputName(),
'fieldName' => self::INPUT_AMOUNT_NAME,

View File

@@ -145,7 +145,7 @@ class CouponCreationForm extends BaseForm
/**
* Validate a date entered with the default Language date format.
*
* @param string $value
* @param string $value
* @param ExecutionContextInterface $context
*/
public function checkLocalizedDate($value, ExecutionContextInterface $context)

View File

@@ -17,7 +17,6 @@ use Thelia\Model\Base\AreaDeliveryModuleQuery as BaseAreaDeliveryModuleQuery;
class AreaDeliveryModuleQuery extends BaseAreaDeliveryModuleQuery
{
public function findByCountryAndModule(Country $country, Module $module)
{
$response = null;

View File

@@ -56,9 +56,21 @@ class Content extends BaseContent
public function setDefaultFolder($folderId)
{
/* ContentFolderQuery::create()
->filterByContentId($this->getId)
->update(array("DefaultFolder" => 0));*/
// Unset previous category
ContentFolderQuery::create()
->filterByContentId($this->getId())
->filterByDefaultFolder(true)
->find()
->setByDefault(false)
->save();
// Set new default category
ContentFolderQuery::create()
->filterByContentId($this->getId())
->filterByFolderId($folderId)
->find()
->setByDefault(true)
->save();
return $this;
}

View File

@@ -23,10 +23,8 @@
namespace Thelia\Model;
use Propel\Runtime\Propel;
use Thelia\Model\Base\Coupon as BaseCoupon;
use Thelia\Model\Exception\InvalidArgumentException;
use Thelia\Model\Map\CouponTableMap;
/**
* Used to provide an effect (mostly a discount)

View File

@@ -172,7 +172,7 @@ class Product extends BaseProduct
$this->setTaxRuleId($taxRuleId);
// Create the default product sale element of this product
$sale_elements = $this->createProductSaleElement($con, $baseWeight, $basePrice, $basePrice, $priceCurrencyId, true);
$this->createProductSaleElement($con, $baseWeight, $basePrice, $basePrice, $priceCurrencyId, true);
// Store all the stuff !
$con->commit();

View File

@@ -2,6 +2,7 @@
namespace Thelia\Model;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\Base\ProductSaleElements as BaseProductSaleElements;
use Thelia\Model\Tools\ProductPriceTools;
use Thelia\TaxEngine\Calculator;

View File

@@ -2,6 +2,7 @@
namespace Thelia\Model;
use Propel\Runtime\Exception\PropelException;
use Thelia\Exception\TaxEngineException;
use Thelia\Model\Base\Tax as BaseTax;
use Thelia\Model\Tools\ModelEventDispatcherTrait;

View File

@@ -119,7 +119,7 @@ trait PositionManagementTrait
$result->setDispatcher($this->getDispatcher())->setPosition($my_position)->save($cnx);
$cnx->commit();
} catch (Exception $e) {
} catch (\Exception $e) {
$cnx->rollback();
}
}
@@ -185,7 +185,7 @@ trait PositionManagementTrait
;
$cnx->commit();
} catch (Exception $e) {
} catch (\Exception $e) {
$cnx->rollback();
}
}

View File

@@ -44,7 +44,6 @@ class ContentTest extends BaseLoopTestor
$content = ContentQuery::create()->findOne();
if (null === $content) {
$content = new \Thelia\Model\Content();
$content->setDefaultFolder(0);
$content->setVisible(1);
$content->setTitle('foo');
$content->save();