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

View File

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

View File

@@ -70,7 +70,7 @@ class Module extends BaseAction implements EventSubscriberInterface
$con->beginTransaction();
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 ?');
}

View File

@@ -29,7 +29,6 @@ use Thelia\Action\BaseAction;
use Thelia\Model\NewsletterQuery;
use Thelia\Model\Newsletter as NewsletterModel;
/**
* Class Newsletter
* @package Thelia\Action
@@ -52,14 +51,14 @@ class Newsletter extends BaseAction implements EventSubscriberInterface
public function unsubscribe(NewsletterEvent $event)
{
if(null !== $nl = NewsletterQuery::create()->findPk($event->getId())) {
if (null !== $nl = NewsletterQuery::create()->findPk($event->getId())) {
$nl->delete();
}
}
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())
->setFirstname($event->getFirstname())
->setLastname($event->getLastname())
@@ -96,4 +95,4 @@ class Newsletter extends BaseAction implements EventSubscriberInterface
TheliaEvents::NEWSLETTER_UNSUBSCRIBE => array('unsubscribe', 128)
);
}
}
}

View File

@@ -52,14 +52,6 @@ use Thelia\Core\Event\Product\ProductSetTemplateEvent;
use Thelia\Model\ProductSaleElementsQuery;
use Thelia\Core\Event\Product\ProductDeleteCategoryEvent;
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\ProductDeleteAccessoryEvent;

View File

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

View File

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

View File

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

View File

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

View File

@@ -61,19 +61,19 @@ class GenerateResources extends ContainerAwareCommand
$constants = $class->getConstants();
if(count($constants) == 0) {
if (count($constants) == 0) {
$output->writeln('No resources found');
exit;
}
switch($input->getOption("output")) {
switch ($input->getOption("output")) {
case 'sql':
$output->writeln(
'INSERT INTO ' . ResourceTableMap::TABLE_NAME . ' (`id`, `code`, `created_at`, `updated_at`) VALUES '
);
$compteur = 0;
foreach($constants as $constant => $value) {
if($constant == AdminResources::SUPERADMINISTRATOR) {
foreach ($constants as $constant => $value) {
if ($constant == AdminResources::SUPERADMINISTRATOR) {
continue;
}
$compteur++;
@@ -87,8 +87,8 @@ class GenerateResources extends ContainerAwareCommand
'INSERT INTO ' . ResourceI18nTableMap::TABLE_NAME . ' (`id`, `locale`, `title`) VALUES '
);
$compteur = 0;
foreach($constants as $constant => $value) {
if($constant == AdminResources::SUPERADMINISTRATOR) {
foreach ($constants as $constant => $value) {
if ($constant == AdminResources::SUPERADMINISTRATOR) {
continue;
}
@@ -105,8 +105,8 @@ class GenerateResources extends ContainerAwareCommand
}
break;
default :
foreach($constants as $constant => $value) {
if($constant == AdminResources::SUPERADMINISTRATOR) {
foreach ($constants as $constant => $value) {
if ($constant == AdminResources::SUPERADMINISTRATOR) {
continue;
}
$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 $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 $updateEventIdentifier the dispatched update TheliaEvent identifier. Example: TheliaEvents::MESSAGE_UPDATE

View File

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

View File

@@ -115,7 +115,7 @@ class BaseAdminController extends BaseController
* Check current admin user authorisations. An ADMIN role is assumed.
*
* @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
*
@@ -369,8 +369,8 @@ class BaseAdminController extends BaseController
* Render the given template, and returns the result as an Http Response.
*
* @param $templateName the complete template name, with extension
* @param array $args the template arguments
* @param int $status http code status
* @param array $args the template arguments
* @param int $status http code status
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function render($templateName, $args = array(), $status = 200)

View File

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

View File

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

View File

@@ -38,5 +38,5 @@ class LanguageController extends BaseAdminController
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::VIEW)) return $response;
return $this->render("languages");
}
}
}

View File

@@ -38,5 +38,5 @@ class MailingSystemController extends BaseAdminController
if (null !== $response = $this->checkAuth(AdminResources::MAILING_SYSTEM, AccessManager::VIEW)) return $response;
return $this->render("mailing-system");
}
}
}

View File

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

View File

@@ -41,7 +41,7 @@ class ModuleController extends BaseAdminController
public function indexAction()
{
if (null !== $response = $this->checkAuth(AdminResources::MODULE, AccessManager::VIEW)) return $response;
$modulemanagement = new ModuleManagement();
$modulemanagement->updateModules();
@@ -100,7 +100,7 @@ class ModuleController extends BaseAdminController
$this->dispatch(TheliaEvents::MODULE_DELETE, $deleteEvent);
if($deleteEvent->hasModule() === false) {
if ($deleteEvent->hasModule() === false) {
throw new \LogicException(
$this->getTranslator()->trans("No %obj was updated.", array('%obj' => 'Module')));
}
@@ -110,7 +110,7 @@ class ModuleController extends BaseAdminController
$message = $e->getMessage();
}
if($message) {
if ($message) {
return $this->render("modules", array(
"error_message" => $message
));

View File

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

View File

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

View File

@@ -28,7 +28,6 @@ use Thelia\Core\Event\Tax\TaxEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Form\TaxCreationForm;
use Thelia\Form\TaxModificationForm;
use Thelia\Form\TaxTaxListUpdateForm;
use Thelia\Model\TaxQuery;
class TaxController extends AbstractCrudController
@@ -177,7 +176,7 @@ class TaxController extends AbstractCrudController
/**
* 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
*/
protected function performAdditionalCreateAction($createEvent)
@@ -200,20 +199,19 @@ class TaxController extends AbstractCrudController
{
$type = $formData['type'];
}
protected function getRequirements($type, $formData)
{
$requirements = array();
foreach($formData as $data => $value) {
if(!strstr($data, ':')) {
foreach ($formData as $data => $value) {
if (!strstr($data, ':')) {
continue;
}
$couple = explode(':', $data);
if(count($couple) != 2 || $couple[0] != $type) {
if (count($couple) != 2 || $couple[0] != $type) {
continue;
}
@@ -222,4 +220,4 @@ class TaxController extends AbstractCrudController
return $requirements;
}
}
}

View File

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

View File

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

View File

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

View File

@@ -24,21 +24,11 @@ namespace Thelia\Controller\Front;
use Propel\Runtime\Exception\PropelException;
use Thelia\Core\Event\Coupon\CouponConsumeEvent;
use Thelia\Exception\TheliaProcessException;
use Thelia\Form\CouponCode;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Core\Event\Order\OrderEvent;
use Thelia\Core\Event\TheliaEvents;
use Symfony\Component\HttpFoundation\Request;
use Thelia\Form\OrderDelivery;
use Thelia\Form\OrderPayment;
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\Tools\URL;
/**
* Class CouponController

View File

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

View File

@@ -23,7 +23,6 @@
namespace Thelia\Controller\Front;
/**
* Class Mail
* @package Thelia\Controller\Front
@@ -46,4 +45,4 @@ class Mail extends BaseFrontController
exit;
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -46,4 +46,4 @@ class TheliaType extends AbstractType
{
return 'thelia_type';
}
}
}

View File

@@ -23,13 +23,6 @@
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
*
@@ -49,7 +42,7 @@ class AccessManager
self::DELETE => false,
);
static protected $accessPows = array(
protected static $accessPows = array(
self::VIEW => 3,
self::CREATE => 2,
self::UPDATE => 1,
@@ -67,7 +60,7 @@ class AccessManager
public function can($type)
{
if(!array_key_exists($type, $this->accessGranted)) {
if (!array_key_exists($type, $this->accessGranted)) {
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;
}
@@ -83,8 +76,8 @@ class AccessManager
public function build($accesses)
{
$this->accessValue = 0;
foreach($accesses as $access) {
if(array_key_exists($access, self::$accessPows)) {
foreach ($accesses as $access) {
if (array_key_exists($access, self::$accessPows)) {
$this->accessValue += pow(2, self::$accessPows[$access]);
}
}
@@ -95,9 +88,9 @@ class AccessManager
protected function fillGrantedAccess()
{
$accessValue = $this->accessValue;
foreach(self::$accessPows as $type => $value) {
foreach (self::$accessPows as $type => $value) {
$pow = pow(2, $value);
if($accessValue >= $pow) {
if ($accessValue >= $pow) {
$accessValue -= $pow;
$this->accessGranted[$type] = true;
} else {
@@ -106,7 +99,6 @@ class AccessManager
}
}
public function getAccessValue()
{
return $this->accessValue;

View File

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

View File

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

View File

@@ -23,12 +23,9 @@
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
@@ -147,29 +144,29 @@ class SecurityContext
return true;
}
if( !method_exists($user, 'getPermissions') ) {
if ( !method_exists($user, 'getPermissions') ) {
return false;
}
$userPermissions = $user->getPermissions();
if($userPermissions === AdminResources::SUPERADMINISTRATOR) {
if ($userPermissions === AdminResources::SUPERADMINISTRATOR) {
return true;
}
foreach($resources as $resource) {
if($resource === '') {
foreach ($resources as $resource) {
if ($resource === '') {
continue;
}
$resource = strtolower($resource);
if(!array_key_exists($resource, $userPermissions)) {
if (!array_key_exists($resource, $userPermissions)) {
return false;
}
foreach($accesses as $access) {
if(!$userPermissions[$resource]->can($access)) {
foreach ($accesses as $access) {
if (!$userPermissions[$resource]->can($access)) {
return false;
}
}

View File

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

View File

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

View File

@@ -24,7 +24,6 @@
namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
@@ -34,7 +33,6 @@ use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\AdminQuery;
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\Model\CountryQuery;
use Thelia\Type;
use Thelia\Type\TypeCollection;
class Cart extends BaseLoop
{
@@ -90,17 +89,17 @@ class Cart extends BaseLoop
$countCartItems = count($cartItems);
if($limit <= 0 || $limit >= $countCartItems){
if ($limit <= 0 || $limit >= $countCartItems) {
$limit = $countCartItems;
}
$position = $this->getPosition();
if(isset($position)){
if($position == "first"){
if (isset($position)) {
if ($position == "first") {
$limit = 1;
$cartItems = array($cartItems[0]);
}else if($position == "last"){
} elseif ($position == "last") {
$limit = 1;
$cartItems = array(end($cartItems));
}

View File

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

View File

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

View File

@@ -107,7 +107,7 @@ class Module extends BaseI18nLoop
$code = $this->getCode();
if(null !== $code) {
if (null !== $code) {
$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\Argument;
use Thelia\Model\CustomerQuery;
use Thelia\Model\OrderAddress;
use Thelia\Model\OrderAddressQuery;
use Thelia\Model\OrderQuery;
use Thelia\Type\TypeCollection;
@@ -100,11 +99,11 @@ class Order extends BaseLoop implements SearchLoopInterface
{
$search->_and();
foreach($searchIn as $index => $searchInElement) {
if($index > 0) {
foreach ($searchIn as $index => $searchInElement) {
if ($index > 0) {
$search->_or();
}
switch($searchInElement) {
switch ($searchInElement) {
case "ref":
$search->filterByRef($searchTerm, $searchCriteria);
break;

View File

@@ -26,7 +26,6 @@ namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\Join;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
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\Exception\TaxEngineException;
use Thelia\Model\Base\ProductSaleElementsQuery;
use Thelia\Model\CategoryQuery;
use Thelia\Model\CountryQuery;
use Thelia\Model\CurrencyQuery;
@@ -148,11 +146,11 @@ class Product extends BaseI18nLoop implements SearchLoopInterface
{
$search->_and();
foreach($searchIn as $index => $searchInElement) {
if($index > 0) {
foreach ($searchIn as $index => $searchInElement) {
if ($index > 0) {
$search->_or();
}
switch($searchInElement) {
switch ($searchInElement) {
case "ref":
$search->filterByRef($searchTerm, $searchCriteria);
break;
@@ -172,7 +170,7 @@ class Product extends BaseI18nLoop implements SearchLoopInterface
public function exec(&$pagination)
{
$complex = $this->getComplex();
if(true === $complex) {
if (true === $complex) {
return $this->execComplex($pagination);
}
@@ -237,7 +235,7 @@ class Product extends BaseI18nLoop implements SearchLoopInterface
$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);
}
@@ -594,7 +592,7 @@ class Product extends BaseI18nLoop implements SearchLoopInterface
$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);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -8,7 +8,6 @@ use \Symfony\Component\EventDispatcher\EventDispatcherInterface;
use \Smarty;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Thelia\Core\Template\ParserInterface;
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\NotBlank;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Security\AccessManager;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Translation\Translator;
use Thelia\Model\AdminQuery;
use Thelia\Model\ProfileQuery;
use Thelia\Model\ConfigQuery;
class AdministratorCreationForm extends BaseForm
{
@@ -110,7 +107,7 @@ class AdministratorCreationForm extends BaseForm
{
$data = $context->getRoot()->getData();
if($data["password"] === '' && $data["password_confirm"] === '') {
if ($data["password"] === '' && $data["password_confirm"] === '') {
$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");
}
if(strlen($data["password"]) < 4) {
if (strlen($data["password"]) < 4) {
$context->addViolation("password must be composed of at least 4 characters");
}
}
@@ -135,4 +132,4 @@ class AdministratorCreationForm extends BaseForm
{
return "thelia_admin_administrator_creation";
}
}
}

View File

@@ -25,7 +25,6 @@ namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Model\AdminQuery;
class AdministratorModificationForm extends AdministratorCreationForm
@@ -90,7 +89,7 @@ class AdministratorModificationForm extends AdministratorCreationForm
$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");
}
}

View File

@@ -27,7 +27,6 @@ use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
/**
* Class ContactForm
* @package Thelia\Form
@@ -107,4 +106,4 @@ class ContactForm extends BaseForm
{
return 'thelia_contact';
}
}
}

View File

@@ -23,8 +23,6 @@
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Thelia\Model\ModuleQuery;
use Thelia\Module\BaseModule;
/**
* 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\NotBlank;
use Symfony\Component\Validator\Constraints\NotEqualTo;
use Symfony\Component\Validator\Constraints\Range;
/**
* Created by JetBrains PhpStorm.

View File

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

View File

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

View File

@@ -26,7 +26,6 @@ use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Form\BaseForm;
use Thelia\Core\Translation\Translator;
/**
* Class LangCreateForm
* @package Thelia\Form\Lang
@@ -113,4 +112,4 @@ class LangCreateForm extends BaseForm
{
return 'thelia_language_create';
}
}
}

View File

@@ -24,11 +24,9 @@
namespace Thelia\Form\Lang;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Range;
use Thelia\Form\BaseForm;
use Thelia\Core\Translation\Translator;
/**
* Class LangDefaultBehaviorForm
* @package Thelia\Form\Lang
@@ -82,4 +80,4 @@ class LangDefaultBehaviorForm extends BaseForm
{
return 'thelia_lang_defaultBehavior';
}
}
}

View File

@@ -25,7 +25,6 @@ namespace Thelia\Form\Lang;
use Symfony\Component\Validator\Constraints\GreaterThan;
use Symfony\Component\Validator\Constraints\NotBlank;
/**
* Class LangUpdateForm
* @package Thelia\Form\Lang
@@ -51,4 +50,4 @@ class LangUpdateForm extends LangCreateForm
{
return 'thelia_lang_update';
}
}
}

View File

@@ -24,7 +24,6 @@
namespace Thelia\Form\Lang;
use Thelia\Core\Event\ActionEvent;
/**
* Class LangUrlEvent
* @package Thelia\Form\Lang
@@ -43,4 +42,4 @@ class LangUrlEvent extends ActionEvent
{
return $this->url;
}
}
}

View File

@@ -26,7 +26,6 @@ use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Form\BaseForm;
use Thelia\Model\LangQuery;
/**
* Class LangUrlForm
* @package Thelia\Form\Lang
@@ -84,4 +83,4 @@ class LangUrlForm extends BaseForm
{
return 'thelia_language_url';
}
}
}

View File

@@ -30,7 +30,6 @@ use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Model\NewsletterQuery;
/**
* Class NewsletterForm
* @package Thelia\Form
@@ -95,4 +94,4 @@ class NewsletterForm extends BaseForm
{
return 'thelia_newsletter';
}
}
}

View File

@@ -111,4 +111,4 @@ class ProductDefaultSaleElementUpdateForm extends ProductSaleElementUpdateForm
{
return "thelia_product_default_sale_element_update_form";
}
}
}

View File

@@ -26,7 +26,6 @@ use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Security\AccessManager;
use Thelia\Core\Translation\Translator;
use Thelia\Model\ProfileQuery;
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(
self::MODULE_ACCESS_FIELD_PREFIX . ':' . str_replace(".", ":", $module->getCode()),
"choice",

View File

@@ -26,7 +26,6 @@ use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Security\AccessManager;
use Thelia\Core\Translation\Translator;
use Thelia\Model\ProfileQuery;
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(
self::RESOURCE_ACCESS_FIELD_PREFIX . ':' . str_replace(".", ":", $resource->getCode()),
"choice",

View File

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

View File

@@ -142,13 +142,12 @@ abstract class BaseModule extends ContainerAware
} catch (\UnexpectedValueException $e) {
throw $e;
}
if(null === $con) {
if (null === $con) {
$con = \Propel\Runtime\Propel::getConnection(
ModuleImageTableMap::DATABASE_NAME
);
}
/* browse the directory */
$imagePosition = 1;
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
*/
public function testCopyUploadedFile()
/* public function testCopyUploadedFile()
{
$this->markTestIncomplete(
'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);
$this->assertCount(1, $actual);
}
}*/
/**
* @covers Thelia\Tools\FileManager::copyUploadedFile
* @expectedException \Thelia\Exception\ImageException
*/
public function testCopyUploadedFileExceptionImageException()
/*public function testCopyUploadedFileExceptionImageException()
{
$this->markTestIncomplete(
'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);
}
}*/
/**
* @covers Thelia\Tools\FileManager::saveImage
@@ -650,23 +650,23 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase
/**
* @covers Thelia\Tools\FileManager::getImageForm
*/
public function testGetImageForm()
/* public function testGetImageForm()
{
// Mock issue
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}*/
/**
* @covers Thelia\Tools\FileManager::getDocumentForm
*/
public function testGetDocumentForm()
/* public function testGetDocumentForm()
{
// Mock issue
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}*/
/**
* @covers Thelia\Tools\FileManager::getUploadDir
@@ -879,21 +879,21 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase
/**
* @covers Thelia\Tools\FileManager::adminLogAppend
*/
public function testAdminLogAppend()
/* public function testAdminLogAppend()
{
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}*/
/**
* @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/
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}*/
}

View File

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

View File

@@ -39,7 +39,7 @@ abstract class BaseType implements TypeInterface
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()));
}
}

View File

@@ -78,7 +78,7 @@ class ModelValidIdType extends BaseType
$queryClass = $this->expectedModelActiveRecordQuery;
$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();
}