Merge branch 'master' into content

Conflicts:
	core/lib/Thelia/Core/Event/TheliaEvents.php
	templates/admin/default/folders.html
This commit is contained in:
Manuel Raynaud
2013-09-20 17:41:38 +02:00
143 changed files with 15038 additions and 2789 deletions

View File

@@ -160,6 +160,7 @@ class Category extends BaseAction implements EventSubscriberInterface
$content = new CategoryAssociatedContent();
$content
->setDispatcher($this->getDispatcher())
->setCategory($event->getCategory())
->setContentId($event->getContentId())
->save()
@@ -174,7 +175,11 @@ class Category extends BaseAction implements EventSubscriberInterface
->filterByCategory($event->getCategory())->findOne()
;
if ($content !== null) $content->delete();
if ($content !== null) {
$content
->setDispatcher($this->getDispatcher())
->delete();
}
}

View File

@@ -23,16 +23,23 @@
namespace Thelia\Action;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\CartEvent;
use Thelia\Core\Event\OrderEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\ProductPrice;
use Thelia\Model\ProductPriceQuery;
use Thelia\Model\CartItem;
use Thelia\Model\CartItemQuery;
use Thelia\Exception\OrderException;
use Thelia\Exception\TheliaProcessException;
use Thelia\Model\AddressQuery;
use Thelia\Model\OrderProductAttributeCombination;
use Thelia\Model\ModuleQuery;
use Thelia\Model\OrderProduct;
use Thelia\Model\OrderStatus;
use Thelia\Model\Map\OrderTableMap;
use Thelia\Model\OrderAddress;
use Thelia\Model\OrderStatusQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Tools\I18n;
/**
*
@@ -67,6 +74,230 @@ class Order extends BaseAction implements EventSubscriberInterface
$event->setOrder($order);
}
/**
* @param \Thelia\Core\Event\OrderEvent $event
*/
public function setInvoiceAddress(OrderEvent $event)
{
$order = $event->getOrder();
$order->chosenInvoiceAddress = $event->getInvoiceAddress();
$event->setOrder($order);
}
/**
* @param \Thelia\Core\Event\OrderEvent $event
*/
public function setPaymentModule(OrderEvent $event)
{
$order = $event->getOrder();
$order->setPaymentModuleId($event->getPaymentModule());
$event->setOrder($order);
}
/**
* @param \Thelia\Core\Event\OrderEvent $event
*/
public function create(OrderEvent $event)
{
$con = \Propel\Runtime\Propel::getConnection(
OrderTableMap::DATABASE_NAME
);
$con->beginTransaction();
$sessionOrder = $event->getOrder();
/* use a copy to avoid errored reccord in session */
$placedOrder = $sessionOrder->copy();
$placedOrder->setDispatcher($this->getDispatcher());
$customer = $this->getSecurityContext()->getCustomerUser();
$currency = $this->getSession()->getCurrency();
$lang = $this->getSession()->getLang();
$deliveryAddress = AddressQuery::create()->findPk($sessionOrder->chosenDeliveryAddress);
$taxCountry = $deliveryAddress->getCountry();
$invoiceAddress = AddressQuery::create()->findPk($sessionOrder->chosenInvoiceAddress);
$cart = $this->getSession()->getCart();
$cartItems = $cart->getCartItems();
$paymentModule = ModuleQuery::create()->findPk($placedOrder->getPaymentModuleId());
/* fulfill order */
$placedOrder->setCustomerId($customer->getId());
$placedOrder->setCurrencyId($currency->getId());
$placedOrder->setCurrencyRate($currency->getRate());
$placedOrder->setLangId($lang->getId());
/* hard save the delivery and invoice addresses */
$deliveryOrderAddress = new OrderAddress();
$deliveryOrderAddress
->setCustomerTitleId($deliveryAddress->getTitleId())
->setCompany($deliveryAddress->getCompany())
->setFirstname($deliveryAddress->getFirstname())
->setLastname($deliveryAddress->getLastname())
->setAddress1($deliveryAddress->getAddress1())
->setAddress2($deliveryAddress->getAddress2())
->setAddress3($deliveryAddress->getAddress3())
->setZipcode($deliveryAddress->getZipcode())
->setCity($deliveryAddress->getCity())
->setCountryId($deliveryAddress->getCountryId())
->save($con)
;
$invoiceOrderAddress = new OrderAddress();
$invoiceOrderAddress
->setCustomerTitleId($invoiceAddress->getTitleId())
->setCompany($invoiceAddress->getCompany())
->setFirstname($invoiceAddress->getFirstname())
->setLastname($invoiceAddress->getLastname())
->setAddress1($invoiceAddress->getAddress1())
->setAddress2($invoiceAddress->getAddress2())
->setAddress3($invoiceAddress->getAddress3())
->setZipcode($invoiceAddress->getZipcode())
->setCity($invoiceAddress->getCity())
->setCountryId($invoiceAddress->getCountryId())
->save($con)
;
$placedOrder->setDeliveryOrderAddressId($deliveryOrderAddress->getId());
$placedOrder->setInvoiceOrderAddressId($invoiceOrderAddress->getId());
$placedOrder->setStatusId(
OrderStatusQuery::create()->findOneByCode(OrderStatus::CODE_NOT_PAID)->getId()
);
$placedOrder->save($con);
/* fulfill order_products and decrease stock */
foreach($cartItems as $cartItem) {
$product = $cartItem->getProduct();
/* get translation */
$productI18n = I18n::forceI18nRetrieving($this->getSession()->getLang()->getLocale(), 'Product', $product->getId());
$pse = $cartItem->getProductSaleElements();
/* check still in stock */
if($cartItem->getQuantity() > $pse->getQuantity()) {
throw new TheliaProcessException("Not enough stock", TheliaProcessException::CART_ITEM_NOT_ENOUGH_STOCK, $cartItem);
}
/* decrease stock */
$pse->setQuantity(
$pse->getQuantity() - $cartItem->getQuantity()
);
$pse->save($con);
/* get tax */
$taxRuleI18n = I18n::forceI18nRetrieving($this->getSession()->getLang()->getLocale(), 'TaxRule', $product->getTaxRuleId());
$taxDetail = $product->getTaxRule()->getTaxDetail(
$taxCountry,
$cartItem->getPromo() == 1 ? $cartItem->getPromoPrice() : $cartItem->getPrice(),
$this->getSession()->getLang()->getLocale()
);
$orderProduct = new OrderProduct();
$orderProduct
->setOrderId($placedOrder->getId())
->setProductRef($product->getRef())
->setProductSaleElementsRef($pse->getRef())
->setTitle($productI18n->getTitle())
->setChapo($productI18n->getChapo())
->setDescription($productI18n->getDescription())
->setPostscriptum($productI18n->getPostscriptum())
->setQuantity($cartItem->getQuantity())
->setPrice($cartItem->getPrice())
->setPromoPrice($cartItem->getPromoPrice())
->setWasNew($pse->getNewness())
->setWasInPromo($cartItem->getPromo())
->setWeight($pse->getWeight())
->setTaxRuleTitle($taxRuleI18n->getTitle())
->setTaxRuleDescription($taxRuleI18n->getDescription())
;
$orderProduct->setDispatcher($this->getDispatcher());
$orderProduct->save($con);
/* fulfill order_product_tax */
foreach($taxDetail as $tax) {
$tax->setOrderProductId($orderProduct->getId());
$tax->save($con);
}
/* fulfill order_attribute_combination and decrease stock */
foreach($pse->getAttributeCombinations() as $attributeCombination) {
$attribute = I18n::forceI18nRetrieving($this->getSession()->getLang()->getLocale(), 'Attribute', $attributeCombination->getAttributeId());
$attributeAv = I18n::forceI18nRetrieving($this->getSession()->getLang()->getLocale(), 'AttributeAv', $attributeCombination->getAttributeAvId());
$orderAttributeCombination = new OrderProductAttributeCombination();
$orderAttributeCombination
->setOrderProductId($orderProduct->getId())
->setAttributeTitle($attribute->getTitle())
->setAttributeChapo($attribute->getChapo())
->setAttributeDescription($attribute->getDescription())
->setAttributePostscriptumn($attribute->getPostscriptum())
->setAttributeAvTitle($attributeAv->getTitle())
->setAttributeAvChapo($attributeAv->getChapo())
->setAttributeAvDescription($attributeAv->getDescription())
->setAttributeAvPostscriptum($attributeAv->getPostscriptum())
;
$orderAttributeCombination->save($con);
}
}
/* discount @todo */
$con->commit();
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_BEFORE_PAYMENT, new OrderEvent($placedOrder));
/* clear session */
/* but memorize placed order */
$sessionOrder = new \Thelia\Model\Order();
$event->setOrder($sessionOrder);
$event->setPlacedOrder($placedOrder);
$this->getSession()->setOrder($sessionOrder);
/* empty cart @todo */
/* call pay method */
$paymentModuleReflection = new \ReflectionClass($paymentModule->getFullNamespace());
$paymentModuleInstance = $paymentModuleReflection->newInstance();
$paymentModuleInstance->setRequest($this->getRequest());
$paymentModuleInstance->setDispatcher($this->getDispatcher());
$paymentModuleInstance->pay($placedOrder);
}
/**
* @param \Thelia\Core\Event\OrderEvent $event
*/
public function sendOrderEmail(OrderEvent $event)
{
/* @todo */
}
/**
* @param \Thelia\Core\Event\OrderEvent $event
*/
public function setReference(OrderEvent $event)
{
$event->getOrder()->setRef($this->generateRef());
}
public function generateRef()
{
/* order addresses are unique */
return uniqid('ORD', true);
}
/**
* Returns an array of event names this subscriber wants to listen to.
*
@@ -92,6 +323,41 @@ class Order extends BaseAction implements EventSubscriberInterface
return array(
TheliaEvents::ORDER_SET_DELIVERY_ADDRESS => array("setDeliveryAddress", 128),
TheliaEvents::ORDER_SET_DELIVERY_MODULE => array("setDeliveryModule", 128),
TheliaEvents::ORDER_SET_INVOICE_ADDRESS => array("setInvoiceAddress", 128),
TheliaEvents::ORDER_SET_PAYMENT_MODULE => array("setPaymentModule", 128),
TheliaEvents::ORDER_PAY => array("create", 128),
TheliaEvents::ORDER_BEFORE_CREATE => array("setReference", 128),
TheliaEvents::ORDER_BEFORE_PAYMENT => array("sendOrderEmail", 128),
);
}
/**
* Return the security context
*
* @return SecurityContext
*/
protected function getSecurityContext()
{
return $this->container->get('thelia.securityContext');
}
/**
* @return \Symfony\Component\HttpFoundation\Request
*/
protected function getRequest()
{
return $this->container->get('request');
}
/**
* Returns the session from the current request
*
* @return \Thelia\Core\HttpFoundation\Session\Session
*/
protected function getSession()
{
$request = $this->getRequest();
return $request->getSession();
}
}

View File

@@ -44,6 +44,10 @@ use Thelia\Model\ProductCategory;
use Thelia\Model\TaxRule;
use Thelia\Model\TaxRuleQuery;
use Thelia\Model\TaxQuery;
use Thelia\Model\AccessoryQuery;
use Thelia\Model\Accessory;
use Thelia\Core\Event\ProductAddAccessoryEvent;
use Thelia\Core\Event\ProductDeleteAccessoryEvent;
class Product extends BaseAction implements EventSubscriberInterface
{
@@ -167,6 +171,7 @@ class Product extends BaseAction implements EventSubscriberInterface
$content = new ProductAssociatedContent();
$content
->setDispatcher($this->getDispatcher())
->setProduct($event->getProduct())
->setContentId($event->getContentId())
->save()
@@ -181,9 +186,66 @@ class Product extends BaseAction implements EventSubscriberInterface
->filterByProduct($event->getProduct())->findOne()
;
if ($content !== null) $content->delete();
if ($content !== null)
$content
->setDispatcher($this->getDispatcher())
->delete()
;
}
public function addAccessory(ProductAddAccessoryEvent $event) {
if (AccessoryQuery::create()
->filterByAccessory($event->getAccessoryId())
->filterByProductId($event->getProduct()->getId())->count() <= 0) {
$accessory = new Accessory();
$accessory
->setDispatcher($this->getDispatcher())
->setProductId($event->getProduct()->getId())
->setAccessory($event->getAccessoryId())
->save()
;
}
}
public function removeAccessory(ProductDeleteAccessoryEvent $event) {
$accessory = AccessoryQuery::create()
->filterByAccessory($event->getAccessoryId())
->filterByProductId($event->getProduct()->getId())->findOne()
;
if ($accessory !== null)
$accessory
->setDispatcher($this->getDispatcher())
->delete()
;
}
/**
* Changes position, selecting absolute ou relative change.
*
* @param ProductChangePositionEvent $event
*/
public function updateAccessoryPosition(UpdatePositionEvent $event)
{
if (null !== $accessory = AccessoryQuery::create()->findPk($event->getObjectId())) {
$accessory->setDispatcher($this->getDispatcher());
$mode = $event->getMode();
if ($mode == UpdatePositionEvent::POSITION_ABSOLUTE)
return $accessory->changeAbsolutePosition($event->getPosition());
else if ($mode == UpdatePositionEvent::POSITION_UP)
return $accessory->movePositionUp();
else if ($mode == UpdatePositionEvent::POSITION_DOWN)
return $accessory->movePositionDown();
}
}
/**
* {@inheritDoc}
@@ -200,7 +262,10 @@ class Product extends BaseAction implements EventSubscriberInterface
TheliaEvents::PRODUCT_ADD_CONTENT => array("addContent", 128),
TheliaEvents::PRODUCT_REMOVE_CONTENT => array("removeContent", 128),
TheliaEvents::PRODUCT_UPDATE_ACCESSORY_POSITION => array("updateAccessoryPosition", 128),
TheliaEvents::PRODUCT_ADD_ACCESSORY => array("addAccessory", 128),
TheliaEvents::PRODUCT_REMOVE_ACCESSORY => array("removeAccessory", 128),
);
}
}

View File

@@ -139,4 +139,6 @@ trait CartTrait
return $id;
}
abstract public function getDispatcher();
}

View File

@@ -18,9 +18,10 @@
<loop class="Thelia\Core\Template\Loop\Currency" name="currency"/>
<loop class="Thelia\Core\Template\Loop\Customer" name="customer"/>
<loop class="Thelia\Core\Template\Loop\Feature" name="feature"/>
<loop class="Thelia\Core\Template\Loop\FeatureAvailability" name="feature_availability"/>
<loop class="Thelia\Core\Template\Loop\FeatureAvailability" name="feature-availability"/>
<loop class="Thelia\Core\Template\Loop\FeatureValue" name="feature_value"/>
<loop class="Thelia\Core\Template\Loop\Folder" name="folder"/>
<loop class="Thelia\Core\Template\Loop\Module" name="module"/>
<loop class="Thelia\Core\Template\Loop\Order" name="order"/>
<loop class="Thelia\Core\Template\Loop\OrderStatus" name="order-status"/>
<loop class="Thelia\Core\Template\Loop\CategoryPath" name="category-path"/>
@@ -31,6 +32,7 @@
<loop class="Thelia\Core\Template\Loop\Title" name="title"/>
<loop class="Thelia\Core\Template\Loop\Lang" name="lang"/>
<loop class="Thelia\Core\Template\Loop\CategoryTree" name="category-tree"/>
<loop class="Thelia\Core\Template\Loop\FolderTree" name="folder-tree"/>
<loop class="Thelia\Core\Template\Loop\Cart" name="cart"/>
<loop class="Thelia\Core\Template\Loop\Image" name="image"/>
<loop class="Thelia\Core\Template\Loop\Config" name="config"/>
@@ -101,6 +103,8 @@
<form name="thelia.admin.country.creation" class="Thelia\Form\CountryCreationForm"/>
<form name="thelia.admin.country.modification" class="Thelia\Form\CountryModificationForm"/>
<form name="thelia.admin.profile.modification" class="Thelia\Form\ProfileModificationForm"/>
</forms>
@@ -227,6 +231,7 @@
<argument type="service" id="request" />
<argument type="service" id="thelia.securityContext" />
<argument type="service" id="thelia.parser.context"/>
<argument type="service" id="event_dispatcher"/>
</service>
<service id="smarty.plugin.adminUtilities" class="Thelia\Core\Template\Smarty\Plugins\AdminUtilities" scope="request">

View File

@@ -24,6 +24,12 @@
<default key="_controller">Thelia\Controller\Admin\SessionController::checkLoginAction</default>
</route>
<!-- Route to edit admin profile -->
<route id="admin.profile.update.view" path="/admin/profile/update" methods="get">
<default key="_controller">Thelia\Controller\Admin\AdminController::updateAction</default>
</route>
<!-- Route to the catalog controller -->
@@ -144,6 +150,8 @@
<default key="_controller">Thelia\Controller\Admin\ProductController::updatePositionAction</default>
</route>
<!-- Related content -->
<route id="admin.products.related-content.add" path="/admin/products/related-content/add">
<default key="_controller">Thelia\Controller\Admin\ProductController::addRelatedContentAction</default>
</route>
@@ -157,6 +165,32 @@
<requirement key="_format">xml|json</requirement>
</route>
<!-- Product accessories -->
<route id="admin.products.accessories.add" path="/admin/products/accessory/add">
<default key="_controller">Thelia\Controller\Admin\ProductController::addAccessoryAction</default>
</route>
<route id="admin.products.accessories.delete" path="/admin/products/accessory/delete">
<default key="_controller">Thelia\Controller\Admin\ProductController::deleteAccessoryAction</default>
</route>
<route id="admin.product.accessories-content" path="/admin/product/{productId}/available-accessories/{categoryId}.{_format}" methods="GET">
<default key="_controller">Thelia\Controller\Admin\ProductController::getAvailableAccessoriesAction</default>
<requirement key="_format">xml|json</requirement>
</route>
<route id="admin.products.update-accessory-position" path="/admin/products/update-accessory-position">
<default key="_controller">Thelia\Controller\Admin\ProductController::updateAccessoryPositionAction</default>
</route>
<!--Features and attributes -->
<route id="admin.products.update-attributes-and-features" path="/admin/product/{productId}/update-attributes-and-features">
<default key="_controller">Thelia\Controller\Admin\ProductController::updateAttributesAndFeaturesAction</default>
</route>
<!-- Folder routes management -->
<route id="admin.folders.default" path="/admin/folders">
<default key="_controller">Thelia\Controller\Admin\FolderController::defaultAction</default>
@@ -404,17 +438,26 @@
<!-- Shipping zones routes management -->
<route id="admin.configuration.shipping-zones.default" path="/admin/configuration/shipping-zones">
<route id="admin.configuration.shipping-zones.default" path="/admin/configuration/shipping_zones">
<default key="_controller">Thelia\Controller\Admin\ShippingZoneController::indexAction</default>
</route>
<route id="admin.configuration.shipping-zones.create" path="/admin/configuration/shipping-zones/create">
<default key="_controller">Thelia\Controller\Admin\ShippingZoneController::createAction</default>
<route id="admin.configuration.shipping-zones.update.view" path="/admin/configuration/shipping_zones/update/{shipping_zones_id}" methods="get">
<default key="_controller">Thelia\Controller\Admin\ShippingZoneController::updateAction</default>
<requirement key="shipping_zones_id">\d+</requirement>
</route>
<route id="admin.configuration.shipping-zones.update.view" path="/admin/configuration/shipping-zones/update/{shipping_zones_id}" methods="get">
<default key="_controller">Thelia\Controller\Admin\ShippingZoneController::updateAction</default>
<requirement key="country_id">\d+</requirement>
<!-- end shipping routes management -->
<!-- Shipping zones routes management -->
<route id="admin.configuration.shipping-configuration.default" path="/admin/configuration/shipping_configuration">
<default key="_controller">Thelia\Controller\Admin\ShippingConfigurationController::indexAction</default>
</route>
<route id="admin.configuration.shipping-configuration.update.view" path="/admin/configuration/shipping_configuration/update/{shipping_configuration_id}" methods="get">
<default key="_controller">Thelia\Controller\Admin\ShippingConfigurationController::updateAction</default>
<requirement key="shipping_configuration_id">\d+</requirement>
</route>
<!-- end shipping routes management -->
@@ -477,6 +520,15 @@
<!-- end feature and feature routes management -->
<!-- Modules rule management -->
<route id="admin.module" path="/admin/modules">
<default key="_controller">Thelia\Controller\Admin\ModuleController::indexAction</default>
</route>
<!-- end Modules rule management -->
<!-- The default route, to display a template -->
<route id="admin.processTemplate" path="/admin/{template}">

View File

@@ -112,6 +112,9 @@
<default key="_view">cart</default>
</route>
<!-- end cart routes -->
<!-- order management process -->
<route id="order.delivery.process" path="/order/delivery" methods="post">
<default key="_controller">Thelia\Controller\Front\OrderController::deliver</default>
<default key="_view">order_delivery</default>
@@ -123,7 +126,7 @@
</route>
<route id="order.invoice.process" path="/order/invoice" methods="post">
<default key="_controller">Thelia\Controller\Front\OrderController::pay</default>
<default key="_controller">Thelia\Controller\Front\OrderController::invoice</default>
<default key="_view">order_invoice</default>
</route>
@@ -132,12 +135,13 @@
<default key="_view">order_invoice</default>
</route>
<!-- end cart routes -->
<route id="order.payment.process" path="/order/pay">
<default key="_controller">Thelia\Controller\Front\OrderController::pay</default>
</route>
<!-- order management process -->
<route id="order.delivery.add" path="/delivery/choose/{delivery_id}">
<default key="_controller">Thelia\Controller\Front\DeliveryController::select</default>
<requirement key="delivery_id">\d+</requirement>
<route id="order.placed" path="/order/placed/{order_id}">
<default key="_controller">Thelia\Controller\Front\OrderController::orderPlaced</default>
<default key="_view">order_placed</default>
</route>
<!-- end order management process -->

View File

@@ -33,4 +33,9 @@ class AdminController extends BaseAdminController
{
return $this->render("home");
}
public function updateAction()
{
return $this->render("profile-edit");
}
}

View File

@@ -21,35 +21,26 @@
/* */
/*************************************************************************************/
namespace Thelia\Controller\Front;
use Thelia\Model\ModuleQuery;
use Thelia\Tools\URL;
namespace Thelia\Controller\Admin;
/**
* Class DeliveryController
* @package Thelia\Controller\Front
* Class ModuleController
* @package Thelia\Controller\Admin
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class DeliveryController extends BaseFrontController
class ModuleController extends BaseAdminController
{
public function select($delivery_id)
public function indexAction()
{
if ($this->getSecurityContext()->hasCustomerUser() === false) {
$this->redirect(URL::getInstance()->getIndexPage());
if (null !== $response = $this->checkAuth("admin.module.view")) return $response;
return $this->render("modules", array("display_module" => 20));
}
$request = $this->getRequest();
public function updateAction($module_id)
{
$deliveryModule = ModuleQuery::create()
->filterById($delivery_id)
->filterByActivate(1)
->findOne()
;
if ($deliveryModule) {
$request->getSession()->setDelivery($delivery_id);
} else {
$this->pageNotFound();
}
return $this->render("module-edit", array(
"module_id" => $module_id
));
}
}

View File

@@ -39,6 +39,10 @@ use Thelia\Model\FolderQuery;
use Thelia\Model\ContentQuery;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Model\ProductAssociatedContentQuery;
use Thelia\Model\AccessoryQuery;
use Thelia\Model\CategoryQuery;
use Thelia\Core\Event\ProductAddAccessoryEvent;
use Thelia\Core\Event\ProductDeleteAccessoryEvent;
/**
* Manages products
@@ -178,6 +182,7 @@ class ProductController extends AbstractCrudController
'category_id' => $this->getCategoryId(),
'product_id' => $this->getRequest()->get('product_id', 0),
'folder_id' => $this->getRequest()->get('folder_id', 0),
'accessory_category_id'=> $this->getRequest()->get('accessory_category_id', 0),
'current_tab' => $this->getRequest()->get('current_tab', 'general')
);
}
@@ -275,6 +280,8 @@ class ProductController extends AbstractCrudController
);
}
// -- Related content management -------------------------------------------
public function getAvailableRelatedContentAction($productId, $folderId)
{
$result = array();
@@ -353,4 +360,118 @@ class ProductController extends AbstractCrudController
$this->redirectToEditionTemplate();
}
// -- Accessories management ----------------------------------------------
public function getAvailableAccessoriesAction($productId, $categoryId)
{
$result = array();
$categories = CategoryQuery::create()->filterById($categoryId)->find();
if ($categories !== null) {
$list = ProductQuery::create()
->joinWithI18n($this->getCurrentEditionLocale())
->filterByCategory($categories, Criteria::IN)
->filterById(AccessoryQuery::create()->select('accessory')->findByProductId($productId), Criteria::NOT_IN)
->find();
;
if ($list !== null) {
foreach($list as $item) {
$result[] = array('id' => $item->getId(), 'title' => $item->getTitle());
}
}
}
return $this->jsonResponse(json_encode($result));
}
public function addAccessoryAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
$accessory_id = intval($this->getRequest()->get('accessory_id'));
if ($accessory_id > 0) {
$event = new ProductAddAccessoryEvent(
$this->getExistingObject(),
$accessory_id
);
try {
$this->dispatch(TheliaEvents::PRODUCT_ADD_ACCESSORY, $event);
}
catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
}
$this->redirectToEditionTemplate();
}
public function deleteAccessoryAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
$accessory_id = intval($this->getRequest()->get('accessory_id'));
if ($accessory_id > 0) {
$event = new ProductDeleteAccessoryEvent(
$this->getExistingObject(),
$accessory_id
);
try {
$this->dispatch(TheliaEvents::PRODUCT_REMOVE_ACCESSORY, $event);
}
catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
}
$this->redirectToEditionTemplate();
}
/**
* Update accessory position (only for objects whichsupport that)
*/
public function updateAccessoryPositionAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth('admin.products.update')) return $response;
try {
$mode = $this->getRequest()->get('mode', null);
if ($mode == 'up')
$mode = UpdatePositionEvent::POSITION_UP;
else if ($mode == 'down')
$mode = UpdatePositionEvent::POSITION_DOWN;
else
$mode = UpdatePositionEvent::POSITION_ABSOLUTE;
$position = $this->getRequest()->get('position', null);
$event = new UpdatePositionEvent($mode, $position);
$this->dispatch(TheliaEvents::PRODUCT_UPDATE_ACCESSORY_POSITION, $event);
}
catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
$this->redirectToEditionTemplate();
}
}

View File

