This commit is contained in:
Manuel Raynaud
2013-10-25 10:07:21 +02:00
parent 22caf28f80
commit 2c030f910b
91 changed files with 219 additions and 761 deletions

View File

@@ -23,11 +23,9 @@
namespace Thelia\Action; namespace Thelia\Action;
use Propel\Runtime\ActiveQuery\Criteria;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\Administrator\AdministratorEvent; use Thelia\Core\Event\Administrator\AdministratorEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Security\AccessManager;
use Thelia\Model\Admin as AdminModel; use Thelia\Model\Admin as AdminModel;
use Thelia\Model\AdminQuery; use Thelia\Model\AdminQuery;
@@ -69,7 +67,7 @@ class Administrator extends BaseAction implements EventSubscriberInterface
->setProfileId($event->getProfile()) ->setProfileId($event->getProfile())
; ;
if('' !== $event->getPassword()) { if ('' !== $event->getPassword()) {
$administrator->setPassword($event->getPassword()); $administrator->setPassword($event->getPassword());
} }

View File

@@ -34,7 +34,6 @@ use Thelia\Model\ConfigQuery;
use Thelia\Model\LangQuery; use Thelia\Model\LangQuery;
use Thelia\Model\Lang as LangModel; use Thelia\Model\Lang as LangModel;
/** /**
* Class Lang * Class Lang
* @package Thelia\Action * @package Thelia\Action
@@ -105,7 +104,7 @@ class Lang extends BaseAction implements EventSubscriberInterface
public function langUrl(LangUrlEvent $event) public function langUrl(LangUrlEvent $event)
{ {
foreach($event->getUrl() as $id => $url){ foreach ($event->getUrl() as $id => $url) {
LangQuery::create() LangQuery::create()
->filterById($id) ->filterById($id)
->update(array('Url' => $url)); ->update(array('Url' => $url));

View File

@@ -70,7 +70,7 @@ class Module extends BaseAction implements EventSubscriberInterface
$con->beginTransaction(); $con->beginTransaction();
try { try {
if(null === $module->getFullNamespace()) { if (null === $module->getFullNamespace()) {
throw new \LogicException('can not instanciante this module if namespace is null. Maybe the model is not loaded ?'); throw new \LogicException('can not instanciante this module if namespace is null. Maybe the model is not loaded ?');
} }

View File

@@ -29,7 +29,6 @@ use Thelia\Action\BaseAction;
use Thelia\Model\NewsletterQuery; use Thelia\Model\NewsletterQuery;
use Thelia\Model\Newsletter as NewsletterModel; use Thelia\Model\Newsletter as NewsletterModel;
/** /**
* Class Newsletter * Class Newsletter
* @package Thelia\Action * @package Thelia\Action
@@ -52,14 +51,14 @@ class Newsletter extends BaseAction implements EventSubscriberInterface
public function unsubscribe(NewsletterEvent $event) public function unsubscribe(NewsletterEvent $event)
{ {
if(null !== $nl = NewsletterQuery::create()->findPk($event->getId())) { if (null !== $nl = NewsletterQuery::create()->findPk($event->getId())) {
$nl->delete(); $nl->delete();
} }
} }
public function update(NewsletterEvent $event) public function update(NewsletterEvent $event)
{ {
if(null !== $nl = NewsletterQuery::create()->findPk($event->getId())) { if (null !== $nl = NewsletterQuery::create()->findPk($event->getId())) {
$nl->setEmail($event->getEmail()) $nl->setEmail($event->getEmail())
->setFirstname($event->getFirstname()) ->setFirstname($event->getFirstname())
->setLastname($event->getLastname()) ->setLastname($event->getLastname())

View File

@@ -52,14 +52,6 @@ use Thelia\Core\Event\Product\ProductSetTemplateEvent;
use Thelia\Model\ProductSaleElementsQuery; use Thelia\Model\ProductSaleElementsQuery;
use Thelia\Core\Event\Product\ProductDeleteCategoryEvent; use Thelia\Core\Event\Product\ProductDeleteCategoryEvent;
use Thelia\Core\Event\Product\ProductAddCategoryEvent; use Thelia\Core\Event\Product\ProductAddCategoryEvent;
use Thelia\Model\AttributeAvQuery;
use Thelia\Model\AttributeCombination;
use Thelia\Core\Event\Product\ProductSaleElementCreateEvent;
use Propel\Runtime\Propel;
use Thelia\Model\Map\ProductTableMap;
use Thelia\Core\Event\Product\ProductSaleElementDeleteEvent;
use Thelia\Model\ProductPrice;
use Thelia\Model\ProductSaleElements;
use Thelia\Core\Event\Product\ProductAddAccessoryEvent; use Thelia\Core\Event\Product\ProductAddAccessoryEvent;
use Thelia\Core\Event\Product\ProductDeleteAccessoryEvent; use Thelia\Core\Event\Product\ProductDeleteAccessoryEvent;

View File

@@ -25,9 +25,6 @@ namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Model\ProductQuery;
use Thelia\Model\Product as ProductModel;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\ProductSaleElement\ProductSaleElementCreateEvent; use Thelia\Core\Event\ProductSaleElement\ProductSaleElementCreateEvent;
use Thelia\Model\Map\ProductSaleElementsTableMap; use Thelia\Model\Map\ProductSaleElementsTableMap;
@@ -49,7 +46,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
/** /**
* Create a new product sale element, with or without combination * Create a new product sale element, with or without combination
* *
* @param ProductSaleElementCreateEvent $event * @param ProductSaleElementCreateEvent $event
* @throws Exception * @throws Exception
*/ */
public function create(ProductSaleElementCreateEvent $event) public function create(ProductSaleElementCreateEvent $event)
@@ -69,8 +66,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
if ($salesElement == null) { if ($salesElement == null) {
// Create a new default product sale element // Create a new default product sale element
$salesElement = $event->getProduct()->createDefaultProductSaleElement($con, 0, 0, $event->getCurrencyId(), true); $salesElement = $event->getProduct()->createDefaultProductSaleElement($con, 0, 0, $event->getCurrencyId(), true);
} } else {
else {
// This (new) one is the default // This (new) one is the default
$salesElement->setIsDefault(true)->save($con); $salesElement->setIsDefault(true)->save($con);
} }
@@ -98,8 +94,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
// Store all the stuff ! // Store all the stuff !
$con->commit(); $con->commit();
} } catch (\Exception $ex) {
catch (\Exception $ex) {
$con->rollback(); $con->rollback();
@@ -170,8 +165,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
->setPromoPrice($event->getSalePrice()) ->setPromoPrice($event->getSalePrice())
->setPrice($event->getPrice()) ->setPrice($event->getPrice())
; ;
} } else {
else {
// Do not store the price. // Do not store the price.
$productPrice $productPrice
->setPromoPrice(0) ->setPromoPrice(0)
@@ -183,8 +177,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
// Store all the stuff ! // Store all the stuff !
$con->commit(); $con->commit();
} } catch (\Exception $ex) {
catch (\Exception $ex) {
$con->rollback(); $con->rollback();
@@ -214,8 +207,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
if ($product->countSaleElements() <= 0) { if ($product->countSaleElements() <= 0) {
// If we just deleted the last PSE, create a default one // If we just deleted the last PSE, create a default one
$product->createDefaultProductSaleElement($con, 0, 0, $event->getCurrencyId(), true); $product->createDefaultProductSaleElement($con, 0, 0, $event->getCurrencyId(), true);
} } elseif ($pse->getIsDefault()) {
else if ($pse->getIsDefault()) {
// If we deleted the default PSE, make the last created one the default // If we deleted the default PSE, make the last created one the default
$pse = ProductSaleElementsQuery::create() $pse = ProductSaleElementsQuery::create()
@@ -229,8 +221,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
// Store all the stuff ! // Store all the stuff !
$con->commit(); $con->commit();
} } catch (\Exception $ex) {
catch (\Exception $ex) {
$con->rollback(); $con->rollback();

View File

@@ -23,7 +23,6 @@
namespace Thelia\Action; namespace Thelia\Action;
use Propel\Runtime\ActiveQuery\Criteria;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\Profile\ProfileEvent; use Thelia\Core\Event\Profile\ProfileEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
@@ -90,7 +89,7 @@ class Profile extends BaseAction implements EventSubscriberInterface
{ {
if (null !== $profile = ProfileQuery::create()->findPk($event->getId())) { if (null !== $profile = ProfileQuery::create()->findPk($event->getId())) {
ProfileResourceQuery::create()->filterByProfileId($event->getId())->delete(); ProfileResourceQuery::create()->filterByProfileId($event->getId())->delete();
foreach($event->getResourceAccess() as $resourceCode => $accesses) { foreach ($event->getResourceAccess() as $resourceCode => $accesses) {
$manager = new AccessManager(0); $manager = new AccessManager(0);
$manager->build($accesses); $manager->build($accesses);
@@ -114,7 +113,7 @@ class Profile extends BaseAction implements EventSubscriberInterface
{ {
if (null !== $profile = ProfileQuery::create()->findPk($event->getId())) { if (null !== $profile = ProfileQuery::create()->findPk($event->getId())) {
ProfileModuleQuery::create()->filterByProfileId($event->getId())->delete(); ProfileModuleQuery::create()->filterByProfileId($event->getId())->delete();
foreach($event->getModuleAccess() as $moduleCode => $accesses) { foreach ($event->getModuleAccess() as $moduleCode => $accesses) {
$manager = new AccessManager(0); $manager = new AccessManager(0);
$manager->build($accesses); $manager->build($accesses);

View File

@@ -23,7 +23,6 @@
namespace Thelia\Action; namespace Thelia\Action;
use Propel\Runtime\ActiveQuery\Criteria;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\Tax\TaxEvent; use Thelia\Core\Event\Tax\TaxEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;

View File

@@ -27,7 +27,6 @@ use Propel\Runtime\ActiveQuery\Criteria;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\Tax\TaxRuleEvent; use Thelia\Core\Event\Tax\TaxRuleEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\Map\TaxRuleTableMap;
use Thelia\Model\TaxRuleCountry; use Thelia\Model\TaxRuleCountry;
use Thelia\Model\TaxRuleCountryQuery; use Thelia\Model\TaxRuleCountryQuery;
use Thelia\Model\TaxRule as TaxRuleModel; use Thelia\Model\TaxRule as TaxRuleModel;

View File

@@ -61,19 +61,19 @@ class GenerateResources extends ContainerAwareCommand
$constants = $class->getConstants(); $constants = $class->getConstants();
if(count($constants) == 0) { if (count($constants) == 0) {
$output->writeln('No resources found'); $output->writeln('No resources found');
exit; exit;
} }
switch($input->getOption("output")) { switch ($input->getOption("output")) {
case 'sql': case 'sql':
$output->writeln( $output->writeln(
'INSERT INTO ' . ResourceTableMap::TABLE_NAME . ' (`id`, `code`, `created_at`, `updated_at`) VALUES ' 'INSERT INTO ' . ResourceTableMap::TABLE_NAME . ' (`id`, `code`, `created_at`, `updated_at`) VALUES '
); );
$compteur = 0; $compteur = 0;
foreach($constants as $constant => $value) { foreach ($constants as $constant => $value) {
if($constant == AdminResources::SUPERADMINISTRATOR) { if ($constant == AdminResources::SUPERADMINISTRATOR) {
continue; continue;
} }
$compteur++; $compteur++;
@@ -87,8 +87,8 @@ class GenerateResources extends ContainerAwareCommand
'INSERT INTO ' . ResourceI18nTableMap::TABLE_NAME . ' (`id`, `locale`, `title`) VALUES ' 'INSERT INTO ' . ResourceI18nTableMap::TABLE_NAME . ' (`id`, `locale`, `title`) VALUES '
); );
$compteur = 0; $compteur = 0;
foreach($constants as $constant => $value) { foreach ($constants as $constant => $value) {
if($constant == AdminResources::SUPERADMINISTRATOR) { if ($constant == AdminResources::SUPERADMINISTRATOR) {
continue; continue;
} }
@@ -105,8 +105,8 @@ class GenerateResources extends ContainerAwareCommand
} }
break; break;
default : default :
foreach($constants as $constant => $value) { foreach ($constants as $constant => $value) {
if($constant == AdminResources::SUPERADMINISTRATOR) { if ($constant == AdminResources::SUPERADMINISTRATOR) {
continue; continue;
} }
$output->writeln('[' . $constant . "] => " . $value); $output->writeln('[' . $constant . "] => " . $value);

View File

@@ -56,7 +56,7 @@ abstract class AbstractCrudController extends BaseAdminController
* @param string $defaultListOrder the default object list order, or null if list is not sortable. Example: manual * @param string $defaultListOrder the default object list order, or null if list is not sortable. Example: manual
* @param string $orderRequestParameterName Name of the request parameter that set the list order (null if list is not sortable) * @param string $orderRequestParameterName Name of the request parameter that set the list order (null if list is not sortable)
* *
* @param string $resourceCode the 'resource' code. Example: "admin.configuration.message" * @param string $resourceCode the 'resource' code. Example: "admin.configuration.message"
* *
* @param string $createEventIdentifier the dispatched create TheliaEvent identifier. Example: TheliaEvents::MESSAGE_CREATE * @param string $createEventIdentifier the dispatched create TheliaEvent identifier. Example: TheliaEvents::MESSAGE_CREATE
* @param string $updateEventIdentifier the dispatched update TheliaEvent identifier. Example: TheliaEvents::MESSAGE_UPDATE * @param string $updateEventIdentifier the dispatched update TheliaEvent identifier. Example: TheliaEvents::MESSAGE_UPDATE

View File

@@ -23,7 +23,6 @@
namespace Thelia\Controller\Admin; namespace Thelia\Controller\Admin;
use Thelia\Core\Security\AccessManager;
use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Event\Administrator\AdministratorEvent; use Thelia\Core\Event\Administrator\AdministratorEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
@@ -31,7 +30,6 @@ use Thelia\Form\AdministratorCreationForm;
use Thelia\Form\AdministratorModificationForm; use Thelia\Form\AdministratorModificationForm;
use Thelia\Model\AdminQuery; use Thelia\Model\AdminQuery;
class AdministratorController extends AbstractCrudController class AdministratorController extends AbstractCrudController
{ {
public function __construct() public function __construct()
@@ -158,7 +156,6 @@ class AdministratorController extends AbstractCrudController
return $object->getId(); return $object->getId();
} }
protected function renderListTemplate($currentOrder) protected function renderListTemplate($currentOrder)
{ {
// We always return to the feature edition form // We always return to the feature edition form

View File

@@ -115,7 +115,7 @@ class BaseAdminController extends BaseController
* Check current admin user authorisations. An ADMIN role is assumed. * Check current admin user authorisations. An ADMIN role is assumed.
* *
* @param mixed $resources a single resource or an array of resources. * @param mixed $resources a single resource or an array of resources.
* @param mixed $accesses a single access or an array of accesses. * @param mixed $accesses a single access or an array of accesses.
* *
* @return mixed null if authorization is granted, or a Response object which contains the error page otherwise * @return mixed null if authorization is granted, or a Response object which contains the error page otherwise
* *
@@ -369,8 +369,8 @@ class BaseAdminController extends BaseController
* Render the given template, and returns the result as an Http Response. * Render the given template, and returns the result as an Http Response.
* *
* @param $templateName the complete template name, with extension * @param $templateName the complete template name, with extension
* @param array $args the template arguments * @param array $args the template arguments
* @param int $status http code status * @param int $status http code status
* @return \Symfony\Component\HttpFoundation\Response * @return \Symfony\Component\HttpFoundation\Response
*/ */
protected function render($templateName, $args = array(), $status = 200) protected function render($templateName, $args = array(), $status = 200)

View File

@@ -25,7 +25,6 @@ namespace Thelia\Controller\Admin;
use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Exception\PropelException;
use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Event\Customer\CustomerAddressEvent;
use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent; use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
use Thelia\Core\Event\Customer\CustomerEvent; use Thelia\Core\Event\Customer\CustomerEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;

View File

@@ -41,7 +41,6 @@ use Thelia\Form\Lang\LangUrlForm;
use Thelia\Model\ConfigQuery; use Thelia\Model\ConfigQuery;
use Thelia\Model\LangQuery; use Thelia\Model\LangQuery;
/** /**
* Class LangController * Class LangController
* @package Thelia\Controller\Admin * @package Thelia\Controller\Admin
@@ -53,7 +52,6 @@ class LangController extends BaseAdminController
public function defaultAction() public function defaultAction()
{ {
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::VIEW)) return $response; if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::VIEW)) return $response;
return $this->renderDefault(); return $this->renderDefault();
} }
@@ -120,7 +118,7 @@ class LangController extends BaseAdminController
$changedObject = $event->getLang(); $changedObject = $event->getLang();
$this->adminLogAppend(sprintf("%s %s (ID %s) modified", 'Lang', $changedObject->getTitle(), $changedObject->getId())); $this->adminLogAppend(sprintf("%s %s (ID %s) modified", 'Lang', $changedObject->getTitle(), $changedObject->getId()));
$this->redirectToRoute('/admin/configuration/languages'); $this->redirectToRoute('/admin/configuration/languages');
} catch(\Exception $e) { } catch (\Exception $e) {
$error_msg = $e->getMessage(); $error_msg = $e->getMessage();
} }
@@ -162,7 +160,7 @@ class LangController extends BaseAdminController
$error = $e->getMessage(); $error = $e->getMessage();
} }
if($error) { if ($error) {
return $this->nullResponse(500); return $this->nullResponse(500);
} else { } else {
return $this->nullResponse(); return $this->nullResponse();
@@ -281,7 +279,7 @@ class LangController extends BaseAdminController
$event = new LangUrlEvent(); $event = new LangUrlEvent();
foreach ($data as $key => $value) { foreach ($data as $key => $value) {
$pos= strpos($key, LangUrlForm::LANG_PREFIX); $pos= strpos($key, LangUrlForm::LANG_PREFIX);
if(false !== strpos($key, LangUrlForm::LANG_PREFIX)) { if (false !== strpos($key, LangUrlForm::LANG_PREFIX)) {
$event->addUrl(substr($key,strlen(LangUrlForm::LANG_PREFIX)), $value); $event->addUrl(substr($key,strlen(LangUrlForm::LANG_PREFIX)), $value);
} }
} }

View File

@@ -47,7 +47,6 @@ class MessageController extends AbstractCrudController
AdminResources::MESSAGE, AdminResources::MESSAGE,
TheliaEvents::MESSAGE_CREATE, TheliaEvents::MESSAGE_CREATE,
TheliaEvents::MESSAGE_UPDATE, TheliaEvents::MESSAGE_UPDATE,
TheliaEvents::MESSAGE_DELETE, TheliaEvents::MESSAGE_DELETE,

View File

@@ -100,7 +100,7 @@ class ModuleController extends BaseAdminController
$this->dispatch(TheliaEvents::MODULE_DELETE, $deleteEvent); $this->dispatch(TheliaEvents::MODULE_DELETE, $deleteEvent);
if($deleteEvent->hasModule() === false) { if ($deleteEvent->hasModule() === false) {
throw new \LogicException( throw new \LogicException(
$this->getTranslator()->trans("No %obj was updated.", array('%obj' => 'Module'))); $this->getTranslator()->trans("No %obj was updated.", array('%obj' => 'Module')));
} }
@@ -110,7 +110,7 @@ class ModuleController extends BaseAdminController
$message = $e->getMessage(); $message = $e->getMessage();
} }
if($message) { if ($message) {
return $this->render("modules", array( return $this->render("modules", array(
"error_message" => $message "error_message" => $message
)); ));

View File

@@ -54,7 +54,6 @@ use Thelia\Core\Event\ProductSaleElement\ProductSaleElementCreateEvent;
use Thelia\Model\AttributeQuery; use Thelia\Model\AttributeQuery;
use Thelia\Model\AttributeAvQuery; use Thelia\Model\AttributeAvQuery;
use Thelia\Form\ProductSaleElementUpdateForm; use Thelia\Form\ProductSaleElementUpdateForm;
use Thelia\Model\ProductSaleElements;
use Thelia\Model\ProductPriceQuery; use Thelia\Model\ProductPriceQuery;
use Thelia\Form\ProductDefaultSaleElementUpdateForm; use Thelia\Form\ProductDefaultSaleElementUpdateForm;
use Thelia\Model\ProductPrice; use Thelia\Model\ProductPrice;
@@ -62,8 +61,6 @@ use Thelia\Model\Currency;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Thelia\TaxEngine\Calculator; use Thelia\TaxEngine\Calculator;
use Thelia\Model\Country; use Thelia\Model\Country;
use Thelia\Model\CountryQuery;
use Thelia\Model\TaxRuleQuery;
use Thelia\Tools\NumberFormat; use Thelia\Tools\NumberFormat;
use Thelia\Model\Product; use Thelia\Model\Product;
use Thelia\Model\CurrencyQuery; use Thelia\Model\CurrencyQuery;
@@ -189,8 +186,8 @@ class ProductController extends AbstractCrudController
return $event->hasProduct(); return $event->hasProduct();
} }
protected function updatePriceFromDefaultCurrency($productPrice, $saleElement, $defaultCurrency, $currentCurrency) { protected function updatePriceFromDefaultCurrency($productPrice, $saleElement, $defaultCurrency, $currentCurrency)
{
// Get price for default currency // Get price for default currency
$priceForDefaultCurrency = ProductPriceQuery::create() $priceForDefaultCurrency = ProductPriceQuery::create()
->filterByCurrency($defaultCurrency) ->filterByCurrency($defaultCurrency)
@@ -206,7 +203,8 @@ class ProductController extends AbstractCrudController
} }
} }
protected function appendValue(&$array, $key, $value) { protected function appendValue(&$array, $key, $value)
{
if (! isset($array[$key])) $array[$key] = array(); if (! isset($array[$key])) $array[$key] = array();
$array[$key][] = $value; $array[$key][] = $value;
@@ -228,7 +226,7 @@ class ProductController extends AbstractCrudController
"tax_rule" => $object->getTaxRuleId() "tax_rule" => $object->getTaxRuleId()
); );
foreach($saleElements as $saleElement) { foreach ($saleElements as $saleElement) {
// Get the product price for the current currency // Get the product price for the current currency
$productPrice = ProductPriceQuery::create() $productPrice = ProductPriceQuery::create()
@@ -277,8 +275,7 @@ class ProductController extends AbstractCrudController
"isdefault" => $saleElement->getIsDefault() > 0 ? 1 : 0, "isdefault" => $saleElement->getIsDefault() > 0 ? 1 : 0,
"ean_code" => $saleElement->getEanCode() "ean_code" => $saleElement->getEanCode()
); );
} } else {
else {
if ($saleElement->getIsDefault()) { if ($saleElement->getIsDefault()) {
$combinationPseData['default_pse'] = $saleElement->getId(); $combinationPseData['default_pse'] = $saleElement->getId();
@@ -871,8 +868,7 @@ class ProductController extends AbstractCrudController
try { try {
$this->dispatch(TheliaEvents::PRODUCT_ADD_PRODUCT_SALE_ELEMENT, $event); $this->dispatch(TheliaEvents::PRODUCT_ADD_PRODUCT_SALE_ELEMENT, $event);
} } catch (\Exception $ex) {
catch (\Exception $ex) {
// Any error // Any error
return $this->errorPage($ex); return $this->errorPage($ex);
} }
@@ -895,8 +891,7 @@ class ProductController extends AbstractCrudController
try { try {
$this->dispatch(TheliaEvents::PRODUCT_DELETE_PRODUCT_SALE_ELEMENT, $event); $this->dispatch(TheliaEvents::PRODUCT_DELETE_PRODUCT_SALE_ELEMENT, $event);
} } catch (\Exception $ex) {
catch (\Exception $ex) {
// Any error // Any error
return $this->errorPage($ex); return $this->errorPage($ex);
} }
@@ -907,7 +902,7 @@ class ProductController extends AbstractCrudController
/** /**
* Process a single PSE update, using form data array. * Process a single PSE update, using form data array.
* *
* @param array $data the form data * @param array $data the form data
* @throws Exception is someting goes wrong. * @throws Exception is someting goes wrong.
*/ */
protected function processSingleProductSaleElementUpdate($data) protected function processSingleProductSaleElementUpdate($data)
@@ -969,7 +964,7 @@ class ProductController extends AbstractCrudController
$count = count($data['product_sale_element_id']); $count = count($data['product_sale_element_id']);
for($idx = 0; $idx < $count; $idx++) { for ($idx = 0; $idx < $count; $idx++) {
$tmp_data['product_sale_element_id'] = $pse_id = $data['product_sale_element_id'][$idx]; $tmp_data['product_sale_element_id'] = $pse_id = $data['product_sale_element_id'][$idx];
$tmp_data['reference'] = $data['reference'][$idx]; $tmp_data['reference'] = $data['reference'][$idx];
$tmp_data['price'] = $data['price'][$idx]; $tmp_data['price'] = $data['price'][$idx];
@@ -983,8 +978,7 @@ class ProductController extends AbstractCrudController
$this->processSingleProductSaleElementUpdate($tmp_data); $this->processSingleProductSaleElementUpdate($tmp_data);
} }
} } else {
else {
// No need to preprocess data // No need to preprocess data
$this->processSingleProductSaleElementUpdate($data); $this->processSingleProductSaleElementUpdate($data);
} }
@@ -996,12 +990,10 @@ class ProductController extends AbstractCrudController
// Redirect to the success URL // Redirect to the success URL
$this->redirect($changeForm->getSuccessUrl()); $this->redirect($changeForm->getSuccessUrl());
} } catch (FormValidationException $ex) {
catch (FormValidationException $ex) {
// Form cannot be validated // Form cannot be validated
$error_msg = $this->createStandardFormValidationErrorMessage($ex); $error_msg = $this->createStandardFormValidationErrorMessage($ex);
} } catch (\Exception $ex) {
catch (\Exception $ex) {
// Any other error // Any other error
$error_msg = $ex->getMessage(); $error_msg = $ex->getMessage();
} }
@@ -1016,7 +1008,8 @@ class ProductController extends AbstractCrudController
/** /**
* Process the change of product's PSE list. * Process the change of product's PSE list.
*/ */
public function updateProductSaleElementsAction() { public function updateProductSaleElementsAction()
{
return $this->processProductSaleElementUpdate( return $this->processProductSaleElementUpdate(
new ProductSaleElementUpdateForm($this->getRequest()) new ProductSaleElementUpdateForm($this->getRequest())
); );
@@ -1025,7 +1018,8 @@ class ProductController extends AbstractCrudController
/** /**
* Update default product sale element (not attached to any combination) * Update default product sale element (not attached to any combination)
*/ */
public function updateProductDefaultSaleElementAction() { public function updateProductDefaultSaleElementAction()
{
return $this->processProductSaleElementUpdate( return $this->processProductSaleElementUpdate(
new ProductDefaultSaleElementUpdateForm($this->getRequest()) new ProductDefaultSaleElementUpdateForm($this->getRequest())
); );
@@ -1035,8 +1029,8 @@ class ProductController extends AbstractCrudController
* Invoked through Ajax; this method calculates the taxed price from the unaxed price, and * Invoked through Ajax; this method calculates the taxed price from the unaxed price, and
* vice versa. * vice versa.
*/ */
public function priceCaclulator() { public function priceCaclulator()
{
$return_price = 0; $return_price = 0;
$price = floatval($this->getRequest()->get('price', 0)); $price = floatval($this->getRequest()->get('price', 0));
@@ -1048,11 +1042,9 @@ class ProductController extends AbstractCrudController
if ($action == 'to_tax') { if ($action == 'to_tax') {
$return_price = $this->computePrice($price, 'without_tax', $product); $return_price = $this->computePrice($price, 'without_tax', $product);
} } elseif ($action == 'from_tax') {
else if ($action == 'from_tax') {
$return_price = $this->computePrice($price, 'with_tax', $product); $return_price = $this->computePrice($price, 'with_tax', $product);
} } else {
else {
$return_price = $price; $return_price = $price;
} }
@@ -1069,8 +1061,8 @@ class ProductController extends AbstractCrudController
* *
* @return \Symfony\Component\HttpFoundation\JsonResponse * @return \Symfony\Component\HttpFoundation\JsonResponse
*/ */
public function loadConvertedPrices() { public function loadConvertedPrices()
{
$product_sale_element_id = intval($this->getRequest()->get('product_sale_element_id', 0)); $product_sale_element_id = intval($this->getRequest()->get('product_sale_element_id', 0));
$currency_id = intval($this->getRequest()->get('currency_id', 0)); $currency_id = intval($this->getRequest()->get('currency_id', 0));
@@ -1114,13 +1106,13 @@ class ProductController extends AbstractCrudController
/** /**
* Calculate taxed/untexted price for a product * Calculate taxed/untexted price for a product
* *
* @param unknown $price * @param unknown $price
* @param unknown $price_type * @param unknown $price_type
* @param Product $product * @param Product $product
* @return Ambigous <unknown, number> * @return Ambigous <unknown, number>
*/ */
protected function computePrice($price, $price_type, Product $product, $convert = false) { protected function computePrice($price, $price_type, Product $product, $convert = false)
{
$calc = new Calculator(); $calc = new Calculator();
$calc->load( $calc->load(
@@ -1130,11 +1122,9 @@ class ProductController extends AbstractCrudController
if ($price_type == 'without_tax') { if ($price_type == 'without_tax') {
$return_price = $calc->getTaxedPrice($price); $return_price = $calc->getTaxedPrice($price);
} } elseif ($price_type == 'with_tax') {
else if ($price_type == 'with_tax') {
$return_price = $calc->getUntaxedPrice($price); $return_price = $calc->getUntaxedPrice($price);
} } else {
else {
$return_price = $price; $return_price = $price;
} }

View File

@@ -29,7 +29,6 @@ use Thelia\Core\Event\Profile\ProfileEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
use Thelia\Form\ProfileCreationForm; use Thelia\Form\ProfileCreationForm;
use Thelia\Form\ProfileModificationForm; use Thelia\Form\ProfileModificationForm;
use Thelia\Form\ProfileProfileListUpdateForm;
use Thelia\Form\ProfileUpdateModuleAccessForm; use Thelia\Form\ProfileUpdateModuleAccessForm;
use Thelia\Form\ProfileUpdateResourceAccessForm; use Thelia\Form\ProfileUpdateResourceAccessForm;
use Thelia\Model\ProfileQuery; use Thelia\Model\ProfileQuery;
@@ -201,8 +200,8 @@ class ProfileController extends AbstractCrudController
/** /**
* Put in this method post object creation processing if required. * Put in this method post object creation processing if required.
* *
* @param ProfileEvent $createEvent the create event * @param ProfileEvent $createEvent the create event
* @return Response a response, or null to continue normal processing * @return Response a response, or null to continue normal processing
*/ */
protected function performAdditionalCreateAction($createEvent) protected function performAdditionalCreateAction($createEvent)
{ {
@@ -263,8 +262,8 @@ class ProfileController extends AbstractCrudController
protected function getResourceAccess($formData) protected function getResourceAccess($formData)
{ {
$requirements = array(); $requirements = array();
foreach($formData as $data => $value) { foreach ($formData as $data => $value) {
if(!strstr($data, ':')) { if (!strstr($data, ':')) {
continue; continue;
} }
@@ -272,7 +271,7 @@ class ProfileController extends AbstractCrudController
$prefix = array_shift ( $explosion ); $prefix = array_shift ( $explosion );
if($prefix != ProfileUpdateResourceAccessForm::RESOURCE_ACCESS_FIELD_PREFIX) { if ($prefix != ProfileUpdateResourceAccessForm::RESOURCE_ACCESS_FIELD_PREFIX) {
continue; continue;
} }
@@ -285,8 +284,8 @@ class ProfileController extends AbstractCrudController
protected function getModuleAccess($formData) protected function getModuleAccess($formData)
{ {
$requirements = array(); $requirements = array();
foreach($formData as $data => $value) { foreach ($formData as $data => $value) {
if(!strstr($data, ':')) { if (!strstr($data, ':')) {
continue; continue;
} }
@@ -294,7 +293,7 @@ class ProfileController extends AbstractCrudController
$prefix = array_shift ( $explosion ); $prefix = array_shift ( $explosion );
if($prefix != ProfileUpdateModuleAccessForm::MODULE_ACCESS_FIELD_PREFIX) { if ($prefix != ProfileUpdateModuleAccessForm::MODULE_ACCESS_FIELD_PREFIX) {
continue; continue;
} }

View File

@@ -28,7 +28,6 @@ use Thelia\Core\Event\Tax\TaxEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
use Thelia\Form\TaxCreationForm; use Thelia\Form\TaxCreationForm;
use Thelia\Form\TaxModificationForm; use Thelia\Form\TaxModificationForm;
use Thelia\Form\TaxTaxListUpdateForm;
use Thelia\Model\TaxQuery; use Thelia\Model\TaxQuery;
class TaxController extends AbstractCrudController class TaxController extends AbstractCrudController
@@ -177,7 +176,7 @@ class TaxController extends AbstractCrudController
/** /**
* Put in this method post object creation processing if required. * Put in this method post object creation processing if required.
* *
* @param TaxEvent $createEvent the create event * @param TaxEvent $createEvent the create event
* @return Response a response, or null to continue normal processing * @return Response a response, or null to continue normal processing
*/ */
protected function performAdditionalCreateAction($createEvent) protected function performAdditionalCreateAction($createEvent)
@@ -200,20 +199,19 @@ class TaxController extends AbstractCrudController
{ {
$type = $formData['type']; $type = $formData['type'];
} }
protected function getRequirements($type, $formData) protected function getRequirements($type, $formData)
{ {
$requirements = array(); $requirements = array();
foreach($formData as $data => $value) { foreach ($formData as $data => $value) {
if(!strstr($data, ':')) { if (!strstr($data, ':')) {
continue; continue;
} }
$couple = explode(':', $data); $couple = explode(':', $data);
if(count($couple) != 2 || $couple[0] != $type) { if (count($couple) != 2 || $couple[0] != $type) {
continue; continue;
} }

View File

@@ -57,7 +57,7 @@ class BaseController extends ContainerAware
/** /**
* Return an empty response (after an ajax request, for example) * Return an empty response (after an ajax request, for example)
* @param int $status * @param int $status
* @return \Symfony\Component\HttpFoundation\Response * @return \Symfony\Component\HttpFoundation\Response
*/ */
protected function nullResponse($status = 200) protected function nullResponse($status = 200)
@@ -196,15 +196,13 @@ class BaseController extends ContainerAware
$errorMessage = null; $errorMessage = null;
if ($form->get("error_message")->getData() != null) { if ($form->get("error_message")->getData() != null) {
$errorMessage = $form->get("error_message")->getData(); $errorMessage = $form->get("error_message")->getData();
} } else {
else {
$errorMessage = sprintf("Missing or invalid data: %s", $this->getErrorMessages($form)); $errorMessage = sprintf("Missing or invalid data: %s", $this->getErrorMessages($form));
} }
throw new FormValidationException($errorMessage); throw new FormValidationException($errorMessage);
} }
} } else {
else {
throw new FormValidationException(sprintf("Wrong form method, %s expected.", $expectedMethod)); throw new FormValidationException(sprintf("Wrong form method, %s expected.", $expectedMethod));
} }
} }
@@ -229,8 +227,7 @@ class BaseController extends ContainerAware
{ {
if ($form != null) { if ($form != null) {
$url = $form->getSuccessUrl(); $url = $form->getSuccessUrl();
} } else {
else {
$url = $this->getRequest()->get("success_url"); $url = $this->getRequest()->get("success_url");
} }

View File

@@ -67,7 +67,6 @@ class CartController extends BaseFrontController
$request->attributes->set('_view', "includes/mini-cart"); $request->attributes->set('_view', "includes/mini-cart");
} }
if ($message) { if ($message) {
$cartAdd->setErrorMessage($message); $cartAdd->setErrorMessage($message);
$this->getParserContext()->addForm($cartAdd); $this->getParserContext()->addForm($cartAdd);

View File

@@ -26,7 +26,6 @@ use Thelia\Form\ContactForm;
use Thelia\Form\Exception\FormValidationException; use Thelia\Form\Exception\FormValidationException;
use Thelia\Model\ConfigQuery; use Thelia\Model\ConfigQuery;
/** /**
* Class ContactController * Class ContactController
* @package Thelia\Controller\Front * @package Thelia\Controller\Front
@@ -53,7 +52,7 @@ class ContactController extends BaseFrontController
$this->getMailer()->send($message); $this->getMailer()->send($message);
} catch(FormValidationException $e) { } catch (FormValidationException $e) {
$error_message = $e->getMessage(); $error_message = $e->getMessage();
} }

View File

@@ -24,21 +24,11 @@ namespace Thelia\Controller\Front;
use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Exception\PropelException;
use Thelia\Core\Event\Coupon\CouponConsumeEvent; use Thelia\Core\Event\Coupon\CouponConsumeEvent;
use Thelia\Exception\TheliaProcessException;
use Thelia\Form\CouponCode; use Thelia\Form\CouponCode;
use Thelia\Form\Exception\FormValidationException; use Thelia\Form\Exception\FormValidationException;
use Thelia\Core\Event\Order\OrderEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
use Symfony\Component\HttpFoundation\Request;
use Thelia\Form\OrderDelivery;
use Thelia\Form\OrderPayment;
use Thelia\Log\Tlog; use Thelia\Log\Tlog;
use Thelia\Model\AddressQuery;
use Thelia\Model\AreaDeliveryModuleQuery;
use Thelia\Model\Base\OrderQuery;
use Thelia\Model\ModuleQuery;
use Thelia\Model\Order; use Thelia\Model\Order;
use Thelia\Tools\URL;
/** /**
* Class CouponController * Class CouponController

View File

@@ -51,7 +51,6 @@ class CustomerController extends BaseFrontController
{ {
use \Thelia\Cart\CartTrait; use \Thelia\Cart\CartTrait;
public function newPasswordAction() public function newPasswordAction()
{ {
if (! $this->getSecurityContext()->hasCustomerUser()) { if (! $this->getSecurityContext()->hasCustomerUser()) {
@@ -156,7 +155,6 @@ class CustomerController extends BaseFrontController
$this->getParserContext()->addForm($customerProfilUpdateForm); $this->getParserContext()->addForm($customerProfilUpdateForm);
} }
public function updatePasswordAction() public function updatePasswordAction()
{ {
if ($this->getSecurityContext()->hasCustomerUser()) { if ($this->getSecurityContext()->hasCustomerUser()) {
@@ -220,14 +218,14 @@ class CustomerController extends BaseFrontController
$nlEvent->setFirstname($updatedCustomer->getFirstname()); $nlEvent->setFirstname($updatedCustomer->getFirstname());
$nlEvent->setLastname($updatedCustomer->getLastname()); $nlEvent->setLastname($updatedCustomer->getLastname());
if(null !== $newsletter = NewsletterQuery::create()->findOneByEmail($newsletterOldEmail)) { if (null !== $newsletter = NewsletterQuery::create()->findOneByEmail($newsletterOldEmail)) {
$nlEvent->setId($newsletter->getId()); $nlEvent->setId($newsletter->getId());
$this->dispatch(TheliaEvents::NEWSLETTER_UPDATE, $nlEvent); $this->dispatch(TheliaEvents::NEWSLETTER_UPDATE, $nlEvent);
} else { } else {
$this->dispatch(TheliaEvents::NEWSLETTER_SUBSCRIBE, $nlEvent); $this->dispatch(TheliaEvents::NEWSLETTER_SUBSCRIBE, $nlEvent);
} }
} else { } else {
if(null !== $newsletter = NewsletterQuery::create()->findOneByEmail($newsletterOldEmail)) { if (null !== $newsletter = NewsletterQuery::create()->findOneByEmail($newsletterOldEmail)) {
$nlEvent = new NewsletterEvent($updatedCustomer->getEmail(), $this->getRequest()->getSession()->getLang()->getLocale()); $nlEvent = new NewsletterEvent($updatedCustomer->getEmail(), $this->getRequest()->getSession()->getLang()->getLocale());
$nlEvent->setId($newsletter->getId()); $nlEvent->setId($newsletter->getId());
$this->dispatch(TheliaEvents::NEWSLETTER_UNSUBSCRIBE, $nlEvent); $this->dispatch(TheliaEvents::NEWSLETTER_UNSUBSCRIBE, $nlEvent);

View File

@@ -23,7 +23,6 @@
namespace Thelia\Controller\Front; namespace Thelia\Controller\Front;
/** /**
* Class Mail * Class Mail
* @package Thelia\Controller\Front * @package Thelia\Controller\Front

View File

@@ -27,7 +27,6 @@ use Thelia\Core\Event\Newsletter\NewsletterEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
use Thelia\Form\NewsletterForm; use Thelia\Form\NewsletterForm;
/** /**
* Class NewsletterController * Class NewsletterController
* @package Thelia\Controller\Front * @package Thelia\Controller\Front
@@ -50,15 +49,14 @@ class NewsletterController extends BaseFrontController
$this->getRequest()->getSession()->getLang()->getLocale() $this->getRequest()->getSession()->getLang()->getLocale()
); );
if (null !== $customer = $this->getSecurityContext()->getCustomerUser()) if (null !== $customer = $this->getSecurityContext()->getCustomerUser()) {
{
$event->setFirstname($customer->getFirstname()); $event->setFirstname($customer->getFirstname());
$event->setLastname($customer->getLastname()); $event->setLastname($customer->getLastname());
} }
$this->dispatch(TheliaEvents::NEWSLETTER_SUBSCRIBE, $event); $this->dispatch(TheliaEvents::NEWSLETTER_SUBSCRIBE, $event);
} catch(\Exception $e) { } catch (\Exception $e) {
$error_message = $e->getMessage(); $error_message = $e->getMessage();
} }

View File

@@ -23,7 +23,6 @@
namespace Thelia\Core\Event\Lang; namespace Thelia\Core\Event\Lang;
/** /**
* Class LangCreateEvent * Class LangCreateEvent
* @package Thelia\Core\Event\Lang * @package Thelia\Core\Event\Lang
@@ -137,5 +136,4 @@ class LangCreateEvent extends LangEvent
return $this->title; return $this->title;
} }
} }

View File

@@ -24,7 +24,6 @@
namespace Thelia\Core\Event\Lang; namespace Thelia\Core\Event\Lang;
use Thelia\Core\Event\ActionEvent; use Thelia\Core\Event\ActionEvent;
/** /**
* Class LangDefaultBehaviorEvent * Class LangDefaultBehaviorEvent
* @package Thelia\Core\Event\Lang * @package Thelia\Core\Event\Lang
@@ -37,7 +36,7 @@ class LangDefaultBehaviorEvent extends ActionEvent
*/ */
protected $defaultBehavior; protected $defaultBehavior;
function __construct($defaultBehavior) public function __construct($defaultBehavior)
{ {
$this->defaultBehavior = $defaultBehavior; $this->defaultBehavior = $defaultBehavior;
} }
@@ -58,7 +57,4 @@ class LangDefaultBehaviorEvent extends ActionEvent
return $this->defaultBehavior; return $this->defaultBehavior;
} }
} }

View File

@@ -23,7 +23,6 @@
namespace Thelia\Core\Event\Lang; namespace Thelia\Core\Event\Lang;
/** /**
* Class LangDeleteEvent * Class LangDeleteEvent
* @package Thelia\Core\Event\Lang * @package Thelia\Core\Event\Lang
@@ -39,7 +38,7 @@ class LangDeleteEvent extends LangEvent
/** /**
* @param int $lang_id * @param int $lang_id
*/ */
function __construct($lang_id) public function __construct($lang_id)
{ {
$this->lang_id = $lang_id; $this->lang_id = $lang_id;
} }

View File

@@ -25,7 +25,6 @@ namespace Thelia\Core\Event\Lang;
use Thelia\Core\Event\ActionEvent; use Thelia\Core\Event\ActionEvent;
use Thelia\Model\Lang; use Thelia\Model\Lang;
/** /**
* Class LangEvent * Class LangEvent
* @package Thelia\Core\Event\Lang * @package Thelia\Core\Event\Lang
@@ -38,7 +37,7 @@ class LangEvent extends ActionEvent
*/ */
protected $lang; protected $lang;
function __construct(Lang $lang = null) public function __construct(Lang $lang = null)
{ {
$this->lang = $lang; $this->lang = $lang;
} }
@@ -70,7 +69,4 @@ class LangEvent extends ActionEvent
return null !== $this->lang; return null !== $this->lang;
} }
} }

View File

@@ -23,7 +23,6 @@
namespace Thelia\Core\Event\Lang; namespace Thelia\Core\Event\Lang;
/** /**
* Class LangToggleDefaultEvent * Class LangToggleDefaultEvent
* @package Thelia\Core\Event\Lang * @package Thelia\Core\Event\Lang
@@ -39,7 +38,7 @@ class LangToggleDefaultEvent extends LangEvent
/** /**
* @param int $lang_id * @param int $lang_id
*/ */
function __construct($lang_id) public function __construct($lang_id)
{ {
$this->lang_id = $lang_id; $this->lang_id = $lang_id;
} }
@@ -64,6 +63,4 @@ class LangToggleDefaultEvent extends LangEvent
return $this->lang_id; return $this->lang_id;
} }
} }

View File

@@ -23,7 +23,6 @@
namespace Thelia\Core\Event\Lang; namespace Thelia\Core\Event\Lang;
/** /**
* Class LangUpdateEvent * Class LangUpdateEvent
* @package Thelia\Core\Event\Lang * @package Thelia\Core\Event\Lang
@@ -39,12 +38,11 @@ class LangUpdateEvent extends LangCreateEvent
/** /**
* @param int $id * @param int $id
*/ */
function __construct($id) public function __construct($id)
{ {
$this->id = $id; $this->id = $id;
} }
/** /**
* @param int $id * @param int $id
* *
@@ -65,5 +63,4 @@ class LangUpdateEvent extends LangCreateEvent
return $this->id; return $this->id;
} }
} }

View File

@@ -23,7 +23,6 @@
namespace Thelia\Core\Event\Module; namespace Thelia\Core\Event\Module;
/** /**
* Class ModuleDeleteEvent * Class ModuleDeleteEvent
* @package Thelia\Core\Event\Module * @package Thelia\Core\Event\Module
@@ -36,7 +35,7 @@ class ModuleDeleteEvent extends ModuleEvent
*/ */
protected $module_id; protected $module_id;
function __construct($module_id) public function __construct($module_id)
{ {
$this->module_id = $module_id; $this->module_id = $module_id;
} }
@@ -57,5 +56,4 @@ class ModuleDeleteEvent extends ModuleEvent
return $this->module_id; return $this->module_id;
} }
} }

View File

@@ -24,7 +24,6 @@
namespace Thelia\Core\Event\Newsletter; namespace Thelia\Core\Event\Newsletter;
use Thelia\Core\Event\ActionEvent; use Thelia\Core\Event\ActionEvent;
/** /**
* Class NewsletterEvent * Class NewsletterEvent
* @package Thelia\Core\Event\Newsletter * @package Thelia\Core\Event\Newsletter
@@ -57,7 +56,7 @@ class NewsletterEvent extends ActionEvent
*/ */
protected $locale; protected $locale;
function __construct($email, $locale) public function __construct($email, $locale)
{ {
$this->email = $email; $this->email = $email;
$this->locale = $locale; $this->locale = $locale;
@@ -159,8 +158,4 @@ class NewsletterEvent extends ActionEvent
return $this->id; return $this->id;
} }
} }

View File

@@ -24,7 +24,6 @@
namespace Thelia\Core\Event\ProductSaleElement; namespace Thelia\Core\Event\ProductSaleElement;
use Thelia\Model\Product; use Thelia\Model\Product;
use Thelia\Core\Event\Product\ProductEvent;
class ProductSaleElementCreateEvent extends ProductSaleElementEvent class ProductSaleElementCreateEvent extends ProductSaleElementEvent
{ {
@@ -65,15 +64,16 @@ class ProductSaleElementCreateEvent extends ProductSaleElementEvent
return $this; return $this;
} }
public function getProduct() { public function getProduct()
{
return $this->product; return $this->product;
} }
public function setProduct($product) { public function setProduct($product)
{
$this->product = $product; $this->product = $product;
return $this; return $this;
} }
} }

View File

@@ -23,7 +23,6 @@
namespace Thelia\Core\Event\ProductSaleElement; namespace Thelia\Core\Event\ProductSaleElement;
use Thelia\Model\Product; use Thelia\Model\Product;
use Thelia\Core\Event\Product\ProductEvent;
class ProductSaleElementDeleteEvent extends ProductSaleElementEvent class ProductSaleElementDeleteEvent extends ProductSaleElementEvent
{ {
@@ -58,6 +57,7 @@ class ProductSaleElementDeleteEvent extends ProductSaleElementEvent
public function setCurrencyId($currency_id) public function setCurrencyId($currency_id)
{ {
$this->currency_id = $currency_id; $this->currency_id = $currency_id;
return $this; return $this;
} }

View File

@@ -22,9 +22,7 @@
/*************************************************************************************/ /*************************************************************************************/
namespace Thelia\Core\Event\ProductSaleElement; namespace Thelia\Core\Event\ProductSaleElement;
use Thelia\Core\Event\Product\ProductCreateEvent;
use Thelia\Model\Product; use Thelia\Model\Product;
use Thelia\Core\Event\Product\ProductEvent;
class ProductSaleElementUpdateEvent extends ProductSaleElementEvent class ProductSaleElementUpdateEvent extends ProductSaleElementEvent
{ {
@@ -217,6 +215,7 @@ class ProductSaleElementUpdateEvent extends ProductSaleElementEvent
public function setFromDefaultCurrency($from_default_currency) public function setFromDefaultCurrency($from_default_currency)
{ {
$this->from_default_currency = $from_default_currency; $this->from_default_currency = $from_default_currency;
return $this; return $this;
} }

View File

@@ -552,7 +552,6 @@ final class TheliaEvents
const TAX_UPDATE = "action.updateTax"; const TAX_UPDATE = "action.updateTax";
const TAX_DELETE = "action.deleteTax"; const TAX_DELETE = "action.deleteTax";
// -- Profile management --------------------------------------------- // -- Profile management ---------------------------------------------
const PROFILE_CREATE = "action.createProfile"; const PROFILE_CREATE = "action.createProfile";

View File

@@ -23,13 +23,6 @@
namespace Thelia\Core\Security; namespace Thelia\Core\Security;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Security\User\UserInterface;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Model\ProfileQuery;
use Thelia\Model\ProfileResourceQuery;
/** /**
* A simple security manager, in charge of checking user * A simple security manager, in charge of checking user
* *
@@ -49,7 +42,7 @@ class AccessManager
self::DELETE => false, self::DELETE => false,
); );
static protected $accessPows = array( protected static $accessPows = array(
self::VIEW => 3, self::VIEW => 3,
self::CREATE => 2, self::CREATE => 2,
self::UPDATE => 1, self::UPDATE => 1,
@@ -67,7 +60,7 @@ class AccessManager
public function can($type) public function can($type)
{ {
if(!array_key_exists($type, $this->accessGranted)) { if (!array_key_exists($type, $this->accessGranted)) {
return false; return false;
} }
@@ -75,7 +68,7 @@ class AccessManager
} }
static public function getMaxAccessValue() public static function getMaxAccessValue()
{ {
return pow(2, current(array_slice( self::$accessPows, -1, 1, true ))) - 1; return pow(2, current(array_slice( self::$accessPows, -1, 1, true ))) - 1;
} }
@@ -83,8 +76,8 @@ class AccessManager
public function build($accesses) public function build($accesses)
{ {
$this->accessValue = 0; $this->accessValue = 0;
foreach($accesses as $access) { foreach ($accesses as $access) {
if(array_key_exists($access, self::$accessPows)) { if (array_key_exists($access, self::$accessPows)) {
$this->accessValue += pow(2, self::$accessPows[$access]); $this->accessValue += pow(2, self::$accessPows[$access]);
} }
} }
@@ -95,9 +88,9 @@ class AccessManager
protected function fillGrantedAccess() protected function fillGrantedAccess()
{ {
$accessValue = $this->accessValue; $accessValue = $this->accessValue;
foreach(self::$accessPows as $type => $value) { foreach (self::$accessPows as $type => $value) {
$pow = pow(2, $value); $pow = pow(2, $value);
if($accessValue >= $pow) { if ($accessValue >= $pow) {
$accessValue -= $pow; $accessValue -= $pow;
$this->accessGranted[$type] = true; $this->accessGranted[$type] = true;
} else { } else {
@@ -106,7 +99,6 @@ class AccessManager
} }
} }
public function getAccessValue() public function getAccessValue()
{ {
return $this->accessValue; return $this->accessValue;

View File

@@ -23,7 +23,7 @@
namespace Thelia\Core\Security\Exception; namespace Thelia\Core\Security\Exception;
class ResourceException extends \RuntimeException class RessourceException extends \RuntimeException
{ {
const UNKNOWN_EXCEPTION = 0; const UNKNOWN_EXCEPTION = 0;

View File

@@ -33,17 +33,17 @@ use Thelia\Core\Security\Exception\ResourceException;
*/ */
final class AdminResources final class AdminResources
{ {
static private $selfReflection = null; private static $selfReflection = null;
static public function retrieve($name) public static function retrieve($name)
{ {
$constantName = strtoupper($name); $constantName = strtoupper($name);
if(null === self::$selfReflection) { if (null === self::$selfReflection) {
self::$selfReflection = new \ReflectionClass(__CLASS__); self::$selfReflection = new \ReflectionClass(__CLASS__);
} }
if(self::$selfReflection->hasConstant($constantName)) { if (self::$selfReflection->hasConstant($constantName)) {
return self::$selfReflection->getConstant($constantName); return self::$selfReflection->getConstant($constantName);
} else { } else {
throw new ResourceException(sprintf('Resource `%s` not found', $constantName), ResourceException::RESOURCE_NOT_FOUND); throw new ResourceException(sprintf('Resource `%s` not found', $constantName), ResourceException::RESOURCE_NOT_FOUND);

View File

@@ -23,12 +23,9 @@
namespace Thelia\Core\Security; namespace Thelia\Core\Security;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Security\User\UserInterface; use Thelia\Core\Security\User\UserInterface;
use Thelia\Core\HttpFoundation\Request; use Thelia\Core\HttpFoundation\Request;
use Thelia\Model\ProfileQuery;
use Thelia\Model\ProfileResourceQuery;
/** /**
* A simple security manager, in charge of checking user * A simple security manager, in charge of checking user
@@ -147,29 +144,29 @@ class SecurityContext
return true; return true;
} }
if( !method_exists($user, 'getPermissions') ) { if ( !method_exists($user, 'getPermissions') ) {
return false; return false;
} }
$userPermissions = $user->getPermissions(); $userPermissions = $user->getPermissions();
if($userPermissions === AdminResources::SUPERADMINISTRATOR) { if ($userPermissions === AdminResources::SUPERADMINISTRATOR) {
return true; return true;
} }
foreach($resources as $resource) { foreach ($resources as $resource) {
if($resource === '') { if ($resource === '') {
continue; continue;
} }
$resource = strtolower($resource); $resource = strtolower($resource);
if(!array_key_exists($resource, $userPermissions)) { if (!array_key_exists($resource, $userPermissions)) {
return false; return false;
} }
foreach($accesses as $access) { foreach ($accesses as $access) {
if(!$userPermissions[$resource]->can($access)) { if (!$userPermissions[$resource]->can($access)) {
return false; return false;
} }
} }

View File

@@ -27,7 +27,6 @@ use Propel\Runtime\ActiveQuery\Criteria;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Thelia\Core\Template\Element\Exception\SearchLoopException;
use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Core\Template\Loop\Argument\Argument;
use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelCriteria;
use Thelia\Core\Security\SecurityContext; use Thelia\Core\Security\SecurityContext;
@@ -95,7 +94,7 @@ abstract class BaseLoop
Argument::createBooleanTypeArgument('force_return', false), Argument::createBooleanTypeArgument('force_return', false),
); );
if(true === $this->countable) { if (true === $this->countable) {
$defaultArgs = array_merge($defaultArgs, array( $defaultArgs = array_merge($defaultArgs, array(
Argument::createIntTypeArgument('offset', 0), Argument::createIntTypeArgument('offset', 0),
Argument::createIntTypeArgument('page'), Argument::createIntTypeArgument('page'),
@@ -103,7 +102,7 @@ abstract class BaseLoop
)); ));
} }
if($this instanceof SearchLoopInterface) { if ($this instanceof SearchLoopInterface) {
$defaultArgs = array_merge($defaultArgs, array( $defaultArgs = array_merge($defaultArgs, array(
Argument::createAnyTypeArgument('search_term'), Argument::createAnyTypeArgument('search_term'),
new Argument( new Argument(
@@ -241,13 +240,13 @@ abstract class BaseLoop
*/ */
protected function search(ModelCriteria $search, &$pagination = null) protected function search(ModelCriteria $search, &$pagination = null)
{ {
if($this instanceof SearchLoopInterface) { if ($this instanceof SearchLoopInterface) {
$searchTerm = $this->getSearch_term(); $searchTerm = $this->getSearch_term();
$searchIn = $this->getSearch_in(); $searchIn = $this->getSearch_in();
$searchMode = $this->getSearch_mode(); $searchMode = $this->getSearch_mode();
if(null !== $searchTerm && null !== $searchIn) { if (null !== $searchTerm && null !== $searchIn) {
switch($searchMode) { switch ($searchMode) {
case SearchLoopInterface::MODE_ANY_WORD: case SearchLoopInterface::MODE_ANY_WORD:
$searchCriteria = Criteria::IN; $searchCriteria = Criteria::IN;
$searchTerm = explode(' ', $searchTerm); $searchTerm = explode(' ', $searchTerm);

View File

@@ -22,8 +22,6 @@
/*************************************************************************************/ /*************************************************************************************/
namespace Thelia\Core\Template\Element; namespace Thelia\Core\Template\Element;
use Symfony\Component\Validator\ExecutionContextInterface;
/** /**
* *
* @author Etienne Roudeix <eroudeix@openstudio.fr> * @author Etienne Roudeix <eroudeix@openstudio.fr>

View File

@@ -24,7 +24,6 @@
namespace Thelia\Core\Template\Loop; namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\BaseLoop; use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Element\LoopResultRow;
@@ -34,7 +33,6 @@ use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\AdminQuery; use Thelia\Model\AdminQuery;
use Thelia\Type; use Thelia\Type;
use Thelia\Type\BooleanOrBothType;
/** /**
* *

View File

@@ -16,7 +16,6 @@ use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\CountryQuery; use Thelia\Model\CountryQuery;
use Thelia\Type; use Thelia\Type;
use Thelia\Type\TypeCollection;
class Cart extends BaseLoop class Cart extends BaseLoop
{ {
@@ -90,17 +89,17 @@ class Cart extends BaseLoop
$countCartItems = count($cartItems); $countCartItems = count($cartItems);
if($limit <= 0 || $limit >= $countCartItems){ if ($limit <= 0 || $limit >= $countCartItems) {
$limit = $countCartItems; $limit = $countCartItems;
} }
$position = $this->getPosition(); $position = $this->getPosition();
if(isset($position)){ if (isset($position)) {
if($position == "first"){ if ($position == "first") {
$limit = 1; $limit = 1;
$cartItems = array($cartItems[0]); $cartItems = array($cartItems[0]);
}else if($position == "last"){ } elseif ($position == "last") {
$limit = 1; $limit = 1;
$cartItems = array(end($cartItems)); $cartItems = array(end($cartItems));
} }

View File

@@ -33,7 +33,6 @@ use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\FolderQuery; use Thelia\Model\FolderQuery;
use Thelia\Model\Map\ContentTableMap; use Thelia\Model\Map\ContentTableMap;
use Thelia\Model\ContentFolderQuery;
use Thelia\Model\ContentQuery; use Thelia\Model\ContentQuery;
use Thelia\Type\TypeCollection; use Thelia\Type\TypeCollection;
use Thelia\Type; use Thelia\Type;

View File

@@ -88,11 +88,11 @@ class Customer extends BaseLoop implements SearchLoopInterface
{ {
$search->_and(); $search->_and();
foreach($searchIn as $index => $searchInElement) { foreach ($searchIn as $index => $searchInElement) {
if($index > 0) { if ($index > 0) {
$search->_or(); $search->_or();
} }
switch($searchInElement) { switch ($searchInElement) {
case "ref": case "ref":
$search->filterByRef($searchTerm, $searchCriteria); $search->filterByRef($searchTerm, $searchCriteria);
break; break;

View File

@@ -107,7 +107,7 @@ class Module extends BaseI18nLoop
$code = $this->getCode(); $code = $this->getCode();
if(null !== $code) { if (null !== $code) {
$search->filterByCode($code, Criteria::IN); $search->filterByCode($code, Criteria::IN);
} }

View File

@@ -32,7 +32,6 @@ use Thelia\Core\Template\Element\SearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\CustomerQuery; use Thelia\Model\CustomerQuery;
use Thelia\Model\OrderAddress;
use Thelia\Model\OrderAddressQuery; use Thelia\Model\OrderAddressQuery;
use Thelia\Model\OrderQuery; use Thelia\Model\OrderQuery;
use Thelia\Type\TypeCollection; use Thelia\Type\TypeCollection;
@@ -100,11 +99,11 @@ class Order extends BaseLoop implements SearchLoopInterface
{ {
$search->_and(); $search->_and();
foreach($searchIn as $index => $searchInElement) { foreach ($searchIn as $index => $searchInElement) {
if($index > 0) { if ($index > 0) {
$search->_or(); $search->_or();
} }
switch($searchInElement) { switch ($searchInElement) {
case "ref": case "ref":
$search->filterByRef($searchTerm, $searchCriteria); $search->filterByRef($searchTerm, $searchCriteria);
break; break;

View File

@@ -26,7 +26,6 @@ namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\Join; use Propel\Runtime\ActiveQuery\Join;
use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Element\LoopResultRow;
@@ -35,7 +34,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Exception\TaxEngineException; use Thelia\Exception\TaxEngineException;
use Thelia\Model\Base\ProductSaleElementsQuery;
use Thelia\Model\CategoryQuery; use Thelia\Model\CategoryQuery;
use Thelia\Model\CountryQuery; use Thelia\Model\CountryQuery;
use Thelia\Model\CurrencyQuery; use Thelia\Model\CurrencyQuery;
@@ -148,11 +146,11 @@ class Product extends BaseI18nLoop implements SearchLoopInterface
{ {
$search->_and(); $search->_and();
foreach($searchIn as $index => $searchInElement) { foreach ($searchIn as $index => $searchInElement) {
if($index > 0) { if ($index > 0) {
$search->_or(); $search->_or();
} }
switch($searchInElement) { switch ($searchInElement) {
case "ref": case "ref":
$search->filterByRef($searchTerm, $searchCriteria); $search->filterByRef($searchTerm, $searchCriteria);
break; break;
@@ -172,7 +170,7 @@ class Product extends BaseI18nLoop implements SearchLoopInterface
public function exec(&$pagination) public function exec(&$pagination)
{ {
$complex = $this->getComplex(); $complex = $this->getComplex();
if(true === $complex) { if (true === $complex) {
return $this->execComplex($pagination); return $this->execComplex($pagination);
} }
@@ -237,7 +235,7 @@ class Product extends BaseI18nLoop implements SearchLoopInterface
$title = $this->getTitle(); $title = $this->getTitle();
if(!is_null($title)) { if (!is_null($title)) {
$search->where("CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".Criteria::LIKE." ?", "%".$title."%", \PDO::PARAM_STR); $search->where("CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".Criteria::LIKE." ?", "%".$title."%", \PDO::PARAM_STR);
} }
@@ -594,7 +592,7 @@ class Product extends BaseI18nLoop implements SearchLoopInterface
$title = $this->getTitle(); $title = $this->getTitle();
if(!is_null($title)){ if (!is_null($title)) {
$search->where(" CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".Criteria::LIKE." ?", "%".$title."%", \PDO::PARAM_STR); $search->where(" CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".Criteria::LIKE." ?", "%".$title."%", \PDO::PARAM_STR);
} }

View File

@@ -33,7 +33,6 @@ use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\ProfileQuery; use Thelia\Model\ProfileQuery;
use Thelia\Type; use Thelia\Type;
use Thelia\Type\BooleanOrBothType;
/** /**
* *

View File

@@ -34,7 +34,6 @@ use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\ResourceQuery; use Thelia\Model\ResourceQuery;
use Thelia\Type; use Thelia\Type;
use Thelia\Type\BooleanOrBothType;
/** /**
* *
@@ -87,7 +86,7 @@ class Resource extends BaseI18nLoop
$code = $this->getCode(); $code = $this->getCode();
if(null !== $code) { if (null !== $code) {
$search->filterByCode($code, Criteria::IN); $search->filterByCode($code, Criteria::IN);
} }

View File

@@ -85,10 +85,10 @@ class TaxRuleCountry extends BaseI18nLoop
$country = $this->getCountry(); $country = $this->getCountry();
$taxRule = $this->getTax_rule(); $taxRule = $this->getTax_rule();
if($ask === 'countries') { if ($ask === 'countries') {
$taxCountForOriginCountry = TaxRuleCountryQuery::create()->filterByCountryId($country)->count(); $taxCountForOriginCountry = TaxRuleCountryQuery::create()->filterByCountryId($country)->count();
if($taxCountForOriginCountry > 0) { if ($taxCountForOriginCountry > 0) {
$search->groupByCountryId(); $search->groupByCountryId();
$originalCountryJoin = new Join(); $originalCountryJoin = new Join();
@@ -127,7 +127,7 @@ class TaxRuleCountry extends BaseI18nLoop
$search->addAscendingOrderByColumn('i18n_TITLE'); $search->addAscendingOrderByColumn('i18n_TITLE');
} }
} elseif($ask === 'taxes') { } elseif ($ask === 'taxes') {
$search->filterByCountryId($country); $search->filterByCountryId($country);
/* manage tax translation */ /* manage tax translation */
@@ -151,8 +151,8 @@ class TaxRuleCountry extends BaseI18nLoop
$loopResultRow = new LoopResultRow($loopResult, $taxRuleCountry, $this->versionable, $this->timestampable, $this->countable); $loopResultRow = new LoopResultRow($loopResult, $taxRuleCountry, $this->versionable, $this->timestampable, $this->countable);
if($ask === 'countries') { if ($ask === 'countries') {
if($taxCountForOriginCountry > 0) { if ($taxCountForOriginCountry > 0) {
$loopResultRow $loopResultRow
->set("COUNTRY" , $taxRuleCountry->getCountryId()) ->set("COUNTRY" , $taxRuleCountry->getCountryId())
->set("COUNTRY_TITLE" , $taxRuleCountry->getVirtualColumn(CountryTableMap::TABLE_NAME . '_i18n_TITLE')) ->set("COUNTRY_TITLE" , $taxRuleCountry->getVirtualColumn(CountryTableMap::TABLE_NAME . '_i18n_TITLE'))
@@ -167,7 +167,7 @@ class TaxRuleCountry extends BaseI18nLoop
->set("COUNTRY_DESCRIPTION" , $taxRuleCountry->getVirtualColumn('i18n_DESCRIPTION')) ->set("COUNTRY_DESCRIPTION" , $taxRuleCountry->getVirtualColumn('i18n_DESCRIPTION'))
->set("COUNTRY_POSTSCRIPTUM" , $taxRuleCountry->getVirtualColumn('i18n_POSTSCRIPTUM')); ->set("COUNTRY_POSTSCRIPTUM" , $taxRuleCountry->getVirtualColumn('i18n_POSTSCRIPTUM'));
} }
} elseif($ask === 'taxes') { } elseif ($ask === 'taxes') {
$loopResultRow $loopResultRow
->set("TAX_RULE" , $taxRuleCountry->getTaxRuleId()) ->set("TAX_RULE" , $taxRuleCountry->getTaxRuleId())
->set("COUNTRY" , $taxRuleCountry->getCountryId()) ->set("COUNTRY" , $taxRuleCountry->getCountryId())
@@ -178,8 +178,6 @@ class TaxRuleCountry extends BaseI18nLoop
; ;
} }
$loopResult->addRow($loopResultRow); $loopResult->addRow($loopResultRow);
} }

View File

@@ -24,7 +24,6 @@
namespace Thelia\Core\Template; namespace Thelia\Core\Template;
use Thelia\Core\Thelia; use Thelia\Core\Thelia;
use Thelia\Model\ConfigQuery;
use Thelia\Core\HttpFoundation\Request; use Thelia\Core\HttpFoundation\Request;
use Thelia\Form\BaseForm; use Thelia\Form\BaseForm;
/** /**

View File

@@ -40,7 +40,7 @@ abstract class AbstractSmartyPlugin
*/ */
protected function _explode($commaSeparatedValues) protected function _explode($commaSeparatedValues)
{ {
if(null === $commaSeparatedValues) { if (null === $commaSeparatedValues) {
return array(); return array();
} }

View File

@@ -60,8 +60,8 @@ use Symfony\Component\Form\Extension\Core\View\ChoiceView;
*/ */
class Form extends AbstractSmartyPlugin class Form extends AbstractSmartyPlugin
{ {
static private $taggedFieldsStack = null; private static $taggedFieldsStack = null;
static private $taggedFieldsStackPosition = null; private static $taggedFieldsStackPosition = null;
protected $request; protected $request;
protected $parserContext; protected $parserContext;
@@ -113,8 +113,7 @@ class Form extends AbstractSmartyPlugin
$template->assign("form_error", $instance->hasError() ? true : false); $template->assign("form_error", $instance->hasError() ? true : false);
$template->assign("form_error_message", $instance->getErrorMessage()); $template->assign("form_error_message", $instance->getErrorMessage());
} } else {
else {
return $content; return $content;
} }
} }
@@ -127,7 +126,6 @@ class Form extends AbstractSmartyPlugin
$template->assign("checked", isset($fieldVars['checked']) ? $fieldVars['checked'] : false); $template->assign("checked", isset($fieldVars['checked']) ? $fieldVars['checked'] : false);
//data //data
$template->assign("data", $fieldVars['data']); $template->assign("data", $fieldVars['data']);
@@ -161,13 +159,13 @@ class Form extends AbstractSmartyPlugin
$formFieldType = $formFieldConfig->getType()->getInnerType(); $formFieldType = $formFieldConfig->getType()->getInnerType();
/* access to choices */ /* access to choices */
if($formFieldType instanceof ChoiceType) { if ($formFieldType instanceof ChoiceType) {
$template->assign("choices", $formFieldView->vars['choices']); $template->assign("choices", $formFieldView->vars['choices']);
} }
/* access to collections */ /* access to collections */
if($formFieldType instanceof CollectionType) { if ($formFieldType instanceof CollectionType) {
if( true === $formFieldConfig->getOption('prototype') ) { if ( true === $formFieldConfig->getOption('prototype') ) {
} else { } else {
/* access to choices */ /* access to choices */
@@ -179,17 +177,16 @@ class Form extends AbstractSmartyPlugin
} }
/* access to thelia type */ /* access to thelia type */
if($formFieldType instanceof TheliaType) { if ($formFieldType instanceof TheliaType) {
$template->assign("formType", $formFieldView->vars['type']); $template->assign("formType", $formFieldView->vars['type']);
switch ($formFieldView->vars['type']) {
switch($formFieldView->vars['type']) {
case "choice": case "choice":
if(!isset($formFieldView->vars['options']['choices']) || !is_array($formFieldView->vars['options']['choices'])) { if (!isset($formFieldView->vars['options']['choices']) || !is_array($formFieldView->vars['options']['choices'])) {
//throw new //throw new
} }
$choices = array(); $choices = array();
foreach($formFieldView->vars['options']['choices'] as $value => $choice) { foreach ($formFieldView->vars['options']['choices'] as $value => $choice) {
$choices[] = new ChoiceView($value, $value, $choice); $choices[] = new ChoiceView($value, $value, $choice);
} }
$template->assign("choices", $choices); $template->assign("choices", $choices);
@@ -223,32 +220,29 @@ class Form extends AbstractSmartyPlugin
$val = $value[$key]; $val = $value[$key];
$this->assignFieldValues($template, $name, $val, $formFieldView->vars, $value_count); $this->assignFieldValues($template, $name, $val, $formFieldView->vars, $value_count);
} } else {
else {
throw new \InvalidArgumentException(sprintf("Missing or empty parameter 'value_key' for field '%s'", $formFieldView->vars["name"])); throw new \InvalidArgumentException(sprintf("Missing or empty parameter 'value_key' for field '%s'", $formFieldView->vars["name"]));
} }
} } else {
else {
$this->assignFieldValues($template, $formFieldView->vars["full_name"], $formFieldView->vars["value"], $formFieldView->vars); $this->assignFieldValues($template, $formFieldView->vars["full_name"], $formFieldView->vars["value"], $formFieldView->vars);
} }
$formFieldView->setRendered(); $formFieldView->setRendered();
} } else {
else {
return $content; return $content;
} }
} }
public function renderTaggedFormFields($params, $content, \Smarty_Internal_Template $template, &$repeat) public function renderTaggedFormFields($params, $content, \Smarty_Internal_Template $template, &$repeat)
{ {
if(null === $content) { if (null === $content) {
self::$taggedFieldsStack = $this->getFormFieldsFromTag($params); self::$taggedFieldsStack = $this->getFormFieldsFromTag($params);
self::$taggedFieldsStackPosition = 0; self::$taggedFieldsStackPosition = 0;
} else { } else {
self::$taggedFieldsStackPosition++; self::$taggedFieldsStackPosition++;
} }
if(isset(self::$taggedFieldsStack[self::$taggedFieldsStackPosition])) { if (isset(self::$taggedFieldsStack[self::$taggedFieldsStackPosition])) {
$this->assignFieldValues( $this->assignFieldValues(
$template, $template,
self::$taggedFieldsStack[self::$taggedFieldsStackPosition]['view']->vars["full_name"], self::$taggedFieldsStack[self::$taggedFieldsStackPosition]['view']->vars["full_name"],
@@ -268,7 +262,7 @@ class Form extends AbstractSmartyPlugin
self::$taggedFieldsStackPosition = null; self::$taggedFieldsStackPosition = null;
} }
if(null !== $content) { if (null !== $content) {
return $content; return $content;
} }
} }
@@ -322,8 +316,7 @@ class Form extends AbstractSmartyPlugin
if ($repeat) { if ($repeat) {
$this->assignFieldErrorVars($template, $errors); $this->assignFieldErrorVars($template, $errors);
} } else {
else {
return $content; return $content;
} }
} }
@@ -364,8 +357,8 @@ class Form extends AbstractSmartyPlugin
throw new \InvalidArgumentException("'tag' parameter is missing"); throw new \InvalidArgumentException("'tag' parameter is missing");
$viewList = array(); $viewList = array();
foreach($instance->getView() as $view) { foreach ($instance->getView() as $view) {
if(isset($view->vars['attr']['tag']) && $tag == $view->vars['attr']['tag']) { if (isset($view->vars['attr']['tag']) && $tag == $view->vars['attr']['tag']) {
$fieldData = $instance->getForm()->all()[$view->vars['name']]; $fieldData = $instance->getForm()->all()[$view->vars['name']];
$viewList[] = array( $viewList[] = array(
'view' => $view, 'view' => $view,

View File

@@ -8,7 +8,6 @@ use \Symfony\Component\EventDispatcher\EventDispatcherInterface;
use \Smarty; use \Smarty;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Thelia\Core\Template\ParserInterface; use Thelia\Core\Template\ParserInterface;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;

View File

@@ -25,12 +25,9 @@ namespace Thelia\Form;
use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Security\AccessManager;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Translation\Translator; use Thelia\Core\Translation\Translator;
use Thelia\Model\AdminQuery; use Thelia\Model\AdminQuery;
use Thelia\Model\ProfileQuery; use Thelia\Model\ProfileQuery;
use Thelia\Model\ConfigQuery;
class AdministratorCreationForm extends BaseForm class AdministratorCreationForm extends BaseForm
{ {
@@ -110,7 +107,7 @@ class AdministratorCreationForm extends BaseForm
{ {
$data = $context->getRoot()->getData(); $data = $context->getRoot()->getData();
if($data["password"] === '' && $data["password_confirm"] === '') { if ($data["password"] === '' && $data["password_confirm"] === '') {
$context->addViolation("password can't be empty"); $context->addViolation("password can't be empty");
} }
@@ -118,7 +115,7 @@ class AdministratorCreationForm extends BaseForm
$context->addViolation("password confirmation is not the same as password field"); $context->addViolation("password confirmation is not the same as password field");
} }
if(strlen($data["password"]) < 4) { if (strlen($data["password"]) < 4) {
$context->addViolation("password must be composed of at least 4 characters"); $context->addViolation("password must be composed of at least 4 characters");
} }
} }

View File

@@ -25,7 +25,6 @@ namespace Thelia\Form;
use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Model\AdminQuery; use Thelia\Model\AdminQuery;
class AdministratorModificationForm extends AdministratorCreationForm class AdministratorModificationForm extends AdministratorCreationForm
@@ -90,7 +89,7 @@ class AdministratorModificationForm extends AdministratorCreationForm
$context->addViolation("password confirmation is not the same as password field"); $context->addViolation("password confirmation is not the same as password field");
} }
if($data["password"] !== '' && strlen($data["password"]) < 4) { if ($data["password"] !== '' && strlen($data["password"]) < 4) {
$context->addViolation("password must be composed of at least 4 characters"); $context->addViolation("password must be composed of at least 4 characters");
} }
} }

View File

@@ -27,7 +27,6 @@ use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator; use Thelia\Core\Translation\Translator;
/** /**
* Class ContactForm * Class ContactForm
* @package Thelia\Form * @package Thelia\Form

View File

@@ -23,8 +23,6 @@
namespace Thelia\Form; namespace Thelia\Form;
use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Constraints;
use Thelia\Model\ModuleQuery;
use Thelia\Module\BaseModule;
/** /**
* Class CouponCode * Class CouponCode

View File

@@ -27,7 +27,6 @@ use Symfony\Component\Validator\Constraints\Date;
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual; use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\NotEqualTo; use Symfony\Component\Validator\Constraints\NotEqualTo;
use Symfony\Component\Validator\Constraints\Range;
/** /**
* Created by JetBrains PhpStorm. * Created by JetBrains PhpStorm.

View File

@@ -26,7 +26,6 @@ use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Model\ConfigQuery; use Thelia\Model\ConfigQuery;
use Thelia\Core\Translation\Translator; use Thelia\Core\Translation\Translator;
use Thelia\Model\CustomerQuery;
/** /**
* Class CustomerPasswordUpdateForm * Class CustomerPasswordUpdateForm

View File

@@ -22,11 +22,8 @@
/*************************************************************************************/ /*************************************************************************************/
namespace Thelia\Form; namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Model\CustomerQuery; use Thelia\Model\CustomerQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Translation\Translator;
/** /**
* Class CustomerProfilUpdateForm * Class CustomerProfilUpdateForm
@@ -69,7 +66,6 @@ class CustomerProfilUpdateForm extends CustomerCreateForm
)); ));
} }
/** /**
* @param $value * @param $value
* @param ExecutionContextInterface $context * @param ExecutionContextInterface $context

View File

@@ -26,7 +26,6 @@ use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Form\BaseForm; use Thelia\Form\BaseForm;
use Thelia\Core\Translation\Translator; use Thelia\Core\Translation\Translator;
/** /**
* Class LangCreateForm * Class LangCreateForm
* @package Thelia\Form\Lang * @package Thelia\Form\Lang

View File

@@ -24,11 +24,9 @@
namespace Thelia\Form\Lang; namespace Thelia\Form\Lang;
use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Range;
use Thelia\Form\BaseForm; use Thelia\Form\BaseForm;
use Thelia\Core\Translation\Translator; use Thelia\Core\Translation\Translator;
/** /**
* Class LangDefaultBehaviorForm * Class LangDefaultBehaviorForm
* @package Thelia\Form\Lang * @package Thelia\Form\Lang

View File

@@ -25,7 +25,6 @@ namespace Thelia\Form\Lang;
use Symfony\Component\Validator\Constraints\GreaterThan; use Symfony\Component\Validator\Constraints\GreaterThan;
use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotBlank;
/** /**
* Class LangUpdateForm * Class LangUpdateForm
* @package Thelia\Form\Lang * @package Thelia\Form\Lang

View File

@@ -24,7 +24,6 @@
namespace Thelia\Form\Lang; namespace Thelia\Form\Lang;
use Thelia\Core\Event\ActionEvent; use Thelia\Core\Event\ActionEvent;
/** /**
* Class LangUrlEvent * Class LangUrlEvent
* @package Thelia\Form\Lang * @package Thelia\Form\Lang

View File

@@ -26,7 +26,6 @@ use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Form\BaseForm; use Thelia\Form\BaseForm;
use Thelia\Model\LangQuery; use Thelia\Model\LangQuery;
/** /**
* Class LangUrlForm * Class LangUrlForm
* @package Thelia\Form\Lang * @package Thelia\Form\Lang

View File

@@ -30,7 +30,6 @@ use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Translation\Translator; use Thelia\Core\Translation\Translator;
use Thelia\Model\NewsletterQuery; use Thelia\Model\NewsletterQuery;
/** /**
* Class NewsletterForm * Class NewsletterForm
* @package Thelia\Form * @package Thelia\Form

View File

@@ -26,7 +26,6 @@ use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Security\AccessManager; use Thelia\Core\Security\AccessManager;
use Thelia\Core\Translation\Translator;
use Thelia\Model\ProfileQuery; use Thelia\Model\ProfileQuery;
use Thelia\Model\ModuleQuery; use Thelia\Model\ModuleQuery;
@@ -57,7 +56,7 @@ class ProfileUpdateModuleAccessForm extends BaseForm
)) ))
; ;
foreach(ModuleQuery::create()->find() as $module) { foreach (ModuleQuery::create()->find() as $module) {
$this->formBuilder->add( $this->formBuilder->add(
self::MODULE_ACCESS_FIELD_PREFIX . ':' . str_replace(".", ":", $module->getCode()), self::MODULE_ACCESS_FIELD_PREFIX . ':' . str_replace(".", ":", $module->getCode()),
"choice", "choice",

View File

@@ -26,7 +26,6 @@ use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Security\AccessManager; use Thelia\Core\Security\AccessManager;
use Thelia\Core\Translation\Translator;
use Thelia\Model\ProfileQuery; use Thelia\Model\ProfileQuery;
use Thelia\Model\ResourceQuery; use Thelia\Model\ResourceQuery;
@@ -57,7 +56,7 @@ class ProfileUpdateResourceAccessForm extends BaseForm
)) ))
; ;
foreach(ResourceQuery::create()->find() as $resource) { foreach (ResourceQuery::create()->find() as $resource) {
$this->formBuilder->add( $this->formBuilder->add(
self::RESOURCE_ACCESS_FIELD_PREFIX . ':' . str_replace(".", ":", $resource->getCode()), self::RESOURCE_ACCESS_FIELD_PREFIX . ':' . str_replace(".", ":", $resource->getCode()),
"choice", "choice",

View File

@@ -43,7 +43,7 @@ class TaxCreationForm extends BaseForm
$types = TaxEngine::getInstance()->getTaxTypeList(); $types = TaxEngine::getInstance()->getTaxTypeList();
$typeList = array(); $typeList = array();
$requirementList = array(); $requirementList = array();
foreach($types as $type) { foreach ($types as $type) {
$classPath = "\\Thelia\\TaxEngine\\TaxType\\$type"; $classPath = "\\Thelia\\TaxEngine\\TaxType\\$type";
$instance = new $classPath(); $instance = new $classPath();
$typeList[$type] = $instance->getTitle(); $typeList[$type] = $instance->getTitle();
@@ -65,8 +65,8 @@ class TaxCreationForm extends BaseForm
)) ))
; ;
foreach($requirementList as $type => $requirements) { foreach ($requirementList as $type => $requirements) {
foreach($requirements as $name => $requirementType) { foreach ($requirements as $name => $requirementType) {
$this->formBuilder $this->formBuilder
->add($type . ':' . $name, new TheliaType(), array( ->add($type . ':' . $name, new TheliaType(), array(
//"instance" => $requirementType, //"instance" => $requirementType,

View File

@@ -142,13 +142,12 @@ abstract class BaseModule extends ContainerAware
} catch (\UnexpectedValueException $e) { } catch (\UnexpectedValueException $e) {
throw $e; throw $e;
} }
if(null === $con) { if (null === $con) {
$con = \Propel\Runtime\Propel::getConnection( $con = \Propel\Runtime\Propel::getConnection(
ModuleImageTableMap::DATABASE_NAME ModuleImageTableMap::DATABASE_NAME
); );
} }
/* browse the directory */ /* browse the directory */
$imagePosition = 1; $imagePosition = 1;
foreach ($directoryBrowser as $directoryContent) { foreach ($directoryBrowser as $directoryContent) {

View File

@@ -1,47 +0,0 @@
<?php
/**********************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/**********************************************************************************/
namespace Thelia\Coupon;
/**
* Created by JetBrains PhpStorm.
* Date: 8/19/13
* Time: 3:24 PM
*
* Unit Test BaseFacade Class
*
* @package Coupon
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class CouponBaseAdapterTest extends \PHPUnit_Framework_TestCase
{
public function testSomething()
{
// Stop here and mark this test as incomplete.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -1,48 +0,0 @@
<?php
/**********************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/**********************************************************************************/
namespace Thelia\Coupon;
require_once 'CouponManagerTest.php';
/**
* Created by JetBrains PhpStorm.
* Date: 8/19/13
* Time: 3:24 PM
*
* Unit Test CouponFactory Class
*
* @package Coupon
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class CouponFactoryTest extends \PHPUnit_Framework_TestCase
{
public function testSomething()
{
// Stop here and mark this test as incomplete.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -1,48 +0,0 @@
<?php
/**********************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/**********************************************************************************/
namespace Thelia\Coupon;
/**
* Created by JetBrains PhpStorm.
* Date: 8/19/13
* Time: 3:24 PM
*
* Unit Test CouponManager Class
*
* @package Coupon
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class CouponManagerTest extends \PHPUnit_Framework_TestCase
{
public function testSomething()
{
// Stop here and mark this test as incomplete.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -1,46 +0,0 @@
<?php
/**********************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/**********************************************************************************/
namespace Thelia\Coupon;
/**
* Created by JetBrains PhpStorm.
* Date: 8/19/13
* Time: 3:24 PM
*
* Unit Test ConditionCollection Class
*
* @package Coupon
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class CouponRuleCollectionTest extends \PHPUnit_Framework_TestCase
{
public function testSomething()
{
// Stop here and mark this test as incomplete.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -1,73 +0,0 @@
<?php
/**********************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/**********************************************************************************/
namespace Thelia\Coupon;
use Thelia\Coupon\RuleOrganizer;
/**
* Created by JetBrains PhpStorm.
* Date: 8/19/13
* Time: 3:24 PM
*
* Unit Test RuleOrganizer Class
*
* @package Coupon
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class RuleOrganizerTest extends \PHPUnit_Framework_TestCase
{
/**
* @var RuleOrganizer
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = new RuleOrganizer();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
/**
* @covers Thelia\Coupon\RuleOrganizer::organize
* @todo Implement testOrganize().
*/
public function testOrganize()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -1,65 +0,0 @@
<?php
/**********************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/**********************************************************************************/
namespace Thelia\Coupon;
//require_once '../CouponManagerTest.php';
/**
* Created by JetBrains PhpStorm.
* Date: 8/19/13
* Time: 3:24 PM
*
* Unit Test RemoveXAmount Class
*
* @package Coupon
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class RemoveXAmountTest extends \PHPUnit_Framework_TestCase
{
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
}
public function testSomething()
{
// Stop here and mark this test as incomplete.
$this->markTestIncomplete(
'This coupon has not been implemented yet.'
);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
}

View File

@@ -1,67 +0,0 @@
<?php
/**********************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/**********************************************************************************/
namespace Thelia\Coupon;
use PHPUnit_Framework_TestCase;
//require_once '../CouponManagerTest.php';
/**
* Created by JetBrains PhpStorm.
* Date: 8/19/13
* Time: 3:24 PM
*
* Unit Test RemoveXPercent Class
*
* @package Coupon
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class RemoveXPercentTest extends \PHPUnit_Framework_TestCase
{
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
}
public function testSomething()
{
$this->markTestIncomplete(
'This coupon has not been implemented yet.'
);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
}

View File

@@ -30,7 +30,7 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase
/** /**
* @covers Thelia\Tools\FileManager::copyUploadedFile * @covers Thelia\Tools\FileManager::copyUploadedFile
*/ */
public function testCopyUploadedFile() /* public function testCopyUploadedFile()
{ {
$this->markTestIncomplete( $this->markTestIncomplete(
'This test has not been implemented yet : Mock issue' 'This test has not been implemented yet : Mock issue'
@@ -103,13 +103,13 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase
$actual = $fileManager->copyUploadedFile(24, FileManager::TYPE_PRODUCT, $stubProductImage, $stubUploadedFile, $newUploadedFiles, FileManager::FILE_TYPE_IMAGES); $actual = $fileManager->copyUploadedFile(24, FileManager::TYPE_PRODUCT, $stubProductImage, $stubUploadedFile, $newUploadedFiles, FileManager::FILE_TYPE_IMAGES);
$this->assertCount(1, $actual); $this->assertCount(1, $actual);
} }*/
/** /**
* @covers Thelia\Tools\FileManager::copyUploadedFile * @covers Thelia\Tools\FileManager::copyUploadedFile
* @expectedException \Thelia\Exception\ImageException * @expectedException \Thelia\Exception\ImageException
*/ */
public function testCopyUploadedFileExceptionImageException() /*public function testCopyUploadedFileExceptionImageException()
{ {
$this->markTestIncomplete( $this->markTestIncomplete(
'This test has not been implemented yet : Mock issue' 'This test has not been implemented yet : Mock issue'
@@ -181,7 +181,7 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase
$actual = $fileManager->copyUploadedFile(24, FileManager::TYPE_PRODUCT, $stubProductImage, $stubUploadedFile, $newUploadedFiles, FileManager::FILE_TYPE_DOCUMENTS); $actual = $fileManager->copyUploadedFile(24, FileManager::TYPE_PRODUCT, $stubProductImage, $stubUploadedFile, $newUploadedFiles, FileManager::FILE_TYPE_DOCUMENTS);
} }*/
/** /**
* @covers Thelia\Tools\FileManager::saveImage * @covers Thelia\Tools\FileManager::saveImage
@@ -650,23 +650,23 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase
/** /**
* @covers Thelia\Tools\FileManager::getImageForm * @covers Thelia\Tools\FileManager::getImageForm
*/ */
public function testGetImageForm() /* public function testGetImageForm()
{ {
// Mock issue // Mock issue
$this->markTestIncomplete( $this->markTestIncomplete(
'This test has not been implemented yet.' 'This test has not been implemented yet.'
); );
} }*/
/** /**
* @covers Thelia\Tools\FileManager::getDocumentForm * @covers Thelia\Tools\FileManager::getDocumentForm
*/ */
public function testGetDocumentForm() /* public function testGetDocumentForm()
{ {
// Mock issue // Mock issue
$this->markTestIncomplete( $this->markTestIncomplete(
'This test has not been implemented yet.' 'This test has not been implemented yet.'
); );
} }*/
/** /**
* @covers Thelia\Tools\FileManager::getUploadDir * @covers Thelia\Tools\FileManager::getUploadDir
@@ -879,21 +879,21 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase
/** /**
* @covers Thelia\Tools\FileManager::adminLogAppend * @covers Thelia\Tools\FileManager::adminLogAppend
*/ */
public function testAdminLogAppend() /* public function testAdminLogAppend()
{ {
$this->markTestIncomplete( $this->markTestIncomplete(
'This test has not been implemented yet.' 'This test has not been implemented yet.'
); );
} }*/
/** /**
* @covers Thelia\Tools\FileManager::deleteFile * @covers Thelia\Tools\FileManager::deleteFile
*/ */
public function testDeleteFile() /* public function testDeleteFile()
{ {
// @todo see http://tech.vg.no/2011/03/09/mocking-the-file-system-using-phpunit-and-vfsstream/ // @todo see http://tech.vg.no/2011/03/09/mocking-the-file-system-using-phpunit-and-vfsstream/
$this->markTestIncomplete( $this->markTestIncomplete(
'This test has not been implemented yet.' 'This test has not been implemented yet.'
); );
} }*/
} }

View File

@@ -46,7 +46,6 @@ class NumberFormat
if ($decimals == null) $decimals = $lang->getDecimals(); if ($decimals == null) $decimals = $lang->getDecimals();
if ($decPoint == null) $decPoint = $lang->getDecimalSeparator(); if ($decPoint == null) $decPoint = $lang->getDecimalSeparator();
if ($thousandsSep == null) $thousandsSep = $lang->getThousandsSeparator(); if ($thousandsSep == null) $thousandsSep = $lang->getThousandsSeparator();
return number_format($number, $decimals, $decPoint, $thousandsSep); return number_format($number, $decimals, $decPoint, $thousandsSep);
} }
} }

View File

@@ -39,7 +39,7 @@ abstract class BaseType implements TypeInterface
public function verifyForm($value, ExecutionContextInterface $context) public function verifyForm($value, ExecutionContextInterface $context)
{ {
if( ! $this->isValid($value) ) { if ( ! $this->isValid($value) ) {
$context->addViolation(sprintf("received value `%s` does not match `%s` type", $value, $this->getType())); $context->addViolation(sprintf("received value `%s` does not match `%s` type", $value, $this->getType()));
} }
} }

View File

@@ -78,7 +78,7 @@ class ModelValidIdType extends BaseType
$queryClass = $this->expectedModelActiveRecordQuery; $queryClass = $this->expectedModelActiveRecordQuery;
$choices = array(); $choices = array();
foreach($queryClass::create()->find() as $item) { foreach ($queryClass::create()->find() as $item) {
$choices[$item->getId()] = method_exists($item, "getTitle") ? $item->getTitle() : $item->getId(); $choices[$item->getId()] = method_exists($item, "getTitle") ? $item->getTitle() : $item->getId();
} }