@@ -0,0 +1,46 @@
<?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\Controller\Admin;
/**
* Class ShippingConfigurationController
* @package Thelia\Controller\Admin
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class ShippingConfigurationController extends BaseAdminController
{
public function indexAction()
{
if (null !== $response = $this->checkAuth("admin.shipping-configuration.view")) return $response;
return $this->render("shipping-configuration", array("display_shipping_configuration" => 20));
}
public function updateAction($shipping_configuration_id)
{
return $this->render("shipping-configuration-edit", array(
"shipping_configuration_id" => $shipping_configuration_id
));
}
}

View File

@@ -24,7 +24,7 @@
namespace Thelia\Controller\Admin;
/**
* Class FolderController
* Class ShippingZoneController
* @package Thelia\Controller\Admin
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/

View File

@@ -24,6 +24,8 @@ namespace Thelia\Controller\Front;
use Symfony\Component\Routing\Router;
use Thelia\Controller\BaseController;
use Thelia\Model\AddressQuery;
use Thelia\Model\ModuleQuery;
use Thelia\Tools\URL;
class BaseFrontController extends BaseController
@@ -69,10 +71,16 @@ class BaseFrontController extends BaseController
protected function checkValidDelivery()
{
$order = $this->getSession()->getOrder();
if(null === $order || null === $order->chosenDeliveryAddress || null === $order->getDeliveryModuleId()) {
if(null === $order || null === $order->chosenDeliveryAddress || null === $order->getDeliveryModuleId() || null === AddressQuery::create()->findPk($order->chosenDeliveryAddress) || null === ModuleQuery::create()->findPk($order->getDeliveryModuleId())) {
$this->redirectToRoute("order.delivery");
}
}
protected function checkValidInvoice()
{
$order = $this->getSession()->getOrder();
if(null === $order || null === $order->chosenInvoiceAddress || null === $order->getPaymentModuleId() || null === AddressQuery::create()->findPk($order->chosenInvoiceAddress) || null === ModuleQuery::create()->findPk($order->getPaymentModuleId())) {
$this->redirectToRoute("order.invoice");
}
}
}

View File

@@ -23,6 +23,7 @@
namespace Thelia\Controller\Front;
use Propel\Runtime\Exception\PropelException;
use Thelia\Exception\TheliaProcessException;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Core\Event\OrderEvent;
use Thelia\Core\Event\TheliaEvents;
@@ -32,9 +33,11 @@ use Thelia\Form\OrderPayment;
use Thelia\Log\Tlog;
use Thelia\Model\AddressQuery;
use Thelia\Model\AreaDeliveryModuleQuery;
use Thelia\Model\Base\OrderQuery;
use Thelia\Model\CountryQuery;
use Thelia\Model\ModuleQuery;
use Thelia\Model\Order;
use Thelia\Tools\URL;
/**
* Class OrderController
@@ -78,11 +81,8 @@ class OrderController extends BaseFrontController
throw new \Exception("Delivery module cannot be use with selected delivery address");
}
/* try to get postage amount */
/* get postage amount */
$moduleReflection = new \ReflectionClass($deliveryModule->getFullNamespace());
if ($moduleReflection->isSubclassOf("Thelia\Module\DeliveryModuleInterface") === false) {
throw new \RuntimeException(sprintf("delivery module %s is not a Thelia\Module\DeliveryModuleInterface", $deliveryModule->getCode()));
}
$moduleInstance = $moduleReflection->newInstance();
$postage = $moduleInstance->getPostage($deliveryAddress->getCountry());
@@ -121,7 +121,7 @@ class OrderController extends BaseFrontController
* set invoice address
* set payment module
*/
public function pay()
public function invoice()
{
$this->checkAuth();
$this->checkCartNotEmpty();
@@ -134,23 +134,23 @@ class OrderController extends BaseFrontController
try {
$form = $this->validateForm($orderPayment, "post");
$deliveryAddressId = $form->get("delivery-address")->getData();
$deliveryModuleId = $form->get("delivery-module")->getData();
$invoiceAddressId = $form->get("invoice-address")->getData();
$paymentModuleId = $form->get("payment-module")->getData();
/* check that the invoice address belongs to the current customer */
$deliveryAddress = AddressQuery::create()->findPk($deliveryAddressId);
if($deliveryAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) {
$invoiceAddress = AddressQuery::create()->findPk($invoiceAddressId);
if($invoiceAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) {
throw new \Exception("Invoice address does not belong to the current customer");
}
$orderEvent = $this->getOrderEvent();
$orderEvent->setInvoiceAddress($deliveryAddressId);
$orderEvent->setPaymentModule($deliveryModuleId);
$orderEvent->setInvoiceAddress($invoiceAddressId);
$orderEvent->setPaymentModule($paymentModuleId);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_ADDRESS, $orderEvent);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_MODULE, $orderEvent);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_INVOICE_ADDRESS, $orderEvent);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_PAYMENT_MODULE, $orderEvent);
$this->redirectToRoute("order.invoice");
$this->redirectToRoute("order.payment.process");
} catch (FormValidationException $e) {
$message = sprintf("Please check your input: %s", $e->getMessage());
@@ -161,7 +161,7 @@ class OrderController extends BaseFrontController
}
if ($message !== false) {
Tlog::getInstance()->error(sprintf("Error during order delivery process : %s. Exception was %s", $message, $e->getMessage()));
Tlog::getInstance()->error(sprintf("Error during order payment process : %s. Exception was %s", $message, $e->getMessage()));
$orderPayment->setErrorMessage($message);
@@ -173,6 +173,55 @@ class OrderController extends BaseFrontController
}
public function pay()
{
/* check customer */
$this->checkAuth();
/* check cart count */
$this->checkCartNotEmpty();
/* check delivery address and module */
$this->checkValidDelivery();
/* check invoice address and payment module */
$this->checkValidInvoice();
$orderEvent = $this->getOrderEvent();
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_PAY, $orderEvent);
$placedOrder = $orderEvent->getPlacedOrder();
if(null !== $placedOrder && null !== $placedOrder->getId()) {
/* order has been placed */
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute('order.placed', array('order_id' => $orderEvent->getPlacedOrder()->getId()))));
} else {
/* order has not been placed */
$this->redirectToRoute("cart.view");
}
}
public function orderPlaced($order_id)
{
/* check if the placed order matched the customer */
$placedOrder = OrderQuery::create()->findPk(
$this->getRequest()->attributes->get('order_id')
);
if(null === $placedOrder) {
throw new TheliaProcessException("No placed order", TheliaProcessException::NO_PLACED_ORDER, $placedOrder);
}
$customer = $this->getSecurityContext()->getCustomerUser();
if(null === $customer || $placedOrder->getCustomerId() !== $customer->getId()) {
throw new TheliaProcessException("Received placed order id does not belong to the current customer", TheliaProcessException::PLACED_ORDER_ID_BAD_CURRENT_CUSTOMER, $placedOrder);
}
$this->getParserContext()->set("placed_order_id", $placedOrder->getId());
}
protected function getOrderEvent()
{
$order = $this->getOrder($this->getRequest());

View File

@@ -0,0 +1,54 @@
<?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\Core\Event;
use Thelia\Model\Accessory;
use Thelia\Core\Event\ActionEvent;
class AccessoryEvent extends ActionEvent
{
public $accessory = null;
public function __construct(Accessory $accessory = null)
{
$this->accessory = $accessory;
}
public function hasAccessory()
{
return ! is_null($this->accessory);
}
public function getAccessory()
{
return $this->accessory;
}
public function setAccessory(Accessory $accessory)
{
$this->accessory = $accessory;
return $this;
}
}

View File

@@ -0,0 +1,54 @@
<?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\Core\Event;
use Thelia\Model\CategoryAssociatedContent;
use Thelia\Core\Event\ActionEvent;
class CategoryAssociatedContentEvent extends ActionEvent
{
public $content = null;
public function __construct(CategoryAssociatedContent $content = null)
{
$this->content = $content;
}
public function hasCategoryAssociatedContent()
{
return ! is_null($this->content);
}
public function getCategoryAssociatedContent()
{
return $this->content;
}
public function setCategoryAssociatedContent(CategoryAssociatedContent $content)
{
$this->content = $content;
return $this;
}
}

View File

@@ -28,11 +28,13 @@ use Thelia\Model\Order;
class OrderEvent extends ActionEvent
{
protected $order = null;
protected $placedOrder = null;
protected $invoiceAddress = null;
protected $deliveryAddress = null;
protected $deliveryModule = null;
protected $paymentModule = null;
protected $postage = null;
protected $ref = null;
/**
* @param Order $order
@@ -50,12 +52,20 @@ class OrderEvent extends ActionEvent
$this->order = $order;
}
/**
* @param Order $order
*/
public function setPlacedOrder(Order $order)
{
$this->placedOrder = $order;
}
/**
* @param $address
*/
public function setInvoiceAddress($address)
{
$this->deliveryAddress = $address;
$this->invoiceAddress = $address;
}
/**
@@ -90,6 +100,14 @@ class OrderEvent extends ActionEvent
$this->postage = $postage;
}
/**
* @param $ref
*/
public function setRef($ref)
{
$this->ref = $ref;
}
/**
* @return null|Order
*/
@@ -98,6 +116,14 @@ class OrderEvent extends ActionEvent
return $this->order;
}
/**
* @return null|Order
*/
public function getPlacedOrder()
{
return $this->placedOrder;
}
/**
* @return null|int
*/
@@ -137,4 +163,12 @@ class OrderEvent extends ActionEvent
{
return $this->postage;
}
/**
* @return null|int
*/
public function getRef()
{
return $this->ref;
}
}

View File

@@ -0,0 +1,48 @@
<?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\Core\Event;
use Thelia\Model\Product;
class ProductAddAccessoryEvent extends ProductEvent
{
protected $accessory_id;
public function __construct(Product $product, $accessory_id)
{
parent::__construct($product);
$this->accessory_id = $accessory_id;
}
public function getAccessoryId()
{
return $this->accessory_id;
}
public function setAccessoryId($accessory_id)
{
$this->accessory_id = $accessory_id;
}
}

View File

@@ -0,0 +1,54 @@
<?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\Core\Event;
use Thelia\Model\ProductAssociatedContent;
use Thelia\Core\Event\ActionEvent;
class ProductAssociatedContentEvent extends ActionEvent
{
public $content = null;
public function __construct(ProductAssociatedContent $content = null)
{
$this->content = $content;
}
public function hasProductAssociatedContent()
{
return ! is_null($this->content);
}
public function getProductAssociatedContent()
{
return $this->content;
}
public function setProductAssociatedContent(ProductAssociatedContent $content)
{
$this->content = $content;
return $this;
}
}

View File

@@ -0,0 +1,48 @@
<?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\Core\Event;
use Thelia\Model\Product;
class ProductDeleteAccessoryEvent extends ProductEvent
{
protected $accessory_id;
public function __construct(Product $product, $accessory_id)
{
parent::__construct($product);
$this->accessory_id = $accessory_id;
}
public function getAccessoryId()
{
return $this->accessory_id;
}
public function setAccessoryId($accessory_id)
{
$this->accessory_id = $accessory_id;
}
}

View File

@@ -185,6 +185,16 @@ final class TheliaEvents
const BEFORE_UPDATEFOLDER = "action.before_updateFolder";
const AFTER_UPDATEFOLDER = "action.after_updateFolder";
// -- Categories Associated Content ----------------------------------------
const BEFORE_CREATECATEGORY_ASSOCIATED_CONTENT = "action.before_createCategoryAssociatedContent";
const AFTER_CREATECATEGORY_ASSOCIATED_CONTENT = "action.after_createCategoryAssociatedContent";
const BEFORE_DELETECATEGORY_ASSOCIATED_CONTENT = "action.before_deleteCategoryAssociatedContenty";
const AFTER_DELETECATEGORY_ASSOCIATED_CONTENT = "action.after_deleteproduct_accessory";
const BEFORE_UPDATECATEGORY_ASSOCIATED_CONTENT = "action.before_updateCategoryAssociatedContent";
const AFTER_UPDATECATEGORY_ASSOCIATED_CONTENT = "action.after_updateCategoryAssociatedContent";
// -- Product management -----------------------------------------------
@@ -197,6 +207,10 @@ final class TheliaEvents
const PRODUCT_ADD_CONTENT = "action.productAddContent";
const PRODUCT_REMOVE_CONTENT = "action.productRemoveContent";
const PRODUCT_ADD_ACCESSORY = "action.productAddAccessory";
const PRODUCT_REMOVE_ACCESSORY = "action.productRemoveAccessory";
const PRODUCT_UPDATE_ACCESSORY_POSITION = "action.updateProductPosition";
const BEFORE_CREATEPRODUCT = "action.before_createproduct";
const AFTER_CREATEPRODUCT = "action.after_createproduct";
@@ -206,6 +220,28 @@ final class TheliaEvents
const BEFORE_UPDATEPRODUCT = "action.before_updateProduct";
const AFTER_UPDATEPRODUCT = "action.after_updateProduct";
// -- Product Accessories --------------------------------------------------
const BEFORE_CREATEACCESSORY = "action.before_createAccessory";
const AFTER_CREATEACCESSORY = "action.after_createAccessory";
const BEFORE_DELETEACCESSORY = "action.before_deleteAccessory";
const AFTER_DELETEACCESSORY = "action.after_deleteAccessory";
const BEFORE_UPDATEACCESSORY = "action.before_updateAccessory";
const AFTER_UPDATEACCESSORY = "action.after_updateAccessory";
// -- Product Associated Content --------------------------------------------------
const BEFORE_CREATEPRODUCT_ASSOCIATED_CONTENT = "action.before_createProductAssociatedContent";
const AFTER_CREATEPRODUCT_ASSOCIATED_CONTENT = "action.after_createProductAssociatedContent";
const BEFORE_DELETEPRODUCT_ASSOCIATED_CONTENT = "action.before_deleteProductAssociatedContenty";
const AFTER_DELETEPRODUCT_ASSOCIATED_CONTENT = "action.after_deleteproduct_accessory";
const BEFORE_UPDATEPRODUCT_ASSOCIATED_CONTENT = "action.before_updateProductAssociatedContent";
const AFTER_UPDATEPRODUCT_ASSOCIATED_CONTENT = "action.after_updateProductAssociatedContent";
/**
* sent when a new existing cat id duplicated. This append when current customer is different from current cart
*/
@@ -236,9 +272,17 @@ final class TheliaEvents
/**
* Order linked event
*/
const ORDER_SET_BILLING_ADDRESS = "action.order.setBillingAddress";
const ORDER_SET_DELIVERY_ADDRESS = "action.order.setDeliveryAddress";
const ORDER_SET_DELIVERY_MODULE = "action.order.setDeliveryModule";
const ORDER_SET_INVOICE_ADDRESS = "action.order.setInvoiceAddress";
const ORDER_SET_PAYMENT_MODULE = "action.order.setPaymentModule";
const ORDER_PAY = "action.order.pay";
const ORDER_BEFORE_CREATE = "action.order.beforeCreate";
const ORDER_AFTER_CREATE = "action.order.afterCreate";
const ORDER_BEFORE_PAYMENT = "action.order.beforePayment";
const ORDER_PRODUCT_BEFORE_CREATE = "action.orderProduct.beforeCreate";
const ORDER_PRODUCT_AFTER_CREATE = "action.orderProduct.afterCreate";
/**
* Sent on image processing

View File

@@ -65,6 +65,8 @@ abstract class BaseI18nLoop extends BaseLoop
{
/* manage translations */
$fr = $this->getForce_return();
return ModelCriteriaTools::getI18n(
$this->getBackend_context(),
$this->getLang(),

View File

@@ -93,8 +93,10 @@ class Accessory extends Product
$accessories = $this->search($search);
$accessoryIdList = array(0);
$accessoryPosition = array();
foreach ($accessories as $accessory) {
array_push($accessoryIdList, $accessory->getAccessory());
$accessoryPosition[$accessory->getAccessory()] = $accessory->getPosition();
}
$receivedIdList = $this->getId();
@@ -106,7 +108,15 @@ class Accessory extends Product
$this->args->get('id')->setValue( implode(',', array_intersect($receivedIdList, $accessoryIdList)) );
}
return parent::exec($pagination);
$loopResult = parent::exec($pagination);
foreach($loopResult as $loopResultRow) {
$loopResultRow
->set("POSITION" , $accessoryPosition[$loopResultRow->get('ID')])
;
}
return $loopResult;
}
}

View File

@@ -58,7 +58,19 @@ class Argument
public function setValue($value)
{
$this->value = $value === null ? null : (string) $value;
$x = $value === null;
if($value === null) {
$this->value = null;
} else {
if(false === $value) {
/* (string) $value = "" */
$this->value = 0;
} else {
$this->value = (string) $value;
}
}
//$this->value = $value === null ? null : (string) $value;
}
public static function createAnyTypeArgument($name, $default=null, $mandatory=false, $empty=true)

View File

@@ -97,9 +97,9 @@ class AssociatedContent extends Content
$exclude_product = $this->getExcludeProduct();
// If we have to filter by template, find all attributes assigned to this template, and filter by found IDs
// If we have to filter by product, find all products assigned to this product, and filter by found IDs
if (null !== $exclude_product) {
// Exclure tous les attribut qui sont attachés aux templates indiqués
// Exclude all contents related to the given product
$search->filterById(
ProductAssociatedContentQuery::create()->filterByProductId($exclude_product)->select('product_id')->find(),
Criteria::NOT_IN
@@ -108,7 +108,7 @@ class AssociatedContent extends Content
$exclude_category = $this->getExcludeCategory();
// If we have to filter by template, find all attributes assigned to this template, and filter by found IDs
// If we have to filter by category, find all contents assigned to this category, and filter by found IDs
if (null !== $exclude_category) {
// Exclure tous les attribut qui sont attachés aux templates indiqués
$search->filterById(

View File

@@ -81,6 +81,8 @@ class Cart extends BaseLoop
return $result;
}
$taxCountry = CountryQuery::create()->findPk(64); // @TODO : make it magic;
foreach ($cartItems as $cartItem) {
$product = $cartItem->getProduct();
$productSaleElement = $cartItem->getProductSaleElements();
@@ -97,12 +99,8 @@ class Cart extends BaseLoop
->set("STOCK", $productSaleElement->getQuantity())
->set("PRICE", $cartItem->getPrice())
->set("PROMO_PRICE", $cartItem->getPromoPrice())
->set("TAXED_PRICE", $cartItem->getTaxedPrice(
CountryQuery::create()->findOneById(64) // @TODO : make it magic
))
->set("PROMO_TAXED_PRICE", $cartItem->getTaxedPromoPrice(
CountryQuery::create()->findOneById(64) // @TODO : make it magic
))
->set("TAXED_PRICE", $cartItem->getTaxedPrice($taxCountry))
->set("PROMO_TAXED_PRICE", $cartItem->getTaxedPromoPrice($taxCountry))
->set("IS_PROMO", $cartItem->getPromo() === 1 ? 1 : 0);
$result->addRow($loopResultRow);
}
@@ -110,4 +108,13 @@ class Cart extends BaseLoop
return $result;
}
/**
* Return the event dispatcher,
*
* @return \Symfony\Component\EventDispatcher\EventDispatcher
*/
public function getDispatcher()
{
return $this->dispatcher;
}
}

View File

@@ -206,7 +206,8 @@ class Category extends BaseI18nLoop
->set("POSTSCRIPTUM", $category->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("PARENT", $category->getParent())
->set("URL", $category->getUrl($locale))
->set("PRODUCT_COUNT", $category->countChild())
->set("PRODUCT_COUNT", $category->countAllProducts())
->set("CHILD_COUNT", $category->countChild())
->set("VISIBLE", $category->getVisible() ? "1" : "0")
->set("POSITION", $category->getPosition())

View File

@@ -59,7 +59,7 @@ class CategoryTree extends BaseI18nLoop
}
// changement de rubrique
protected function buildCategoryTree($parent, $visible, $level, $max_level, $exclude, LoopResult &$loopResult)
protected function buildCategoryTree($parent, $visible, $level, $previousLevel, $max_level, $exclude, LoopResult &$loopResult)
{
if ($level > $max_level) return;
@@ -87,11 +87,12 @@ class CategoryTree extends BaseI18nLoop
->set("ID", $result->getId())->set("TITLE", $result->getVirtualColumn('i18n_TITLE'))
->set("PARENT", $result->getParent())->set("URL", $result->getUrl($locale))
->set("VISIBLE", $result->getVisible() ? "1" : "0")->set("LEVEL", $level)
->set('CHILD_COUNT', $result->countChild())->set('PREV_LEVEL', $previousLevel)
;
$loopResult->addRow($loopResultRow);
$this->buildCategoryTree($result->getId(), $visible, 1 + $level, $max_level, $exclude, $loopResult);
$this->buildCategoryTree($result->getId(), $visible, 1 + $level, $level, $max_level, $exclude, $loopResult);
}
}
@@ -109,7 +110,7 @@ class CategoryTree extends BaseI18nLoop
$loopResult = new LoopResult();
$this->buildCategoryTree($id, $visible, 0, $depth, $exclude, $loopResult);
$this->buildCategoryTree($id, $visible, 0, 0, $depth, $exclude, $loopResult);
return $loopResult;
}

View File

@@ -31,10 +31,12 @@ use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\Base\CategoryQuery;
use Thelia\Model\Base\ProductCategoryQuery;
use Thelia\Model\Base\FeatureQuery;
use Thelia\Model\CategoryQuery;
use Thelia\Model\FeatureI18nQuery;
use Thelia\Model\ProductCategoryQuery;
use Thelia\Model\FeatureQuery;
use Thelia\Model\Map\ProductCategoryTableMap;
use Thelia\Model\ProductQuery;
use Thelia\Type\TypeCollection;
use Thelia\Type;
use Thelia\Type\BooleanOrBothType;
@@ -71,7 +73,8 @@ class Feature extends BaseI18nLoop
new Type\EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual_reverse'))
),
'manual'
)
),
Argument::createAnyTypeArgument('title')
);
}
@@ -134,6 +137,23 @@ class Feature extends BaseI18nLoop
);
}
$title = $this->getTitle();
if (null !== $title) {
//find all feture that match exactly this title and find with all locales.
$features = FeatureI18nQuery::create()
->filterByTitle($title, Criteria::LIKE)
->select('id')
->find();
if($features) {
$search->filterById(
$features,
Criteria::IN
);
}
}
$orders = $this->getOrder();
foreach ($orders as $order) {

View File

@@ -162,7 +162,8 @@ class Folder extends BaseI18nLoop
->set("POSTSCRIPTUM", $folder->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("PARENT", $folder->getParent())
->set("URL", $folder->getUrl($locale))
->set("CONTENT_COUNT", $folder->countChild())
->set("CHILD_COUNT", $folder->countChild())
->set("CONTENT_COUNT", $folder->countAllContents())
->set("VISIBLE", $folder->getVisible() ? "1" : "0")
->set("POSITION", $folder->getPosition())
;

View File

@@ -0,0 +1,118 @@
<?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\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\FolderQuery;
use Thelia\Type;
use Thelia\Type\BooleanOrBothType;
use Thelia\Core\Template\Element\BaseI18nLoop;
/**
*
* Folder tree loop, to get a folder tree from a given folder to a given depth.
*
* - folder is the folder id
* - depth is the maximum depth to go, default unlimited
* - visible if true or missing, only visible categories will be displayed. If false, all categories (visible or not) are returned.
*
* @package Thelia\Core\Template\Loop
* @author Franck Allimant <franck@cqfdev.fr>
*/
class FolderTree extends BaseI18nLoop
{
/**
* @return ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntTypeArgument('folder', null, true),
Argument::createIntTypeArgument('depth', PHP_INT_MAX),
Argument::createBooleanOrBothTypeArgument('visible', true, false),
Argument::createIntListTypeArgument('exclude', array())
);
}
// changement de rubrique
protected function buildFolderTree($parent, $visible, $level, $max_level, $exclude, LoopResult &$loopResult)
{
if ($level > $max_level) return;
$search = FolderQuery::create();
$locale = $this->configureI18nProcessing($search, array(
'TITLE'
));
$search->filterByParent($parent);
if ($visible != BooleanOrBothType::ANY) $search->filterByVisible($visible);
if ($exclude != null) $search->filterById($exclude, Criteria::NOT_IN);
$search->orderByPosition(Criteria::ASC);
$results = $search->find();
foreach ($results as $result) {
$loopResultRow = new LoopResultRow();
$loopResultRow
->set("ID", $result->getId())->set("TITLE", $result->getVirtualColumn('i18n_TITLE'))
->set("PARENT", $result->getParent())->set("URL", $result->getUrl($locale))
->set("VISIBLE", $result->getVisible() ? "1" : "0")->set("LEVEL", $level)
;
$loopResult->addRow($loopResultRow);
$this->buildFolderTree($result->getId(), $visible, 1 + $level, $max_level, $exclude, $loopResult);
}
}
/**
* @param $pagination (ignored)
*
* @return \Thelia\Core\Template\Element\LoopResult
*/
public function exec(&$pagination)
{
$id = $this->getFolder();
$depth = $this->getDepth();
$visible = $this->getVisible();
$exclude = $this->getExclude();
$loopResult = new LoopResult();
$this->buildFolderTree($id, $visible, 0, $depth, $exclude, $loopResult);
return $loopResult;
}
}

View File

@@ -93,7 +93,8 @@ class Image extends BaseI18nLoop
new EnumType($this->possible_sources)
)
),
Argument::createIntTypeArgument('source_id')
Argument::createIntTypeArgument('source_id'),
Argument::createBooleanTypeArgument('force_return', true)
);
// Add possible image sources

View File

@@ -0,0 +1,137 @@
<?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\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\ModuleQuery;
use Thelia\Module\BaseModule;
use Thelia\Type;
/**
*
* Module loop
*
*
* Class Module
* @package Thelia\Core\Template\Loop
* @author Etienne Roudeix <eroudeix@openstudio.fr>
*/
class Module extends BaseI18nLoop
{
public $timestampable = true;
/**
* @return ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntListTypeArgument('id'),
new Argument(
'module_type',
new Type\TypeCollection(
new Type\EnumListType(array(
BaseModule::CLASSIC_MODULE_TYPE,
BaseModule::DELIVERY_MODULE_TYPE,
BaseModule::PAYMENT_MODULE_TYPE,
))
)
),
Argument::createIntListTypeArgument('exclude'),
Argument::createBooleanOrBothTypeArgument('active', Type\BooleanOrBothType::ANY)
);
}
/**
* @param $pagination
*
* @return \Thelia\Core\Template\Element\LoopResult
*/
public function exec(&$pagination)
{
$search = ModuleQuery::create();
/* manage translations */
$locale = $this->configureI18nProcessing($search);
$id = $this->getId();
if (null !== $id) {
$search->filterById($id, Criteria::IN);
}
$moduleType = $this->getModule_type();
if (null !== $moduleType) {
$search->filterByType($moduleType, Criteria::IN);
}
$exclude = $this->getExclude();
if (!is_null($exclude)) {
$search->filterById($exclude, Criteria::NOT_IN);
}
$active = $this->getActive();
if($active !== Type\BooleanOrBothType::ANY) {
$search->filterByActivate($active ? 1 : 0, Criteria::EQUAL);
}
$search->orderByPosition();
/* perform search */
$modules = $this->search($search, $pagination);
$loopResult = new LoopResult($modules);
foreach ($modules as $module) {
$loopResultRow = new LoopResultRow($loopResult, $module, $this->versionable, $this->timestampable, $this->countable);
$loopResultRow->set("ID", $module->getId())
->set("IS_TRANSLATED",$module->getVirtualColumn('IS_TRANSLATED'))
->set("LOCALE",$locale)
->set("TITLE",$module->getVirtualColumn('i18n_TITLE'))
->set("CHAPO", $module->getVirtualColumn('i18n_CHAPO'))
->set("DESCRIPTION", $module->getVirtualColumn('i18n_DESCRIPTION'))
->set("POSTSCRIPTUM", $module->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("CODE", $module->getCode())
->set("TYPE", $module->getType())
->set("ACTIVE", $module->getActivate())
->set("CLASS", $module->getFullNamespace())
->set("POSITION", $module->getPosition());
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}

View File

@@ -23,12 +23,16 @@
namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\OrderQuery;
use Thelia\Type\TypeCollection;
use Thelia\Type;
/**
*
* @package Thelia\Core\Template\Loop
@@ -37,19 +41,94 @@ use Thelia\Core\Template\Loop\Argument\Argument;
*/
class Order extends BaseLoop
{
public $countable = true;
public $timestampable = true;
public $versionable = false;
public function getArgDefinitions()
{
return new ArgumentCollection();
return new ArgumentCollection(
Argument::createIntListTypeArgument('id'),
new Argument(
'customer',
new TypeCollection(
new Type\IntType(),
new Type\EnumType(array('current'))
),
'current'
),
Argument::createIntListTypeArgument('status')
);
}
/**
* @param $pagination
*
*
* @return \Thelia\Core\Template\Element\LoopResult
* @return LoopResult
*/
public function exec(&$pagination)
{
// TODO : a coder !
$search = OrderQuery::create();
$id = $this->getId();
if (null !== $id) {
$search->filterById($id, Criteria::IN);
}
$customer = $this->getCustomer();
if ($customer === 'current') {
$currentCustomer = $this->securityContext->getCustomerUser();
if ($currentCustomer === null) {
return new LoopResult();
} else {
$search->filterByCustomerId($currentCustomer->getId(), Criteria::EQUAL);
}
} else {
$search->filterByCustomerId($customer, Criteria::EQUAL);
}
$status = $this->getStatus();
if (null !== $status) {
$search->filterByStatusId($status, Criteria::IN);
}
$orders = $this->search($search, $pagination);
$loopResult = new LoopResult($orders);
foreach ($orders as $order) {
$tax = 0;
$amount = $order->getTotalAmount($tax);
$loopResultRow = new LoopResultRow($loopResult, $order, $this->versionable, $this->timestampable, $this->countable);
$loopResultRow
->set("ID", $order->getId())
->set("REF", $order->getRef())
->set("CUSTOMER", $order->getCustomerId())
->set("DELIVERY_ADDRESS", $order->getDeliveryOrderAddressId())
->set("INVOICE_ADDRESS", $order->getInvoiceOrderAddressId())
->set("INVOICE_DATE", $order->getInvoiceDate())
->set("CURRENCY", $order->getCurrencyId())
->set("CURRENCY_RATE", $order->getCurrencyRate())
->set("TRANSACTION_REF", $order->getTransactionRef())
->set("DELIVERY_REF", $order->getDeliveryRef())
->set("INVOICE_REF", $order->getInvoiceRef())
->set("POSTAGE", $order->getPostage())
->set("PAYMENT_MODULE", $order->getPaymentModuleId())
->set("DELIVERY_MODULE", $order->getDeliveryModuleId())
->set("STATUS", $order->getStatusId())
->set("LANG", $order->getLangId())
->set("POSTAGE", $order->getPostage())
->set("TOTAL_TAX", $tax)
->set("TOTAL_AMOUNT", $amount - $tax)
->set("TOTAL_TAXED_AMOUNT", $amount)
;
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}

View File

@@ -24,6 +24,7 @@
namespace Thelia\Core\Template\Smarty\Plugins;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher;
use Symfony\Component\HttpFoundation\Request;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Core\Security\SecurityContext;
@@ -53,12 +54,14 @@ class DataAccessFunctions extends AbstractSmartyPlugin
private $securityContext;
protected $parserContext;
protected $request;
protected $dispatcher;
public function __construct(Request $request, SecurityContext $securityContext, ParserContext $parserContext)
public function __construct(Request $request, SecurityContext $securityContext, ParserContext $parserContext, ContainerAwareEventDispatcher $dispatcher)
{
$this->securityContext = $securityContext;
$this->parserContext = $parserContext;
$this->request = $request;
$this->dispatcher = $dispatcher;
}
/**
@@ -195,6 +198,12 @@ class DataAccessFunctions extends AbstractSmartyPlugin
return $order->getPostage();
case 'delivery_address':
return $order->chosenDeliveryAddress;
case 'invoice_address':
return $order->chosenInvoiceAddress;
case 'delivery_module':
return $order->getDeliveryModuleId();
case 'payment_module':
return $order->getPaymentModuleId();
}
throw new \InvalidArgumentException(sprintf("%s has no '%s' attribute", 'Order', $attribute));
@@ -320,4 +329,14 @@ class DataAccessFunctions extends AbstractSmartyPlugin
new SmartyPluginDescriptor('function', 'order', $this, 'orderDataAccess'),
);
}
/**
* Return the event dispatcher,
*
* @return \Symfony\Component\EventDispatcher\EventDispatcher
*/
public function getDispatcher()
{
return $this->dispatcher;
}
}

View File

@@ -132,6 +132,8 @@ class TheliaLoop extends AbstractSmartyPlugin
$loopResults = $loop->exec(self::$pagination[$name]);
$loopResults->rewind();
$this->loopstack[$name] = $loopResults;
// Pas de résultat ? la boucle est terminée, ne pas évaluer le contenu.

View File

@@ -186,7 +186,8 @@ class UrlGenerator extends AbstractSmartyPlugin
protected function getCurrentUrl()
{
return URL::getInstance()->retrieveCurrent($this->request)->toString();
//return URL::getInstance()->retrieveCurrent($this->request)->toString();
return $this->request->getUri();
}
protected function getReturnToUrl()

View File

@@ -266,4 +266,14 @@ class CouponBaseAdapter implements CouponAdapterInterface
{
return $this->container->get('thelia.constraint.validator');
}
/**
* Return the event dispatcher,
*
* @return \Symfony\Component\EventDispatcher\EventDispatcher
*/
public function getDispatcher()
{
return $this->container->get('event_dispatcher');
}
}

View File

@@ -39,6 +39,7 @@ class TaxEngineException extends \RuntimeException
const UNDEFINED_TAX_RULES_COLLECTION = 503;
const UNDEFINED_REQUIREMENTS = 504;
const UNDEFINED_REQUIREMENT_VALUE = 505;
const UNDEFINED_TAX_RULE = 506;
const BAD_AMOUNT_FORMAT = 601;

View File

@@ -0,0 +1,54 @@
<?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\Exception;
/**
* these exception are non fatal exception, due to thelia process exception
* or customer random navigation
*
* they redirect the customer who trig them to a specific error page // @todo
*
* Class TheliaProcessException
* @package Thelia\Exception
*/
class TheliaProcessException extends \RuntimeException
{
public $data = null;
const UNKNOWN_EXCEPTION = 0;
const CART_ITEM_NOT_ENOUGH_STOCK = 100;
const NO_PLACED_ORDER = 101;
const PLACED_ORDER_ID_BAD_CURRENT_CUSTOMER = 102;
public function __construct($message, $code = null, $data = null, $previous = null)
{
$this->data = $data;
if ($code === null) {
$code = self::UNKNOWN_EXCEPTION;
}
parent::__construct($message, $code, $previous);
}
}

View File

@@ -80,11 +80,18 @@ class OrderDelivery extends BaseForm
->filterByType(BaseModule::DELIVERY_MODULE_TYPE)
->filterByActivate(1)
->filterById($value)
->find();
->findOne();
if(null === $module) {
$context->addViolation("Delivery module ID not found");
}
$moduleReflection = new \ReflectionClass($module->getFullNamespace());
if ($moduleReflection->isSubclassOf("Thelia\Module\DeliveryModuleInterface") === false) {
$context->addViolation(
sprintf("delivery module %s is not a Thelia\Module\DeliveryModuleInterface", $module->getCode())
);
}
}
public function getName()

View File

@@ -80,11 +80,18 @@ class OrderPayment extends BaseForm
->filterByType(BaseModule::PAYMENT_MODULE_TYPE)
->filterByActivate(1)
->filterById($value)
->find();
->findOne();
if(null === $module) {
$context->addViolation("Payment module ID not found");
}
$moduleReflection = new \ReflectionClass($module->getFullNamespace());
if ($moduleReflection->isSubclassOf("Thelia\Module\PaymentModuleInterface") === false) {
$context->addViolation(
sprintf("delivery module %s is not a Thelia\Module\PaymentModuleInterface", $module->getCode())
);
}
}
public function getName()

View File

@@ -44,32 +44,26 @@ class ProductCreationForm extends BaseForm
->add("ref", "text", array(
"constraints" => $ref_constraints,
"label" => "Product reference *",
"label_attr" => array(
"for" => "ref"
)
"label_attr" => array("for" => "ref")
))
->add("title", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => "Product title *",
"label_attr" => array(
"for" => "title"
)
"label_attr" => array("for" => "title")
))
->add("default_category", "integer", array(
"constraints" => array(
new NotBlank()
)
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Default product category."),
"label_attr" => array("for" => "default_category_field")
))
->add("locale", "text", array(
"constraints" => array(
new NotBlank()
)
"constraints" => array(new NotBlank())
))
->add("visible", "integer", array(
"label" => Translator::getInstance()->trans("This product is online."),
"label_attr" => array("for" => "visible_create")
"label_attr" => array("for" => "visible_field")
))
;
}

View File

@@ -0,0 +1,119 @@
<?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\Form;
use Symfony\Component\Validator\Constraints;
use Thelia\Core\Translation\Translator;
use Thelia\Model\ConfigQuery;
/**
* Class ProfileModification
* @package Thelia\Form
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class ProfileModificationForm extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add("firstname", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("First Name"),
"label_attr" => array(
"for" => "firstname"
)
))
->add("lastname", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Last Name"),
"label_attr" => array(
"for" => "lastname"
)
))
->add("default_language", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Default language"),
"label_attr" => array(
"for" => "default_language"
)
))
->add("editing_language_default", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Editing language default"),
"label_attr" => array(
"for" => "editing_language_default"
)
))
->add("old_password", "password", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4)))
),
"label" => Translator::getInstance()->trans("Old password"),
"label_attr" => array(
"for" => "old_password"
)
))
->add("password", "password", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4)))
),
"label" => Translator::getInstance()->trans("Password"),
"label_attr" => array(
"for" => "password"
)
))
->add("password_confirm", "password", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4))),
new Constraints\Callback(array("methods" => array(
array($this, "verifyPasswordField")
)))
),
"label" => "Password confirmation",
"label_attr" => array(
"for" => "password_confirmation"
)
))
;
}
public function getName()
{
return "thelia_profile_modification";
}
}

View File

@@ -3,7 +3,77 @@
namespace Thelia\Model;
use Thelia\Model\Base\Accessory as BaseAccessory;
use Thelia\Core\Event\TheliaEvents;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Core\Event\AccessoryEvent;
class Accessory extends BaseAccessory {
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
use \Thelia\Model\Tools\PositionManagementTrait;
/**
* Calculate next position relative to our product
*/
protected function addCriteriaToPositionQuery($query) {
$query->filterByProductId($this->getProductId());
}
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->setPosition($this->getNextPosition());
$this->dispatchEvent(TheliaEvents::BEFORE_CREATEACCESSORY, new AccessoryEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_CREATEACCESSORY, new AccessoryEvent($this));
}
/**
* {@inheritDoc}
*/
public function preUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_UPDATEACCESSORY, new AccessoryEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_UPDATEACCESSORY, new AccessoryEvent($this));
}
/**
* {@inheritDoc}
*/
public function preDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_DELETEACCESSORY, new AccessoryEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_DELETEACCESSORY, new AccessoryEvent($this));
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,897 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\OrderProductAttributeCombination as ChildOrderProductAttributeCombination;
use Thelia\Model\OrderProductAttributeCombinationQuery as ChildOrderProductAttributeCombinationQuery;
use Thelia\Model\Map\OrderProductAttributeCombinationTableMap;
/**
* Base class that represents a query for the 'order_product_attribute_combination' table.
*
*
*
* @method ChildOrderProductAttributeCombinationQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildOrderProductAttributeCombinationQuery orderByOrderProductId($order = Criteria::ASC) Order by the order_product_id column
* @method ChildOrderProductAttributeCombinationQuery orderByAttributeTitle($order = Criteria::ASC) Order by the attribute_title column
* @method ChildOrderProductAttributeCombinationQuery orderByAttributeChapo($order = Criteria::ASC) Order by the attribute_chapo column
* @method ChildOrderProductAttributeCombinationQuery orderByAttributeDescription($order = Criteria::ASC) Order by the attribute_description column
* @method ChildOrderProductAttributeCombinationQuery orderByAttributePostscriptumn($order = Criteria::ASC) Order by the attribute_postscriptumn column
* @method ChildOrderProductAttributeCombinationQuery orderByAttributeAvTitle($order = Criteria::ASC) Order by the attribute_av_title column
* @method ChildOrderProductAttributeCombinationQuery orderByAttributeAvChapo($order = Criteria::ASC) Order by the attribute_av_chapo column
* @method ChildOrderProductAttributeCombinationQuery orderByAttributeAvDescription($order = Criteria::ASC) Order by the attribute_av_description column
* @method ChildOrderProductAttributeCombinationQuery orderByAttributeAvPostscriptum($order = Criteria::ASC) Order by the attribute_av_postscriptum column
* @method ChildOrderProductAttributeCombinationQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildOrderProductAttributeCombinationQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildOrderProductAttributeCombinationQuery groupById() Group by the id column
* @method ChildOrderProductAttributeCombinationQuery groupByOrderProductId() Group by the order_product_id column
* @method ChildOrderProductAttributeCombinationQuery groupByAttributeTitle() Group by the attribute_title column
* @method ChildOrderProductAttributeCombinationQuery groupByAttributeChapo() Group by the attribute_chapo column
* @method ChildOrderProductAttributeCombinationQuery groupByAttributeDescription() Group by the attribute_description column
* @method ChildOrderProductAttributeCombinationQuery groupByAttributePostscriptumn() Group by the attribute_postscriptumn column
* @method ChildOrderProductAttributeCombinationQuery groupByAttributeAvTitle() Group by the attribute_av_title column
* @method ChildOrderProductAttributeCombinationQuery groupByAttributeAvChapo() Group by the attribute_av_chapo column
* @method ChildOrderProductAttributeCombinationQuery groupByAttributeAvDescription() Group by the attribute_av_description column
* @method ChildOrderProductAttributeCombinationQuery groupByAttributeAvPostscriptum() Group by the attribute_av_postscriptum column
* @method ChildOrderProductAttributeCombinationQuery groupByCreatedAt() Group by the created_at column
* @method ChildOrderProductAttributeCombinationQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildOrderProductAttributeCombinationQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildOrderProductAttributeCombinationQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildOrderProductAttributeCombinationQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildOrderProductAttributeCombinationQuery leftJoinOrderProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderProduct relation
* @method ChildOrderProductAttributeCombinationQuery rightJoinOrderProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderProduct relation
* @method ChildOrderProductAttributeCombinationQuery innerJoinOrderProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderProduct relation
*
* @method ChildOrderProductAttributeCombination findOne(ConnectionInterface $con = null) Return the first ChildOrderProductAttributeCombination matching the query
* @method ChildOrderProductAttributeCombination findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrderProductAttributeCombination matching the query, or a new ChildOrderProductAttributeCombination object populated from the query conditions when no match is found
*
* @method ChildOrderProductAttributeCombination findOneById(int $id) Return the first ChildOrderProductAttributeCombination filtered by the id column
* @method ChildOrderProductAttributeCombination findOneByOrderProductId(int $order_product_id) Return the first ChildOrderProductAttributeCombination filtered by the order_product_id column
* @method ChildOrderProductAttributeCombination findOneByAttributeTitle(string $attribute_title) Return the first ChildOrderProductAttributeCombination filtered by the attribute_title column
* @method ChildOrderProductAttributeCombination findOneByAttributeChapo(string $attribute_chapo) Return the first ChildOrderProductAttributeCombination filtered by the attribute_chapo column
* @method ChildOrderProductAttributeCombination findOneByAttributeDescription(string $attribute_description) Return the first ChildOrderProductAttributeCombination filtered by the attribute_description column
* @method ChildOrderProductAttributeCombination findOneByAttributePostscriptumn(string $attribute_postscriptumn) Return the first ChildOrderProductAttributeCombination filtered by the attribute_postscriptumn column
* @method ChildOrderProductAttributeCombination findOneByAttributeAvTitle(string $attribute_av_title) Return the first ChildOrderProductAttributeCombination filtered by the attribute_av_title column
* @method ChildOrderProductAttributeCombination findOneByAttributeAvChapo(string $attribute_av_chapo) Return the first ChildOrderProductAttributeCombination filtered by the attribute_av_chapo column
* @method ChildOrderProductAttributeCombination findOneByAttributeAvDescription(string $attribute_av_description) Return the first ChildOrderProductAttributeCombination filtered by the attribute_av_description column
* @method ChildOrderProductAttributeCombination findOneByAttributeAvPostscriptum(string $attribute_av_postscriptum) Return the first ChildOrderProductAttributeCombination filtered by the attribute_av_postscriptum column
* @method ChildOrderProductAttributeCombination findOneByCreatedAt(string $created_at) Return the first ChildOrderProductAttributeCombination filtered by the created_at column
* @method ChildOrderProductAttributeCombination findOneByUpdatedAt(string $updated_at) Return the first ChildOrderProductAttributeCombination filtered by the updated_at column
*
* @method array findById(int $id) Return ChildOrderProductAttributeCombination objects filtered by the id column
* @method array findByOrderProductId(int $order_product_id) Return ChildOrderProductAttributeCombination objects filtered by the order_product_id column
* @method array findByAttributeTitle(string $attribute_title) Return ChildOrderProductAttributeCombination objects filtered by the attribute_title column
* @method array findByAttributeChapo(string $attribute_chapo) Return ChildOrderProductAttributeCombination objects filtered by the attribute_chapo column
* @method array findByAttributeDescription(string $attribute_description) Return ChildOrderProductAttributeCombination objects filtered by the attribute_description column
* @method array findByAttributePostscriptumn(string $attribute_postscriptumn) Return ChildOrderProductAttributeCombination objects filtered by the attribute_postscriptumn column
* @method array findByAttributeAvTitle(string $attribute_av_title) Return ChildOrderProductAttributeCombination objects filtered by the attribute_av_title column
* @method array findByAttributeAvChapo(string $attribute_av_chapo) Return ChildOrderProductAttributeCombination objects filtered by the attribute_av_chapo column
* @method array findByAttributeAvDescription(string $attribute_av_description) Return ChildOrderProductAttributeCombination objects filtered by the attribute_av_description column
* @method array findByAttributeAvPostscriptum(string $attribute_av_postscriptum) Return ChildOrderProductAttributeCombination objects filtered by the attribute_av_postscriptum column
* @method array findByCreatedAt(string $created_at) Return ChildOrderProductAttributeCombination objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildOrderProductAttributeCombination objects filtered by the updated_at column
*
*/
abstract class OrderProductAttributeCombinationQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\OrderProductAttributeCombinationQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\OrderProductAttributeCombination', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildOrderProductAttributeCombinationQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildOrderProductAttributeCombinationQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\OrderProductAttributeCombinationQuery) {
return $criteria;
}
$query = new \Thelia\Model\OrderProductAttributeCombinationQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildOrderProductAttributeCombination|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = OrderProductAttributeCombinationTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(OrderProductAttributeCombinationTableMap::DATABASE_NAME);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildOrderProductAttributeCombination A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, ORDER_PRODUCT_ID, ATTRIBUTE_TITLE, ATTRIBUTE_CHAPO, ATTRIBUTE_DESCRIPTION, ATTRIBUTE_POSTSCRIPTUMN, ATTRIBUTE_AV_TITLE, ATTRIBUTE_AV_CHAPO, ATTRIBUTE_AV_DESCRIPTION, ATTRIBUTE_AV_POSTSCRIPTUM, CREATED_AT, UPDATED_AT FROM order_product_attribute_combination WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildOrderProductAttributeCombination();
$obj->hydrate($row);
OrderProductAttributeCombinationTableMap::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildOrderProductAttributeCombination|array|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ID, $key, Criteria::EQUAL);
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ID, $keys, Criteria::IN);
}
/**
* Filter the query on the id column
*
* Example usage:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @param mixed $id The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(OrderProductAttributeCombinationTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(OrderProductAttributeCombinationTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the order_product_id column
*
* Example usage:
* <code>
* $query->filterByOrderProductId(1234); // WHERE order_product_id = 1234
* $query->filterByOrderProductId(array(12, 34)); // WHERE order_product_id IN (12, 34)
* $query->filterByOrderProductId(array('min' => 12)); // WHERE order_product_id > 12
* </code>
*
* @see filterByOrderProduct()
*
* @param mixed $orderProductId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByOrderProductId($orderProductId = null, $comparison = null)
{
if (is_array($orderProductId)) {
$useMinMax = false;
if (isset($orderProductId['min'])) {
$this->addUsingAlias(OrderProductAttributeCombinationTableMap::ORDER_PRODUCT_ID, $orderProductId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($orderProductId['max'])) {
$this->addUsingAlias(OrderProductAttributeCombinationTableMap::ORDER_PRODUCT_ID, $orderProductId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ORDER_PRODUCT_ID, $orderProductId, $comparison);
}
/**
* Filter the query on the attribute_title column
*
* Example usage:
* <code>
* $query->filterByAttributeTitle('fooValue'); // WHERE attribute_title = 'fooValue'
* $query->filterByAttributeTitle('%fooValue%'); // WHERE attribute_title LIKE '%fooValue%'
* </code>
*
* @param string $attributeTitle The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByAttributeTitle($attributeTitle = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($attributeTitle)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $attributeTitle)) {
$attributeTitle = str_replace('*', '%', $attributeTitle);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ATTRIBUTE_TITLE, $attributeTitle, $comparison);
}
/**
* Filter the query on the attribute_chapo column
*
* Example usage:
* <code>
* $query->filterByAttributeChapo('fooValue'); // WHERE attribute_chapo = 'fooValue'
* $query->filterByAttributeChapo('%fooValue%'); // WHERE attribute_chapo LIKE '%fooValue%'
* </code>
*
* @param string $attributeChapo The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByAttributeChapo($attributeChapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($attributeChapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $attributeChapo)) {
$attributeChapo = str_replace('*', '%', $attributeChapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ATTRIBUTE_CHAPO, $attributeChapo, $comparison);
}
/**
* Filter the query on the attribute_description column
*
* Example usage:
* <code>
* $query->filterByAttributeDescription('fooValue'); // WHERE attribute_description = 'fooValue'
* $query->filterByAttributeDescription('%fooValue%'); // WHERE attribute_description LIKE '%fooValue%'
* </code>
*
* @param string $attributeDescription The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByAttributeDescription($attributeDescription = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($attributeDescription)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $attributeDescription)) {
$attributeDescription = str_replace('*', '%', $attributeDescription);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ATTRIBUTE_DESCRIPTION, $attributeDescription, $comparison);
}
/**
* Filter the query on the attribute_postscriptumn column
*
* Example usage:
* <code>
* $query->filterByAttributePostscriptumn('fooValue'); // WHERE attribute_postscriptumn = 'fooValue'
* $query->filterByAttributePostscriptumn('%fooValue%'); // WHERE attribute_postscriptumn LIKE '%fooValue%'
* </code>
*
* @param string $attributePostscriptumn The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByAttributePostscriptumn($attributePostscriptumn = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($attributePostscriptumn)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $attributePostscriptumn)) {
$attributePostscriptumn = str_replace('*', '%', $attributePostscriptumn);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ATTRIBUTE_POSTSCRIPTUMN, $attributePostscriptumn, $comparison);
}
/**
* Filter the query on the attribute_av_title column
*
* Example usage:
* <code>
* $query->filterByAttributeAvTitle('fooValue'); // WHERE attribute_av_title = 'fooValue'
* $query->filterByAttributeAvTitle('%fooValue%'); // WHERE attribute_av_title LIKE '%fooValue%'
* </code>
*
* @param string $attributeAvTitle The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByAttributeAvTitle($attributeAvTitle = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($attributeAvTitle)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $attributeAvTitle)) {
$attributeAvTitle = str_replace('*', '%', $attributeAvTitle);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_TITLE, $attributeAvTitle, $comparison);
}
/**
* Filter the query on the attribute_av_chapo column
*
* Example usage:
* <code>
* $query->filterByAttributeAvChapo('fooValue'); // WHERE attribute_av_chapo = 'fooValue'
* $query->filterByAttributeAvChapo('%fooValue%'); // WHERE attribute_av_chapo LIKE '%fooValue%'
* </code>
*
* @param string $attributeAvChapo The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByAttributeAvChapo($attributeAvChapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($attributeAvChapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $attributeAvChapo)) {
$attributeAvChapo = str_replace('*', '%', $attributeAvChapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_CHAPO, $attributeAvChapo, $comparison);
}
/**
* Filter the query on the attribute_av_description column
*
* Example usage:
* <code>
* $query->filterByAttributeAvDescription('fooValue'); // WHERE attribute_av_description = 'fooValue'
* $query->filterByAttributeAvDescription('%fooValue%'); // WHERE attribute_av_description LIKE '%fooValue%'
* </code>
*
* @param string $attributeAvDescription The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByAttributeAvDescription($attributeAvDescription = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($attributeAvDescription)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $attributeAvDescription)) {
$attributeAvDescription = str_replace('*', '%', $attributeAvDescription);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_DESCRIPTION, $attributeAvDescription, $comparison);
}
/**
* Filter the query on the attribute_av_postscriptum column
*
* Example usage:
* <code>
* $query->filterByAttributeAvPostscriptum('fooValue'); // WHERE attribute_av_postscriptum = 'fooValue'
* $query->filterByAttributeAvPostscriptum('%fooValue%'); // WHERE attribute_av_postscriptum LIKE '%fooValue%'
* </code>
*
* @param string $attributeAvPostscriptum The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByAttributeAvPostscriptum($attributeAvPostscriptum = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($attributeAvPostscriptum)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $attributeAvPostscriptum)) {
$attributeAvPostscriptum = str_replace('*', '%', $attributeAvPostscriptum);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_POSTSCRIPTUM, $attributeAvPostscriptum, $comparison);
}
/**
* Filter the query on the created_at column
*
* Example usage:
* <code>
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
* </code>
*
* @param mixed $createdAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByCreatedAt($createdAt = null, $comparison = null)
{
if (is_array($createdAt)) {
$useMinMax = false;
if (isset($createdAt['min'])) {
$this->addUsingAlias(OrderProductAttributeCombinationTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(OrderProductAttributeCombinationTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::CREATED_AT, $createdAt, $comparison);
}
/**
* Filter the query on the updated_at column
*
* Example usage:
* <code>
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
* </code>
*
* @param mixed $updatedAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
{
if (is_array($updatedAt)) {
$useMinMax = false;
if (isset($updatedAt['min'])) {
$this->addUsingAlias(OrderProductAttributeCombinationTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(OrderProductAttributeCombinationTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\OrderProduct object
*
* @param \Thelia\Model\OrderProduct|ObjectCollection $orderProduct The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByOrderProduct($orderProduct, $comparison = null)
{
if ($orderProduct instanceof \Thelia\Model\OrderProduct) {
return $this
->addUsingAlias(OrderProductAttributeCombinationTableMap::ORDER_PRODUCT_ID, $orderProduct->getId(), $comparison);
} elseif ($orderProduct instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(OrderProductAttributeCombinationTableMap::ORDER_PRODUCT_ID, $orderProduct->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByOrderProduct() only accepts arguments of type \Thelia\Model\OrderProduct or Collection');
}
}
/**
* Adds a JOIN clause to the query using the OrderProduct relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function joinOrderProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('OrderProduct');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'OrderProduct');
}
return $this;
}
/**
* Use the OrderProduct relation OrderProduct object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\OrderProductQuery A secondary query class using the current class as primary query
*/
public function useOrderProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinOrderProduct($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'OrderProduct', '\Thelia\Model\OrderProductQuery');
}
/**
* Exclude object from result
*
* @param ChildOrderProductAttributeCombination $orderProductAttributeCombination Object to remove from the list of results
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function prune($orderProductAttributeCombination = null)
{
if ($orderProductAttributeCombination) {
$this->addUsingAlias(OrderProductAttributeCombinationTableMap::ID, $orderProductAttributeCombination->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the order_product_attribute_combination table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(OrderProductAttributeCombinationTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($con);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
OrderProductAttributeCombinationTableMap::clearInstancePool();
OrderProductAttributeCombinationTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildOrderProductAttributeCombination or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildOrderProductAttributeCombination object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(OrderProductAttributeCombinationTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(OrderProductAttributeCombinationTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
OrderProductAttributeCombinationTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
OrderProductAttributeCombinationTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(OrderProductAttributeCombinationTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(OrderProductAttributeCombinationTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(OrderProductAttributeCombinationTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(OrderProductAttributeCombinationTableMap::CREATED_AT);
}
} // OrderProductAttributeCombinationQuery

View File

@@ -24,12 +24,19 @@ use Thelia\Model\Map\OrderProductTableMap;
* @method ChildOrderProductQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildOrderProductQuery orderByOrderId($order = Criteria::ASC) Order by the order_id column
* @method ChildOrderProductQuery orderByProductRef($order = Criteria::ASC) Order by the product_ref column
* @method ChildOrderProductQuery orderByProductSaleElementsRef($order = Criteria::ASC) Order by the product_sale_elements_ref column
* @method ChildOrderProductQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildOrderProductQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildOrderProductQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method ChildOrderProductQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildOrderProductQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
* @method ChildOrderProductQuery orderByQuantity($order = Criteria::ASC) Order by the quantity column
* @method ChildOrderProductQuery orderByPrice($order = Criteria::ASC) Order by the price column
* @method ChildOrderProductQuery orderByTax($order = Criteria::ASC) Order by the tax column
* @method ChildOrderProductQuery orderByPromoPrice($order = Criteria::ASC) Order by the promo_price column
* @method ChildOrderProductQuery orderByWasNew($order = Criteria::ASC) Order by the was_new column
* @method ChildOrderProductQuery orderByWasInPromo($order = Criteria::ASC) Order by the was_in_promo column
* @method ChildOrderProductQuery orderByWeight($order = Criteria::ASC) Order by the weight column
* @method ChildOrderProductQuery orderByTaxRuleTitle($order = Criteria::ASC) Order by the tax_rule_title column
* @method ChildOrderProductQuery orderByTaxRuleDescription($order = Criteria::ASC) Order by the tax_rule_description column
* @method ChildOrderProductQuery orderByParent($order = Criteria::ASC) Order by the parent column
* @method ChildOrderProductQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildOrderProductQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
@@ -37,12 +44,19 @@ use Thelia\Model\Map\OrderProductTableMap;
* @method ChildOrderProductQuery groupById() Group by the id column
* @method ChildOrderProductQuery groupByOrderId() Group by the order_id column
* @method ChildOrderProductQuery groupByProductRef() Group by the product_ref column
* @method ChildOrderProductQuery groupByProductSaleElementsRef() Group by the product_sale_elements_ref column
* @method ChildOrderProductQuery groupByTitle() Group by the title column
* @method ChildOrderProductQuery groupByDescription() Group by the description column
* @method ChildOrderProductQuery groupByChapo() Group by the chapo column
* @method ChildOrderProductQuery groupByDescription() Group by the description column
* @method ChildOrderProductQuery groupByPostscriptum() Group by the postscriptum column
* @method ChildOrderProductQuery groupByQuantity() Group by the quantity column
* @method ChildOrderProductQuery groupByPrice() Group by the price column
* @method ChildOrderProductQuery groupByTax() Group by the tax column
* @method ChildOrderProductQuery groupByPromoPrice() Group by the promo_price column
* @method ChildOrderProductQuery groupByWasNew() Group by the was_new column
* @method ChildOrderProductQuery groupByWasInPromo() Group by the was_in_promo column
* @method ChildOrderProductQuery groupByWeight() Group by the weight column
* @method ChildOrderProductQuery groupByTaxRuleTitle() Group by the tax_rule_title column
* @method ChildOrderProductQuery groupByTaxRuleDescription() Group by the tax_rule_description column
* @method ChildOrderProductQuery groupByParent() Group by the parent column
* @method ChildOrderProductQuery groupByCreatedAt() Group by the created_at column
* @method ChildOrderProductQuery groupByUpdatedAt() Group by the updated_at column
@@ -55,9 +69,13 @@ use Thelia\Model\Map\OrderProductTableMap;
* @method ChildOrderProductQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation
* @method ChildOrderProductQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation
*
* @method ChildOrderProductQuery leftJoinOrderFeature($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderFeature relation
* @method ChildOrderProductQuery rightJoinOrderFeature($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderFeature relation
* @method ChildOrderProductQuery innerJoinOrderFeature($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderFeature relation
* @method ChildOrderProductQuery leftJoinOrderProductAttributeCombination($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderProductAttributeCombination relation
* @method ChildOrderProductQuery rightJoinOrderProductAttributeCombination($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderProductAttributeCombination relation
* @method ChildOrderProductQuery innerJoinOrderProductAttributeCombination($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderProductAttributeCombination relation
*
* @method ChildOrderProductQuery leftJoinOrderProductTax($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderProductTax relation
* @method ChildOrderProductQuery rightJoinOrderProductTax($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderProductTax relation
* @method ChildOrderProductQuery innerJoinOrderProductTax($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderProductTax relation
*
* @method ChildOrderProduct findOne(ConnectionInterface $con = null) Return the first ChildOrderProduct matching the query
* @method ChildOrderProduct findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrderProduct matching the query, or a new ChildOrderProduct object populated from the query conditions when no match is found
@@ -65,12 +83,19 @@ use Thelia\Model\Map\OrderProductTableMap;
* @method ChildOrderProduct findOneById(int $id) Return the first ChildOrderProduct filtered by the id column
* @method ChildOrderProduct findOneByOrderId(int $order_id) Return the first ChildOrderProduct filtered by the order_id column
* @method ChildOrderProduct findOneByProductRef(string $product_ref) Return the first ChildOrderProduct filtered by the product_ref column
* @method ChildOrderProduct findOneByProductSaleElementsRef(string $product_sale_elements_ref) Return the first ChildOrderProduct filtered by the product_sale_elements_ref column
* @method ChildOrderProduct findOneByTitle(string $title) Return the first ChildOrderProduct filtered by the title column
* @method ChildOrderProduct findOneByDescription(string $description) Return the first ChildOrderProduct filtered by the description column
* @method ChildOrderProduct findOneByChapo(string $chapo) Return the first ChildOrderProduct filtered by the chapo column
* @method ChildOrderProduct findOneByDescription(string $description) Return the first ChildOrderProduct filtered by the description column
* @method ChildOrderProduct findOneByPostscriptum(string $postscriptum) Return the first ChildOrderProduct filtered by the postscriptum column
* @method ChildOrderProduct findOneByQuantity(double $quantity) Return the first ChildOrderProduct filtered by the quantity column
* @method ChildOrderProduct findOneByPrice(double $price) Return the first ChildOrderProduct filtered by the price column
* @method ChildOrderProduct findOneByTax(double $tax) Return the first ChildOrderProduct filtered by the tax column
* @method ChildOrderProduct findOneByPromoPrice(string $promo_price) Return the first ChildOrderProduct filtered by the promo_price column
* @method ChildOrderProduct findOneByWasNew(int $was_new) Return the first ChildOrderProduct filtered by the was_new column
* @method ChildOrderProduct findOneByWasInPromo(int $was_in_promo) Return the first ChildOrderProduct filtered by the was_in_promo column
* @method ChildOrderProduct findOneByWeight(string $weight) Return the first ChildOrderProduct filtered by the weight column
* @method ChildOrderProduct findOneByTaxRuleTitle(string $tax_rule_title) Return the first ChildOrderProduct filtered by the tax_rule_title column
* @method ChildOrderProduct findOneByTaxRuleDescription(string $tax_rule_description) Return the first ChildOrderProduct filtered by the tax_rule_description column
* @method ChildOrderProduct findOneByParent(int $parent) Return the first ChildOrderProduct filtered by the parent column
* @method ChildOrderProduct findOneByCreatedAt(string $created_at) Return the first ChildOrderProduct filtered by the created_at column
* @method ChildOrderProduct findOneByUpdatedAt(string $updated_at) Return the first ChildOrderProduct filtered by the updated_at column
@@ -78,12 +103,19 @@ use Thelia\Model\Map\OrderProductTableMap;
* @method array findById(int $id) Return ChildOrderProduct objects filtered by the id column
* @method array findByOrderId(int $order_id) Return ChildOrderProduct objects filtered by the order_id column
* @method array findByProductRef(string $product_ref) Return ChildOrderProduct objects filtered by the product_ref column
* @method array findByProductSaleElementsRef(string $product_sale_elements_ref) Return ChildOrderProduct objects filtered by the product_sale_elements_ref column
* @method array findByTitle(string $title) Return ChildOrderProduct objects filtered by the title column
* @method array findByDescription(string $description) Return ChildOrderProduct objects filtered by the description column
* @method array findByChapo(string $chapo) Return ChildOrderProduct objects filtered by the chapo column
* @method array findByDescription(string $description) Return ChildOrderProduct objects filtered by the description column
* @method array findByPostscriptum(string $postscriptum) Return ChildOrderProduct objects filtered by the postscriptum column
* @method array findByQuantity(double $quantity) Return ChildOrderProduct objects filtered by the quantity column
* @method array findByPrice(double $price) Return ChildOrderProduct objects filtered by the price column
* @method array findByTax(double $tax) Return ChildOrderProduct objects filtered by the tax column
* @method array findByPromoPrice(string $promo_price) Return ChildOrderProduct objects filtered by the promo_price column
* @method array findByWasNew(int $was_new) Return ChildOrderProduct objects filtered by the was_new column
* @method array findByWasInPromo(int $was_in_promo) Return ChildOrderProduct objects filtered by the was_in_promo column
* @method array findByWeight(string $weight) Return ChildOrderProduct objects filtered by the weight column
* @method array findByTaxRuleTitle(string $tax_rule_title) Return ChildOrderProduct objects filtered by the tax_rule_title column
* @method array findByTaxRuleDescription(string $tax_rule_description) Return ChildOrderProduct objects filtered by the tax_rule_description column
* @method array findByParent(int $parent) Return ChildOrderProduct objects filtered by the parent column
* @method array findByCreatedAt(string $created_at) Return ChildOrderProduct objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildOrderProduct objects filtered by the updated_at column
@@ -175,7 +207,7 @@ abstract class OrderProductQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, ORDER_ID, PRODUCT_REF, TITLE, DESCRIPTION, CHAPO, QUANTITY, PRICE, TAX, PARENT, CREATED_AT, UPDATED_AT FROM order_product WHERE ID = :p0';
$sql = 'SELECT ID, ORDER_ID, PRODUCT_REF, PRODUCT_SALE_ELEMENTS_REF, TITLE, CHAPO, DESCRIPTION, POSTSCRIPTUM, QUANTITY, PRICE, PROMO_PRICE, WAS_NEW, WAS_IN_PROMO, WEIGHT, TAX_RULE_TITLE, TAX_RULE_DESCRIPTION, PARENT, CREATED_AT, UPDATED_AT FROM order_product WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -377,6 +409,35 @@ abstract class OrderProductQuery extends ModelCriteria
return $this->addUsingAlias(OrderProductTableMap::PRODUCT_REF, $productRef, $comparison);
}
/**
* Filter the query on the product_sale_elements_ref column
*
* Example usage:
* <code>
* $query->filterByProductSaleElementsRef('fooValue'); // WHERE product_sale_elements_ref = 'fooValue'
* $query->filterByProductSaleElementsRef('%fooValue%'); // WHERE product_sale_elements_ref LIKE '%fooValue%'
* </code>
*
* @param string $productSaleElementsRef The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByProductSaleElementsRef($productSaleElementsRef = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($productSaleElementsRef)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $productSaleElementsRef)) {
$productSaleElementsRef = str_replace('*', '%', $productSaleElementsRef);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF, $productSaleElementsRef, $comparison);
}
/**
* Filter the query on the title column
*
@@ -406,6 +467,35 @@ abstract class OrderProductQuery extends ModelCriteria
return $this->addUsingAlias(OrderProductTableMap::TITLE, $title, $comparison);
}
/**
* Filter the query on the chapo column
*
* Example usage:
* <code>
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
* </code>
*
* @param string $chapo The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByChapo($chapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($chapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $chapo)) {
$chapo = str_replace('*', '%', $chapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductTableMap::CHAPO, $chapo, $comparison);
}
/**
* Filter the query on the description column
*
@@ -436,32 +526,32 @@ abstract class OrderProductQuery extends ModelCriteria
}
/**
* Filter the query on the chapo column
* Filter the query on the postscriptum column
*
* Example usage:
* <code>
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
* $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
* $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
* </code>
*
* @param string $chapo The value to use as filter.
* @param string $postscriptum The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByChapo($chapo = null, $comparison = null)
public function filterByPostscriptum($postscriptum = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($chapo)) {
if (is_array($postscriptum)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $chapo)) {
$chapo = str_replace('*', '%', $chapo);
} elseif (preg_match('/[\%\*]/', $postscriptum)) {
$postscriptum = str_replace('*', '%', $postscriptum);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductTableMap::CHAPO, $chapo, $comparison);
return $this->addUsingAlias(OrderProductTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
}
/**
@@ -547,16 +637,45 @@ abstract class OrderProductQuery extends ModelCriteria
}
/**
* Filter the query on the tax column
* Filter the query on the promo_price column
*
* Example usage:
* <code>
* $query->filterByTax(1234); // WHERE tax = 1234
* $query->filterByTax(array(12, 34)); // WHERE tax IN (12, 34)
* $query->filterByTax(array('min' => 12)); // WHERE tax > 12
* $query->filterByPromoPrice('fooValue'); // WHERE promo_price = 'fooValue'
* $query->filterByPromoPrice('%fooValue%'); // WHERE promo_price LIKE '%fooValue%'
* </code>
*
* @param mixed $tax The value to use as filter.
* @param string $promoPrice The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByPromoPrice($promoPrice = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($promoPrice)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $promoPrice)) {
$promoPrice = str_replace('*', '%', $promoPrice);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductTableMap::PROMO_PRICE, $promoPrice, $comparison);
}
/**
* Filter the query on the was_new column
*
* Example usage:
* <code>
* $query->filterByWasNew(1234); // WHERE was_new = 1234
* $query->filterByWasNew(array(12, 34)); // WHERE was_new IN (12, 34)
* $query->filterByWasNew(array('min' => 12)); // WHERE was_new > 12
* </code>
*
* @param mixed $wasNew The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@@ -564,16 +683,16 @@ abstract class OrderProductQuery extends ModelCriteria
*
* @return ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByTax($tax = null, $comparison = null)
public function filterByWasNew($wasNew = null, $comparison = null)
{
if (is_array($tax)) {
if (is_array($wasNew)) {
$useMinMax = false;
if (isset($tax['min'])) {
$this->addUsingAlias(OrderProductTableMap::TAX, $tax['min'], Criteria::GREATER_EQUAL);
if (isset($wasNew['min'])) {
$this->addUsingAlias(OrderProductTableMap::WAS_NEW, $wasNew['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($tax['max'])) {
$this->addUsingAlias(OrderProductTableMap::TAX, $tax['max'], Criteria::LESS_EQUAL);
if (isset($wasNew['max'])) {
$this->addUsingAlias(OrderProductTableMap::WAS_NEW, $wasNew['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
@@ -584,7 +703,135 @@ abstract class OrderProductQuery extends ModelCriteria
}
}
return $this->addUsingAlias(OrderProductTableMap::TAX, $tax, $comparison);
return $this->addUsingAlias(OrderProductTableMap::WAS_NEW, $wasNew, $comparison);
}
/**
* Filter the query on the was_in_promo column
*
* Example usage:
* <code>
* $query->filterByWasInPromo(1234); // WHERE was_in_promo = 1234
* $query->filterByWasInPromo(array(12, 34)); // WHERE was_in_promo IN (12, 34)
* $query->filterByWasInPromo(array('min' => 12)); // WHERE was_in_promo > 12
* </code>
*
* @param mixed $wasInPromo The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByWasInPromo($wasInPromo = null, $comparison = null)
{
if (is_array($wasInPromo)) {
$useMinMax = false;
if (isset($wasInPromo['min'])) {
$this->addUsingAlias(OrderProductTableMap::WAS_IN_PROMO, $wasInPromo['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($wasInPromo['max'])) {
$this->addUsingAlias(OrderProductTableMap::WAS_IN_PROMO, $wasInPromo['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderProductTableMap::WAS_IN_PROMO, $wasInPromo, $comparison);
}
/**
* Filter the query on the weight column
*
* Example usage:
* <code>
* $query->filterByWeight('fooValue'); // WHERE weight = 'fooValue'
* $query->filterByWeight('%fooValue%'); // WHERE weight LIKE '%fooValue%'
* </code>
*
* @param string $weight The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByWeight($weight = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($weight)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $weight)) {
$weight = str_replace('*', '%', $weight);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductTableMap::WEIGHT, $weight, $comparison);
}
/**
* Filter the query on the tax_rule_title column
*
* Example usage:
* <code>
* $query->filterByTaxRuleTitle('fooValue'); // WHERE tax_rule_title = 'fooValue'
* $query->filterByTaxRuleTitle('%fooValue%'); // WHERE tax_rule_title LIKE '%fooValue%'
* </code>
*
* @param string $taxRuleTitle The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByTaxRuleTitle($taxRuleTitle = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($taxRuleTitle)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $taxRuleTitle)) {
$taxRuleTitle = str_replace('*', '%', $taxRuleTitle);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductTableMap::TAX_RULE_TITLE, $taxRuleTitle, $comparison);
}
/**
* Filter the query on the tax_rule_description column
*
* Example usage:
* <code>
* $query->filterByTaxRuleDescription('fooValue'); // WHERE tax_rule_description = 'fooValue'
* $query->filterByTaxRuleDescription('%fooValue%'); // WHERE tax_rule_description LIKE '%fooValue%'
* </code>
*
* @param string $taxRuleDescription The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByTaxRuleDescription($taxRuleDescription = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($taxRuleDescription)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $taxRuleDescription)) {
$taxRuleDescription = str_replace('*', '%', $taxRuleDescription);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductTableMap::TAX_RULE_DESCRIPTION, $taxRuleDescription, $comparison);
}
/**
@@ -790,40 +1037,40 @@ abstract class OrderProductQuery extends ModelCriteria
}
/**
* Filter the query by a related \Thelia\Model\OrderFeature object
* Filter the query by a related \Thelia\Model\OrderProductAttributeCombination object
*
* @param \Thelia\Model\OrderFeature|ObjectCollection $orderFeature the related object to use as filter
* @param \Thelia\Model\OrderProductAttributeCombination|ObjectCollection $orderProductAttributeCombination the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByOrderFeature($orderFeature, $comparison = null)
public function filterByOrderProductAttributeCombination($orderProductAttributeCombination, $comparison = null)
{
if ($orderFeature instanceof \Thelia\Model\OrderFeature) {
if ($orderProductAttributeCombination instanceof \Thelia\Model\OrderProductAttributeCombination) {
return $this
->addUsingAlias(OrderProductTableMap::ID, $orderFeature->getOrderProductId(), $comparison);
} elseif ($orderFeature instanceof ObjectCollection) {
->addUsingAlias(OrderProductTableMap::ID, $orderProductAttributeCombination->getOrderProductId(), $comparison);
} elseif ($orderProductAttributeCombination instanceof ObjectCollection) {
return $this
->useOrderFeatureQuery()
->filterByPrimaryKeys($orderFeature->getPrimaryKeys())
->useOrderProductAttributeCombinationQuery()
->filterByPrimaryKeys($orderProductAttributeCombination->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByOrderFeature() only accepts arguments of type \Thelia\Model\OrderFeature or Collection');
throw new PropelException('filterByOrderProductAttributeCombination() only accepts arguments of type \Thelia\Model\OrderProductAttributeCombination or Collection');
}
}
/**
* Adds a JOIN clause to the query using the OrderFeature relation
* Adds a JOIN clause to the query using the OrderProductAttributeCombination relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildOrderProductQuery The current query, for fluid interface
*/
public function joinOrderFeature($relationAlias = null, $joinType = Criteria::INNER_JOIN)
public function joinOrderProductAttributeCombination($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('OrderFeature');
$relationMap = $tableMap->getRelation('OrderProductAttributeCombination');
// create a ModelJoin object for this join
$join = new ModelJoin();
@@ -838,14 +1085,14 @@ abstract class OrderProductQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'OrderFeature');
$this->addJoinObject($join, 'OrderProductAttributeCombination');
}
return $this;
}
/**
* Use the OrderFeature relation OrderFeature object
* Use the OrderProductAttributeCombination relation OrderProductAttributeCombination object
*
* @see useQuery()
*
@@ -853,13 +1100,86 @@ abstract class OrderProductQuery extends ModelCriteria
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\OrderFeatureQuery A secondary query class using the current class as primary query
* @return \Thelia\Model\OrderProductAttributeCombinationQuery A secondary query class using the current class as primary query
*/
public function useOrderFeatureQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
public function useOrderProductAttributeCombinationQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinOrderFeature($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'OrderFeature', '\Thelia\Model\OrderFeatureQuery');
->joinOrderProductAttributeCombination($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'OrderProductAttributeCombination', '\Thelia\Model\OrderProductAttributeCombinationQuery');
}
/**
* Filter the query by a related \Thelia\Model\OrderProductTax object
*
* @param \Thelia\Model\OrderProductTax|ObjectCollection $orderProductTax the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByOrderProductTax($orderProductTax, $comparison = null)
{
if ($orderProductTax instanceof \Thelia\Model\OrderProductTax) {
return $this
->addUsingAlias(OrderProductTableMap::ID, $orderProductTax->getOrderProductId(), $comparison);
} elseif ($orderProductTax instanceof ObjectCollection) {
return $this
->useOrderProductTaxQuery()
->filterByPrimaryKeys($orderProductTax->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByOrderProductTax() only accepts arguments of type \Thelia\Model\OrderProductTax or Collection');
}
}
/**
* Adds a JOIN clause to the query using the OrderProductTax relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildOrderProductQuery The current query, for fluid interface
*/
public function joinOrderProductTax($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('OrderProductTax');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'OrderProductTax');
}
return $this;
}
/**
* Use the OrderProductTax relation OrderProductTax object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\OrderProductTaxQuery A secondary query class using the current class as primary query
*/
public function useOrderProductTaxQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinOrderProductTax($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'OrderProductTax', '\Thelia\Model\OrderProductTaxQuery');
}
/**

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,744 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\OrderProductTax as ChildOrderProductTax;
use Thelia\Model\OrderProductTaxQuery as ChildOrderProductTaxQuery;
use Thelia\Model\Map\OrderProductTaxTableMap;
/**
* Base class that represents a query for the 'order_product_tax' table.
*
*
*
* @method ChildOrderProductTaxQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildOrderProductTaxQuery orderByOrderProductId($order = Criteria::ASC) Order by the order_product_id column
* @method ChildOrderProductTaxQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildOrderProductTaxQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildOrderProductTaxQuery orderByAmount($order = Criteria::ASC) Order by the amount column
* @method ChildOrderProductTaxQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildOrderProductTaxQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildOrderProductTaxQuery groupById() Group by the id column
* @method ChildOrderProductTaxQuery groupByOrderProductId() Group by the order_product_id column
* @method ChildOrderProductTaxQuery groupByTitle() Group by the title column
* @method ChildOrderProductTaxQuery groupByDescription() Group by the description column
* @method ChildOrderProductTaxQuery groupByAmount() Group by the amount column
* @method ChildOrderProductTaxQuery groupByCreatedAt() Group by the created_at column
* @method ChildOrderProductTaxQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildOrderProductTaxQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildOrderProductTaxQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildOrderProductTaxQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildOrderProductTaxQuery leftJoinOrderProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderProduct relation
* @method ChildOrderProductTaxQuery rightJoinOrderProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderProduct relation
* @method ChildOrderProductTaxQuery innerJoinOrderProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderProduct relation
*
* @method ChildOrderProductTax findOne(ConnectionInterface $con = null) Return the first ChildOrderProductTax matching the query
* @method ChildOrderProductTax findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrderProductTax matching the query, or a new ChildOrderProductTax object populated from the query conditions when no match is found
*
* @method ChildOrderProductTax findOneById(int $id) Return the first ChildOrderProductTax filtered by the id column
* @method ChildOrderProductTax findOneByOrderProductId(int $order_product_id) Return the first ChildOrderProductTax filtered by the order_product_id column
* @method ChildOrderProductTax findOneByTitle(string $title) Return the first ChildOrderProductTax filtered by the title column
* @method ChildOrderProductTax findOneByDescription(string $description) Return the first ChildOrderProductTax filtered by the description column
* @method ChildOrderProductTax findOneByAmount(double $amount) Return the first ChildOrderProductTax filtered by the amount column
* @method ChildOrderProductTax findOneByCreatedAt(string $created_at) Return the first ChildOrderProductTax filtered by the created_at column
* @method ChildOrderProductTax findOneByUpdatedAt(string $updated_at) Return the first ChildOrderProductTax filtered by the updated_at column
*
* @method array findById(int $id) Return ChildOrderProductTax objects filtered by the id column
* @method array findByOrderProductId(int $order_product_id) Return ChildOrderProductTax objects filtered by the order_product_id column
* @method array findByTitle(string $title) Return ChildOrderProductTax objects filtered by the title column
* @method array findByDescription(string $description) Return ChildOrderProductTax objects filtered by the description column
* @method array findByAmount(double $amount) Return ChildOrderProductTax objects filtered by the amount column
* @method array findByCreatedAt(string $created_at) Return ChildOrderProductTax objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildOrderProductTax objects filtered by the updated_at column
*
*/
abstract class OrderProductTaxQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\OrderProductTaxQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\OrderProductTax', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildOrderProductTaxQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildOrderProductTaxQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\OrderProductTaxQuery) {
return $criteria;
}
$query = new \Thelia\Model\OrderProductTaxQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildOrderProductTax|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = OrderProductTaxTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(OrderProductTaxTableMap::DATABASE_NAME);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildOrderProductTax A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, ORDER_PRODUCT_ID, TITLE, DESCRIPTION, AMOUNT, CREATED_AT, UPDATED_AT FROM order_product_tax WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildOrderProductTax();
$obj->hydrate($row);
OrderProductTaxTableMap::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildOrderProductTax|array|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(OrderProductTaxTableMap::ID, $key, Criteria::EQUAL);
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(OrderProductTaxTableMap::ID, $keys, Criteria::IN);
}
/**
* Filter the query on the id column
*
* Example usage:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @param mixed $id The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(OrderProductTaxTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(OrderProductTaxTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderProductTaxTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the order_product_id column
*
* Example usage:
* <code>
* $query->filterByOrderProductId(1234); // WHERE order_product_id = 1234
* $query->filterByOrderProductId(array(12, 34)); // WHERE order_product_id IN (12, 34)
* $query->filterByOrderProductId(array('min' => 12)); // WHERE order_product_id > 12
* </code>
*
* @see filterByOrderProduct()
*
* @param mixed $orderProductId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function filterByOrderProductId($orderProductId = null, $comparison = null)
{
if (is_array($orderProductId)) {
$useMinMax = false;
if (isset($orderProductId['min'])) {
$this->addUsingAlias(OrderProductTaxTableMap::ORDER_PRODUCT_ID, $orderProductId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($orderProductId['max'])) {
$this->addUsingAlias(OrderProductTaxTableMap::ORDER_PRODUCT_ID, $orderProductId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderProductTaxTableMap::ORDER_PRODUCT_ID, $orderProductId, $comparison);
}
/**
* Filter the query on the title column
*
* Example usage:
* <code>
* $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
* $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
* </code>
*
* @param string $title The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function filterByTitle($title = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($title)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $title)) {
$title = str_replace('*', '%', $title);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductTaxTableMap::TITLE, $title, $comparison);
}
/**
* Filter the query on the description column
*
* Example usage:
* <code>
* $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
* $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
* </code>
*
* @param string $description The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function filterByDescription($description = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($description)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $description)) {
$description = str_replace('*', '%', $description);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductTaxTableMap::DESCRIPTION, $description, $comparison);
}
/**
* Filter the query on the amount column
*
* Example usage:
* <code>
* $query->filterByAmount(1234); // WHERE amount = 1234
* $query->filterByAmount(array(12, 34)); // WHERE amount IN (12, 34)
* $query->filterByAmount(array('min' => 12)); // WHERE amount > 12
* </code>
*
* @param mixed $amount The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function filterByAmount($amount = null, $comparison = null)
{
if (is_array($amount)) {
$useMinMax = false;
if (isset($amount['min'])) {
$this->addUsingAlias(OrderProductTaxTableMap::AMOUNT, $amount['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($amount['max'])) {
$this->addUsingAlias(OrderProductTaxTableMap::AMOUNT, $amount['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderProductTaxTableMap::AMOUNT, $amount, $comparison);
}
/**
* Filter the query on the created_at column
*
* Example usage:
* <code>
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
* </code>
*
* @param mixed $createdAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function filterByCreatedAt($createdAt = null, $comparison = null)
{
if (is_array($createdAt)) {
$useMinMax = false;
if (isset($createdAt['min'])) {
$this->addUsingAlias(OrderProductTaxTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(OrderProductTaxTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderProductTaxTableMap::CREATED_AT, $createdAt, $comparison);
}
/**
* Filter the query on the updated_at column
*
* Example usage:
* <code>
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
* </code>
*
* @param mixed $updatedAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
{
if (is_array($updatedAt)) {
$useMinMax = false;
if (isset($updatedAt['min'])) {
$this->addUsingAlias(OrderProductTaxTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(OrderProductTaxTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderProductTaxTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\OrderProduct object
*
* @param \Thelia\Model\OrderProduct|ObjectCollection $orderProduct The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function filterByOrderProduct($orderProduct, $comparison = null)
{
if ($orderProduct instanceof \Thelia\Model\OrderProduct) {
return $this
->addUsingAlias(OrderProductTaxTableMap::ORDER_PRODUCT_ID, $orderProduct->getId(), $comparison);
} elseif ($orderProduct instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(OrderProductTaxTableMap::ORDER_PRODUCT_ID, $orderProduct->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByOrderProduct() only accepts arguments of type \Thelia\Model\OrderProduct or Collection');
}
}
/**
* Adds a JOIN clause to the query using the OrderProduct relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function joinOrderProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('OrderProduct');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'OrderProduct');
}
return $this;
}
/**
* Use the OrderProduct relation OrderProduct object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\OrderProductQuery A secondary query class using the current class as primary query
*/
public function useOrderProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinOrderProduct($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'OrderProduct', '\Thelia\Model\OrderProductQuery');
}
/**
* Exclude object from result
*
* @param ChildOrderProductTax $orderProductTax Object to remove from the list of results
*
* @return ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function prune($orderProductTax = null)
{
if ($orderProductTax) {
$this->addUsingAlias(OrderProductTaxTableMap::ID, $orderProductTax->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the order_product_tax table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(OrderProductTaxTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($con);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
OrderProductTaxTableMap::clearInstancePool();
OrderProductTaxTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildOrderProductTax or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildOrderProductTax object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(OrderProductTaxTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(OrderProductTaxTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
OrderProductTaxTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
OrderProductTaxTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(OrderProductTaxTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(OrderProductTaxTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(OrderProductTaxTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(OrderProductTaxTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(OrderProductTaxTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(OrderProductTaxTableMap::CREATED_AT);
}
} // OrderProductTaxQuery

View File

@@ -3,7 +3,66 @@
namespace Thelia\Model;
use Thelia\Model\Base\CategoryAssociatedContent as BaseCategoryAssociatedContent;
use Thelia\Core\Event\CategoryAssociatedContentEvent;
use Thelia\Core\Event\TheliaEvents;
use Propel\Runtime\Connection\ConnectionInterface;
class CategoryAssociatedContent extends BaseCategoryAssociatedContent {
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_CREATECATEGORY_ASSOCIATED_CONTENT, new CategoryAssociatedContentEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_CREATECATEGORY_ASSOCIATED_CONTENT, new CategoryAssociatedContentEvent($this));
}
/**
* {@inheritDoc}
*/
public function preUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_UPDATECATEGORY_ASSOCIATED_CONTENT, new CategoryAssociatedContentEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_UPDATECATEGORY_ASSOCIATED_CONTENT, new CategoryAssociatedContentEvent($this));
}
/**
* {@inheritDoc}
*/
public function preDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_DELETECATEGORY_ASSOCIATED_CONTENT, new CategoryAssociatedContentEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_DELETECATEGORY_ASSOCIATED_CONTENT, new CategoryAssociatedContentEvent($this));
}
}

View File

@@ -44,8 +44,8 @@ class Folder extends BaseFolder
foreach($children as $child)
{
$contentsCount += ProductQuery::create()
->filterByCategory($child)
$contentsCount += ContentQuery::create()
->filterByFolder($child)
->count();
}

View File

@@ -0,0 +1,503 @@
<?php
namespace Thelia\Model\Map;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
use Thelia\Model\OrderProductAttributeCombination;
use Thelia\Model\OrderProductAttributeCombinationQuery;
/**
* This class defines the structure of the 'order_product_attribute_combination' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
*/
class OrderProductAttributeCombinationTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Thelia.Model.Map.OrderProductAttributeCombinationTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'order_product_attribute_combination';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Thelia\\Model\\OrderProductAttributeCombination';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Thelia.Model.OrderProductAttributeCombination';
/**
* The total number of columns
*/
const NUM_COLUMNS = 12;
/**
* The number of lazy-loaded columns
*/
const NUM_LAZY_LOAD_COLUMNS = 0;
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 12;
/**
* the column name for the ID field
*/
const ID = 'order_product_attribute_combination.ID';
/**
* the column name for the ORDER_PRODUCT_ID field
*/
const ORDER_PRODUCT_ID = 'order_product_attribute_combination.ORDER_PRODUCT_ID';
/**
* the column name for the ATTRIBUTE_TITLE field
*/
const ATTRIBUTE_TITLE = 'order_product_attribute_combination.ATTRIBUTE_TITLE';
/**
* the column name for the ATTRIBUTE_CHAPO field
*/
const ATTRIBUTE_CHAPO = 'order_product_attribute_combination.ATTRIBUTE_CHAPO';
/**
* the column name for the ATTRIBUTE_DESCRIPTION field
*/
const ATTRIBUTE_DESCRIPTION = 'order_product_attribute_combination.ATTRIBUTE_DESCRIPTION';
/**
* the column name for the ATTRIBUTE_POSTSCRIPTUMN field
*/
const ATTRIBUTE_POSTSCRIPTUMN = 'order_product_attribute_combination.ATTRIBUTE_POSTSCRIPTUMN';
/**
* the column name for the ATTRIBUTE_AV_TITLE field
*/
const ATTRIBUTE_AV_TITLE = 'order_product_attribute_combination.ATTRIBUTE_AV_TITLE';
/**
* the column name for the ATTRIBUTE_AV_CHAPO field
*/
const ATTRIBUTE_AV_CHAPO = 'order_product_attribute_combination.ATTRIBUTE_AV_CHAPO';
/**
* the column name for the ATTRIBUTE_AV_DESCRIPTION field
*/
const ATTRIBUTE_AV_DESCRIPTION = 'order_product_attribute_combination.ATTRIBUTE_AV_DESCRIPTION';
/**
* the column name for the ATTRIBUTE_AV_POSTSCRIPTUM field
*/
const ATTRIBUTE_AV_POSTSCRIPTUM = 'order_product_attribute_combination.ATTRIBUTE_AV_POSTSCRIPTUM';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'order_product_attribute_combination.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'order_product_attribute_combination.UPDATED_AT';
/**
* The default string format for model objects of the related table
*/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'OrderProductId', 'AttributeTitle', 'AttributeChapo', 'AttributeDescription', 'AttributePostscriptumn', 'AttributeAvTitle', 'AttributeAvChapo', 'AttributeAvDescription', 'AttributeAvPostscriptum', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'orderProductId', 'attributeTitle', 'attributeChapo', 'attributeDescription', 'attributePostscriptumn', 'attributeAvTitle', 'attributeAvChapo', 'attributeAvDescription', 'attributeAvPostscriptum', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(OrderProductAttributeCombinationTableMap::ID, OrderProductAttributeCombinationTableMap::ORDER_PRODUCT_ID, OrderProductAttributeCombinationTableMap::ATTRIBUTE_TITLE, OrderProductAttributeCombinationTableMap::ATTRIBUTE_CHAPO, OrderProductAttributeCombinationTableMap::ATTRIBUTE_DESCRIPTION, OrderProductAttributeCombinationTableMap::ATTRIBUTE_POSTSCRIPTUMN, OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_TITLE, OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_CHAPO, OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_DESCRIPTION, OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_POSTSCRIPTUM, OrderProductAttributeCombinationTableMap::CREATED_AT, OrderProductAttributeCombinationTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'ORDER_PRODUCT_ID', 'ATTRIBUTE_TITLE', 'ATTRIBUTE_CHAPO', 'ATTRIBUTE_DESCRIPTION', 'ATTRIBUTE_POSTSCRIPTUMN', 'ATTRIBUTE_AV_TITLE', 'ATTRIBUTE_AV_CHAPO', 'ATTRIBUTE_AV_DESCRIPTION', 'ATTRIBUTE_AV_POSTSCRIPTUM', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'order_product_id', 'attribute_title', 'attribute_chapo', 'attribute_description', 'attribute_postscriptumn', 'attribute_av_title', 'attribute_av_chapo', 'attribute_av_description', 'attribute_av_postscriptum', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'OrderProductId' => 1, 'AttributeTitle' => 2, 'AttributeChapo' => 3, 'AttributeDescription' => 4, 'AttributePostscriptumn' => 5, 'AttributeAvTitle' => 6, 'AttributeAvChapo' => 7, 'AttributeAvDescription' => 8, 'AttributeAvPostscriptum' => 9, 'CreatedAt' => 10, 'UpdatedAt' => 11, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderProductId' => 1, 'attributeTitle' => 2, 'attributeChapo' => 3, 'attributeDescription' => 4, 'attributePostscriptumn' => 5, 'attributeAvTitle' => 6, 'attributeAvChapo' => 7, 'attributeAvDescription' => 8, 'attributeAvPostscriptum' => 9, 'createdAt' => 10, 'updatedAt' => 11, ),
self::TYPE_COLNAME => array(OrderProductAttributeCombinationTableMap::ID => 0, OrderProductAttributeCombinationTableMap::ORDER_PRODUCT_ID => 1, OrderProductAttributeCombinationTableMap::ATTRIBUTE_TITLE => 2, OrderProductAttributeCombinationTableMap::ATTRIBUTE_CHAPO => 3, OrderProductAttributeCombinationTableMap::ATTRIBUTE_DESCRIPTION => 4, OrderProductAttributeCombinationTableMap::ATTRIBUTE_POSTSCRIPTUMN => 5, OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_TITLE => 6, OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_CHAPO => 7, OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_DESCRIPTION => 8, OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_POSTSCRIPTUM => 9, OrderProductAttributeCombinationTableMap::CREATED_AT => 10, OrderProductAttributeCombinationTableMap::UPDATED_AT => 11, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_PRODUCT_ID' => 1, 'ATTRIBUTE_TITLE' => 2, 'ATTRIBUTE_CHAPO' => 3, 'ATTRIBUTE_DESCRIPTION' => 4, 'ATTRIBUTE_POSTSCRIPTUMN' => 5, 'ATTRIBUTE_AV_TITLE' => 6, 'ATTRIBUTE_AV_CHAPO' => 7, 'ATTRIBUTE_AV_DESCRIPTION' => 8, 'ATTRIBUTE_AV_POSTSCRIPTUM' => 9, 'CREATED_AT' => 10, 'UPDATED_AT' => 11, ),
self::TYPE_FIELDNAME => array('id' => 0, 'order_product_id' => 1, 'attribute_title' => 2, 'attribute_chapo' => 3, 'attribute_description' => 4, 'attribute_postscriptumn' => 5, 'attribute_av_title' => 6, 'attribute_av_chapo' => 7, 'attribute_av_description' => 8, 'attribute_av_postscriptum' => 9, 'created_at' => 10, 'updated_at' => 11, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
);
/**
* Initialize the table attributes and columns
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('order_product_attribute_combination');
$this->setPhpName('OrderProductAttributeCombination');
$this->setClassName('\\Thelia\\Model\\OrderProductAttributeCombination');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('ORDER_PRODUCT_ID', 'OrderProductId', 'INTEGER', 'order_product', 'ID', true, null, null);
$this->addColumn('ATTRIBUTE_TITLE', 'AttributeTitle', 'VARCHAR', true, 255, null);
$this->addColumn('ATTRIBUTE_CHAPO', 'AttributeChapo', 'LONGVARCHAR', false, null, null);
$this->addColumn('ATTRIBUTE_DESCRIPTION', 'AttributeDescription', 'CLOB', false, null, null);
$this->addColumn('ATTRIBUTE_POSTSCRIPTUMN', 'AttributePostscriptumn', 'LONGVARCHAR', false, null, null);
$this->addColumn('ATTRIBUTE_AV_TITLE', 'AttributeAvTitle', 'VARCHAR', true, 255, null);
$this->addColumn('ATTRIBUTE_AV_CHAPO', 'AttributeAvChapo', 'LONGVARCHAR', false, null, null);
$this->addColumn('ATTRIBUTE_AV_DESCRIPTION', 'AttributeAvDescription', 'CLOB', false, null, null);
$this->addColumn('ATTRIBUTE_AV_POSTSCRIPTUM', 'AttributeAvPostscriptum', 'LONGVARCHAR', false, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('OrderProduct', '\\Thelia\\Model\\OrderProduct', RelationMap::MANY_TO_ONE, array('order_product_id' => 'id', ), 'CASCADE', 'RESTRICT');
} // buildRelations()
/**
*
* Gets the list of behaviors registered for this table
*
* @return array Associative array (name => parameters) of behaviors
*/
public function getBehaviors()
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
);
} // getBehaviors()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*/
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
// If the PK cannot be derived from the row, return NULL.
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
return (int) $row[
$indexType == TableMap::TYPE_NUM
? 0 + $offset
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
];
}
/**
* The class that the tableMap will make instances of.
*
* If $withPrefix is true, the returned path
* uses a dot-path notation which is translated into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @param boolean $withPrefix Whether or not to return the path with the class name
* @return string path.to.ClassName
*/
public static function getOMClass($withPrefix = true)
{
return $withPrefix ? OrderProductAttributeCombinationTableMap::CLASS_DEFAULT : OrderProductAttributeCombinationTableMap::OM_CLASS;
}
/**
* Populates an object of the default type or an object that inherit from the default.
*
* @param array $row row returned by DataFetcher->fetch().
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return array (OrderProductAttributeCombination object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = OrderProductAttributeCombinationTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = OrderProductAttributeCombinationTableMap::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $offset, true); // rehydrate
$col = $offset + OrderProductAttributeCombinationTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = OrderProductAttributeCombinationTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
OrderProductAttributeCombinationTableMap::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @param DataFetcherInterface $dataFetcher
* @return array
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(DataFetcherInterface $dataFetcher)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = static::getOMClass(false);
// populate the object(s)
while ($row = $dataFetcher->fetch()) {
$key = OrderProductAttributeCombinationTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = OrderProductAttributeCombinationTableMap::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, 0, true); // rehydrate
$results[] = $obj;
} else {
$obj = new $cls();
$obj->hydrate($row);
$results[] = $obj;
OrderProductAttributeCombinationTableMap::addInstanceToPool($obj, $key);
} // if key exists
}
return $results;
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param Criteria $criteria object containing the columns to add.
* @param string $alias optional table alias
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(OrderProductAttributeCombinationTableMap::ID);
$criteria->addSelectColumn(OrderProductAttributeCombinationTableMap::ORDER_PRODUCT_ID);
$criteria->addSelectColumn(OrderProductAttributeCombinationTableMap::ATTRIBUTE_TITLE);
$criteria->addSelectColumn(OrderProductAttributeCombinationTableMap::ATTRIBUTE_CHAPO);
$criteria->addSelectColumn(OrderProductAttributeCombinationTableMap::ATTRIBUTE_DESCRIPTION);
$criteria->addSelectColumn(OrderProductAttributeCombinationTableMap::ATTRIBUTE_POSTSCRIPTUMN);
$criteria->addSelectColumn(OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_TITLE);
$criteria->addSelectColumn(OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_CHAPO);
$criteria->addSelectColumn(OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_DESCRIPTION);
$criteria->addSelectColumn(OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_POSTSCRIPTUM);
$criteria->addSelectColumn(OrderProductAttributeCombinationTableMap::CREATED_AT);
$criteria->addSelectColumn(OrderProductAttributeCombinationTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.ORDER_PRODUCT_ID');
$criteria->addSelectColumn($alias . '.ATTRIBUTE_TITLE');
$criteria->addSelectColumn($alias . '.ATTRIBUTE_CHAPO');
$criteria->addSelectColumn($alias . '.ATTRIBUTE_DESCRIPTION');
$criteria->addSelectColumn($alias . '.ATTRIBUTE_POSTSCRIPTUMN');
$criteria->addSelectColumn($alias . '.ATTRIBUTE_AV_TITLE');
$criteria->addSelectColumn($alias . '.ATTRIBUTE_AV_CHAPO');
$criteria->addSelectColumn($alias . '.ATTRIBUTE_AV_DESCRIPTION');
$criteria->addSelectColumn($alias . '.ATTRIBUTE_AV_POSTSCRIPTUM');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
/**
* Returns the TableMap related to this object.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getServiceContainer()->getDatabaseMap(OrderProductAttributeCombinationTableMap::DATABASE_NAME)->getTable(OrderProductAttributeCombinationTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(OrderProductAttributeCombinationTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(OrderProductAttributeCombinationTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new OrderProductAttributeCombinationTableMap());
}
}
/**
* Performs a DELETE on the database, given a OrderProductAttributeCombination or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or OrderProductAttributeCombination object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(OrderProductAttributeCombinationTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Thelia\Model\OrderProductAttributeCombination) { // it's a model object
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(OrderProductAttributeCombinationTableMap::DATABASE_NAME);
$criteria->add(OrderProductAttributeCombinationTableMap::ID, (array) $values, Criteria::IN);
}
$query = OrderProductAttributeCombinationQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { OrderProductAttributeCombinationTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { OrderProductAttributeCombinationTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the order_product_attribute_combination table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll(ConnectionInterface $con = null)
{
return OrderProductAttributeCombinationQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a OrderProductAttributeCombination or Criteria object.
*
* @param mixed $criteria Criteria or OrderProductAttributeCombination object containing data that is used to create the INSERT statement.
* @param ConnectionInterface $con the ConnectionInterface connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($criteria, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(OrderProductAttributeCombinationTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from OrderProductAttributeCombination object
}
if ($criteria->containsKey(OrderProductAttributeCombinationTableMap::ID) && $criteria->keyContainsValue(OrderProductAttributeCombinationTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.OrderProductAttributeCombinationTableMap::ID.')');
}
// Set the correct dbName
$query = OrderProductAttributeCombinationQuery::create()->mergeWith($criteria);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = $query->doInsert($con);
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $pk;
}
} // OrderProductAttributeCombinationTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
OrderProductAttributeCombinationTableMap::buildTableMap();

View File

@@ -57,7 +57,7 @@ class OrderProductTableMap extends TableMap
/**
* The total number of columns
*/
const NUM_COLUMNS = 12;
const NUM_COLUMNS = 19;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class OrderProductTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 12;
const NUM_HYDRATE_COLUMNS = 19;
/**
* the column name for the ID field
@@ -84,20 +84,30 @@ class OrderProductTableMap extends TableMap
*/
const PRODUCT_REF = 'order_product.PRODUCT_REF';
/**
* the column name for the PRODUCT_SALE_ELEMENTS_REF field
*/
const PRODUCT_SALE_ELEMENTS_REF = 'order_product.PRODUCT_SALE_ELEMENTS_REF';
/**
* the column name for the TITLE field
*/
const TITLE = 'order_product.TITLE';
/**
* the column name for the CHAPO field
*/
const CHAPO = 'order_product.CHAPO';
/**
* the column name for the DESCRIPTION field
*/
const DESCRIPTION = 'order_product.DESCRIPTION';
/**
* the column name for the CHAPO field
* the column name for the POSTSCRIPTUM field
*/
const CHAPO = 'order_product.CHAPO';
const POSTSCRIPTUM = 'order_product.POSTSCRIPTUM';
/**
* the column name for the QUANTITY field
@@ -110,9 +120,34 @@ class OrderProductTableMap extends TableMap
const PRICE = 'order_product.PRICE';
/**
* the column name for the TAX field
* the column name for the PROMO_PRICE field
*/
const TAX = 'order_product.TAX';
const PROMO_PRICE = 'order_product.PROMO_PRICE';
/**
* the column name for the WAS_NEW field
*/
const WAS_NEW = 'order_product.WAS_NEW';
/**
* the column name for the WAS_IN_PROMO field
*/
const WAS_IN_PROMO = 'order_product.WAS_IN_PROMO';
/**
* the column name for the WEIGHT field
*/
const WEIGHT = 'order_product.WEIGHT';
/**
* the column name for the TAX_RULE_TITLE field
*/
const TAX_RULE_TITLE = 'order_product.TAX_RULE_TITLE';
/**
* the column name for the TAX_RULE_DESCRIPTION field
*/
const TAX_RULE_DESCRIPTION = 'order_product.TAX_RULE_DESCRIPTION';
/**
* the column name for the PARENT field
@@ -141,12 +176,12 @@ class OrderProductTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'OrderId', 'ProductRef', 'Title', 'Description', 'Chapo', 'Quantity', 'Price', 'Tax', 'Parent', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'productRef', 'title', 'description', 'chapo', 'quantity', 'price', 'tax', 'parent', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(OrderProductTableMap::ID, OrderProductTableMap::ORDER_ID, OrderProductTableMap::PRODUCT_REF, OrderProductTableMap::TITLE, OrderProductTableMap::DESCRIPTION, OrderProductTableMap::CHAPO, OrderProductTableMap::QUANTITY, OrderProductTableMap::PRICE, OrderProductTableMap::TAX, OrderProductTableMap::PARENT, OrderProductTableMap::CREATED_AT, OrderProductTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'PRODUCT_REF', 'TITLE', 'DESCRIPTION', 'CHAPO', 'QUANTITY', 'PRICE', 'TAX', 'PARENT', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'order_id', 'product_ref', 'title', 'description', 'chapo', 'quantity', 'price', 'tax', 'parent', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
self::TYPE_PHPNAME => array('Id', 'OrderId', 'ProductRef', 'ProductSaleElementsRef', 'Title', 'Chapo', 'Description', 'Postscriptum', 'Quantity', 'Price', 'PromoPrice', 'WasNew', 'WasInPromo', 'Weight', 'TaxRuleTitle', 'TaxRuleDescription', 'Parent', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'productRef', 'productSaleElementsRef', 'title', 'chapo', 'description', 'postscriptum', 'quantity', 'price', 'promoPrice', 'wasNew', 'wasInPromo', 'weight', 'taxRuleTitle', 'taxRuleDescription', 'parent', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(OrderProductTableMap::ID, OrderProductTableMap::ORDER_ID, OrderProductTableMap::PRODUCT_REF, OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF, OrderProductTableMap::TITLE, OrderProductTableMap::CHAPO, OrderProductTableMap::DESCRIPTION, OrderProductTableMap::POSTSCRIPTUM, OrderProductTableMap::QUANTITY, OrderProductTableMap::PRICE, OrderProductTableMap::PROMO_PRICE, OrderProductTableMap::WAS_NEW, OrderProductTableMap::WAS_IN_PROMO, OrderProductTableMap::WEIGHT, OrderProductTableMap::TAX_RULE_TITLE, OrderProductTableMap::TAX_RULE_DESCRIPTION, OrderProductTableMap::PARENT, OrderProductTableMap::CREATED_AT, OrderProductTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'PRODUCT_REF', 'PRODUCT_SALE_ELEMENTS_REF', 'TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'QUANTITY', 'PRICE', 'PROMO_PRICE', 'WAS_NEW', 'WAS_IN_PROMO', 'WEIGHT', 'TAX_RULE_TITLE', 'TAX_RULE_DESCRIPTION', 'PARENT', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'order_id', 'product_ref', 'product_sale_elements_ref', 'title', 'chapo', 'description', 'postscriptum', 'quantity', 'price', 'promo_price', 'was_new', 'was_in_promo', 'weight', 'tax_rule_title', 'tax_rule_description', 'parent', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, )
);
/**
@@ -156,12 +191,12 @@ class OrderProductTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'ProductRef' => 2, 'Title' => 3, 'Description' => 4, 'Chapo' => 5, 'Quantity' => 6, 'Price' => 7, 'Tax' => 8, 'Parent' => 9, 'CreatedAt' => 10, 'UpdatedAt' => 11, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'productRef' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'quantity' => 6, 'price' => 7, 'tax' => 8, 'parent' => 9, 'createdAt' => 10, 'updatedAt' => 11, ),
self::TYPE_COLNAME => array(OrderProductTableMap::ID => 0, OrderProductTableMap::ORDER_ID => 1, OrderProductTableMap::PRODUCT_REF => 2, OrderProductTableMap::TITLE => 3, OrderProductTableMap::DESCRIPTION => 4, OrderProductTableMap::CHAPO => 5, OrderProductTableMap::QUANTITY => 6, OrderProductTableMap::PRICE => 7, OrderProductTableMap::TAX => 8, OrderProductTableMap::PARENT => 9, OrderProductTableMap::CREATED_AT => 10, OrderProductTableMap::UPDATED_AT => 11, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'PRODUCT_REF' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'CHAPO' => 5, 'QUANTITY' => 6, 'PRICE' => 7, 'TAX' => 8, 'PARENT' => 9, 'CREATED_AT' => 10, 'UPDATED_AT' => 11, ),
self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'product_ref' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'quantity' => 6, 'price' => 7, 'tax' => 8, 'parent' => 9, 'created_at' => 10, 'updated_at' => 11, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'ProductRef' => 2, 'ProductSaleElementsRef' => 3, 'Title' => 4, 'Chapo' => 5, 'Description' => 6, 'Postscriptum' => 7, 'Quantity' => 8, 'Price' => 9, 'PromoPrice' => 10, 'WasNew' => 11, 'WasInPromo' => 12, 'Weight' => 13, 'TaxRuleTitle' => 14, 'TaxRuleDescription' => 15, 'Parent' => 16, 'CreatedAt' => 17, 'UpdatedAt' => 18, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'productRef' => 2, 'productSaleElementsRef' => 3, 'title' => 4, 'chapo' => 5, 'description' => 6, 'postscriptum' => 7, 'quantity' => 8, 'price' => 9, 'promoPrice' => 10, 'wasNew' => 11, 'wasInPromo' => 12, 'weight' => 13, 'taxRuleTitle' => 14, 'taxRuleDescription' => 15, 'parent' => 16, 'createdAt' => 17, 'updatedAt' => 18, ),
self::TYPE_COLNAME => array(OrderProductTableMap::ID => 0, OrderProductTableMap::ORDER_ID => 1, OrderProductTableMap::PRODUCT_REF => 2, OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF => 3, OrderProductTableMap::TITLE => 4, OrderProductTableMap::CHAPO => 5, OrderProductTableMap::DESCRIPTION => 6, OrderProductTableMap::POSTSCRIPTUM => 7, OrderProductTableMap::QUANTITY => 8, OrderProductTableMap::PRICE => 9, OrderProductTableMap::PROMO_PRICE => 10, OrderProductTableMap::WAS_NEW => 11, OrderProductTableMap::WAS_IN_PROMO => 12, OrderProductTableMap::WEIGHT => 13, OrderProductTableMap::TAX_RULE_TITLE => 14, OrderProductTableMap::TAX_RULE_DESCRIPTION => 15, OrderProductTableMap::PARENT => 16, OrderProductTableMap::CREATED_AT => 17, OrderProductTableMap::UPDATED_AT => 18, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'PRODUCT_REF' => 2, 'PRODUCT_SALE_ELEMENTS_REF' => 3, 'TITLE' => 4, 'CHAPO' => 5, 'DESCRIPTION' => 6, 'POSTSCRIPTUM' => 7, 'QUANTITY' => 8, 'PRICE' => 9, 'PROMO_PRICE' => 10, 'WAS_NEW' => 11, 'WAS_IN_PROMO' => 12, 'WEIGHT' => 13, 'TAX_RULE_TITLE' => 14, 'TAX_RULE_DESCRIPTION' => 15, 'PARENT' => 16, 'CREATED_AT' => 17, 'UPDATED_AT' => 18, ),
self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'product_ref' => 2, 'product_sale_elements_ref' => 3, 'title' => 4, 'chapo' => 5, 'description' => 6, 'postscriptum' => 7, 'quantity' => 8, 'price' => 9, 'promo_price' => 10, 'was_new' => 11, 'was_in_promo' => 12, 'weight' => 13, 'tax_rule_title' => 14, 'tax_rule_description' => 15, 'parent' => 16, 'created_at' => 17, 'updated_at' => 18, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, )
);
/**
@@ -182,13 +217,20 @@ class OrderProductTableMap extends TableMap
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('ORDER_ID', 'OrderId', 'INTEGER', 'order', 'ID', true, null, null);
$this->addColumn('PRODUCT_REF', 'ProductRef', 'VARCHAR', false, 255, null);
$this->addColumn('PRODUCT_REF', 'ProductRef', 'VARCHAR', true, 255, null);
$this->addColumn('PRODUCT_SALE_ELEMENTS_REF', 'ProductSaleElementsRef', 'VARCHAR', true, 255, null);
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
$this->addColumn('QUANTITY', 'Quantity', 'FLOAT', true, null, null);
$this->addColumn('PRICE', 'Price', 'FLOAT', true, null, null);
$this->addColumn('TAX', 'Tax', 'FLOAT', false, null, null);
$this->addColumn('PROMO_PRICE', 'PromoPrice', 'VARCHAR', false, 45, null);
$this->addColumn('WAS_NEW', 'WasNew', 'TINYINT', true, null, null);
$this->addColumn('WAS_IN_PROMO', 'WasInPromo', 'TINYINT', true, null, null);
$this->addColumn('WEIGHT', 'Weight', 'VARCHAR', false, 45, null);
$this->addColumn('TAX_RULE_TITLE', 'TaxRuleTitle', 'VARCHAR', false, 255, null);
$this->addColumn('TAX_RULE_DESCRIPTION', 'TaxRuleDescription', 'CLOB', false, null, null);
$this->addColumn('PARENT', 'Parent', 'INTEGER', false, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
@@ -200,7 +242,8 @@ class OrderProductTableMap extends TableMap
public function buildRelations()
{
$this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::MANY_TO_ONE, array('order_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('OrderFeature', '\\Thelia\\Model\\OrderFeature', RelationMap::ONE_TO_MANY, array('id' => 'order_product_id', ), 'CASCADE', 'RESTRICT', 'OrderFeatures');
$this->addRelation('OrderProductAttributeCombination', '\\Thelia\\Model\\OrderProductAttributeCombination', RelationMap::ONE_TO_MANY, array('id' => 'order_product_id', ), 'CASCADE', 'RESTRICT', 'OrderProductAttributeCombinations');
$this->addRelation('OrderProductTax', '\\Thelia\\Model\\OrderProductTax', RelationMap::ONE_TO_MANY, array('id' => 'order_product_id', ), 'CASCADE', 'RESTRICT', 'OrderProductTaxes');
} // buildRelations()
/**
@@ -222,7 +265,8 @@ class OrderProductTableMap extends TableMap
{
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
OrderFeatureTableMap::clearInstancePool();
OrderProductAttributeCombinationTableMap::clearInstancePool();
OrderProductTaxTableMap::clearInstancePool();
}
/**
@@ -366,12 +410,19 @@ class OrderProductTableMap extends TableMap
$criteria->addSelectColumn(OrderProductTableMap::ID);
$criteria->addSelectColumn(OrderProductTableMap::ORDER_ID);
$criteria->addSelectColumn(OrderProductTableMap::PRODUCT_REF);
$criteria->addSelectColumn(OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF);
$criteria->addSelectColumn(OrderProductTableMap::TITLE);
$criteria->addSelectColumn(OrderProductTableMap::DESCRIPTION);
$criteria->addSelectColumn(OrderProductTableMap::CHAPO);
$criteria->addSelectColumn(OrderProductTableMap::DESCRIPTION);
$criteria->addSelectColumn(OrderProductTableMap::POSTSCRIPTUM);
$criteria->addSelectColumn(OrderProductTableMap::QUANTITY);
$criteria->addSelectColumn(OrderProductTableMap::PRICE);
$criteria->addSelectColumn(OrderProductTableMap::TAX);
$criteria->addSelectColumn(OrderProductTableMap::PROMO_PRICE);
$criteria->addSelectColumn(OrderProductTableMap::WAS_NEW);
$criteria->addSelectColumn(OrderProductTableMap::WAS_IN_PROMO);
$criteria->addSelectColumn(OrderProductTableMap::WEIGHT);
$criteria->addSelectColumn(OrderProductTableMap::TAX_RULE_TITLE);
$criteria->addSelectColumn(OrderProductTableMap::TAX_RULE_DESCRIPTION);
$criteria->addSelectColumn(OrderProductTableMap::PARENT);
$criteria->addSelectColumn(OrderProductTableMap::CREATED_AT);
$criteria->addSelectColumn(OrderProductTableMap::UPDATED_AT);
@@ -379,12 +430,19 @@ class OrderProductTableMap extends TableMap
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.ORDER_ID');
$criteria->addSelectColumn($alias . '.PRODUCT_REF');
$criteria->addSelectColumn($alias . '.PRODUCT_SALE_ELEMENTS_REF');
$criteria->addSelectColumn($alias . '.TITLE');
$criteria->addSelectColumn($alias . '.DESCRIPTION');
$criteria->addSelectColumn($alias . '.CHAPO');
$criteria->addSelectColumn($alias . '.DESCRIPTION');
$criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
$criteria->addSelectColumn($alias . '.QUANTITY');
$criteria->addSelectColumn($alias . '.PRICE');
$criteria->addSelectColumn($alias . '.TAX');
$criteria->addSelectColumn($alias . '.PROMO_PRICE');
$criteria->addSelectColumn($alias . '.WAS_NEW');
$criteria->addSelectColumn($alias . '.WAS_IN_PROMO');
$criteria->addSelectColumn($alias . '.WEIGHT');
$criteria->addSelectColumn($alias . '.TAX_RULE_TITLE');
$criteria->addSelectColumn($alias . '.TAX_RULE_DESCRIPTION');
$criteria->addSelectColumn($alias . '.PARENT');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');

View File

@@ -0,0 +1,463 @@
<?php
namespace Thelia\Model\Map;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
use Thelia\Model\OrderProductTax;
use Thelia\Model\OrderProductTaxQuery;
/**
* This class defines the structure of the 'order_product_tax' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
*/
class OrderProductTaxTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Thelia.Model.Map.OrderProductTaxTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'order_product_tax';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Thelia\\Model\\OrderProductTax';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Thelia.Model.OrderProductTax';
/**
* The total number of columns
*/
const NUM_COLUMNS = 7;
/**
* The number of lazy-loaded columns
*/
const NUM_LAZY_LOAD_COLUMNS = 0;
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 7;
/**
* the column name for the ID field
*/
const ID = 'order_product_tax.ID';
/**
* the column name for the ORDER_PRODUCT_ID field
*/
const ORDER_PRODUCT_ID = 'order_product_tax.ORDER_PRODUCT_ID';
/**
* the column name for the TITLE field
*/
const TITLE = 'order_product_tax.TITLE';
/**
* the column name for the DESCRIPTION field
*/
const DESCRIPTION = 'order_product_tax.DESCRIPTION';
/**
* the column name for the AMOUNT field
*/
const AMOUNT = 'order_product_tax.AMOUNT';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'order_product_tax.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'order_product_tax.UPDATED_AT';
/**
* The default string format for model objects of the related table
*/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'OrderProductId', 'Title', 'Description', 'Amount', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'orderProductId', 'title', 'description', 'amount', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(OrderProductTaxTableMap::ID, OrderProductTaxTableMap::ORDER_PRODUCT_ID, OrderProductTaxTableMap::TITLE, OrderProductTaxTableMap::DESCRIPTION, OrderProductTaxTableMap::AMOUNT, OrderProductTaxTableMap::CREATED_AT, OrderProductTaxTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'ORDER_PRODUCT_ID', 'TITLE', 'DESCRIPTION', 'AMOUNT', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'order_product_id', 'title', 'description', 'amount', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'OrderProductId' => 1, 'Title' => 2, 'Description' => 3, 'Amount' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderProductId' => 1, 'title' => 2, 'description' => 3, 'amount' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
self::TYPE_COLNAME => array(OrderProductTaxTableMap::ID => 0, OrderProductTaxTableMap::ORDER_PRODUCT_ID => 1, OrderProductTaxTableMap::TITLE => 2, OrderProductTaxTableMap::DESCRIPTION => 3, OrderProductTaxTableMap::AMOUNT => 4, OrderProductTaxTableMap::CREATED_AT => 5, OrderProductTaxTableMap::UPDATED_AT => 6, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_PRODUCT_ID' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'AMOUNT' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
self::TYPE_FIELDNAME => array('id' => 0, 'order_product_id' => 1, 'title' => 2, 'description' => 3, 'amount' => 4, 'created_at' => 5, 'updated_at' => 6, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
);
/**
* Initialize the table attributes and columns
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('order_product_tax');
$this->setPhpName('OrderProductTax');
$this->setClassName('\\Thelia\\Model\\OrderProductTax');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('ORDER_PRODUCT_ID', 'OrderProductId', 'INTEGER', 'order_product', 'ID', true, null, null);
$this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('AMOUNT', 'Amount', 'FLOAT', true, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('OrderProduct', '\\Thelia\\Model\\OrderProduct', RelationMap::MANY_TO_ONE, array('order_product_id' => 'id', ), 'CASCADE', 'RESTRICT');
} // buildRelations()
/**
*
* Gets the list of behaviors registered for this table
*
* @return array Associative array (name => parameters) of behaviors
*/
public function getBehaviors()
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
);
} // getBehaviors()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*/
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
// If the PK cannot be derived from the row, return NULL.
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
return (int) $row[
$indexType == TableMap::TYPE_NUM
? 0 + $offset
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
];
}
/**
* The class that the tableMap will make instances of.
*
* If $withPrefix is true, the returned path
* uses a dot-path notation which is translated into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @param boolean $withPrefix Whether or not to return the path with the class name
* @return string path.to.ClassName
*/
public static function getOMClass($withPrefix = true)
{
return $withPrefix ? OrderProductTaxTableMap::CLASS_DEFAULT : OrderProductTaxTableMap::OM_CLASS;
}
/**
* Populates an object of the default type or an object that inherit from the default.
*
* @param array $row row returned by DataFetcher->fetch().
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return array (OrderProductTax object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = OrderProductTaxTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = OrderProductTaxTableMap::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $offset, true); // rehydrate
$col = $offset + OrderProductTaxTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = OrderProductTaxTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
OrderProductTaxTableMap::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @param DataFetcherInterface $dataFetcher
* @return array
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(DataFetcherInterface $dataFetcher)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = static::getOMClass(false);
// populate the object(s)
while ($row = $dataFetcher->fetch()) {
$key = OrderProductTaxTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = OrderProductTaxTableMap::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, 0, true); // rehydrate
$results[] = $obj;
} else {
$obj = new $cls();
$obj->hydrate($row);
$results[] = $obj;
OrderProductTaxTableMap::addInstanceToPool($obj, $key);
} // if key exists
}
return $results;
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param Criteria $criteria object containing the columns to add.
* @param string $alias optional table alias
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(OrderProductTaxTableMap::ID);
$criteria->addSelectColumn(OrderProductTaxTableMap::ORDER_PRODUCT_ID);
$criteria->addSelectColumn(OrderProductTaxTableMap::TITLE);
$criteria->addSelectColumn(OrderProductTaxTableMap::DESCRIPTION);
$criteria->addSelectColumn(OrderProductTaxTableMap::AMOUNT);
$criteria->addSelectColumn(OrderProductTaxTableMap::CREATED_AT);
$criteria->addSelectColumn(OrderProductTaxTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.ORDER_PRODUCT_ID');
$criteria->addSelectColumn($alias . '.TITLE');
$criteria->addSelectColumn($alias . '.DESCRIPTION');
$criteria->addSelectColumn($alias . '.AMOUNT');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
/**
* Returns the TableMap related to this object.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getServiceContainer()->getDatabaseMap(OrderProductTaxTableMap::DATABASE_NAME)->getTable(OrderProductTaxTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(OrderProductTaxTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(OrderProductTaxTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new OrderProductTaxTableMap());
}
}
/**
* Performs a DELETE on the database, given a OrderProductTax or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or OrderProductTax object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(OrderProductTaxTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Thelia\Model\OrderProductTax) { // it's a model object
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(OrderProductTaxTableMap::DATABASE_NAME);
$criteria->add(OrderProductTaxTableMap::ID, (array) $values, Criteria::IN);
}
$query = OrderProductTaxQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { OrderProductTaxTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { OrderProductTaxTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the order_product_tax table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll(ConnectionInterface $con = null)
{
return OrderProductTaxQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a OrderProductTax or Criteria object.
*
* @param mixed $criteria Criteria or OrderProductTax object containing data that is used to create the INSERT statement.
* @param ConnectionInterface $con the ConnectionInterface connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($criteria, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(OrderProductTaxTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from OrderProductTax object
}
if ($criteria->containsKey(OrderProductTaxTableMap::ID) && $criteria->keyContainsValue(OrderProductTaxTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.OrderProductTaxTableMap::ID.')');
}
// Set the correct dbName
$query = OrderProductTaxQuery::create()->mergeWith($criteria);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = $query->doInsert($con);
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $pk;
}
} // OrderProductTaxTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
OrderProductTaxTableMap::buildTableMap();

View File

@@ -150,7 +150,7 @@ class OrderStatusTableMap extends TableMap
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('CODE', 'Code', 'VARCHAR', false, 45, null);
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()

View File

@@ -215,7 +215,7 @@ class OrderTableMap extends TableMap
$this->addForeignKey('CUSTOMER_ID', 'CustomerId', 'INTEGER', 'customer', 'ID', true, null, null);
$this->addForeignKey('INVOICE_ORDER_ADDRESS_ID', 'InvoiceOrderAddressId', 'INTEGER', 'order_address', 'ID', true, null, null);
$this->addForeignKey('DELIVERY_ORDER_ADDRESS_ID', 'DeliveryOrderAddressId', 'INTEGER', 'order_address', 'ID', true, null, null);
$this->addColumn('INVOICE_DATE', 'InvoiceDate', 'DATE', true, null, null);
$this->addColumn('INVOICE_DATE', 'InvoiceDate', 'DATE', false, null, null);
$this->addForeignKey('CURRENCY_ID', 'CurrencyId', 'INTEGER', 'currency', 'ID', true, null, null);
$this->addColumn('CURRENCY_RATE', 'CurrencyRate', 'FLOAT', true, null, null);
$this->addColumn('TRANSACTION_REF', 'TransactionRef', 'VARCHAR', false, 100, null);

View File

@@ -143,7 +143,7 @@ class TaxI18nTableMap extends TableMap
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'tax', 'ID', true, null, null);
$this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
} // initialize()
/**

View File

@@ -143,7 +143,7 @@ class TaxRuleI18nTableMap extends TableMap
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'tax_rule', 'ID', true, null, null);
$this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
} // initialize()
/**

View File

@@ -2,22 +2,233 @@
namespace Thelia\Model;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Propel;
use Thelia\Core\Event\OrderEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\Base\Order as BaseOrder;
use Thelia\Model\Base\OrderProductTaxQuery;
use Thelia\Model\Map\OrderProductTaxTableMap;
use Thelia\Model\OrderProductQuery;
use Thelia\Model\Map\OrderTableMap;
use \PDO;
class Order extends BaseOrder
{
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
public $chosenDeliveryAddress = null;
public $chosenInvoiceAddress = null;
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::ORDER_BEFORE_CREATE, new OrderEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::ORDER_AFTER_CREATE, new OrderEvent($this));
}
/**
* calculate the total amount
*
* @TODO create body method
* @param int $tax
*
* @return int
* @return int|string|Base\double
*/
public function getTotalAmount()
public function getTotalAmount(&$tax = 0)
{
return 2;
$amount = 0;
$tax = 0;
/* browse all products */
$orderProductIds = array();
foreach($this->getOrderProducts() as $orderProduct) {
$taxAmount = OrderProductTaxQuery::create()
->withColumn('SUM(' . OrderProductTaxTableMap::AMOUNT . ')', 'total_tax')
->filterByOrderProductId($orderProduct->getId(), Criteria::EQUAL)
->findOne();
$amount += ($orderProduct->getWasInPromo() == 1 ? $orderProduct->getPromoPrice() : $orderProduct->getPrice()) * $orderProduct->getQuantity();
$tax += round($taxAmount->getVirtualColumn('total_tax'), 2) * $orderProduct->getQuantity();
}
return $amount + $tax + $this->getPostage(); // @todo : manage discount
}
/**
* PROPEL SHOULD FIX IT
*
* Insert the row in the database.
*
* @param ConnectionInterface $con
*
* @throws PropelException
* @see doSave()
*/
protected function doInsert(ConnectionInterface $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = OrderTableMap::ID;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . OrderTableMap::ID . ')');
}
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(OrderTableMap::ID)) {
$modifiedColumns[':p' . $index++] = 'ID';
}
if ($this->isColumnModified(OrderTableMap::REF)) {
$modifiedColumns[':p' . $index++] = 'REF';
}
if ($this->isColumnModified(OrderTableMap::CUSTOMER_ID)) {
$modifiedColumns[':p' . $index++] = 'CUSTOMER_ID';
}
if ($this->isColumnModified(OrderTableMap::INVOICE_ORDER_ADDRESS_ID)) {
$modifiedColumns[':p' . $index++] = 'INVOICE_ORDER_ADDRESS_ID';
}
if ($this->isColumnModified(OrderTableMap::DELIVERY_ORDER_ADDRESS_ID)) {
$modifiedColumns[':p' . $index++] = 'DELIVERY_ORDER_ADDRESS_ID';
}
if ($this->isColumnModified(OrderTableMap::INVOICE_DATE)) {
$modifiedColumns[':p' . $index++] = 'INVOICE_DATE';
}
if ($this->isColumnModified(OrderTableMap::CURRENCY_ID)) {
$modifiedColumns[':p' . $index++] = 'CURRENCY_ID';
}
if ($this->isColumnModified(OrderTableMap::CURRENCY_RATE)) {
$modifiedColumns[':p' . $index++] = 'CURRENCY_RATE';
}
if ($this->isColumnModified(OrderTableMap::TRANSACTION_REF)) {
$modifiedColumns[':p' . $index++] = 'TRANSACTION_REF';
}
if ($this->isColumnModified(OrderTableMap::DELIVERY_REF)) {
$modifiedColumns[':p' . $index++] = 'DELIVERY_REF';
}
if ($this->isColumnModified(OrderTableMap::INVOICE_REF)) {
$modifiedColumns[':p' . $index++] = 'INVOICE_REF';
}
if ($this->isColumnModified(OrderTableMap::POSTAGE)) {
$modifiedColumns[':p' . $index++] = 'POSTAGE';
}
if ($this->isColumnModified(OrderTableMap::PAYMENT_MODULE_ID)) {
$modifiedColumns[':p' . $index++] = 'PAYMENT_MODULE_ID';
}
if ($this->isColumnModified(OrderTableMap::DELIVERY_MODULE_ID)) {
$modifiedColumns[':p' . $index++] = 'DELIVERY_MODULE_ID';
}
if ($this->isColumnModified(OrderTableMap::STATUS_ID)) {
$modifiedColumns[':p' . $index++] = 'STATUS_ID';
}
if ($this->isColumnModified(OrderTableMap::LANG_ID)) {
$modifiedColumns[':p' . $index++] = 'LANG_ID';
}
if ($this->isColumnModified(OrderTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
if ($this->isColumnModified(OrderTableMap::UPDATED_AT)) {
$modifiedColumns[':p' . $index++] = 'UPDATED_AT';
}
$db = Propel::getServiceContainer()->getAdapter(OrderTableMap::DATABASE_NAME);
if ($db->useQuoteIdentifier()) {
$tableName = $db->quoteIdentifierTable(OrderTableMap::TABLE_NAME);
} else {
$tableName = OrderTableMap::TABLE_NAME;
}
$sql = sprintf(
'INSERT INTO %s (%s) VALUES (%s)',
$tableName,
implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns))
);
try {
$stmt = $con->prepare($sql);
foreach ($modifiedColumns as $identifier => $columnName) {
switch ($columnName) {
case 'ID':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break;
case 'REF':
$stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR);
break;
case 'CUSTOMER_ID':
$stmt->bindValue($identifier, $this->customer_id, PDO::PARAM_INT);
break;
case 'INVOICE_ORDER_ADDRESS_ID':
$stmt->bindValue($identifier, $this->invoice_order_address_id, PDO::PARAM_INT);
break;
case 'DELIVERY_ORDER_ADDRESS_ID':
$stmt->bindValue($identifier, $this->delivery_order_address_id, PDO::PARAM_INT);
break;
case 'INVOICE_DATE':
$stmt->bindValue($identifier, $this->invoice_date ? $this->invoice_date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
case 'CURRENCY_ID':
$stmt->bindValue($identifier, $this->currency_id, PDO::PARAM_INT);
break;
case 'CURRENCY_RATE':
$stmt->bindValue($identifier, $this->currency_rate, PDO::PARAM_STR);
break;
case 'TRANSACTION_REF':
$stmt->bindValue($identifier, $this->transaction_ref, PDO::PARAM_STR);
break;
case 'DELIVERY_REF':
$stmt->bindValue($identifier, $this->delivery_ref, PDO::PARAM_STR);
break;
case 'INVOICE_REF':
$stmt->bindValue($identifier, $this->invoice_ref, PDO::PARAM_STR);
break;
case 'POSTAGE':
$stmt->bindValue($identifier, $this->postage, PDO::PARAM_STR);
break;
case 'PAYMENT_MODULE_ID':
$stmt->bindValue($identifier, $this->payment_module_id, PDO::PARAM_INT);
break;
case 'DELIVERY_MODULE_ID':
$stmt->bindValue($identifier, $this->delivery_module_id, PDO::PARAM_INT);
break;
case 'STATUS_ID':
$stmt->bindValue($identifier, $this->status_id, PDO::PARAM_INT);
break;
case 'LANG_ID':
$stmt->bindValue($identifier, $this->lang_id, PDO::PARAM_INT);
break;
case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
case 'UPDATED_AT':
$stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
}
}
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
}
try {
$pk = $con->lastInsertId();
} catch (Exception $e) {
throw new PropelException('Unable to get autoincrement id.', 0, $e);
}
$this->setId($pk);
$this->setNew(false);
}
}

24
core/lib/Thelia/Model/OrderProduct.php Executable file → Normal file
View File

@@ -2,8 +2,30 @@
namespace Thelia\Model;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Core\Event\OrderEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\Base\OrderProduct as BaseOrderProduct;
class OrderProduct extends BaseOrderProduct {
class OrderProduct extends BaseOrderProduct
{
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::ORDER_PRODUCT_BEFORE_CREATE, new OrderEvent($this->getOrder()));
return true;
}
/**
* {@inheritDoc}
*/
public function postInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::ORDER_PRODUCT_AFTER_CREATE, new OrderEvent($this->getOrder()));
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\OrderProductAttributeCombination as BaseOrderProductAttributeCombination;
class OrderProductAttributeCombination extends BaseOrderProductAttributeCombination
{
}

View File

@@ -0,0 +1,21 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\OrderProductAttributeCombinationQuery as BaseOrderProductAttributeCombinationQuery;
/**
* Skeleton subclass for performing query and update operations on the 'order_product_attribute_combination' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
*/
class OrderProductAttributeCombinationQuery extends BaseOrderProductAttributeCombinationQuery
{
} // OrderProductAttributeCombinationQuery

3
core/lib/Thelia/Model/OrderProductQuery.php Executable file → Normal file
View File

@@ -15,6 +15,7 @@ use Thelia\Model\Base\OrderProductQuery as BaseOrderProductQuery;
* long as it does not already exist in the output directory.
*
*/
class OrderProductQuery extends BaseOrderProductQuery {
class OrderProductQuery extends BaseOrderProductQuery
{
} // OrderProductQuery

View File

@@ -0,0 +1,10 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\OrderProductTax as BaseOrderProductTax;
class OrderProductTax extends BaseOrderProductTax
{
}

View File

@@ -0,0 +1,21 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\OrderProductTaxQuery as BaseOrderProductTaxQuery;
/**
* Skeleton subclass for performing query and update operations on the 'order_product_tax' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
*/
class OrderProductTaxQuery extends BaseOrderProductTaxQuery
{
} // OrderProductTaxQuery

View File

@@ -2,8 +2,11 @@
namespace Thelia\Model;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Propel;
use Thelia\Model\Base\OrderQuery as BaseOrderQuery;
use \PDO;
use Thelia\Model\Map\OrderTableMap;
/**
* Skeleton subclass for performing query and update operations on the 'order' table.
@@ -15,6 +18,38 @@ use Thelia\Model\Base\OrderQuery as BaseOrderQuery;
* long as it does not already exist in the output directory.
*
*/
class OrderQuery extends BaseOrderQuery {
class OrderQuery extends BaseOrderQuery
{
/**
* PROPEL SHOULD FIX IT
*
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return Order A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, REF, CUSTOMER_ID, INVOICE_ORDER_ADDRESS_ID, DELIVERY_ORDER_ADDRESS_ID, INVOICE_DATE, CURRENCY_ID, CURRENCY_RATE, TRANSACTION_REF, DELIVERY_REF, INVOICE_REF, POSTAGE, PAYMENT_MODULE_ID, DELIVERY_MODULE_ID, STATUS_ID, LANG_ID, CREATED_AT, UPDATED_AT FROM `order` WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (\Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new Order();
$obj->hydrate($row);
OrderTableMap::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
} // OrderQuery

View File

@@ -4,6 +4,11 @@ namespace Thelia\Model;
use Thelia\Model\Base\OrderStatus as BaseOrderStatus;
class OrderStatus extends BaseOrderStatus {
class OrderStatus extends BaseOrderStatus
{
const CODE_NOT_PAID = "not_paid";
const CODE_PAID = "paid";
const CODE_PROCESSED = "processed";
const CODE_SENT = "sent";
const CODE_CANCELED = "canceled";
}

View File

@@ -3,7 +3,65 @@
namespace Thelia\Model;
use Thelia\Model\Base\ProductAssociatedContent as BaseProductAssociatedContent;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Core\Event\ProductAssociatedContentEvent;
use Thelia\Core\Event\TheliaEvents;
class ProductAssociatedContent extends BaseProductAssociatedContent {
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_CREATEPRODUCT_ASSOCIATED_CONTENT, new ProductAssociatedContentEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_CREATEPRODUCT_ASSOCIATED_CONTENT, new ProductAssociatedContentEvent($this));
}
/**
* {@inheritDoc}
*/
public function preUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_UPDATEPRODUCT_ASSOCIATED_CONTENT, new ProductAssociatedContentEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_UPDATEPRODUCT_ASSOCIATED_CONTENT, new ProductAssociatedContentEvent($this));
}
/**
* {@inheritDoc}
*/
public function preDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_DELETEPRODUCT_ASSOCIATED_CONTENT, new ProductAssociatedContentEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_DELETEPRODUCT_ASSOCIATED_CONTENT, new ProductAssociatedContentEvent($this));
}
}

View File

@@ -3,7 +3,25 @@
namespace Thelia\Model;
use Thelia\Model\Base\TaxRule as BaseTaxRule;
use Thelia\TaxEngine\Calculator;
use Thelia\TaxEngine\OrderProductTaxCollection;
class TaxRule extends BaseTaxRule {
class TaxRule extends BaseTaxRule
{
/**
* @param Country $country
* @param $untaxedAmount
* @param null $askedLocale
*
* @return OrderProductTaxCollection
*/
public function getTaxDetail(Country $country, $untaxedAmount, $askedLocale = null)
{
$taxCalculator = new Calculator();
$taxCollection = new OrderProductTaxCollection();
$taxCalculator->loadTaxRule($this, $country)->getTaxedPrice($untaxedAmount, $taxCollection, $askedLocale);
return $taxCollection;
}
}

View File

@@ -21,13 +21,19 @@ class TaxRuleQuery extends BaseTaxRuleQuery
{
const ALIAS_FOR_TAX_RULE_COUNTRY_POSITION = 'taxRuleCountryPosition';
public function getTaxCalculatorCollection(Product $product, Country $country)
/**
* @param TaxRule $taxRule
* @param Country $country
*
* @return array|mixed|\Propel\Runtime\Collection\ObjectCollection
*/
public function getTaxCalculatorCollection(TaxRule $taxRule, Country $country)
{
$search = TaxQuery::create()
->filterByTaxRuleCountry(
TaxRuleCountryQuery::create()
->filterByCountry($country, Criteria::EQUAL)
->filterByTaxRuleId($product->getTaxRuleId())
->filterByTaxRuleId($taxRule->getId())
->orderByPosition()
->find()
)

View File

@@ -44,8 +44,11 @@ trait UrlRewritingTrait {
*
* @param string $locale a valid locale (e.g. en_US)
*/
public function getUrl($locale)
public function getUrl($locale = null)
{
if(null === $locale) {
$locale = $this->getLocale();
}
return URL::getInstance()->retrieve($this->getRewrittenUrlViewName(), $this->getId(), $locale)->toString();
}

View File

@@ -25,7 +25,9 @@
namespace Thelia\Module;
use Symfony\Component\DependencyInjection\ContainerAware;
use Thelia\Model\ModuleI18nQuery;
use Thelia\Model\Map\ModuleImageTableMap;
use Thelia\Model\ModuleI18n;
use Thelia\Tools\Image;
use Thelia\Exception\ModuleException;
use Thelia\Model\Module;
@@ -76,6 +78,27 @@ abstract class BaseModule extends ContainerAware
return $this->container;
}
public function setTitle(Module $module, $titles)
{
if(is_array($titles)) {
foreach($titles as $locale => $title) {
$moduleI18n = ModuleI18nQuery::create()->filterById($module->getId())->filterByLocale($locale)->findOne();
if(null === $moduleI18n) {
$moduleI18n = new ModuleI18n();
$moduleI18n
->setId($module->getId())
->setLocale($locale)
->setTitle($title)
;
$moduleI18n->save();
} else {
$moduleI18n->setTitle($title);
$moduleI18n->save();
}
}
}
}
public function deployImageFolder(Module $module, $folderPath)
{
try {
@@ -105,7 +128,7 @@ abstract class BaseModule extends ContainerAware
$image = new ModuleImage();
$image->setModuleId($module->getId());
$image->setPosition($imagePosition);
$image->save();
$image->save($con);
$imageDirectory = sprintf("%s/../../../../local/media/images/module", __DIR__);
$imageFileName = sprintf("%s-%d-%s", $module->getCode(), $image->getId(), $fileName);
@@ -131,7 +154,7 @@ abstract class BaseModule extends ContainerAware
}
$image->setFile($imageFileName);
$image->save();
$image->save($con);
$con->commit();
$imagePosition++;

View File

@@ -24,8 +24,11 @@ namespace Thelia\TaxEngine;
use Thelia\Exception\TaxEngineException;
use Thelia\Model\Country;
use Thelia\Model\OrderProductTax;
use Thelia\Model\Product;
use Thelia\Model\TaxRule;
use Thelia\Model\TaxRuleQuery;
use Thelia\Tools\I18n;
/**
* Class Calculator
@@ -68,14 +71,34 @@ class Calculator
$this->product = $product;
$this->country = $country;
$this->taxRulesCollection = $this->taxRuleQuery->getTaxCalculatorCollection($product, $country);
$this->taxRulesCollection = $this->taxRuleQuery->getTaxCalculatorCollection($product->getTaxRule(), $country);
return $this;
}
public function getTaxAmountFromUntaxedPrice($untaxedPrice)
public function loadTaxRule(TaxRule $taxRule, Country $country)
{
return $this->getTaxedPrice($untaxedPrice) - $untaxedPrice;
$this->product = null;
$this->country = null;
$this->taxRulesCollection = null;
if($taxRule->getId() === null) {
throw new TaxEngineException('TaxRule id is empty in Calculator::loadTaxRule', TaxEngineException::UNDEFINED_TAX_RULE);
}
if($country->getId() === null) {
throw new TaxEngineException('Country id is empty in Calculator::loadTaxRule', TaxEngineException::UNDEFINED_COUNTRY);
}
$this->country = $country;
$this->taxRulesCollection = $this->taxRuleQuery->getTaxCalculatorCollection($taxRule, $country);
return $this;
}
public function getTaxAmountFromUntaxedPrice($untaxedPrice, &$taxCollection = null)
{
return $this->getTaxedPrice($untaxedPrice, $taxCollection) - $untaxedPrice;
}
public function getTaxAmountFromTaxedPrice($taxedPrice)
@@ -83,7 +106,15 @@ class Calculator
return $taxedPrice - $this->getUntaxedPrice($taxedPrice);
}
public function getTaxedPrice($untaxedPrice)
/**
* @param $untaxedPrice
* @param null $taxCollection returns OrderProductTaxCollection
* @param null $askedLocale
*
* @return int
* @throws \Thelia\Exception\TaxEngineException
*/
public function getTaxedPrice($untaxedPrice, &$taxCollection = null, $askedLocale = null)
{
if(null === $this->taxRulesCollection) {
throw new TaxEngineException('Tax rules collection is empty in Calculator::getTaxAmount', TaxEngineException::UNDEFINED_TAX_RULES_COLLECTION);
@@ -97,6 +128,9 @@ class Calculator
$currentPosition = 1;
$currentTax = 0;
if(null !== $taxCollection) {
$taxCollection = new OrderProductTaxCollection();
}
foreach($this->taxRulesCollection as $taxRule) {
$position = (int)$taxRule->getTaxRuleCountryPosition();
@@ -109,7 +143,17 @@ class Calculator
$currentPosition = $position;
}
$currentTax += $taxType->calculate($taxedPrice);
$taxAmount = round($taxType->calculate($taxedPrice), 2);
$currentTax += $taxAmount;
if(null !== $taxCollection) {
$taxI18n = I18n::forceI18nRetrieving($askedLocale, 'Tax', $taxRule->getId());
$orderProductTax = new OrderProductTax();
$orderProductTax->setTitle($taxI18n->getTitle());
$orderProductTax->setDescription($taxI18n->getDescription());
$orderProductTax->setAmount($taxAmount);
$taxCollection->addTax($orderProductTax);
}
}
$taxedPrice += $currentTax;

View File

@@ -0,0 +1,126 @@
<?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\TaxEngine;
use Thelia\Model\OrderProductTax;
/**
*
* @author Etienne Roudeix <eroudeix@openstudio.fr>
*
*/
class OrderProductTaxCollection implements \Iterator
{
private $position;
protected $taxes = array();
public function __construct()
{
foreach (func_get_args() as $tax) {
$this->addTax($tax);
}
}
public function isEmpty()
{
return count($this->taxes) == 0;
}
/**
* @param OrderProductTax $tax
*
* @return OrderProductTaxCollection
*/
public function addTax(OrderProductTax $tax)
{
$this->taxes[] = $tax;
return $this;
}
public function getCount()
{
return count($this->taxes);
}
/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Return the current element
* @link http://php.net/manual/en/iterator.current.php
* @return OrderProductTax
*/
public function current()
{
return $this->taxes[$this->position];
}
/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Move forward to next element
* @link http://php.net/manual/en/iterator.next.php
* @return void Any returned value is ignored.
*/
public function next()
{
$this->position++;
}
/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Return the key of the current element
* @link http://php.net/manual/en/iterator.key.php
* @return mixed scalar on success, or null on failure.
*/
public function key()
{
return $this->position;
}
/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Checks if current position is valid
* @link http://php.net/manual/en/iterator.valid.php
* @return boolean The return value will be casted to boolean and then evaluated.
* Returns true on success or false on failure.
*/
public function valid()
{
return isset($this->taxes[$this->position]);
}
/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Rewind the Iterator to the first element
* @link http://php.net/manual/en/iterator.rewind.php
* @return void Any returned value is ignored.
*/
public function rewind()
{
$this->position = 0;
}
public function getKey($key)
{
return isset($this->taxes[$key]) ? $this->taxes[$key] : null;
}
}

View File

@@ -68,14 +68,11 @@ class ModuleActivateCommandTest extends \PHPUnit_Framework_TestCase
*/
public function testModuleActivateCommandUnknownModule()
{
$module = ModuleQuery::create()->findOne();
$testedModule = ModuleQuery::create()->findOneByCode('Letshopethismoduledoesnotexists');
if(null !== $module && null == $testedModule) {
if(null == $testedModule) {
$application = new Application($this->getKernel());
$module->setActivate(BaseModule::IS_NOT_ACTIVATED);
$module->save();
$moduleActivate = new ModuleActivateCommand();
$moduleActivate->setContainer($this->getContainer());

View File

@@ -86,7 +86,7 @@ class CalculatorTest extends \PHPUnit_Framework_TestCase
$taxRuleQuery = $this->getMock('\Thelia\Model\TaxRuleQuery', array('getTaxCalculatorCollection'));
$taxRuleQuery->expects($this->once())
->method('getTaxCalculatorCollection')
->with($productQuery, $countryQuery)
->with($productQuery->getTaxRule(), $countryQuery)
->will($this->returnValue('foo'));
$rewritingUrlQuery = $this->getProperty('taxRuleQuery');

View File

@@ -23,6 +23,8 @@
namespace Thelia\Tools;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveRecord\ActiveRecordInterface;
use Thelia\Model\Lang;
/**
@@ -54,4 +56,39 @@ class I18n
return \DateTime::createFromFormat($currentDateFormat, $date);
}
public static function forceI18nRetrieving($askedLocale, $modelName, $id, $needed = array('Title'))
{
$i18nQueryClass = sprintf("\\Thelia\\Model\\%sI18nQuery", $modelName);
$i18nClass = sprintf("\\Thelia\\Model\\%sI18n", $modelName);
/* get customer language translation */
$i18n = $i18nQueryClass::create()
->filterById($id)
->filterByLocale(
$askedLocale
)->findOne();
/* or default translation */
if(null === $i18n) {
$i18n = $i18nQueryClass::create()
->filterById($id)
->filterByLocale(
Lang::getDefaultLanguage()->getLocale()
)->findOne();
}
if(null === $i18n) { // @todo something else ?
$i18n = new $i18nClass();;
$i18n->setId($id);
foreach($needed as $need) {
$method = sprintf('set%s', $need);
if(method_exists($i18n, $method)) {
$i18n->$method('DEFAULT ' . strtoupper($need));
} else {
// @todo throw sg ?
}
}
}
return $i18n;
}
}

View File

@@ -18,7 +18,7 @@ Swivel feature for added function. ";"Zoe est un fauteuil contemporain qui combi
"PROD013";"Violet";"A beautifull classic";"Une beauté classique";"A new edition of a classic. Beneath a beautiful colorfull leather, a strong walnut wood frame. You will appreciate the luxurious stylish details of the ''Violet'' armless chair. ";"La réédition d'un classique. Sous un superbe cuir aux couleurs chatoyantes, une solide structure en noyer. Vous apprécierez les détails stylistiques luxueux de notre chaise Violet. ";"Dimensions : Width : 19'' Depth : 23'' Height : 31''";"Dimensions : Larg. 50 cm Prof.60 cm Haut. 80 cm";98;;"PROD013-1.jpg";"MAGIS";"Gray";"Chairs"
"PROD014";"Sally";"Contemporary atypical chair";"Chaise contemporaine hors normes";"Contemporary atypical chair. The atypical sitting of the ''Sally '' chair will nestled you in confort. Play with the vibrant colours range to create a unique dining room. ";"Chaise contemporaine hors normes. L'assise surprenante de la chaise Sally vous enveloppera de confort. Amusez vous avec l'éventail de couleurs lumineuses pour créer une salle à manger unique. ";"Dimensions : Width : 19'' Depth : 23'' Height : 31''";"Dimensions : Larg. 50 cm Prof.60 cm Haut. 80 cm";112;;"PROD014-1.jpg;PROD014-2.jpg;PROD014-3.jpg;PROD014-4.jpg";"PARRY";"blue;purple;orange;yellow";"Chairs"
"PROD015";"Oliver";"Comfort & Design";"Confort et Design";"Surround yourself in ultra modern luxury with the ''Oliver'' armchair and get a look at the future ! Eye-catching, this unique combination of comfort and design is a must-have for today's book nook. ";"Abandonnez vous à un univers de luxe ultra moderne avec le fauteuil Oliver et voyagez dans le futur ! Cette combinaison unique de confort et de design est spectaculaire. Un élément incontournable pour votre bibliothèque. ";"Dimensions : Width : 30'' Depth : 27'' height : 31''";"Dimensions : Larg. 75 cm Prof. 69 cm Haut. 80 cm";340;;"PROD015-1.jpg;PROD015-2.jpg;";"MAGIS";"white;black";"Armchairs;Chairs"
"PROD016";"Lexie";"A modern style";"Un style moderne";"Demonstrate your flair for modern style with our ''Lexie'' chair in your dining room. A rectangular cushioned back offers a contemporary feel, while the comfortable seat provides complete comfort. ";"Montrez que vous avez le sens de la modernité en choisissant la chaise ''Lexie'' pour votre salle à manger. Le coussin rectangulaire sur le dossier apporte une touche contemporaine. L'assise généreuse apporte un confort complet. ";"Dimensions : Width : 19'' Depth : 23'' Height : 40''";"Dimensions : larg. 50 cm Prof. 60 cm Haut. 100 cm";159;;"PROD016-1.jpg";"PLINK";;"Chairs"
"PROD016";"Lexie";"A modern style";"Un style moderne";"Demonstrate your flair for modern style with our ''Lexie'' chair in your dining room. A rectangular cushioned back offers a contemporary feel, while the comfortable seat provides complete comfort. ";"Montrez que vous avez le sens de la modernité en choisissant la chaise ''Lexie'' pour votre salle à manger. Le coussin rectangulaire sur le dossier apporte une touche contemporaine. L'assise généreuse apporte un confort complet. ";"Dimensions : Width : 19'' Depth : 23'' Height : 40''";"Dimensions : larg. 50 cm Prof. 60 cm Haut. 100 cm";159;;"PROD016-1.jpg";"PLINK";"Beige";"Chairs"
"PROD017";"Flynn";"A touch of retro vibe";"Un petit air rétro";"If your destination is up-to-date décor with a touch of retro vibe, look no further than our ''Flynn'' sofa. Sleek, low track arms and high tapering legs give this piece a mid-century flavor. The vibrant tones of the woven upholstery will easily blend with any interior décor. ";"Si vous recherchez une décoration actuelle avec une touche rétro, n'allez pas plus loin et opter pour notre canapé ''Flynn''. Ce canapé a un petit air des années 50 grâce à ses accoudoirs bas, ses pieds allongés et ses lignes pures. Les couleurs chatoyantes de son revêtement en laine lui permettent de se fondre dans tous les intérieurs. ";"Dimensions : Width : 89'' Depth : 37'' Height : 36''";"Dimensions : Larg. 225 cm Prof. 95 cm Haut. 90 cm";1299;;"PROD017-1.jpg;PROD017-2.jpg;PROD017-3.jpg;PROD017-4.jpg";"OFFUS";"blue;green;red;purple";"Sofas"
"PROD018";"Emily";"A old-world feel";"Une touche d'histoire";"Our ''Emily'' armlesschair adds a touch of a old-world feel to your space. Perfect for when defining the seating space in a larger room. A medium wood finish sets off the delicate embellishments at the base, while the luxurous upholstery keeps the look fresh. The cushions guarantee that this is a chair worth relaxing in, not just admiring from afar. ";"La chaise ''Emily'' apporte une touche d'histoire à votre intérieur. Elle est parfaite pour structurer votre espace, notamment dans une grande pièce. Les finitions bois font la part belle à de délicates arabesques, tandis que le luxueux revêtement apporte un look frais. Cette chaise n'est pas destinée à la figuration grâce à la mousse confortable de l'assise. ";"Dimensions : Width : 33'' Depth : 27'' Height : 40''";"Dimensions : Larg. 85 cm Prof. 69 cm Haut. 100 cm";690;;"PROD018-1.jpg";"PARRY";"red";"Armchairs"
"PROD019";"Edgar";"A special spot";"Un endroit à part";"A special spot for reading, lounging or chatting, our '' Edgar '' armchair has no reservations when it comes to style. The design starts with mid-century modern elements like lean arms, while the brushed stainless steel base ensures stability. Swivel feature for added function. ";"Un endroit spécial où lire, rêver ou discuter, notre fauteuil ''Edgar'' n'a pas de limite quand il s'agit de style. Son design part d'éléments contemporains comme ses accoudoirs bas et fins, tandis que sa base en inox brossé assure la stabilité de l'ensemble. Siège pivotant. ";"Dimensions : Width : 33'' Depth : 27'' Height : 40''";"Dimensions: Larg. 85 cm Prof. 69 cm Haut. 100 cm";275;;"PROD019-1.jpg;PROD019-2.jpg;PROD019-3.jpg;PROD019-4.jpg;PROD019-5.jpg";"TOKO";"blue;yellow;orange;pink;purple";"Armchairs"
1 REF TITRE UK CHAPO UK CHAPO FR DESCRIPTIF UK DESCRIPTIF FR POSTSCRIPTUM UK POSTSCRIPTUM FR PRIX PRIX2 PHOTO BRAND COULEUR UK CATEGORIE
18 PROD017 Flynn A touch of retro vibe Un petit air rétro If your destination is up-to-date décor with a touch of retro vibe, look no further than our ''Flynn'' sofa. Sleek, low track arms and high tapering legs give this piece a mid-century flavor. The vibrant tones of the woven upholstery will easily blend with any interior décor. Si vous recherchez une décoration actuelle avec une touche rétro, n'allez pas plus loin et opter pour notre canapé ''Flynn''. Ce canapé a un petit air des années 50 grâce à ses accoudoirs bas, ses pieds allongés et ses lignes pures. Les couleurs chatoyantes de son revêtement en laine lui permettent de se fondre dans tous les intérieurs. Dimensions : Width : 89'' – Depth : 37'' – Height : 36'' Dimensions : Larg. 225 cm – Prof. 95 cm – Haut. 90 cm 1299 PROD017-1.jpg;PROD017-2.jpg;PROD017-3.jpg;PROD017-4.jpg OFFUS blue;green;red;purple Sofas
19 PROD018 Emily A old-world feel Une touche d'histoire Our ''Emily'' armlesschair adds a touch of a old-world feel to your space. Perfect for when defining the seating space in a larger room. A medium wood finish sets off the delicate embellishments at the base, while the luxurous upholstery keeps the look fresh. The cushions guarantee that this is a chair worth relaxing in, not just admiring from afar. La chaise ''Emily'' apporte une touche d'histoire à votre intérieur. Elle est parfaite pour structurer votre espace, notamment dans une grande pièce. Les finitions bois font la part belle à de délicates arabesques, tandis que le luxueux revêtement apporte un look frais. Cette chaise n'est pas destinée à la figuration grâce à la mousse confortable de l'assise. Dimensions : Width : 33'' – Depth : 27'' – Height : 40'' Dimensions : Larg. 85 cm – Prof. 69 cm – Haut. 100 cm 690 PROD018-1.jpg PARRY red Armchairs
20 PROD019 Edgar A special spot Un endroit à part A special spot for reading, lounging or chatting, our '' Edgar '' armchair has no reservations when it comes to style. The design starts with mid-century modern elements like lean arms, while the brushed stainless steel base ensures stability. Swivel feature for added function. Un endroit spécial où lire, rêver ou discuter, notre fauteuil ''Edgar'' n'a pas de limite quand il s'agit de style. Son design part d'éléments contemporains comme ses accoudoirs bas et fins, tandis que sa base en inox brossé assure la stabilité de l'ensemble. Siège pivotant. Dimensions : Width : 33'' – Depth : 27'' – Height : 40'' Dimensions: Larg. 85 cm – Prof. 69 cm – Haut. 100 cm 275 PROD019-1.jpg;PROD019-2.jpg;PROD019-3.jpg;PROD019-4.jpg;PROD019-5.jpg TOKO blue;yellow;orange;pink;purple Armchairs
21 PROD020 Pamela Clean lines Des lignes pures By making our ''Pamela'' chair a centerpiece of your dining area, you'll demonstrate your eye for clean lines and comfortable seating. The contemporary touches of this chair are provided by the light brown wool, a flared seat back and slightly curved wood back legs. The color of the uphostery is the perfect complement to the wood finish of the chair legs. Choisissez notre chaise '' Pamela'' comme pièce maitresse de votre salle à manger et faites la démonstration de votre maitrise des lignes épurées et du confort d'assise. L'allure contemporaine de cette chaise provient de la laine beige, du dossier légèrement évasé et des pieds en bois arrières délicatement incurvés. La couleur du revêtement fait parfaitement écho à la finition bois des pieds. Dimensions : larg. 50 cm – Prof. 60 cm – Haut. 100 cm Dimensions : Width : 19'' – Depth : 23'' – Height : 40'' Dimensions : Width : 19'' – Depth : 23'' – Height : 40'' 189 PROD020-1.jpg OFFUS brown Chairs
22 PROD021 Courtney Mil madness Douce folie Add a dash of mild madness to your kitchen ! Eye-catching, this ''Courtney'' armless chair is a must-have for hip dining area. Mettez une touche de douce folie dans votre cuisine ! Surprenante, notre chaise ''Courtney'' est incontournable pour un coin repas branché. Dimensions : Width : 19'' – Depth : 23'' – Height : 31'' Dimensions : Larg. 50 cm – Prof.60 cm – Haut. 80 cm 89 PROD021-1.jpg;PROD021-2.jpg;PROD021-3.jpg;PROD021-4.jpg TOKO blue;orange;green;purple Chairs
23 PROD022 Barbara An amazing look Un look détonnant An amazing look for our ''Barbara'' chair ! A cut-out oval in the back provides a distinctive character, while the lively range of colours and the mat finish makes a big style statement. Dimensions : Width : 19'' – Depth : 23'' – Height : 31'' Un look hors du commun pour la chaise ''Barbara'' ! L'ouverture oval du dossier apporte une personnalité toute particulière tandis que la large gamme de couleurs vives et le rendu mat provoque un vrai effet de style. Dimensions : Larg. 50 cm – Prof.60 cm – Haut. 80 cm Width : 19'' – Depth : 23'' – Height : 31'' Dimensions : Larg. 50 cm – Prof.60 cm – Haut. 80 cm 122 PROD022-1.jpg;PROD022-2.jpg;PROD022-3.jpg;PROD022-4.jpg;PROD022-5.jpg MAGIS blue;turquoise;yellow;orange;red Chairs
24 PROD023 Haley An armless chair coming from outer space ! Une chaise cosmique ! This ''Haley'' amazing chair is as light as paper but sturdy as steel. Play with the vibrant colours range to create a unique dining area. La chaise ''Haley'' est étonnante : légère comme le papier mais solide comme l'acier. Jouez avec la gamme de couleurs vibrantes pour composer un espace repas unique. Dimensions : Width : 19'' – Depth : 23'' – Height : 31'' Dimensions : Larg. 50 cm – Prof.60 cm – Haut. 80 cm 93 PROD023-1.jpg;PROD023-2.jpg;PROD023-3.jpg;PROD023-4.jpg;PROD023-5.jpg;PROD023-6.jpg MILAN purple;green;pink;red;orange;turquoise Chairs

View File

@@ -27,7 +27,7 @@ INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updat
('thelia_admin_remember_me_cookie_expiration', 2592000, 0, 0, NOW(), NOW()),
('thelia_customer_remember_me_cookie_name', 'tcrmcn', 0, 0, NOW(), NOW()),
('thelia_customer_remember_me_cookie_expiration', 31536000, 0, 0, NOW(), NOW()),
('session_config.handlers', 'Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler', 0, 0, NOW(), NOW())
('session_config.handlers', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeFileSessionHandler', 0, 0, NOW(), NOW())
;
@@ -1153,7 +1153,7 @@ INSERT INTO `tax` (`id`, `type`, `serialized_requirements`, `created_at`, `upda
INSERT INTO `tax_i18n` (`id`, `locale`, `title`)
VALUES
(1, 'fr_FR', 'TVA française à 19.6%'),
(1, 'en_UK', 'french 19.6% tax');
(1, 'en_US', 'french 19.6% tax');
INSERT INTO `tax_rule` (`id`, `is_default`, `created_at`, `updated_at`)
VALUES
@@ -1162,8 +1162,27 @@ INSERT INTO `tax_rule` (`id`, `is_default`, `created_at`, `updated_at`)
INSERT INTO `tax_rule_i18n` (`id`, `locale`, `title`)
VALUES
(1, 'fr_FR', 'TVA française à 19.6%'),
(1, 'en_UK', 'french 19.6% tax');
(1, 'en_US', 'french 19.6% tax');
INSERT INTO `tax_rule_country` (`tax_rule_id`, `country_id`, `tax_id`, `position`, `created_at`, `updated_at`)
VALUES
(1, 64, 1, 1, NOW(), NOW());
INSERT INTO `order_status`(`id`, `code`, `created_at`, `updated_at`) VALUES
(1, 'not_paid', NOW(), NOW()),
(2, 'paid', NOW(), NOW()),
(3, 'processing', NOW(), NOW()),
(4, 'sent', NOW(), NOW()),
(5, 'canceled', NOW(), NOW());
INSERT INTO `order_status_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES
(1, 'en_US', 'Not paid', '', '', ''),
(1, 'fr_FR', 'Non payée', '', '', ''),
(2, 'en_US', 'Paid', '', '', ''),
(2, 'fr_FR', 'Payée', '', '', ''),
(3, 'en_US', 'Processing', '', '', ''),
(3, 'fr_FR', 'Traitement', '', '', ''),
(4, 'en_US', 'Sent', '', '', ''),
(4, 'fr_FR', 'Envoyée', '', '', ''),
(5, 'en_US', 'Canceled', '', '', ''),
(5, 'fr_FR', 'Annulée', '', '', '');

View File

@@ -641,7 +641,7 @@ CREATE TABLE `order`
`customer_id` INTEGER NOT NULL,
`invoice_order_address_id` INTEGER NOT NULL,
`delivery_order_address_id` INTEGER NOT NULL,
`invoice_date` DATE NOT NULL,
`invoice_date` DATE,
`currency_id` INTEGER NOT NULL,
`currency_rate` FLOAT NOT NULL,
`transaction_ref` VARCHAR(100) COMMENT 'transaction reference - usually use to identify a transaction with banking modules',
@@ -760,14 +760,21 @@ CREATE TABLE `order_product`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`order_id` INTEGER NOT NULL,
`product_ref` VARCHAR(255),
`product_ref` VARCHAR(255) NOT NULL,
`product_sale_elements_ref` VARCHAR(255) NOT NULL,
`title` VARCHAR(255),
`description` TEXT,
`chapo` TEXT,
`description` LONGTEXT,
`postscriptum` TEXT,
`quantity` FLOAT NOT NULL,
`price` FLOAT NOT NULL,
`tax` FLOAT,
`parent` INTEGER,
`promo_price` VARCHAR(45),
`was_new` TINYINT NOT NULL,
`was_in_promo` TINYINT NOT NULL,
`weight` VARCHAR(45),
`tax_rule_title` VARCHAR(255),
`tax_rule_description` LONGTEXT,
`parent` INTEGER COMMENT 'not managed yet',
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
@@ -788,29 +795,36 @@ DROP TABLE IF EXISTS `order_status`;
CREATE TABLE `order_status`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`code` VARCHAR(45),
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- order_feature
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `order_feature`;
CREATE TABLE `order_feature`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`order_product_id` INTEGER NOT NULL,
`feature_desc` VARCHAR(255),
`feature_av_desc` VARCHAR(255),
`code` VARCHAR(45) NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `idx_order_feature_order_product_id` (`order_product_id`),
CONSTRAINT `fk_order_feature_order_product_id`
UNIQUE INDEX `code_UNIQUE` (`code`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- order_product_attribute_combination
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `order_product_attribute_combination`;
CREATE TABLE `order_product_attribute_combination`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`order_product_id` INTEGER NOT NULL,
`attribute_title` VARCHAR(255) NOT NULL,
`attribute_chapo` TEXT,
`attribute_description` LONGTEXT,
`attribute_postscriptumn` TEXT,
`attribute_av_title` VARCHAR(255) NOT NULL,
`attribute_av_chapo` TEXT,
`attribute_av_description` LONGTEXT,
`attribute_av_postscriptum` TEXT,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `idx_order_product_attribute_combination_order_product_id` (`order_product_id`),
CONSTRAINT `fk_order_product_attribute_combination_order_product_id`
FOREIGN KEY (`order_product_id`)
REFERENCES `order_product` (`id`)
ON UPDATE RESTRICT
@@ -1559,6 +1573,30 @@ CREATE TABLE `module_image`
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- order_product_tax
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `order_product_tax`;
CREATE TABLE `order_product_tax`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`order_product_id` INTEGER NOT NULL,
`title` VARCHAR(255) NOT NULL,
`description` LONGTEXT,
`amount` FLOAT NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `idx_ order_product_tax_order_product_id` (`order_product_id`),
CONSTRAINT `fk_ order_product_tax_order_product_id0`
FOREIGN KEY (`order_product_id`)
REFERENCES `order_product` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- category_i18n
-- ---------------------------------------------------------------------
@@ -1633,7 +1671,7 @@ CREATE TABLE `tax_i18n`
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255),
`description` TEXT,
`description` LONGTEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `tax_i18n_FK_1`
FOREIGN KEY (`id`)
@@ -1652,7 +1690,7 @@ CREATE TABLE `tax_rule_i18n`
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255),
`description` TEXT,
`description` LONGTEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `tax_rule_i18n_FK_1`
FOREIGN KEY (`id`)

View File

@@ -101,7 +101,7 @@
<column name="type" required="true" size="255" type="VARCHAR" />
<column name="serialized_requirements" required="true" type="LONGVARCHAR" />
<column name="title" size="255" type="VARCHAR" />
<column name="description" type="LONGVARCHAR" />
<column name="description" type="CLOB" />
<behavior name="timestampable" />
<behavior name="i18n">
<parameter name="i18n_columns" value="title, description" />
@@ -110,7 +110,7 @@
<table name="tax_rule" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="title" size="255" type="VARCHAR" />
<column name="description" type="LONGVARCHAR" />
<column name="description" type="CLOB" />
<column defaultValue="0" name="is_default" required="true" type="BOOLEAN" />
<behavior name="timestampable" />
<behavior name="i18n">
@@ -500,7 +500,7 @@
<column name="customer_id" required="true" type="INTEGER" />
<column name="invoice_order_address_id" required="true" type="INTEGER" />
<column name="delivery_order_address_id" required="true" type="INTEGER" />
<column name="invoice_date" required="true" type="DATE" />
<column name="invoice_date" type="DATE" />
<column name="currency_id" required="true" type="INTEGER" />
<column name="currency_rate" required="true" type="FLOAT" />
<column description="transaction reference - usually use to identify a transaction with banking modules" name="transaction_ref" size="100" type="VARCHAR" />
@@ -595,14 +595,21 @@
<table name="order_product" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="order_id" required="true" type="INTEGER" />
<column name="product_ref" size="255" type="VARCHAR" />
<column name="product_ref" required="true" size="255" type="VARCHAR" />
<column name="product_sale_elements_ref" required="true" size="255" type="VARCHAR" />
<column name="title" size="255" type="VARCHAR" />
<column name="description" type="LONGVARCHAR" />
<column name="chapo" type="LONGVARCHAR" />
<column name="description" type="CLOB" />
<column name="postscriptum" type="LONGVARCHAR" />
<column name="quantity" required="true" type="FLOAT" />
<column name="price" required="true" type="FLOAT" />
<column name="tax" type="FLOAT" />
<column name="parent" type="INTEGER" />
<column name="promo_price" size="45" type="VARCHAR" />
<column name="was_new" required="true" type="TINYINT" />
<column name="was_in_promo" required="true" type="TINYINT" />
<column name="weight" size="45" type="VARCHAR" />
<column name="tax_rule_title" size="255" type="VARCHAR" />
<column name="tax_rule_description" type="CLOB" />
<column description="not managed yet" name="parent" type="INTEGER" />
<foreign-key foreignTable="order" name="fk_order_product_order_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="order_id" />
</foreign-key>
@@ -613,25 +620,34 @@
</table>
<table name="order_status" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="code" size="45" type="VARCHAR" />
<column name="code" required="true" size="45" type="VARCHAR" />
<column name="title" size="255" type="VARCHAR" />
<column name="description" type="CLOB" />
<column name="chapo" type="LONGVARCHAR" />
<column name="postscriptum" type="LONGVARCHAR" />
<unique name="code_UNIQUE">
<unique-column name="code" />
</unique>
<behavior name="timestampable" />
<behavior name="i18n">
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
</behavior>
</table>
<table name="order_feature" namespace="Thelia\Model">
<table name="order_product_attribute_combination" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="order_product_id" required="true" type="INTEGER" />
<column name="feature_desc" size="255" type="VARCHAR" />
<column name="feature_av_desc" size="255" type="VARCHAR" />
<foreign-key foreignTable="order_product" name="fk_order_feature_order_product_id" onDelete="CASCADE" onUpdate="RESTRICT">
<column name="attribute_title" required="true" size="255" type="VARCHAR" />
<column name="attribute_chapo" type="LONGVARCHAR" />
<column name="attribute_description" type="CLOB" />
<column name="attribute_postscriptumn" type="LONGVARCHAR" />
<column name="attribute_av_title" required="true" size="255" type="VARCHAR" />
<column name="attribute_av_chapo" type="LONGVARCHAR" />
<column name="attribute_av_description" type="CLOB" />
<column name="attribute_av_postscriptum" type="LONGVARCHAR" />
<foreign-key foreignTable="order_product" name="fk_order_product_attribute_combination_order_product_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="order_product_id" />
</foreign-key>
<index name="idx_order_feature_order_product_id">
<index name="idx_order_product_attribute_combination_order_product_id">
<index-column name="order_product_id" />
</index>
<behavior name="timestampable" />
@@ -1221,4 +1237,18 @@
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
</behavior>
</table>
<table name="order_product_tax" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="order_product_id" required="true" type="INTEGER" />
<column name="title" required="true" size="255" type="VARCHAR" />
<column name="description" type="CLOB" />
<column name="amount" required="true" type="FLOAT" />
<foreign-key foreignTable="order_product" name="fk_ order_product_tax_order_product_id0" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="order_product_id" />
</foreign-key>
<index name="idx_ order_product_tax_order_product_id">
<index-column name="order_product_id" />
</index>
<behavior name="timestampable" />
</table>
</database>

View File

@@ -56,7 +56,7 @@ class Cheque extends BaseModule implements PaymentModuleInterface
public function pay()
{
// TODO: Implement pay() method.
// no special process, waiting for the cheque.
}
public function install()
@@ -71,6 +71,15 @@ class Cheque extends BaseModule implements PaymentModuleInterface
if(ModuleImageQuery::create()->filterByModule($module)->count() == 0) {
$this->deployImageFolder($module, sprintf('%s/images', __DIR__));
}
/* set module title */
$this->setTitle(
$module,
array(
"en_US" => "Cheque",
"fr_FR" => "Cheque",
)
);
}
public function destroy()

View File

@@ -71,6 +71,15 @@ class FakeCB extends BaseModule implements PaymentModuleInterface
if(ModuleImageQuery::create()->filterByModule($module)->count() == 0) {
$this->deployImageFolder($module, sprintf('%s/images', __DIR__));
}
/* set module title */
$this->setTitle(
$module,
array(
"en_US" => "Credit Card",
"fr_FR" => "Carte de crédit",
)
);
}
public function destroy()

View File

@@ -51,14 +51,10 @@
<div class="container">
<div class="row">
<div class="col-md-6">
<div class="version-info">{intl l='Version %ver' ver="{$THELIA_VERSION}"}</div>
</div>
{module_include location='inside_topbar'}
<div class="col-md-6 clearfix">
<div class="col-md-12 clearfix">
<div class="version-info pull-left">{intl l='Version %ver' ver="{$THELIA_VERSION}"}</div>
<div class="clearfix pull-right hidden-xs">
<div class="btn-group pull-right">
<a href="{navigate to="index"}" title="{intl l='View site'}" target="_blank" class="btn btn-default"><span class="glyphicon glyphicon-eye-open"></span> {intl l="View shop"}</a>
<button class="btn btn-default btn-primary"><span class="glyphicon glyphicon-user"></span> {admin attr="firstname"} {admin attr="lastname"}</button>
@@ -66,12 +62,16 @@
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a class="profile" href="{url path='admin/edit_profile'}"><span class="glyphicon glyphicon-edit"></span> {intl l="Profil"}</a></li>
<li><a class="profile" href="{url path='admin/profile/update'}"><span class="glyphicon glyphicon-edit"></span> {intl l="Profil"}</a></li>
<li><a class="logout" href="{url path='admin/logout'}" title="{intl l='Close administation session'}"><span class="glyphicon glyphicon-off"></span> {intl l="Logout"}</a></li>
</ul>
</div>
</div>
</div>
{module_include location='inside_topbar'}
</div>
</div>
@@ -87,6 +87,7 @@
<div class="container">
<div class="row">
<div class="navbar-header">
<button type="button" class="btn navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
@@ -167,7 +168,7 @@
</ul>
{loop name="top-bar-search" type="auth" roles="ADMIN" permissions="admin.search"}
<form class="navbar-form pull-right" action="{url path='/admin/search'}">
<form class="navbar-form pull-right hidden-xs" action="{url path='/admin/search'}">
<div class="form-group">
<input type="text" class="form-control" id="search_term" name="search_term" placeholder="{intl l='Search'}">
</div>
@@ -177,6 +178,7 @@
</div>
</div>
</div>
</nav>
{module_include location='after_top_menu'}

View File

@@ -25,6 +25,7 @@
{/elseloop}
</div>
<div class="table-responsive">
<table class="table table-striped table-condensed table-left-aligned">
<thead>
<tr>
@@ -72,7 +73,7 @@
{/elseloop}
</tbody>
</table>
</div>
{* Delete value confirmation dialog *}
{capture "delete_attribute_dialog"}

View File

@@ -25,6 +25,7 @@
{/elseloop}
</div>
<div class="table-responsive">
<table class="table table-striped table-condensed table-left-aligned">
<thead>
<tr>
@@ -72,6 +73,7 @@
{/elseloop}
</tbody>
</table>
</div>
{* Delete value confirmation dialog *}

View File

@@ -0,0 +1,709 @@
/*!
* bootstrap-select v1.3.1
* http://silviomoreto.github.io/bootstrap-select/
*
* Copyright 2013 bootstrap-select
* Licensed under the MIT license
*/
!function($) {
"use strict";
$.expr[":"].icontains = $.expr.createPseudo(function(arg) {
return function( elem ) {
return $(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
};
});
var Selectpicker = function(element, options, e) {
if (e) {
e.stopPropagation();
e.preventDefault();
}
this.$element = $(element);
this.$newElement = null;
this.$button = null;
this.$menu = null;
//Merge defaults, options and data-attributes to make our options
this.options = $.extend({}, $.fn.selectpicker.defaults, this.$element.data(), typeof options == 'object' && options);
//If we have no title yet, check the attribute 'title' (this is missed by jq as its not a data-attribute
if (this.options.title == null) {
this.options.title = this.$element.attr('title');
}
//Expose public methods
this.val = Selectpicker.prototype.val;
this.render = Selectpicker.prototype.render;
this.refresh = Selectpicker.prototype.refresh;
this.setStyle = Selectpicker.prototype.setStyle;
this.selectAll = Selectpicker.prototype.selectAll;
this.deselectAll = Selectpicker.prototype.deselectAll;
this.init();
};
Selectpicker.prototype = {
constructor: Selectpicker,
init: function(e) {
this.$element.hide();
this.multiple = this.$element.prop('multiple');
var id = this.$element.attr('id');
this.$newElement = this.createView();
this.$element.after(this.$newElement);
this.$menu = this.$newElement.find('> .dropdown-menu');
this.$button = this.$newElement.find('> button');
this.$searchbox = this.$newElement.find('input');
if (id !== undefined) {
var that = this;
this.$button.attr('data-id', id);
$('label[for="' + id + '"]').click(function(e) {
e.preventDefault();
that.$button.focus();
});
}
this.checkDisabled();
this.checkTabIndex();
this.clickListener();
this.liveSearchListener();
this.render();
this.liHeight();
this.setStyle();
this.setWidth();
if (this.options.container) {
this.selectPosition();
}
this.$menu.data('this', this);
this.$newElement.data('this', this);
},
createDropdown: function() {
//If we are multiple, then add the show-tick class by default
var multiple = this.multiple ? ' show-tick' : '';
var header = this.options.header ? '<h3 class="popover-title">' + this.options.header + '<button type="button" class="close" aria-hidden="true">&times;</button></h3>' : '';
var searchbox = this.options.liveSearch ? '<div class="bootstrap-select-searchbox"><input type="text" class="input-block-level form-control" /></div>' : '';
var drop =
"<div class='btn-group bootstrap-select" + multiple + "'>" +
"<button type='button' class='btn dropdown-toggle' data-toggle='dropdown'>" +
"<div class='filter-option pull-left'></div>&nbsp;" +
"<div class='caret'></div>" +
"</button>" +
"<div class='dropdown-menu open'>" +
header +
searchbox +
"<ul class='dropdown-menu inner' role='menu'>" +
"</ul>" +
"</div>" +
"</div>";
return $(drop);
},
createView: function() {
var $drop = this.createDropdown();
var $li = this.createLi();
$drop.find('ul').append($li);
return $drop;
},
reloadLi: function() {
//Remove all children.
this.destroyLi();
//Re build
var $li = this.createLi();
this.$menu.find('ul').append( $li );
},
destroyLi: function() {
this.$menu.find('li').remove();
},
createLi: function() {
var that = this,
_liA = [],
_liHtml = '';
this.$element.find('option').each(function(index) {
var $this = $(this);
//Get the class and text for the option
var optionClass = $this.attr("class") || '';
var inline = $this.attr("style") || '';
var text = $this.data('content') ? $this.data('content') : $this.html();
var subtext = $this.data('subtext') !== undefined ? '<small class="muted">' + $this.data('subtext') + '</small>' : '';
var icon = $this.data('icon') !== undefined ? '<i class="glyphicon '+$this.data('icon')+'"></i> ' : '';
if (icon !== '' && ($this.is(':disabled') || $this.parent().is(':disabled'))) {
icon = '<span>'+icon+'</span>';
}
if (!$this.data('content')) {
//Prepend any icon and append any subtext to the main text.
text = icon + '<span class="text">' + text + subtext + '</span>';
}
if (that.options.hideDisabled && ($this.is(':disabled') || $this.parent().is(':disabled'))) {
_liA.push('<a style="min-height: 0; padding: 0"></a>');
} else if ($this.parent().is('optgroup') && $this.data('divider') != true) {
if ($this.index() == 0) {
//Get the opt group label
var label = $this.parent().attr('label');
var labelSubtext = $this.parent().data('subtext') !== undefined ? '<small class="muted">'+$this.parent().data('subtext')+'</small>' : '';
var labelIcon = $this.parent().data('icon') ? '<i class="'+$this.parent().data('icon')+'"></i> ' : '';
label = labelIcon + '<span class="text">' + label + labelSubtext + '</span>';
if ($this[0].index != 0) {
_liA.push(
'<div class="div-contain"><div class="divider"></div></div>'+
'<dt>'+label+'</dt>'+
that.createA(text, "opt " + optionClass, inline )
);
} else {
_liA.push(
'<dt>'+label+'</dt>'+
that.createA(text, "opt " + optionClass, inline ));
}
} else {
_liA.push(that.createA(text, "opt " + optionClass, inline ));
}
} else if ($this.data('divider') == true) {
_liA.push('<div class="div-contain"><div class="divider"></div></div>');
} else if ($(this).data('hidden') == true) {
_liA.push('');
} else {
_liA.push(that.createA(text, optionClass, inline ));
}
});
$.each(_liA, function(i, item) {
_liHtml += "<li rel=" + i + ">" + item + "</li>";
});
//If we are not multiple, and we dont have a selected item, and we dont have a title, select the first element so something is set in the button
if (!this.multiple && this.$element.find('option:selected').length==0 && !this.options.title) {
this.$element.find('option').eq(0).prop('selected', true).attr('selected', 'selected');
}
return $(_liHtml);
},
createA: function(text, classes, inline) {
return '<a tabindex="0" class="'+classes+'" style="'+inline+'">' +
text +
'<i class="glyphicon glyphicon-ok icon-ok check-mark"></i>' +
'</a>';
},
render: function() {
var that = this;
//Update the LI to match the SELECT
this.$element.find('option').each(function(index) {
that.setDisabled(index, $(this).is(':disabled') || $(this).parent().is(':disabled') );
that.setSelected(index, $(this).is(':selected') );
});
var selectedItems = this.$element.find('option:selected').map(function(index,value) {
var $this = $(this);
var icon = $this.data('icon') && that.options.showIcon ? '<i class="glyphicon ' + $this.data('icon') + '"></i> ' : '';
var subtext;
if (that.options.showSubtext && $this.attr('data-subtext') && !that.multiple) {
subtext = ' <small class="muted">'+$this.data('subtext') +'</small>';
} else {
subtext = '';
}
if ($this.data('content') && that.options.showContent) {
return $this.data('content');
} else if ($this.attr('title') != undefined) {
return $this.attr('title');
} else {
return icon + $this.html() + subtext;
}
}).toArray();
//Fixes issue in IE10 occurring when no default option is selected and at least one option is disabled
//Convert all the values into a comma delimited string
var title = !this.multiple ? selectedItems[0] : selectedItems.join(", ");
//If this is multi select, and the selectText type is count, the show 1 of 2 selected etc..
if (this.multiple && this.options.selectedTextFormat.indexOf('count') > -1) {
var max = this.options.selectedTextFormat.split(">");
var notDisabled = this.options.hideDisabled ? ':not([disabled])' : '';
if ( (max.length>1 && selectedItems.length > max[1]) || (max.length==1 && selectedItems.length>=2)) {
title = this.options.countSelectedText.replace('{0}', selectedItems.length).replace('{1}', this.$element.find('option:not([data-divider="true"]):not([data-hidden="true"])'+notDisabled).length);
}
}
//If we dont have a title, then use the default, or if nothing is set at all, use the not selected text
if (!title) {
title = this.options.title != undefined ? this.options.title : this.options.noneSelectedText;
}
this.$newElement.find('.filter-option').html(title);
},
setStyle: function(style, status) {
if (this.$element.attr('class')) {
this.$newElement.addClass(this.$element.attr('class').replace(/selectpicker|mobile-device/gi, ''));
}
var buttonClass = style ? style : this.options.style;
if (status == 'add') {
this.$button.addClass(buttonClass);
} else if (status == 'remove') {
this.$button.removeClass(buttonClass);
} else {
this.$button.removeClass(this.options.style);
this.$button.addClass(buttonClass);
}
},
liHeight: function() {
var selectClone = this.$newElement.clone();
selectClone.appendTo('body');
var $menuClone = selectClone.addClass('open').find('> .dropdown-menu');
var liHeight = $menuClone.find('li > a').outerHeight();
var headerHeight = this.options.header ? $menuClone.find('.popover-title').outerHeight() : 0;
selectClone.remove();
this.$newElement.data('liHeight', liHeight).data('headerHeight', headerHeight);
},
setSize: function() {
var that = this,
menu = this.$menu,
menuInner = menu.find('.inner'),
menuA = menuInner.find('li > a'),
selectHeight = this.$newElement.outerHeight(),
liHeight = this.$newElement.data('liHeight'),
headerHeight = this.$newElement.data('headerHeight'),
divHeight = menu.find('li .divider').outerHeight(true),
menuPadding = parseInt(menu.css('padding-top')) +
parseInt(menu.css('padding-bottom')) +
parseInt(menu.css('border-top-width')) +
parseInt(menu.css('border-bottom-width')),
notDisabled = this.options.hideDisabled ? ':not(.disabled)' : '',
$window = $(window),
menuExtras = menuPadding + parseInt(menu.css('margin-top')) + parseInt(menu.css('margin-bottom')) + 2,
menuHeight,
selectOffsetTop,
selectOffsetBot,
posVert = function() {
selectOffsetTop = that.$newElement.offset().top - $window.scrollTop();
selectOffsetBot = $window.height() - selectOffsetTop - selectHeight;
};
posVert();
if (this.options.header) menu.css('padding-top', 0);
if (this.options.size == 'auto') {
var getSize = function() {
var minHeight;
posVert();
menuHeight = selectOffsetBot - menuExtras;
that.$newElement.toggleClass('dropup', (selectOffsetTop > selectOffsetBot) && (menuHeight - menuExtras) < menu.height() && that.options.dropupAuto);
if (that.$newElement.hasClass('dropup')) {
menuHeight = selectOffsetTop - menuExtras;
}
if ((menu.find('li').length + menu.find('dt').length) > 3) {
minHeight = liHeight*3 + menuExtras - 2;
} else {
minHeight = 0;
}
menu.css({'max-height' : menuHeight + 'px', 'overflow' : 'hidden', 'min-height' : minHeight + 'px'});
menuInner.css({'max-height' : menuHeight - headerHeight- menuPadding + 'px', 'overflow-y' : 'auto', 'min-height' : minHeight - menuPadding + 'px'});
}
getSize();
$(window).resize(getSize);
$(window).scroll(getSize);
} else if (this.options.size && this.options.size != 'auto' && menu.find('li'+notDisabled).length > this.options.size) {
var optIndex = menu.find("li"+notDisabled+" > *").filter(':not(.div-contain)').slice(0,this.options.size).last().parent().index();
var divLength = menu.find("li").slice(0,optIndex + 1).find('.div-contain').length;
menuHeight = liHeight*this.options.size + divLength*divHeight + menuPadding;
this.$newElement.toggleClass('dropup', (selectOffsetTop > selectOffsetBot) && menuHeight < menu.height() && this.options.dropupAuto);
menu.css({'max-height' : menuHeight + headerHeight + 'px', 'overflow' : 'hidden'});
menuInner.css({'max-height' : menuHeight - menuPadding + 'px', 'overflow-y' : 'auto'});
}
},
setWidth: function() {
if (this.options.width == 'auto') {
this.$menu.css('min-width', '0');
// Get correct width if element hidden
var selectClone = this.$newElement.clone().appendTo('body');
var ulWidth = selectClone.find('> .dropdown-menu').css('width');
selectClone.remove();
this.$newElement.css('width', ulWidth);
} else if (this.options.width == 'fit') {
// Remove inline min-width so width can be changed from 'auto'
this.$menu.css('min-width', '');
this.$newElement.css('width', '').addClass('fit-width');
} else if (this.options.width) {
// Remove inline min-width so width can be changed from 'auto'
this.$menu.css('min-width', '');
this.$newElement.css('width', this.options.width);
} else {
// Remove inline min-width/width so width can be changed
this.$menu.css('min-width', '');
this.$newElement.css('width', '');
}
// Remove fit-width class if width is changed programmatically
if (this.$newElement.hasClass('fit-width') && this.options.width !== 'fit') {
this.$newElement.removeClass('fit-width');
}
},
selectPosition: function() {
var that = this,
drop = "<div />",
$drop = $(drop),
pos,
actualHeight,
getPlacement = function($element) {
$drop.addClass($element.attr('class')).toggleClass('dropup', $element.hasClass('dropup'));
pos = $element.offset();
actualHeight = $element.hasClass('dropup') ? 0 : $element[0].offsetHeight;
$drop.css({'top' : pos.top + actualHeight, 'left' : pos.left, 'width' : $element[0].offsetWidth, 'position' : 'absolute'});
};
this.$newElement.on('click', function(e) {
getPlacement($(this));
$drop.appendTo(that.options.container);
$drop.toggleClass('open', !$(this).hasClass('open'));
$drop.append(that.$menu);
});
$(window).resize(function() {
getPlacement(that.$newElement);
});
$(window).on('scroll', function(e) {
getPlacement(that.$newElement);
});
$('html').on('click', function(e) {
if ($(e.target).closest(that.$newElement).length < 1) {
$drop.removeClass('open');
}
});
},
mobile: function() {
this.$element.addClass('mobile-device').appendTo(this.$newElement);
if (this.options.container) this.$menu.hide();
},
refresh: function() {
this.reloadLi();
this.render();
this.setWidth();
this.setStyle();
this.checkDisabled();
this.liHeight();
},
setSelected: function(index, selected) {
this.$menu.find('li').eq(index).toggleClass('selected', selected);
},
setDisabled: function(index, disabled) {
if (disabled) {
this.$menu.find('li').eq(index).addClass('disabled').find('a').attr('href','#').attr('tabindex',-1);
} else {
this.$menu.find('li').eq(index).removeClass('disabled').find('a').removeAttr('href').attr('tabindex',0);
}
},
isDisabled: function() {
return this.$element.is(':disabled');
},
checkDisabled: function() {
var that = this;
if (this.isDisabled()) {
this.$button.addClass('disabled');
this.$button.attr('tabindex','-1');
} else if (this.$button.hasClass('disabled')) {
this.$button.removeClass('disabled');
this.$button.removeAttr('tabindex');
}
this.$button.click(function() {
return !that.isDisabled();
});
},
checkTabIndex: function() {
if (this.$element.is('[tabindex]')) {
var tabindex = this.$element.attr("tabindex");
this.$button.attr('tabindex', tabindex);
}
},
clickListener: function() {
var that = this;
$('body').on('touchstart.dropdown', '.dropdown-menu', function(e) {
e.stopPropagation();
});
this.$newElement.on('click', function() {
that.setSize();
});
this.$menu.on('click', 'li a', function(e) {
var clickedIndex = $(this).parent().index(),
$this = $(this).parent(),
prevValue = that.$element.val();
//Dont close on multi choice menu
if (that.multiple) {
e.stopPropagation();
}
e.preventDefault();
//Dont run if we have been disabled
if (!that.isDisabled() && !$(this).parent().hasClass('disabled')) {
var $options = that.$element.find('option');
var $option = $options.eq(clickedIndex);
//Deselect all others if not multi select box
if (!that.multiple) {
$options.prop('selected', false);
$option.prop('selected', true);
}
//Else toggle the one we have chosen if we are multi select.
else {
var state = $option.prop('selected');
$option.prop('selected', !state);
}
that.$button.focus();
// Trigger select 'change'
if (prevValue != that.$element.val()) {
that.$element.change();
}
}
});
this.$menu.on('click', 'li.disabled a, li dt, li .div-contain, h3.popover-title', function(e) {
if (e.target == this) {
e.preventDefault();
e.stopPropagation();
that.$button.focus();
}
});
this.$searchbox.on('click', function(e) {
e.stopPropagation();
});
this.$element.change(function() {
that.render()
});
},
liveSearchListener: function() {
var that = this;
this.$newElement.on('click.dropdown.data-api', function(e){
if(that.options.liveSearch) {
setTimeout(function() {
that.$searchbox.focus();
}, 10);
}
});
this.$searchbox.on('input', function() {
that.$newElement.find('li').show().not(':icontains(' + that.$searchbox.val() + ')').hide();
});
},
val: function(value) {
if (value != undefined) {
this.$element.val( value );
this.$element.change();
return this.$element;
} else {
return this.$element.val();
}
},
selectAll: function() {
this.$element.find('option').prop('selected', true).attr('selected', 'selected');
this.render();
},
deselectAll: function() {
this.$element.find('option').prop('selected', false).removeAttr('selected');
this.render();
},
keydown: function(e) {
var $this,
$items,
$parent,
index,
next,
first,
last,
prev,
nextPrev,
that;
$this = $(this);
$parent = $this.parent();
that = $parent.data('this');
if (that.options.container) $parent = that.$menu;
$items = $('[role=menu] li:not(.divider):visible a', $parent);
if (!$items.length) return;
if (/(38|40)/.test(e.keyCode)) {
index = $items.index($items.filter(':focus'));
first = $items.parent(':not(.disabled)').first().index();
last = $items.parent(':not(.disabled)').last().index();
next = $items.eq(index).parent().nextAll(':not(.disabled)').eq(0).index();
prev = $items.eq(index).parent().prevAll(':not(.disabled)').eq(0).index();
nextPrev = $items.eq(next).parent().prevAll(':not(.disabled)').eq(0).index();
if (e.keyCode == 38) {
if (index != nextPrev && index > prev) index = prev;
if (index < first) index = first;
}
if (e.keyCode == 40) {
if (index != nextPrev && index < next) index = next;
if (index > last) index = last;
if (index == -1) index = 0;
}
$items.eq(index).focus();
} else {
var keyCodeMap = {
48:"0", 49:"1", 50:"2", 51:"3", 52:"4", 53:"5", 54:"6", 55:"7", 56:"8", 57:"9", 59:";",
65:"a", 66:"b", 67:"c", 68:"d", 69:"e", 70:"f", 71:"g", 72:"h", 73:"i", 74:"j", 75:"k", 76:"l",
77:"m", 78:"n", 79:"o", 80:"p", 81:"q", 82:"r", 83:"s", 84:"t", 85:"u", 86:"v", 87:"w", 88:"x", 89:"y", 90:"z",
96:"0", 97:"1", 98:"2", 99:"3", 100:"4", 101:"5", 102:"6", 103:"7", 104:"8", 105:"9"
}
var keyIndex = [];
$items.each(function() {
if ($(this).parent().is(':not(.disabled)')) {
if ($.trim($(this).text().toLowerCase()).substring(0,1) == keyCodeMap[e.keyCode]) {
keyIndex.push($(this).parent().index());
}
}
});
var count = $(document).data('keycount');
count++;
$(document).data('keycount',count);
var prevKey = $.trim($(':focus').text().toLowerCase()).substring(0,1);
if (prevKey != keyCodeMap[e.keyCode]) {
count = 1;
$(document).data('keycount',count);
} else if (count >= keyIndex.length) {
$(document).data('keycount',0);
}
$items.eq(keyIndex[count - 1]).focus();
}
// select focused option if "Enter" or "Spacebar" are pressed
if (/(13|32)/.test(e.keyCode)) {
e.preventDefault();
$(':focus').click();
$(document).data('keycount',0);
}
},
hide: function() {
this.$newElement.hide();
},
show: function() {
this.$newElement.show();
},
destroy: function() {
this.$newElement.remove();
this.$element.remove();
}
};
$.fn.selectpicker = function(option, event) {
//get the args of the outer function..
var args = arguments;
var value;
var chain = this.each(function() {
if ($(this).is('select')) {
var $this = $(this),
data = $this.data('selectpicker'),
options = typeof option == 'object' && option;
if (!data) {
$this.data('selectpicker', (data = new Selectpicker(this, options, event)));
} else if (options) {
for(var i in options) {
data.options[i] = options[i];
}
}
if (typeof option == 'string') {
//Copy the value of option, as once we shift the arguments
//it also shifts the value of option.
var property = option;
if (data[property] instanceof Function) {
[].shift.apply(args);
value = data[property].apply(data, args);
} else {
value = data.options[property];
}
}
}
});
if (value != undefined) {
return value;
} else {
return chain;
}
};
$.fn.selectpicker.defaults = {
style: 'btn-default',
size: 'auto',
title: null,
selectedTextFormat : 'values',
noneSelectedText : 'Nothing selected',
countSelectedText: '{0} of {1} selected',
width: false,
container: false,
hideDisabled: false,
showSubtext: false,
showIcon: true,
showContent: true,
dropupAuto: true,
header: false,
liveSearch: false
}
$(document)
.data('keycount', 0)
.on('keydown', '[data-toggle=dropdown], [role=menu]' , Selectpicker.prototype.keydown)
}(window.jQuery);

View File

@@ -47,6 +47,11 @@
$('[rel="tooltip"]').tooltip();
}
// -- Bootstrap select --
if($('[data-toggle="selectpicker"]').length){
$('[data-toggle="selectpicker"]').selectpicker();
}
// -- Confirm Box --
if($('[data-toggle="confirm"]').length){
$('[data-toggle="confirm"]').click(function(e){

View File

@@ -0,0 +1,275 @@
/*!
* bootstrap-select v1.3.1
* http://silviomoreto.github.io/bootstrap-select/
*
* Copyright 2013 bootstrap-select
* Licensed under the MIT license
*/
.input-group{
.bootstrap-select.btn-group,
.bootstrap-select.btn-group[class*="span"] {
width: 100%;
margin-bottom: 0;
.btn{
.border-right-radius(0);
}
}
}
.bootstrap-select.btn-group,
.bootstrap-select.btn-group[class*="span"] {
float: none;
display: inline-block;
margin-bottom: 10px;
margin-left: 0;
}
.form-search .bootstrap-select.btn-group,
.form-inline .bootstrap-select.btn-group,
.form-horizontal .bootstrap-select.btn-group {
margin-bottom: 0;
}
.bootstrap-select.btn-group.pull-right,
.bootstrap-select.btn-group[class*="span"].pull-right,
.row-fluid .bootstrap-select.btn-group[class*="span"].pull-right {
float: right;
}
.input-append .bootstrap-select.btn-group {
margin-left: -1px;
}
.input-prepend .bootstrap-select.btn-group {
margin-right: -1px;
}
.bootstrap-select:not([class*="span"]) {
width: 100%;
}
.bootstrap-select {
/*width: 220px\9; IE8 and below*/
width: 100%\0; /*IE9 and below*/
}
.bootstrap-select > .btn {
width: 100%;
.form-control-focus();
}
.dropdown-menu {
z-index: 2000;
}
.bootstrap-select.show-menu-arrow.open > .btn {
z-index: 2051;
}
.bootstrap-select.btn-group .btn .filter-option {
overflow: hidden;
position: absolute;
left: 12px;
right: 25px;
text-align: left;
color: @input-color;
}
.bootstrap-select.btn-group .btn .caret {
position: absolute;
top: 50%;
right: 12px;
margin-top: -2px;
vertical-align: middle;
}
.bootstrap-select.btn-group > .disabled,
.bootstrap-select.btn-group .dropdown-menu li.disabled > a {
cursor: not-allowed;
}
.bootstrap-select.btn-group > .disabled:focus {
outline: none !important;
}
.bootstrap-select.btn-group[class*="span"] .btn {
width: 100%;
}
.bootstrap-select.btn-group .dropdown-menu {
min-width: 100%;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.bootstrap-select.btn-group .dropdown-menu.inner {
position: static;
border: 0;
padding: 0;
margin: 0;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.bootstrap-select.btn-group .dropdown-menu dt {
display: block;
padding: 3px 20px;
cursor: default;
}
.bootstrap-select.btn-group .div-contain {
overflow: hidden;
}
.bootstrap-select.btn-group .dropdown-menu li a{
color: @input-color;
&:hover{
color: #FFF;
}
}
.bootstrap-select.btn-group .dropdown-menu li {
position: relative;
&:focus, a:focus{
outline: none;
}
}
.bootstrap-select.btn-group .dropdown-menu li > a.opt {
position: relative;
padding-left: 35px;
}
.bootstrap-select.btn-group .dropdown-menu li > a {
cursor: pointer;
}
.bootstrap-select.btn-group .dropdown-menu li > dt small {
font-weight: normal;
}
.bootstrap-select.btn-group.show-tick .dropdown-menu li.selected a i.check-mark {
display: inline-block;
position: absolute;
right: 15px;
margin-top: 2.5px;
}
.bootstrap-select.btn-group .dropdown-menu li a i.check-mark {
display: none;
}
.bootstrap-select.btn-group.show-tick .dropdown-menu li a span.text {
margin-right: 34px;
}
.bootstrap-select.btn-group .dropdown-menu li small {
padding-left: 0.5em;
}
.bootstrap-select.btn-group .dropdown-menu li:not(.disabled) > a:hover small,
.bootstrap-select.btn-group .dropdown-menu li:not(.disabled) > a:focus small {
color: #64b1d8;
color: rgba(255,255,255,0.4);
}
.bootstrap-select.btn-group .dropdown-menu li > dt small {
font-weight: normal;
}
.bootstrap-select.show-menu-arrow .dropdown-toggle:before {
content: '';
display: inline-block;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #CCC;
border-bottom-color: rgba(0, 0, 0, 0.2);
position: absolute;
bottom: -4px;
left: 9px;
display: none;
}
.bootstrap-select.show-menu-arrow .dropdown-toggle:after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid white;
position: absolute;
bottom: -4px;
left: 10px;
display: none;
}
.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle:before {
bottom: auto;
top: -3px;
border-top: 7px solid #ccc;
border-bottom: 0;
border-top-color: rgba(0, 0, 0, 0.2);
}
.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle:after {
bottom: auto;
top: -3px;
border-top: 6px solid #ffffff;
border-bottom: 0;
}
.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle:before {
right: 12px;
left: auto;
}
.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle:after {
right: 13px;
left: auto;
}
.bootstrap-select.show-menu-arrow.open > .dropdown-toggle:before,
.bootstrap-select.show-menu-arrow.open > .dropdown-toggle:after {
display: block;
}
.mobile-device {
position: absolute;
top: 0;
left: 0;
display: block !important;
width: 100%;
height: 100% !important;
opacity: 0;
}
.bootstrap-select.fit-width {
width: auto !important;
}
.bootstrap-select.btn-group.fit-width .btn .filter-option {
position: static;
}
.bootstrap-select.btn-group.fit-width .btn .caret {
position: static;
top: auto;
margin-top: -1px;
}
.control-group.error .bootstrap-select .dropdown-toggle{
border-color: #b94a48;
}
.bootstrap-select-searchbox {
padding: 4px 8px;
}

View File

@@ -167,6 +167,36 @@ form .info {
}
}
// Form validation states
//
// Used in forms.less to generate the form validation CSS for warnings, errors,
// and successes.
.form-control-validation(@text-color: #555; @border-color: #ccc; @background-color: #f5f5f5) {
// Color the label and help text
.help-block,
.control-label {
color: @text-color;
}
// Set the border and box shadow on specific inputs to match
.form-control, .bootstrap-select .btn {
border-color: @border-color;
.box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work
&:focus {
border-color: darken(@border-color, 10%);
@shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@border-color, 20%);
.box-shadow(@shadow);
}
}
// Set validation states also for addons
.input-group-addon {
color: @text-color;
border-color: @border-color;
background-color: @background-color;
}
}
// -- Sign in --
.form-signin{
// .form-control {

View File

@@ -0,0 +1,11 @@
@media (max-width: @screen-desktop) {
.navbar-form{
width: 100%;
.form-group{
width: 94%;
}
}
}

View File

@@ -31,3 +31,7 @@
.navbar-default .navbar-toggle .icon-bar{
background-color: @btn-primary-color;
}
.navbar-form{
padding: 0;
}

View File

@@ -7,8 +7,9 @@
// -------------------------
body {
background: #FFF url("@{imgDir}/bg.jpg") top left no-repeat;
background-size: cover;
// background: #FFF url("@{imgDir}/bg.jpg") top left no-repeat;
// background-size: cover;
background-color: #eee;
}

View File

@@ -1,3 +1,22 @@
// Baseline styles
.table {
// Cells
thead,
tbody,
tfoot {
> tr {
> th,
> td {
vertical-align: middle;
}
}
}
}
tfoot{
.pagination{

View File

@@ -2,6 +2,7 @@
@import "navbar.less";
@import "scaffolding.less";
@import "type.less";
@import "grid.less";
@import "breadcrumbs.less";
@import "forms.less";
@import "datepicker.less";
@@ -11,6 +12,7 @@
@import "wizard.less";
@import "bootstrap-editable.less";
@import "bootstrap-switch.less";
@import "bootstrap-select.less";
@import "jqplot.less";
// -- Base styling ------------------------------------------------------------

View File

@@ -78,6 +78,7 @@
{intl l="Enter here all possible attribute values."}
</div>
<div class="table-responsive">
<table class="table table-striped table-condensed table-left-aligned">
<thead>
<tr>
@@ -166,6 +167,7 @@
{/elseloop}
</tbody>
</table>
</div>
</div>
</form>
{/form}

View File

@@ -21,6 +21,7 @@
<div class="col-md-12">
<form action="#" method="post">
<div class="general-block-decorator">
<div class="table-responsive">
<table class="table table-striped table-condensed table-left-aligned">
<caption>
{intl l='Thelia product attributes'}
@@ -133,6 +134,7 @@
</tbody>
</table>
</div>
</div>
</form>
</div>
</div>

View File

@@ -16,7 +16,7 @@
<div class="row">
<div class="col-md-12">
<div class="general-block-decorator">
<div class="table-responsive">
<table class="table table-striped table-condensed" id="category_list">
<caption>
{* display parent category name, and get current cat ID *}
@@ -175,13 +175,14 @@
</div>
</div>
</div>
</div>
{* -- PRODUCT MANAGEMENT ---------------------------------------------------- *}
<div class="row">
<div class="col-md-12">
<div class="general-block-decorator">
<div class="table-responsive">
<table class="table table-striped table-condensed">
<caption>
{* display parent category name *}
@@ -266,14 +267,14 @@
<td>
{loop type="image" name="cat_image" source="product" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"}
<a href="{url path='admin/product/edit' id=$ID}" title="{intl l='Edit this product'}">
<a href="{url path='/admin/products/update' product_id=$ID}" title="{intl l='Edit this product'}">
<img src="{$IMAGE_URL}" alt="{$TITLE}" />
</a>
{/loop}
<td class="object-title"><a href="{url path="/admin/product/update/$ID"}" title="{intl l='Edit this product'}">{$REF}</a></td>
<td class="object-title"><a href="{url path='/admin/products/update' product_id=$ID}" title="{intl l='Edit this product'}">{$REF}</a></td>
<td class="object-title"><a href="{url path="/admin/product/update/$ID"}" title="{intl l='Edit this product'}">{$TITLE}</a></td>
<td class="object-title"><a href="{url path='/admin/products/update' product_id=$ID}" title="{intl l='Edit this product'}">{$TITLE}</a></td>
{module_include location='product_list_row'}
@@ -305,7 +306,7 @@
<td>
<div class="btn-group">
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.product.edit"}
<a class="btn btn-default btn-xs" title="{intl l='Edit this product'}" href="{url path="admin/product/update/$ID"}"><i class="glyphicon glyphicon-edit"></i></a>
<a class="btn btn-default btn-xs" title="{intl l='Edit this product'}" href="{url path='/admin/products/update' product_id=$ID}"><i class="glyphicon glyphicon-edit"></i></a>
{/loop}
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.product.delete"}
@@ -326,8 +327,7 @@
</thead>
{/elseloop}
</table>
</div>
</div>
</div>
</div>

Some files were not shown because too many files have changed in this diff Show More