Merge branch 'modules' of https://github.com/thelia/thelia into modules

Conflicts:
	core/lib/Thelia/Core/Template/Assets/AssetManagerInterface.php
	core/lib/Thelia/Core/Template/Assets/AsseticAssetManager.php
	core/lib/Thelia/Core/Template/Loop/Template.php
	core/lib/Thelia/Core/Template/Smarty/SmartyParser.php
	core/lib/Thelia/Core/Template/TemplateDefinition.php
	core/lib/Thelia/Model/Base/CartItem.php
	core/lib/Thelia/Model/Base/CartItemQuery.php
	core/lib/Thelia/Model/Base/CouponOrder.php
	core/lib/Thelia/Model/Base/Order.php
	core/lib/Thelia/Model/Base/OrderCouponQuery.php
	core/lib/Thelia/Model/Base/OrderQuery.php
This commit is contained in:
Franck Allimant
2013-12-20 14:30:50 +01:00
144 changed files with 1945 additions and 1986 deletions

View File

@@ -22,7 +22,7 @@ Requirements
* gd * gd
* curl * curl
* safe_mode off * safe_mode off
* memory_limit at least 128M, preferably 256. * memory_limit at least 150M, preferably 256.
* post_max_size 20M * post_max_size 20M
* upload_max_filesize 2M * upload_max_filesize 2M
* apache 2 * apache 2
@@ -44,8 +44,10 @@ Installation
------------ ------------
``` bash ``` bash
$ git clone https://github.com/thelia/thelia.git
$ cd thelia
$ curl -sS https://getcomposer.org/installer | php $ curl -sS https://getcomposer.org/installer | php
$ php composer.phar create-project thelia/thelia path/ dev-master $ php composer.phar install --prefer-dist --optimize-autoloader
``` ```
Finish the installation using cli tools : Finish the installation using cli tools :
@@ -56,14 +58,6 @@ $ php Thelia thelia:install
You just have to follow all instructions. You just have to follow all instructions.
Documentation
-------------
Thelia documentation is available at http://doc.thelia.net
The documentation is also in beta version and some part can be obsolete cause to some refactor.
Contribute Contribute
---------- ----------

View File

@@ -30,6 +30,7 @@ use Thelia\Core\Event\UpdateSeoEvent;
use Thelia\Exception\UrlRewritingException; use Thelia\Exception\UrlRewritingException;
use Thelia\Form\Exception\FormValidationException; use Thelia\Form\Exception\FormValidationException;
use \Thelia\Model\Tools\UrlRewritingTrait;
class BaseAction class BaseAction
{ {
@@ -81,8 +82,8 @@ class BaseAction
/** /**
* Changes SEO Fields for an object. * Changes SEO Fields for an object.
* *
* @param ModelCriteria $query * @param ModelCriteria $query
* @param UpdateSeoEvent $event * @param UpdateSeoEvent $event
* *
* @return mixed * @return mixed
*/ */
@@ -104,7 +105,7 @@ class BaseAction
// Update the rewritten URL, if required // Update the rewritten URL, if required
try { try {
$object->setRewrittenUrl($event->getLocale(), $event->getUrl()); $object->setRewrittenUrl($event->getLocale(), $event->getUrl());
} catch (UrlRewritingException $e) { } catch(UrlRewritingException $e) {
throw new FormValidationException($e->getMessage(), $e->getCode()); throw new FormValidationException($e->getMessage(), $e->getCode());
} }

View File

@@ -28,7 +28,6 @@ use Thelia\Condition\ConditionFactory;
use Thelia\Condition\Implementation\ConditionInterface; use Thelia\Condition\Implementation\ConditionInterface;
use Thelia\Core\Event\Coupon\CouponConsumeEvent; use Thelia\Core\Event\Coupon\CouponConsumeEvent;
use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent; use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent;
use Thelia\Core\Event\Order\OrderEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\HttpFoundation\Request; use Thelia\Core\HttpFoundation\Request;
use Thelia\Coupon\CouponFactory; use Thelia\Coupon\CouponFactory;
@@ -37,7 +36,6 @@ use Thelia\Condition\ConditionCollection;
use Thelia\Coupon\Type\CouponInterface; use Thelia\Coupon\Type\CouponInterface;
use Thelia\Model\Coupon as CouponModel; use Thelia\Model\Coupon as CouponModel;
use Thelia\Model\CouponQuery; use Thelia\Model\CouponQuery;
use Thelia\Model\OrderCoupon;
/** /**
* Created by JetBrains PhpStorm. * Created by JetBrains PhpStorm.
@@ -124,20 +122,23 @@ class Coupon extends BaseAction implements EventSubscriberInterface
$request->getSession()->setConsumedCoupons($consumedCoupons); $request->getSession()->setConsumedCoupons($consumedCoupons);
$totalDiscount = $couponManager->getDiscount(); $totalDiscount = $couponManager->getDiscount();
// @todo insert false product in cart with the name of the coupon and the discount as negative price
// Decrement coupon quantity
// @todo move this part in after order event
$couponQuery = CouponQuery::create();
$couponModel = $couponQuery->findOneByCode($coupon->getCode());
$couponManager->decrementQuantity($couponModel);
$request $request
->getSession() ->getSession()
->getCart() ->getCart()
->setDiscount($totalDiscount) ->setDiscount($totalDiscount)
->save(); ->save();
$request
->getSession()
->getOrder()
->setDiscount($totalDiscount)
->save();
} }
} }
$event->setIsValid($isValid); $event->setIsValid($isValid);
$event->setDiscount($totalDiscount); $event->setDiscount($totalDiscount);
} }
@@ -206,68 +207,6 @@ class Coupon extends BaseAction implements EventSubscriberInterface
$event->setCouponModel($coupon); $event->setCouponModel($coupon);
} }
/**
* @param \Thelia\Core\Event\Order\OrderEvent $event
*/
public function testFreePostage(OrderEvent $event)
{
/** @var CouponManager $couponManager */
$couponManager = $this->container->get('thelia.coupon.manager');
if($couponManager->isCouponRemovingPostage()) {
$order = $event->getOrder();
$order->setPostage(0);
$event->setOrder($order);
$event->stopPropagation();
}
}
/**
* @param \Thelia\Core\Event\Order\OrderEvent $event
*/
public function afterOrder(OrderEvent $event)
{
$request = $this->container->get('request');
/** @var CouponManager $couponManager */
$couponManager = $this->container->get('thelia.coupon.manager');
$consumedCoupons = $request->getSession()->getConsumedCoupons();
if (is_array($consumedCoupons)) {
foreach($consumedCoupons as $couponCode) {
$couponQuery = CouponQuery::create();
$couponModel = $couponQuery->findOneByCode($couponCode);
$couponModel->setLocale($request->getSession()->getLang()->getLocale());
/* decrease coupon quantity */
$couponManager->decrementQuantity($couponModel);
/* memorize coupon */
$orderCoupon = new OrderCoupon();
$orderCoupon->setOrder($event->getOrder())
->setCode($couponModel->getCode())
->setType($couponModel->getType())
->setAmount($couponModel->getAmount())
->setTitle($couponModel->getTitle())
->setShortDescription($couponModel->getShortDescription())
->setDescription($couponModel->getDescription())
->setExpirationDate($couponModel->getExpirationDate())
->setIsCumulative($couponModel->getIsCumulative())
->setIsRemovingPostage($couponModel->getIsRemovingPostage())
->setIsAvailableOnSpecialOffers($couponModel->getIsAvailableOnSpecialOffers())
->setSerializedConditions($couponModel->getSerializedConditions())
;
$orderCoupon->save();
}
}
}
/** /**
* Returns an array of event names this subscriber listens to. * Returns an array of event names this subscriber listens to.
* *
@@ -294,9 +233,7 @@ class Coupon extends BaseAction implements EventSubscriberInterface
TheliaEvents::COUPON_CREATE => array("create", 128), TheliaEvents::COUPON_CREATE => array("create", 128),
TheliaEvents::COUPON_UPDATE => array("update", 128), TheliaEvents::COUPON_UPDATE => array("update", 128),
TheliaEvents::COUPON_CONSUME => array("consume", 128), TheliaEvents::COUPON_CONSUME => array("consume", 128),
TheliaEvents::COUPON_CONDITION_UPDATE => array("updateCondition", 128), TheliaEvents::COUPON_CONDITION_UPDATE => array("updateCondition", 128)
TheliaEvents::ORDER_SET_POSTAGE => array("testFreePostage", 256),
TheliaEvents::ORDER_BEFORE_PAYMENT => array("afterOrder", 128),
); );
} }
} }

View File

@@ -35,7 +35,7 @@ class MailingSystem extends BaseAction implements EventSubscriberInterface
*/ */
public function update(MailingSystemEvent $event) public function update(MailingSystemEvent $event)
{ {
if ($event->getEnabled()) { if($event->getEnabled()) {
ConfigQuery::enableSmtp(); ConfigQuery::enableSmtp();
} else { } else {
ConfigQuery::disableSmtp(); ConfigQuery::disableSmtp();

View File

@@ -30,7 +30,6 @@ use Thelia\Core\Event\Cart\CartEvent;
use Thelia\Core\Event\Order\OrderAddressEvent; use Thelia\Core\Event\Order\OrderAddressEvent;
use Thelia\Core\Event\Order\OrderEvent; use Thelia\Core\Event\Order\OrderEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
use Thelia\Coupon\CouponManager;
use Thelia\Exception\TheliaProcessException; use Thelia\Exception\TheliaProcessException;
use Thelia\Model\AddressQuery; use Thelia\Model\AddressQuery;
use Thelia\Model\ConfigQuery; use Thelia\Model\ConfigQuery;
@@ -74,17 +73,6 @@ class Order extends BaseAction implements EventSubscriberInterface
$order = $event->getOrder(); $order = $event->getOrder();
$order->setDeliveryModuleId($event->getDeliveryModule()); $order->setDeliveryModuleId($event->getDeliveryModule());
$event->setOrder($order);
}
/**
* @param \Thelia\Core\Event\Order\OrderEvent $event
*/
public function setPostage(OrderEvent $event)
{
$order = $event->getOrder();
$order->setPostage($event->getPostage()); $order->setPostage($event->getPostage());
$event->setOrder($order); $event->setOrder($order);
@@ -190,11 +178,6 @@ class Order extends BaseAction implements EventSubscriberInterface
OrderStatusQuery::create()->findOneByCode(OrderStatus::CODE_NOT_PAID)->getId() OrderStatusQuery::create()->findOneByCode(OrderStatus::CODE_NOT_PAID)->getId()
); );
/* memorize discount */
$placedOrder->setDiscount(
$cart->getDiscount()
);
$placedOrder->save($con); $placedOrder->save($con);
/* fulfill order_products and decrease stock */ /* fulfill order_products and decrease stock */
@@ -279,6 +262,8 @@ class Order extends BaseAction implements EventSubscriberInterface
} }
} }
/* discount @todo */
$con->commit(); $con->commit();
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_BEFORE_PAYMENT, new OrderEvent($placedOrder)); $this->getDispatcher()->dispatch(TheliaEvents::ORDER_BEFORE_PAYMENT, new OrderEvent($placedOrder));
@@ -288,7 +273,7 @@ class Order extends BaseAction implements EventSubscriberInterface
$sessionOrder = new \Thelia\Model\Order(); $sessionOrder = new \Thelia\Model\Order();
$event->setOrder($sessionOrder); $event->setOrder($sessionOrder);
$event->setPlacedOrder($placedOrder); $event->setPlacedOrder($placedOrder);
$this->getSession()->setOrder($placedOrder); $this->getSession()->setOrder($sessionOrder);
/* empty cart */ /* empty cart */
$this->getDispatcher()->dispatch(TheliaEvents::CART_CLEAR, new CartEvent($this->getCart($this->getRequest()))); $this->getDispatcher()->dispatch(TheliaEvents::CART_CLEAR, new CartEvent($this->getCart($this->getRequest())));
@@ -305,7 +290,7 @@ class Order extends BaseAction implements EventSubscriberInterface
{ {
$contact_email = ConfigQuery::read('contact_email'); $contact_email = ConfigQuery::read('contact_email');
if ($contact_email) { if($contact_email) {
$message = MessageQuery::create() $message = MessageQuery::create()
->filterByName('order_confirmation') ->filterByName('order_confirmation')
@@ -427,7 +412,6 @@ class Order extends BaseAction implements EventSubscriberInterface
return array( return array(
TheliaEvents::ORDER_SET_DELIVERY_ADDRESS => array("setDeliveryAddress", 128), TheliaEvents::ORDER_SET_DELIVERY_ADDRESS => array("setDeliveryAddress", 128),
TheliaEvents::ORDER_SET_DELIVERY_MODULE => array("setDeliveryModule", 128), TheliaEvents::ORDER_SET_DELIVERY_MODULE => array("setDeliveryModule", 128),
TheliaEvents::ORDER_SET_POSTAGE => array("setPostage", 128),
TheliaEvents::ORDER_SET_INVOICE_ADDRESS => array("setInvoiceAddress", 128), TheliaEvents::ORDER_SET_INVOICE_ADDRESS => array("setInvoiceAddress", 128),
TheliaEvents::ORDER_SET_PAYMENT_MODULE => array("setPaymentModule", 128), TheliaEvents::ORDER_SET_PAYMENT_MODULE => array("setPaymentModule", 128),
TheliaEvents::ORDER_PAY => array("create", 128), TheliaEvents::ORDER_PAY => array("create", 128),

View File

@@ -131,6 +131,7 @@ class Product extends BaseAction implements EventSubscriberInterface
return $this->genericUpdateSeo(ProductQuery::create(), $event); return $this->genericUpdateSeo(ProductQuery::create(), $event);
} }
/** /**
* Delete a product entry * Delete a product entry
* *

View File

@@ -209,7 +209,8 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
if ($product->countSaleElements() <= 0) { if ($product->countSaleElements() <= 0) {
// If we just deleted the last PSE, create a default one // If we just deleted the last PSE, create a default one
$product->createProductSaleElement($con, 0, 0, 0, $event->getCurrencyId(), true); $product->createProductSaleElement($con, 0, 0, 0, $event->getCurrencyId(), true);
} elseif ($pse->getIsDefault()) { }
elseif ($pse->getIsDefault()) {
// If we deleted the default PSE, make the last created one the default // If we deleted the default PSE, make the last created one the default
$pse = ProductSaleElementsQuery::create() $pse = ProductSaleElementsQuery::create()
@@ -237,8 +238,8 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
* *
* @param ProductCombinationGenerationEvent $event * @param ProductCombinationGenerationEvent $event
*/ */
public function generateCombinations(ProductCombinationGenerationEvent $event) public function generateCombinations(ProductCombinationGenerationEvent $event) {
{
$con = Propel::getWriteConnection(ProductSaleElementsTableMap::DATABASE_NAME); $con = Propel::getWriteConnection(ProductSaleElementsTableMap::DATABASE_NAME);
$con->beginTransaction(); $con->beginTransaction();
@@ -251,7 +252,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
$isDefault = true; $isDefault = true;
// Create all combinations // Create all combinations
foreach ($event->getCombinations() as $combinationAttributesAvIds) { foreach($event->getCombinations() as $combinationAttributesAvIds) {
// Create the PSE // Create the PSE
$saleElement = $event->getProduct()->createProductSaleElement( $saleElement = $event->getProduct()->createProductSaleElement(
@@ -275,7 +276,8 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
// Store all the stuff ! // Store all the stuff !
$con->commit(); $con->commit();
} catch (\Exception $ex) { }
catch (\Exception $ex) {
$con->rollback(); $con->rollback();
@@ -286,9 +288,9 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
/** /**
* Create a combination for a given product sale element * Create a combination for a given product sale element
* *
* @param ConnectionInterface $con the Propel connection * @param ConnectionInterface $con the Propel connection
* @param ProductSaleElement $salesElement the product sale element * @param ProductSaleElement $salesElement the product sale element
* @param unknown $combinationAttributes an array oif attributes av IDs * @param unknown $combinationAttributes an array oif attributes av IDs
*/ */
protected function createCombination(ConnectionInterface $con, ProductSaleElements $salesElement, $combinationAttributes) protected function createCombination(ConnectionInterface $con, ProductSaleElements $salesElement, $combinationAttributes)
{ {

View File

@@ -32,6 +32,7 @@ use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\AdminQuery; use Thelia\Model\AdminQuery;
use Thelia\Tools\Password; use Thelia\Tools\Password;
/** /**
* command line for updating admin password * command line for updating admin password
* *
@@ -71,15 +72,18 @@ class AdminUpdatePasswordCommand extends ContainerAwareCommand
{ {
$login = $input->getArgument('login'); $login = $input->getArgument('login');
if (null === $admin = AdminQuery::create()->filterByLogin($login)->findOne()) { if (null === $admin = AdminQuery::create()->filterByLogin($login)->findOne()) {
throw new \RuntimeException(sprintf('Admin with login %s does not exists', $login)); throw new \RuntimeException(sprintf('Admin with login %s does not exists', $login));
} }
$password = $input->getOption('password') ?: Password::generateRandom(); $password = $input->getOption('password') ?: Password::generateRandom();
$event = new AdministratorUpdatePasswordEvent($admin); $event = new AdministratorUpdatePasswordEvent($admin);
$event->setPassword($password); $event->setPassword($password);
$this-> $this->
getContainer() getContainer()
->get('event_dispatcher') ->get('event_dispatcher')
@@ -95,3 +99,4 @@ class AdminUpdatePasswordCommand extends ContainerAwareCommand
} }
} }

View File

@@ -1,14 +1,14 @@
<?php <?php
return array( return array(
'Delivery module' => 'Delivery module', 'Delivery module' => 'Delivery module',
'Quantity' => 'Quantity', 'Quantity' => 'Quantity',
'Product' => 'Product', 'Product' => 'Product',
'Unit. price' => 'Unit. price', 'Unit. price' => 'Unit. price',
'Tax' => 'Tax', 'Tax' => 'Tax',
'Unit taxed price' => 'Unit taxed price', 'Unit taxed price' => 'Unit taxed price',
'Taxed total' => 'Taxed total', 'Taxed total' => 'Taxed total',
'Payment module' => 'Payment module', 'Payment module' => 'Payment module',
'Postage' => 'Postage', 'Postage' => 'Postage',
'Total' => 'Total', 'Total' => 'Total',
); );

View File

@@ -1,36 +1,36 @@
<?php <?php
return array( return array(
'Combination builder' => 'Combination builder', 'Combination builder' => 'Combination builder',
'Title' => 'Title', 'Title' => 'Title',
'City' => 'City', 'City' => 'City',
'Zip code' => 'Zip code', 'Zip code' => 'Zip code',
'Country' => 'Country', 'Country' => 'Country',
'Phone' => 'Phone', 'Phone' => 'Phone',
'Login' => 'Login', 'Login' => 'Login',
'Password' => 'Password', 'Password' => 'Password',
'Profile' => 'Profile', 'Profile' => 'Profile',
'Postage' => 'Postage', 'Postage' => 'Postage',
'Add to all product templates' => 'Add to all product templates', 'Add to all product templates' => 'Add to all product templates',
'Quantity' => 'Quantity', 'Quantity' => 'Quantity',
'Name' => 'Name', 'Name' => 'Name',
'Value' => 'Value', 'Value' => 'Value',
'Subject' => 'Subject', 'Subject' => 'Subject',
'Company' => 'Company', 'Company' => 'Company',
'Description' => 'Description', 'Description' => 'Description',
'Language name' => 'Language name', 'Language name' => 'Language name',
'ISO 639 Code' => 'ISO 639 Code', 'ISO 639 Code' => 'ISO 639 Code',
'If a translation is missing or incomplete :' => 'If a translation is missing or incomplete :', 'If a translation is missing or incomplete :' => 'If a translation is missing or incomplete :',
'Host' => 'Host', 'Host' => 'Host',
'Port' => 'Port', 'Port' => 'Port',
'Encryption' => 'Encryption', 'Encryption' => 'Encryption',
'Username' => 'Username', 'Username' => 'Username',
'Timeout' => 'Timeout', 'Timeout' => 'Timeout',
'Source IP' => 'Source IP', 'Source IP' => 'Source IP',
'Email address' => 'Email address', 'Email address' => 'Email address',
'Firstname' => 'Firstname', 'Firstname' => 'Firstname',
'Lastname' => 'Lastname', 'Lastname' => 'Lastname',
'Additional address' => 'Additional address', 'Additional address' => 'Additional address',
'Reference' => 'Reference', 'Reference' => 'Reference',
'EAN Code' => 'EAN Code', 'EAN Code' => 'EAN Code',
); );

View File

@@ -28,7 +28,6 @@
<loop class="Thelia\Core\Template\Loop\Order" name="order"/> <loop class="Thelia\Core\Template\Loop\Order" name="order"/>
<loop class="Thelia\Core\Template\Loop\OrderAddress" name="order_address"/> <loop class="Thelia\Core\Template\Loop\OrderAddress" name="order_address"/>
<loop class="Thelia\Core\Template\Loop\OrderProduct" name="order_product"/> <loop class="Thelia\Core\Template\Loop\OrderProduct" name="order_product"/>
<loop class="Thelia\Core\Template\Loop\OrderCoupon" name="order_coupon"/>
<loop class="Thelia\Core\Template\Loop\OrderProductAttributeCombination" name="order_product_attribute_combination"/> <loop class="Thelia\Core\Template\Loop\OrderProductAttributeCombination" name="order_product_attribute_combination"/>
<loop class="Thelia\Core\Template\Loop\OrderStatus" name="order-status"/> <loop class="Thelia\Core\Template\Loop\OrderStatus" name="order-status"/>
<loop class="Thelia\Core\Template\Loop\CategoryPath" name="category-path"/> <loop class="Thelia\Core\Template\Loop\CategoryPath" name="category-path"/>

View File

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

View File

@@ -53,7 +53,7 @@ abstract class AbstractSeoCrudController extends AbstractCrudController
* *
* @param string $visibilityToggleEventIdentifier the dispatched visibility toggle TheliaEvent identifier, or null if the object has no visible options. Example: TheliaEvents::MESSAGE_TOGGLE_VISIBILITY * @param string $visibilityToggleEventIdentifier the dispatched visibility toggle TheliaEvent identifier, or null if the object has no visible options. Example: TheliaEvents::MESSAGE_TOGGLE_VISIBILITY
* @param string $changePositionEventIdentifier the dispatched position change TheliaEvent identifier, or null if the object has no position. Example: TheliaEvents::MESSAGE_UPDATE_POSITION * @param string $changePositionEventIdentifier the dispatched position change TheliaEvent identifier, or null if the object has no position. Example: TheliaEvents::MESSAGE_UPDATE_POSITION
* @param string $updateSeoEventIdentifier the dispatched update SEO change TheliaEvent identifier, or null if the object has no SEO. Example: TheliaEvents::MESSAGE_UPDATE_SEO * @param string $updateSeoEventIdentifier the dispatched update SEO change TheliaEvent identifier, or null if the object has no SEO. Example: TheliaEvents::MESSAGE_UPDATE_SEO
*/ */
public function __construct( public function __construct(
$objectName, $objectName,
@@ -134,8 +134,7 @@ abstract class AbstractSeoCrudController extends AbstractCrudController
* *
* @param unknown $object * @param unknown $object
*/ */
protected function hydrateSeoForm($object) protected function hydrateSeoForm($object){
{
// The "SEO" tab form // The "SEO" tab form
$locale = $object->getLocale(); $locale = $object->getLocale();
$data = array( $data = array(
@@ -228,6 +227,8 @@ abstract class AbstractSeoCrudController extends AbstractCrudController
$ex $ex
); );
// At this point, the form has errors, and should be redisplayed. // At this point, the form has errors, and should be redisplayed.
return $this->renderEditionTemplate(); return $this->renderEditionTemplate();
} }

View File

@@ -98,7 +98,7 @@ class AddressController extends AbstractCrudController
/** /**
* Fills in the form data array * Fills in the form data array
* *
* @param unknown $object * @param unknown $object
* @return multitype:NULL * @return multitype:NULL
*/ */
protected function createFormDataArray($object) protected function createFormDataArray($object)
@@ -309,8 +309,7 @@ class AddressController extends AbstractCrudController
$this->redirectToEditionTemplate(); $this->redirectToEditionTemplate();
} }
protected function getCustomerId() protected function getCustomerId() {
{
if (null !== $address = $this->getExistingObject()) if (null !== $address = $this->getExistingObject())
return $address->getCustomerId(); return $address->getCustomerId();
else else

View File

@@ -34,6 +34,7 @@ use Thelia\Form\AttributeModificationForm;
use Thelia\Form\AttributeCreationForm; use Thelia\Form\AttributeCreationForm;
use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Model\AttributeAv; use Thelia\Model\AttributeAv;
use Thelia\Model\AttributeAvQuery;
use Thelia\Core\Event\Attribute\AttributeAvUpdateEvent; use Thelia\Core\Event\Attribute\AttributeAvUpdateEvent;
use Thelia\Core\Event\Attribute\AttributeEvent; use Thelia\Core\Event\Attribute\AttributeEvent;

View File

@@ -309,7 +309,6 @@ class BaseAdminController extends BaseController
{ {
// Check if the functionality is activated // Check if the functionality is activated
if(!ConfigQuery::read("one_domain_foreach_lang", false)) if(!ConfigQuery::read("one_domain_foreach_lang", false))
return; return;
// If we don't have a locale value, use the locale value in the session // If we don't have a locale value, use the locale value in the session
@@ -391,8 +390,8 @@ class BaseAdminController extends BaseController
* Render the given template, and returns the result as an Http Response. * Render the given template, and returns the result as an Http Response.
* *
* @param $templateName the complete template name, with extension * @param $templateName the complete template name, with extension
* @param array $args the template arguments * @param array $args the template arguments
* @param int $status http code status * @param int $status http code status
* @return \Thelia\Core\HttpFoundation\Response * @return \Thelia\Core\HttpFoundation\Response
*/ */
protected function render($templateName, $args = array(), $status = 200) protected function render($templateName, $args = array(), $status = 200)

View File

@@ -201,12 +201,15 @@ class CategoryController extends AbstractSeoCrudController
protected function redirectToListTemplateWithId($category_id) protected function redirectToListTemplateWithId($category_id)
{ {
if ($category_id > 0) { if($category_id > 0)
{
$this->redirectToRoute( $this->redirectToRoute(
'admin.categories.default', 'admin.categories.default',
array('category_id' => $category_id) array('category_id' => $category_id)
); );
} else { }
else
{
$this->redirectToRoute( $this->redirectToRoute(
'admin.catalog' 'admin.catalog'
); );

View File

@@ -23,9 +23,11 @@
namespace Thelia\Controller\Admin; namespace Thelia\Controller\Admin;
use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Security\AccessManager; use Thelia\Core\Security\AccessManager;
use Thelia\Form\ConfigStoreForm; use Thelia\Form\ConfigStoreForm;
use Thelia\Log\Tlog;
use Thelia\Model\ConfigQuery; use Thelia\Model\ConfigQuery;
/** /**
* Class ConfigStoreController * Class ConfigStoreController
@@ -78,7 +80,7 @@ class ConfigStoreController extends BaseAdminController
$data = $form->getData(); $data = $form->getData();
// Update store // Update store
foreach ($data as $name => $value) { foreach($data as $name => $value) {
if(! in_array($name , array('success_url', 'error_message'))) if(! in_array($name , array('success_url', 'error_message')))
ConfigQuery::write($name, $value, false); ConfigQuery::write($name, $value, false);
} }

View File

@@ -23,14 +23,19 @@
namespace Thelia\Controller\Admin; namespace Thelia\Controller\Admin;
use Propel\Runtime\Exception\PropelException;
use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent; use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
use Thelia\Core\Event\Customer\CustomerEvent; use Thelia\Core\Event\Customer\CustomerEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Security\AccessManager;
use Thelia\Form\CustomerCreateForm; use Thelia\Form\CustomerCreateForm;
use Thelia\Form\CustomerUpdateForm; use Thelia\Form\CustomerUpdateForm;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Model\CustomerQuery; use Thelia\Model\CustomerQuery;
use Thelia\Core\Translation\Translator;
use Thelia\Tools\Password; use Thelia\Tools\Password;
use Thelia\Model\AddressQuery;
use Thelia\Model\Address; use Thelia\Model\Address;
/** /**

View File

@@ -34,6 +34,7 @@ use Thelia\Form\FeatureModificationForm;
use Thelia\Form\FeatureCreationForm; use Thelia\Form\FeatureCreationForm;
use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Model\FeatureAv; use Thelia\Model\FeatureAv;
use Thelia\Model\FeatureAvQuery;
use Thelia\Core\Event\Feature\FeatureAvUpdateEvent; use Thelia\Core\Event\Feature\FeatureAvUpdateEvent;
use Thelia\Core\Event\Feature\FeatureEvent; use Thelia\Core\Event\Feature\FeatureEvent;

View File

@@ -584,7 +584,7 @@ class FileController extends BaseAdminController
); );
} }
if (null === $message) { if(null === $message) {
$message = $this->getTranslator() $message = $this->getTranslator()
->trans( ->trans(
'Images deleted successfully', 'Images deleted successfully',
@@ -638,7 +638,7 @@ class FileController extends BaseAdminController
) . $e->getMessage(); ) . $e->getMessage();
} }
if (null === $message) { if(null === $message) {
$message = $this->getTranslator() $message = $this->getTranslator()
->trans( ->trans(
'Image position updated', 'Image position updated',
@@ -692,7 +692,7 @@ class FileController extends BaseAdminController
) . $e->getMessage(); ) . $e->getMessage();
} }
if (null === $message) { if(null === $message) {
$message = $this->getTranslator() $message = $this->getTranslator()
->trans( ->trans(
'Document position updated', 'Document position updated',

View File

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

View File

@@ -31,6 +31,7 @@ use Thelia\Model\MessageQuery;
use Thelia\Form\MessageModificationForm; use Thelia\Form\MessageModificationForm;
use Thelia\Form\MessageCreationForm; use Thelia\Form\MessageCreationForm;
use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\Finder;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Template\TemplateHelper; use Thelia\Core\Template\TemplateHelper;
/** /**
@@ -163,8 +164,8 @@ class MessageController extends AbstractCrudController
return $this->render('messages'); return $this->render('messages');
} }
protected function listDirectoryContent($requiredExtension) protected function listDirectoryContent($requiredExtension) {
{
$list = array(); $list = array();
$dir = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath(); $dir = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath();

View File

@@ -149,6 +149,7 @@ class ModuleController extends AbstractCrudController
->findOneById($this->getRequest()->get('module_id')); ->findOneById($this->getRequest()->get('module_id'));
} }
protected function getObjectLabel($object) protected function getObjectLabel($object)
{ {
return $object->getTitle(); return $object->getTitle();
@@ -217,11 +218,12 @@ class ModuleController extends AbstractCrudController
{ {
$module = ModuleQuery::create()->findOneByCode($module_code); $module = ModuleQuery::create()->findOneByCode($module_code);
if (null === $module) { if(null === $module) {
throw new \InvalidArgumentException(sprintf("Module `%s` does not exists", $module_code)); throw new \InvalidArgumentException(sprintf("Module `%s` does not exists", $module_code));
} }
if (null !== $response = $this->checkAuth(array(), $module_code, AccessManager::VIEW)) return $response; if (null !== $response = $this->checkAuth(array(), $module_code, AccessManager::VIEW)) return $response;
return $this->render( return $this->render(
"module-configure", "module-configure",
array( array(

View File

@@ -27,6 +27,7 @@ use Thelia\Core\HttpFoundation\Response;
use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Event\Order\OrderAddressEvent; use Thelia\Core\Event\Order\OrderAddressEvent;
use Thelia\Core\Event\Order\OrderEvent; use Thelia\Core\Event\Order\OrderEvent;
use Thelia\Core\Event\PdfEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Security\AccessManager; use Thelia\Core\Security\AccessManager;
use Thelia\Form\OrderUpdateAddress; use Thelia\Form\OrderUpdateAddress;
@@ -35,6 +36,7 @@ use Thelia\Model\Base\OrderAddressQuery;
use Thelia\Model\OrderQuery; use Thelia\Model\OrderQuery;
use Thelia\Model\OrderStatusQuery; use Thelia\Model\OrderStatusQuery;
use Thelia\Tools\URL; use Thelia\Tools\URL;
use Thelia\Core\Template\TemplateHelper;
/** /**
* Class OrderController * Class OrderController
@@ -201,18 +203,20 @@ class OrderController extends BaseAdminController
public function generateInvoicePdf($order_id) public function generateInvoicePdf($order_id)
{ {
if (null !== $response = $this->checkAuth(AdminResources::ORDER, array(), AccessManager::UPDATE)) return $response; if (null !== $response = $this->checkAuth(AdminResources::ORDER, array(), AccessManager::UPDATE)) return $response;
return $this->generateBackOfficeOrderPdf($order_id, ConfigQuery::read('pdf_invoice_file', 'invoice')); return $this->generateBackOfficeOrderPdf($order_id, ConfigQuery::read('pdf_invoice_file', 'invoice'));
} }
public function generateDeliveryPdf($order_id) public function generateDeliveryPdf($order_id)
{ {
if (null !== $response = $this->checkAuth(AdminResources::ORDER, array(), AccessManager::UPDATE)) return $response; if (null !== $response = $this->checkAuth(AdminResources::ORDER, array(), AccessManager::UPDATE)) return $response;
return $this->generateBackOfficeOrderPdf($order_id, ConfigQuery::read('pdf_delivery_file', 'delivery')); return $this->generateBackOfficeOrderPdf($order_id, ConfigQuery::read('pdf_delivery_file', 'delivery'));
} }
private function generateBackOfficeOrderPdf($order_id, $fileName) private function generateBackOfficeOrderPdf($order_id, $fileName)
{ {
if (null === $response = $this->generateOrderPdf($order_id, $fileName)) { if(null === $response = $this->generateOrderPdf($order_id, $fileName)){
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute("admin.order.update.view", array( $this->redirect(URL::getInstance()->absoluteUrl($this->getRoute("admin.order.update.view", array(
'order_id' => $order_id 'order_id' => $order_id
)))); ))));
@@ -221,4 +225,5 @@ class OrderController extends BaseAdminController
return $response; return $response;
} }
} }

View File

@@ -72,6 +72,7 @@ use Thelia\Form\ProductCombinationGenerationForm;
use Thelia\TaxEngine\Calculator; use Thelia\TaxEngine\Calculator;
use Thelia\Tools\NumberFormat; use Thelia\Tools\NumberFormat;
/** /**
* Manages products * Manages products
* *
@@ -1036,18 +1037,17 @@ class ProductController extends AbstractSeoCrudController
} }
// Create combinations // Create combinations
protected function combine($input, &$output, &$tmp) protected function combine($input, &$output, &$tmp) {
{
$current = array_shift($input); $current = array_shift($input);
if (count($input) > 0) { if (count($input) > 0) {
foreach ($current as $element) { foreach($current as $element) {
$tmp[] = $element; $tmp[] = $element;
$this->combine($input, $output, $tmp); $this->combine($input, $output, $tmp);
array_pop($tmp); array_pop($tmp);
} }
} else { } else {
foreach ($current as $element) { foreach($current as $element) {
$tmp[] = $element; $tmp[] = $element;
$output[] = $tmp; $output[] = $tmp;
array_pop($tmp); array_pop($tmp);
@@ -1058,8 +1058,8 @@ class ProductController extends AbstractSeoCrudController
/** /**
* Build combinations from the combination output builder * Build combinations from the combination output builder
*/ */
public function buildCombinationsAction() public function buildCombinationsAction() {
{
// Check current user authorization // Check current user authorization
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response; if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
@@ -1082,7 +1082,7 @@ class ProductController extends AbstractSeoCrudController
// from the list of attribute_id:attributes_av ID from the form. // from the list of attribute_id:attributes_av ID from the form.
$combinations = $attributes_av_list = array(); $combinations = $attributes_av_list = array();
foreach ($data['attribute_av'] as $item) { foreach($data['attribute_av'] as $item) {
list($attribute_id, $attribute_av_id) = explode(':', $item); list($attribute_id, $attribute_av_id) = explode(':', $item);
if (! isset($attributes_av_list[$attribute_id])) if (! isset($attributes_av_list[$attribute_id]))

View File

@@ -23,6 +23,7 @@
namespace Thelia\Controller\Admin; namespace Thelia\Controller\Admin;
use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Security\AccessManager; use Thelia\Core\Security\AccessManager;
use Thelia\Form\SystemLogConfigurationForm; use Thelia\Form\SystemLogConfigurationForm;
@@ -42,7 +43,7 @@ class SystemLogController extends BaseAdminController
$destination_directories = Tlog::getInstance()->getDestinationsDirectories(); $destination_directories = Tlog::getInstance()->getDestinationsDirectories();
foreach ($destination_directories as $dir) { foreach($destination_directories as $dir) {
$this->loadDefinedDestinations($dir, $destinations); $this->loadDefinedDestinations($dir, $destinations);
} }
@@ -57,8 +58,8 @@ class SystemLogController extends BaseAdminController
); );
} }
protected function loadDefinedDestinations($directory, &$destinations) protected function loadDefinedDestinations($directory, &$destinations) {
{
try { try {
foreach (new \DirectoryIterator($directory) as $fileInfo) { foreach (new \DirectoryIterator($directory) as $fileInfo) {
@@ -143,7 +144,7 @@ class SystemLogController extends BaseAdminController
$active_destinations = array(); $active_destinations = array();
foreach ($destinations as $classname => $destination) { foreach($destinations as $classname => $destination) {
if (isset($destination['active'])) { if (isset($destination['active'])) {
$active_destinations[] = $destination['classname']; $active_destinations[] = $destination['classname'];
@@ -152,7 +153,7 @@ class SystemLogController extends BaseAdminController
if (isset($configs[$classname])) { if (isset($configs[$classname])) {
// Update destinations configuration // Update destinations configuration
foreach ($configs[$classname] as $var => $value) { foreach($configs[$classname] as $var => $value) {
ConfigQuery::write($var, $value, true, true); ConfigQuery::write($var, $value, true, true);
} }
} }

View File

@@ -23,8 +23,12 @@
namespace Thelia\Controller\Admin; namespace Thelia\Controller\Admin;
use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Security\AccessManager; use Thelia\Core\Security\AccessManager;
use Thelia\Form\SystemLogConfigurationForm;
use Thelia\Log\Tlog;
use Thelia\Model\ConfigQuery;
use Thelia\Model\ModuleQuery; use Thelia\Model\ModuleQuery;
use Thelia\Core\Template\TemplateHelper; use Thelia\Core\Template\TemplateHelper;
use Thelia\Core\Template\TemplateDefinition; use Thelia\Core\Template\TemplateDefinition;
@@ -63,7 +67,7 @@ class TranslationsController extends BaseAdminController
if (! empty($item_id) || $item_to_translate == 'co') { if (! empty($item_id) || $item_to_translate == 'co') {
switch ($item_to_translate) { switch($item_to_translate) {
case 'mo' : case 'mo' :
if (null !== $module = ModuleQuery::create()->findPk($item_id)) { if (null !== $module = ModuleQuery::create()->findPk($item_id)) {
@@ -145,7 +149,8 @@ class TranslationsController extends BaseAdminController
$templateArguments['max_input_vars_warning'] = true; $templateArguments['max_input_vars_warning'] = true;
$templateArguments['required_max_input_vars'] = $stringsCount; $templateArguments['required_max_input_vars'] = $stringsCount;
$templateArguments['current_max_input_vars'] = ini_get('max_input_vars'); $templateArguments['current_max_input_vars'] = ini_get('max_input_vars');
} else { }
else {
$templateArguments['all_strings'] = $all_strings; $templateArguments['all_strings'] = $all_strings;
} }
} }
@@ -157,12 +162,14 @@ class TranslationsController extends BaseAdminController
public function defaultAction() public function defaultAction()
{ {
if (null !== $response = $this->checkAuth(AdminResources::TRANSLATIONS, array(), AccessManager::VIEW)) return $response; if (null !== $response = $this->checkAuth(AdminResources::TRANSLATIONS, array(), AccessManager::VIEW)) return $response;
return $this->renderTemplate(); return $this->renderTemplate();
} }
public function updateAction() public function updateAction()
{ {
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, array(), AccessManager::UPDATE)) return $response; if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, array(), AccessManager::UPDATE)) return $response;
return $this->renderTemplate(); return $this->renderTemplate();
} }
} }

View File

@@ -61,7 +61,7 @@ abstract class BaseController extends ContainerAware
/** /**
* Return an empty response (after an ajax request, for example) * Return an empty response (after an ajax request, for example)
* @param int $status * @param int $status
* @return \Thelia\Core\HttpFoundation\Response * @return \Thelia\Core\HttpFoundation\Response
*/ */
protected function nullResponse($status = 200) protected function nullResponse($status = 200)
@@ -252,6 +252,7 @@ abstract class BaseController extends ContainerAware
} }
} }
/** /**
@@ -366,8 +367,8 @@ abstract class BaseController extends ContainerAware
* Render the given template, and returns the result as an Http Response. * Render the given template, and returns the result as an Http Response.
* *
* @param $templateName the complete template name, with extension * @param $templateName the complete template name, with extension
* @param array $args the template arguments * @param array $args the template arguments
* @param int $status http code status * @param int $status http code status
* @return \Thelia\Core\HttpFoundation\Response * @return \Thelia\Core\HttpFoundation\Response
*/ */
abstract protected function render($templateName, $args = array(), $status = 200); abstract protected function render($templateName, $args = array(), $status = 200);

View File

@@ -25,8 +25,10 @@ namespace Thelia\Controller\Front;
use Symfony\Component\Routing\Router; use Symfony\Component\Routing\Router;
use Thelia\Controller\BaseController; use Thelia\Controller\BaseController;
use Thelia\Core\HttpFoundation\Response; use Thelia\Core\HttpFoundation\Response;
use Thelia\Core\Security\Exception\AuthenticationException;
use Thelia\Core\Template\TemplateHelper; use Thelia\Core\Template\TemplateHelper;
use Thelia\Model\AddressQuery; use Thelia\Model\AddressQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Model\ModuleQuery; use Thelia\Model\ModuleQuery;
use Thelia\Tools\Redirect; use Thelia\Tools\Redirect;
use Thelia\Tools\URL; use Thelia\Tools\URL;
@@ -104,8 +106,8 @@ class BaseFrontController extends BaseController
* Render the given template, and returns the result as an Http Response. * Render the given template, and returns the result as an Http Response.
* *
* @param $templateName the complete template name, with extension * @param $templateName the complete template name, with extension
* @param array $args the template arguments * @param array $args the template arguments
* @param int $status http code status * @param int $status http code status
* @return \Thelia\Core\HttpFoundation\Response * @return \Thelia\Core\HttpFoundation\Response
*/ */
protected function render($templateName, $args = array(), $status = 200) protected function render($templateName, $args = array(), $status = 200)

View File

@@ -26,6 +26,7 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Reference;
/** /**
* Class TranslatorPass * Class TranslatorPass
* @package Thelia\Core\DependencyInjection\Compiler * @package Thelia\Core\DependencyInjection\Compiler
@@ -49,7 +50,7 @@ class TranslatorPass implements CompilerPassInterface
$translator = $container->getDefinition('thelia.translator'); $translator = $container->getDefinition('thelia.translator');
foreach ($container->findTaggedServiceIds('translation.loader') as $id => $attributes) { foreach($container->findTaggedServiceIds('translation.loader') as $id => $attributes) {
$translator->addMethodCall('addLoader', array($attributes[0]['alias'], new Reference($id))); $translator->addMethodCall('addLoader', array($attributes[0]['alias'], new Reference($id)));
if (isset($attributes[0]['legacy-alias'])) { if (isset($attributes[0]['legacy-alias'])) {
$translator->addMethodCall('addLoader', array($attributes[0]['legacy-alias'], new Reference($id))); $translator->addMethodCall('addLoader', array($attributes[0]['legacy-alias'], new Reference($id)));

View File

@@ -25,6 +25,7 @@ namespace Thelia\Core\Event\Administrator;
use Thelia\Core\Event\ActionEvent; use Thelia\Core\Event\ActionEvent;
use Thelia\Model\Admin; use Thelia\Model\Admin;
/** /**
* Class AdministratorUpdatePasswordEvent * Class AdministratorUpdatePasswordEvent
* @package Thelia\Core\Event\Administrator * @package Thelia\Core\Event\Administrator
@@ -81,3 +82,4 @@ class AdministratorUpdatePasswordEvent extends ActionEvent
} }
} }

View File

@@ -23,6 +23,7 @@
namespace Thelia\Core\Event\Customer; namespace Thelia\Core\Event\Customer;
use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\Event;
use Thelia\Core\Event\ActionEvent;
use Thelia\Model\Customer; use Thelia\Model\Customer;
/** /**

View File

@@ -23,6 +23,7 @@
namespace Thelia\Core\Event\Customer; namespace Thelia\Core\Event\Customer;
use Thelia\Core\Event\ActionEvent;
use Thelia\Model\Customer; use Thelia\Model\Customer;
class CustomerLoginEvent extends CustomerEvent class CustomerLoginEvent extends CustomerEvent

View File

@@ -65,7 +65,6 @@ class ProductCombinationGenerationEvent extends ProductEvent
public function setReference($reference) public function setReference($reference)
{ {
$this->reference = $reference; $this->reference = $reference;
return $this; return $this;
} }
@@ -77,7 +76,6 @@ class ProductCombinationGenerationEvent extends ProductEvent
public function setPrice($price) public function setPrice($price)
{ {
$this->price = $price; $this->price = $price;
return $this; return $this;
} }
@@ -89,7 +87,6 @@ class ProductCombinationGenerationEvent extends ProductEvent
public function setWeight($weight) public function setWeight($weight)
{ {
$this->weight = $weight; $this->weight = $weight;
return $this; return $this;
} }
@@ -101,7 +98,6 @@ class ProductCombinationGenerationEvent extends ProductEvent
public function setQuantity($quantity) public function setQuantity($quantity)
{ {
$this->quantity = $quantity; $this->quantity = $quantity;
return $this; return $this;
} }
@@ -113,7 +109,6 @@ class ProductCombinationGenerationEvent extends ProductEvent
public function setSalePrice($sale_price) public function setSalePrice($sale_price)
{ {
$this->sale_price = $sale_price; $this->sale_price = $sale_price;
return $this; return $this;
} }
@@ -125,7 +120,6 @@ class ProductCombinationGenerationEvent extends ProductEvent
public function setOnsale($onsale) public function setOnsale($onsale)
{ {
$this->onsale = $onsale; $this->onsale = $onsale;
return $this; return $this;
} }
@@ -137,7 +131,6 @@ class ProductCombinationGenerationEvent extends ProductEvent
public function setIsnew($isnew) public function setIsnew($isnew)
{ {
$this->isnew = $isnew; $this->isnew = $isnew;
return $this; return $this;
} }
@@ -149,7 +142,6 @@ class ProductCombinationGenerationEvent extends ProductEvent
public function setEanCode($ean_code) public function setEanCode($ean_code)
{ {
$this->ean_code = $ean_code; $this->ean_code = $ean_code;
return $this; return $this;
return $this; return $this;
} }
@@ -162,7 +154,6 @@ class ProductCombinationGenerationEvent extends ProductEvent
public function setCombinations($combinations) public function setCombinations($combinations)
{ {
$this->combinations = $combinations; $this->combinations = $combinations;
return $this; return $this;
} }
} }

View File

@@ -22,6 +22,7 @@
/*************************************************************************************/ /*************************************************************************************/
namespace Thelia\Core\Event\ProductSaleElement; namespace Thelia\Core\Event\ProductSaleElement;
use Thelia\Model\Product;
class ProductSaleElementDeleteEvent extends ProductSaleElementEvent class ProductSaleElementDeleteEvent extends ProductSaleElementEvent
{ {

View File

@@ -370,7 +370,6 @@ final class TheliaEvents
*/ */
const ORDER_SET_DELIVERY_ADDRESS = "action.order.setDeliveryAddress"; const ORDER_SET_DELIVERY_ADDRESS = "action.order.setDeliveryAddress";
const ORDER_SET_DELIVERY_MODULE = "action.order.setDeliveryModule"; const ORDER_SET_DELIVERY_MODULE = "action.order.setDeliveryModule";
const ORDER_SET_POSTAGE = "action.order.setPostage";
const ORDER_SET_INVOICE_ADDRESS = "action.order.setInvoiceAddress"; const ORDER_SET_INVOICE_ADDRESS = "action.order.setInvoiceAddress";
const ORDER_SET_PAYMENT_MODULE = "action.order.setPaymentModule"; const ORDER_SET_PAYMENT_MODULE = "action.order.setPaymentModule";
const ORDER_PAY = "action.order.pay"; const ORDER_PAY = "action.order.pay";

View File

@@ -184,4 +184,5 @@ class UpdateSeoEvent extends ActionEvent
return $this->object; return $this->object;
} }
} }

View File

@@ -30,10 +30,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Thelia\Core\HttpFoundation\Response; use Thelia\Core\HttpFoundation\Response;
use Symfony\Component\Routing\Router; use Symfony\Component\Routing\Router;
use Thelia\Core\HttpKernel\Exception\NotFountHttpException;
use Thelia\Core\Template\Exception\ResourceNotFoundException; use Thelia\Core\Template\Exception\ResourceNotFoundException;
use Thelia\Core\Template\ParserInterface; use Thelia\Core\Template\ParserInterface;
use Thelia\Core\Template\TemplateHelper; use Thelia\Core\Template\TemplateHelper;
use Thelia\Exception\OrderException; use Thelia\Exception\OrderException;
use Thelia\Model\ConfigQuery;
use Thelia\Tools\Redirect; use Thelia\Tools\Redirect;
use Thelia\Tools\URL; use Thelia\Tools\URL;
use Thelia\Core\Security\Exception\AuthenticationException; use Thelia\Core\Security\Exception\AuthenticationException;

View File

@@ -39,8 +39,8 @@ class Response extends BaseResponse
* *
* @see \Thelia\Core\HttpFoundation\Response::sendContent() * @see \Thelia\Core\HttpFoundation\Response::sendContent()
*/ */
public function sendContent() public function sendContent() {
{
Tlog::getInstance()->write($this->content); Tlog::getInstance()->write($this->content);
parent::sendContent(); parent::sendContent();

View File

@@ -65,7 +65,6 @@ class HttpCache extends BaseHttpCache implements HttpKernelInterface
$request->getContent() $request->getContent()
); );
} }
return parent::handle($request, $type, $catch); return parent::handle($request, $type, $catch);
} }

View File

@@ -177,7 +177,7 @@ class SecurityContext
continue; continue;
} }
if (!array_key_exists('module', $userPermissions)) { if(!array_key_exists('module', $userPermissions)) {
return false; return false;
} }

View File

@@ -23,8 +23,7 @@
namespace Thelia\Core\Template\Assets; namespace Thelia\Core\Template\Assets;
interface AssetManagerInterface interface AssetManagerInterface {
{
/** /**
* Prepare an asset directory by checking that no changes occured in * Prepare an asset directory by checking that no changes occured in
* the source directory. If any change is detected, the whole asset directory * the source directory. If any change is detected, the whole asset directory
@@ -36,6 +35,10 @@ interface AssetManagerInterface
* @param string $webAssetsKey the assets key : module name or 0 for base template * @param string $webAssetsKey the assets key : module name or 0 for base template
* *
* @throws \RuntimeException if something goes wrong. * @throws \RuntimeException if something goes wrong.
*
* @internal param string $source_assets_directory the full path to the source asstes directory
* @internal param string $web_assets_directory_base the base directory of the web based asset directory
* @internal param string $key the assets key : module name or 0 for base template
*/ */
public function prepareAssets($sourceAssetsDirectory, $webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey); public function prepareAssets($sourceAssetsDirectory, $webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey);
@@ -55,6 +58,9 @@ interface AssetManagerInterface
* *
* @param boolean $debug true / false * @param boolean $debug true / false
* *
* @internal param string $web_assets_directory_base the full disk path to the base assets output directory in the web space
* @internal param string $output_url the URL to the base assets output directory in the web space
*
* @return string The URL to the generated asset file. * @return string The URL to the generated asset file.
*/ */
public function processAsset($assetSource, $assetDirectoryBase, $webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey, $outputUrl, $assetType, $filters, $debug); public function processAsset($assetSource, $assetDirectoryBase, $webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey, $outputUrl, $assetType, $filters, $debug);

View File

@@ -51,7 +51,7 @@ class AsseticAssetManager implements AssetManagerInterface
/** /**
* Create a stamp form the modification time of the content of the given directory and all of its subdirectories * Create a stamp form the modification time of the content of the given directory and all of its subdirectories
* *
* @param string $directory ther directory name * @param string $directory ther directory name
* @return string the stamp of this directory * @return string the stamp of this directory
*/ */
protected function getStamp($directory) protected function getStamp($directory)
@@ -76,8 +76,7 @@ class AsseticAssetManager implements AssetManagerInterface
* *
* @return bool * @return bool
*/ */
protected function isSourceFile(\SplFileInfo $fileInfo) protected function isSourceFile(\SplFileInfo $fileInfo) {
{
return in_array($fileInfo->getExtension(), $this->source_file_extensions); return in_array($fileInfo->getExtension(), $this->source_file_extensions);
} }
@@ -135,27 +134,6 @@ class AsseticAssetManager implements AssetManagerInterface
* @internal param string $source_assets_directory the source directory * @internal param string $source_assets_directory the source directory
* @return the full path of the destination directory * @return the full path of the destination directory
*/ */
protected function getRelativeDirectoryPath($source_assets_directory, $web_assets_directory_base)
{
$source_assets_directory = realpath($source_assets_directory);
// Remove base path from asset source path to get a path relative to the template base
// and use it to create the destination path.
return str_replace(
realpath(THELIA_ROOT),
'',
$source_assets_directory
);
}
/**
* Compute the destination directory path, from the source directory and the
* base directory of the web assets
*
* @param string $source_assets_directory the source directory
* @param string $web_assets_directory_base base directory of the web assets
* @return the full path of the destination directory
*/
protected function getDestinationDirectory($webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey) protected function getDestinationDirectory($webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey)
{ {
// Compute the absolute path of the output directory // Compute the absolute path of the output directory
@@ -227,7 +205,8 @@ class AsseticAssetManager implements AssetManagerInterface
throw new \RuntimeException( throw new \RuntimeException(
"Failed to create asset stamp file $stamp_file_path. Please check that your web server has the proper access rights to do that."); "Failed to create asset stamp file $stamp_file_path. Please check that your web server has the proper access rights to do that.");
} }
/* } else { /* }
else {
@fclose($fp); @fclose($fp);
} }
*/ */
@@ -237,13 +216,13 @@ class AsseticAssetManager implements AssetManagerInterface
/** /**
* Decode the filters names, and initialize the Assetic FilterManager * Decode the filters names, and initialize the Assetic FilterManager
* *
* @param FilterManager $filterManager the Assetic filter manager * @param FilterManager $filterManager the Assetic filter manager
* @param string $filters a comma separated list of filter names * @param string $filters a comma separated list of filter names
* @throws \InvalidArgumentException if a wrong filter is passed * @throws \InvalidArgumentException if a wrong filter is passed
* @return an array of filter names * @return an array of filter names
*/ */
protected function decodeAsseticFilters(FilterManager $filterManager, $filters) protected function decodeAsseticFilters(FilterManager $filterManager, $filters) {
{
if (!empty($filters)) { if (!empty($filters)) {
$filter_list = explode(',', $filters); $filter_list = explode(',', $filters);
@@ -282,7 +261,8 @@ class AsseticAssetManager implements AssetManagerInterface
break; break;
} }
} }
} else { }
else {
$filter_list = array(); $filter_list = array();
} }

View File

@@ -277,6 +277,7 @@ abstract class BaseLoop
} }
} }
protected function searchArray(array $search, &$pagination = null) protected function searchArray(array $search, &$pagination = null)
{ {
if (false === $this->countable) { if (false === $this->countable) {
@@ -285,7 +286,7 @@ abstract class BaseLoop
if ($this->getArgValue('page') !== null) { if ($this->getArgValue('page') !== null) {
$nbPage = ceil(count($search)/$this->getArgValue('limit')); $nbPage = ceil(count($search)/$this->getArgValue('limit'));
if ($this->getArgValue('page') > $nbPage || $this->getArgValue('page') <= 0) { if($this->getArgValue('page') > $nbPage || $this->getArgValue('page') <= 0) {
return array(); return array();
} }
@@ -337,9 +338,9 @@ abstract class BaseLoop
*/ */
public function exec(&$pagination) public function exec(&$pagination)
{ {
if ($this instanceof PropelSearchLoopInterface) { if($this instanceof PropelSearchLoopInterface) {
$searchModelCriteria = $this->buildModelCriteria(); $searchModelCriteria = $this->buildModelCriteria();
if (null === $searchModelCriteria) { if(null === $searchModelCriteria) {
$results = array(); $results = array();
} else { } else {
$results = $this->search( $results = $this->search(
@@ -349,7 +350,7 @@ abstract class BaseLoop
} }
} elseif ($this instanceof ArraySearchLoopInterface) { } elseif ($this instanceof ArraySearchLoopInterface) {
$searchArray = $this->buildArray(); $searchArray = $this->buildArray();
if (null === $searchArray) { if(null === $searchArray) {
$results = array(); $results = array();
} else { } else {
$results = $this->searchArray( $results = $this->searchArray(
@@ -361,13 +362,13 @@ abstract class BaseLoop
$loopResult = new LoopResult($results); $loopResult = new LoopResult($results);
if (true === $this->countable) { if(true === $this->countable) {
$loopResult->setCountable(); $loopResult->setCountable();
} }
if (true === $this->timestampable) { if(true === $this->timestampable) {
$loopResult->setTimestamped(); $loopResult->setTimestamped();
} }
if (true === $this->versionable) { if(true === $this->versionable) {
$loopResult->setVersioned(); $loopResult->setVersioned();
} }
@@ -381,29 +382,29 @@ abstract class BaseLoop
* - ArraySearchLoopInterface * - ArraySearchLoopInterface
*/ */
$searchInterface = false; $searchInterface = false;
if ($this instanceof PropelSearchLoopInterface) { if($this instanceof PropelSearchLoopInterface) {
if (true === $searchInterface) { if(true === $searchInterface) {
throw new LoopException('Loop cannot implements multiple Search Interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`', LoopException::MULTIPLE_SEARCH_INTERFACE); throw new LoopException('Loop cannot implements multiple Search Interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`', LoopException::MULTIPLE_SEARCH_INTERFACE);
} }
$searchInterface = true; $searchInterface = true;
} }
if ($this instanceof ArraySearchLoopInterface) { if($this instanceof ArraySearchLoopInterface) {
if (true === $searchInterface) { if(true === $searchInterface) {
throw new LoopException('Loop cannot implements multiple Search Interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`', LoopException::MULTIPLE_SEARCH_INTERFACE); throw new LoopException('Loop cannot implements multiple Search Interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`', LoopException::MULTIPLE_SEARCH_INTERFACE);
} }
$searchInterface = true; $searchInterface = true;
} }
if (false === $searchInterface) { if(false === $searchInterface) {
throw new LoopException('Loop must implements one of the following interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`', LoopException::SEARCH_INTERFACE_NOT_FOUND); throw new LoopException('Loop must implements one of the following interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`', LoopException::SEARCH_INTERFACE_NOT_FOUND);
} }
/* Only PropelSearch allows timestamp and version */ /* Only PropelSearch allows timestamp and version */
if (!$this instanceof PropelSearchLoopInterface) { if(!$this instanceof PropelSearchLoopInterface) {
if (true === $this->timestampable) { if(true === $this->timestampable) {
throw new LoopException("Loop must implements 'PropelSearchLoopInterface' to be timestampable", LoopException::NOT_TIMESTAMPED); throw new LoopException("Loop must implements 'PropelSearchLoopInterface' to be timestampable", LoopException::NOT_TIMESTAMPED);
} }
if (true === $this->versionable) { if(true === $this->versionable) {
throw new LoopException("Loop must implements 'PropelSearchLoopInterface' to be versionable", LoopException::NOT_VERSIONED); throw new LoopException("Loop must implements 'PropelSearchLoopInterface' to be versionable", LoopException::NOT_VERSIONED);
} }
} }

View File

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

View File

@@ -88,7 +88,7 @@ class Auth extends BaseLoop implements ArraySearchLoopInterface
$module = $this->getModule(); $module = $this->getModule();
$access = $this->getAccess(); $access = $this->getAccess();
if (null !== $module) { if(null !== $module) {
$in = true; $in = true;
} }

View File

@@ -24,6 +24,7 @@
namespace Thelia\Core\Template\Loop; namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\PropelSearchLoopInterface; use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\ArgumentCollection;

View File

@@ -58,7 +58,7 @@ class Cart extends BaseLoop implements ArraySearchLoopInterface
{ {
$cart = $this->getCart($this->request); $cart = $this->getCart($this->request);
if (null === $cart) { if(null === $cart) {
return array(); return array();
} }
@@ -79,9 +79,9 @@ class Cart extends BaseLoop implements ArraySearchLoopInterface
public function parseResults(LoopResult $loopResult) public function parseResults(LoopResult $loopResult)
{ {
$taxCountry = TaxEngine::getInstance($this->request->getSession())->getTaxCountry(); $taxCountry = TaxEngine::getInstance($this->request->getSession())->getDeliveryCountry();
foreach ($loopResult->getResultDataCollection() as $cartItem) { foreach($loopResult->getResultDataCollection() as $cartItem) {
$product = $cartItem->getProduct(); $product = $cartItem->getProduct();
$productSaleElement = $cartItem->getProductSaleElements(); $productSaleElement = $cartItem->getProductSaleElements();

View File

@@ -125,9 +125,9 @@ class CategoryPath extends BaseI18nLoop implements ArraySearchLoopInterface
public function parseResults(LoopResult $loopResult) public function parseResults(LoopResult $loopResult)
{ {
foreach ($loopResult->getResultDataCollection() as $result) { foreach($loopResult->getResultDataCollection() as $result) {
$loopResultRow = new LoopResultRow($result); $loopResultRow = new LoopResultRow($result);
foreach ($result as $output => $outputValue) { foreach($result as $output => $outputValue) {
$loopResultRow->set($output, $outputValue); $loopResultRow->set($output, $outputValue);
} }
$loopResult->addRow($loopResultRow); $loopResult->addRow($loopResultRow);

View File

@@ -99,9 +99,9 @@ class CategoryTree extends BaseI18nLoop implements ArraySearchLoopInterface
public function parseResults(LoopResult $loopResult) public function parseResults(LoopResult $loopResult)
{ {
foreach ($loopResult->getResultDataCollection() as $result) { foreach($loopResult->getResultDataCollection() as $result) {
$loopResultRow = new LoopResultRow($result); $loopResultRow = new LoopResultRow($result);
foreach ($result as $output => $outputValue) { foreach($result as $output => $outputValue) {
$loopResultRow->set($output, $outputValue); $loopResultRow->set($output, $outputValue);
} }
$loopResult->addRow($loopResultRow); $loopResult->addRow($loopResultRow);

View File

@@ -24,6 +24,7 @@
namespace Thelia\Core\Template\Loop; namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Util\PropelModelPager;
use Thelia\Condition\ConditionFactory; use Thelia\Condition\ConditionFactory;
use Thelia\Condition\Implementation\ConditionInterface; use Thelia\Condition\Implementation\ConditionInterface;
use Thelia\Core\HttpFoundation\Request; use Thelia\Core\HttpFoundation\Request;

View File

@@ -158,7 +158,6 @@ class Currency extends BaseI18nLoop implements PropelSearchLoopInterface
} }
/* perform search */ /* perform search */
return $search; return $search;
} }

View File

@@ -36,6 +36,9 @@ use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\CustomerQuery; use Thelia\Model\CustomerQuery;
use Thelia\Type\TypeCollection; use Thelia\Type\TypeCollection;
use Thelia\Type; use Thelia\Type;
use Thelia\Model\OrderQuery;
use Thelia\Model\Map\OrderAddressTableMap;
use Thelia\Model\Map\OrderTableMap;
/** /**
* *
@@ -205,6 +208,7 @@ class Customer extends BaseLoop implements SearchLoopInterface, PropelSearchLoop
$search->orderByCreatedAt(Criteria::DESC); $search->orderByCreatedAt(Criteria::DESC);
break; break;
} }
} }

View File

@@ -29,6 +29,7 @@ use Thelia\Exception\OrderException;
use Thelia\Model\CountryQuery; use Thelia\Model\CountryQuery;
use Thelia\Module\BaseModule; use Thelia\Module\BaseModule;
use Thelia\Module\DeliveryModuleInterface; use Thelia\Module\DeliveryModuleInterface;
use Thelia\TaxEngine\TaxEngine;
/** /**
* Class Delivery * Class Delivery
@@ -59,7 +60,7 @@ class Delivery extends BaseSpecificModule
throw new \InvalidArgumentException('Cannot found country id: `' . $countryId . '` in delivery loop'); throw new \InvalidArgumentException('Cannot found country id: `' . $countryId . '` in delivery loop');
} }
} else { } else {
$country = CountryQuery::create()->findOneByByDefault(1); $country = TaxEngine::getInstance($this->request->getSession())->getDeliveryCountry();
} }
foreach ($loopResult->getResultDataCollection() as $deliveryModule) { foreach ($loopResult->getResultDataCollection() as $deliveryModule) {
@@ -73,8 +74,8 @@ class Delivery extends BaseSpecificModule
try { try {
$postage = $moduleInstance->getPostage($country); $postage = $moduleInstance->getPostage($country);
} catch (OrderException $e) { } catch(OrderException $e) {
switch ($e->getCode()) { switch($e->getCode()) {
case OrderException::DELIVERY_MODULE_UNAVAILABLE: case OrderException::DELIVERY_MODULE_UNAVAILABLE:
/* do not show this delivery module */ /* do not show this delivery module */
continue(2); continue(2);

View File

@@ -126,6 +126,7 @@ class Folder extends BaseI18nLoop implements PropelSearchLoopInterface
if ($visible !== BooleanOrBothType::ANY) $search->filterByVisible($visible ? 1 : 0); if ($visible !== BooleanOrBothType::ANY) $search->filterByVisible($visible ? 1 : 0);
$orders = $this->getOrder(); $orders = $this->getOrder();
foreach ($orders as $order) { foreach ($orders as $order) {

View File

@@ -135,9 +135,9 @@ class FolderPath extends BaseI18nLoop implements ArraySearchLoopInterface
public function parseResults(LoopResult $loopResult) public function parseResults(LoopResult $loopResult)
{ {
foreach ($loopResult->getResultDataCollection() as $result) { foreach($loopResult->getResultDataCollection() as $result) {
$loopResultRow = new LoopResultRow($result); $loopResultRow = new LoopResultRow($result);
foreach ($result as $output => $outputValue) { foreach($result as $output => $outputValue) {
$loopResultRow->set($output, $outputValue); $loopResultRow->set($output, $outputValue);
} }
$loopResult->addRow($loopResultRow); $loopResult->addRow($loopResultRow);

View File

@@ -100,9 +100,9 @@ class FolderTree extends BaseI18nLoop implements ArraySearchLoopInterface
public function parseResults(LoopResult $loopResult) public function parseResults(LoopResult $loopResult)
{ {
foreach ($loopResult->getResultDataCollection() as $result) { foreach($loopResult->getResultDataCollection() as $result) {
$loopResultRow = new LoopResultRow($result); $loopResultRow = new LoopResultRow($result);
foreach ($result as $output => $outputValue) { foreach($result as $output => $outputValue) {
$loopResultRow->set($output, $outputValue); $loopResultRow->set($output, $outputValue);
} }
$loopResult->addRow($loopResultRow); $loopResult->addRow($loopResultRow);

View File

@@ -236,6 +236,7 @@ class Image extends BaseI18nLoop implements PropelSearchLoopInterface
$search->filterById($exclude, Criteria::NOT_IN); $search->filterById($exclude, Criteria::NOT_IN);
// echo "sql=".$search->toString(); // echo "sql=".$search->toString();
return $search; return $search;
} }

View File

@@ -196,19 +196,19 @@ class Module extends BaseI18nLoop implements PropelSearchLoopInterface
/* first test if module defines it's own config route */ /* first test if module defines it's own config route */
$routerId = "router." . $module->getBaseDir(); $routerId = "router." . $module->getBaseDir();
if ($this->container->has($routerId)) { if($this->container->has($routerId)) {
try { try {
if ($this->container->get($routerId)->match('/admin/module/' . $module->getCode())) { if($this->container->get($routerId)->match('/admin/module/' . $module->getCode())) {
$hasConfigurationInterface = true; $hasConfigurationInterface = true;
} }
} catch (ResourceNotFoundException $e) { } catch(ResourceNotFoundException $e) {
/* $hasConfigurationInterface stays false */ /* $hasConfigurationInterface stays false */
} }
} }
/* if not ; test if it uses admin inclusion : module_configuration.html */ /* if not ; test if it uses admin inclusion : module_configuration.html */
if (false === $hasConfigurationInterface) { if(false === $hasConfigurationInterface) {
if (file_exists( sprintf("%s/AdminIncludes/%s.html", $module->getAbsoluteBaseDir(), "module_configuration"))) { if(file_exists( sprintf("%s/AdminIncludes/%s.html", $module->getAbsoluteBaseDir(), "module_configuration"))) {
$hasConfigurationInterface = true; $hasConfigurationInterface = true;
} }
} }

View File

@@ -46,7 +46,7 @@ use Thelia\Type;
*/ */
class Order extends BaseLoop implements SearchLoopInterface, PropelSearchLoopInterface class Order extends BaseLoop implements SearchLoopInterface, PropelSearchLoopInterface
{ {
protected $countable = true; protected $countable = true;
protected $timestampable = true; protected $timestampable = true;
protected $versionable = false; protected $versionable = false;
@@ -175,6 +175,7 @@ class Order extends BaseLoop implements SearchLoopInterface, PropelSearchLoopInt
} }
return $search; return $search;
} }
public function parseResults(LoopResult $loopResult) public function parseResults(LoopResult $loopResult)
@@ -201,7 +202,6 @@ class Order extends BaseLoop implements SearchLoopInterface, PropelSearchLoopInt
->set("STATUS", $order->getStatusId()) ->set("STATUS", $order->getStatusId())
->set("LANG", $order->getLangId()) ->set("LANG", $order->getLangId())
->set("POSTAGE", $order->getPostage()) ->set("POSTAGE", $order->getPostage())
->set("DISCOUNT", $order->getDiscount())
->set("TOTAL_TAX", $tax) ->set("TOTAL_TAX", $tax)
->set("TOTAL_AMOUNT", $amount - $tax) ->set("TOTAL_AMOUNT", $amount - $tax)
->set("TOTAL_TAXED_AMOUNT", $amount) ->set("TOTAL_TAXED_AMOUNT", $amount)

View File

@@ -1,116 +0,0 @@
<?php
/**********************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/**********************************************************************************/
namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Condition\ConditionFactory;
use Thelia\Condition\Implementation\ConditionInterface;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\OrderCouponQuery;
use Thelia\Model\OrderQuery;
use Thelia\Type;
/**
*
* OrderCoupon loop
*
*
* Class OrderCoupon
* @package Thelia\Core\Template\Loop
* @author Etienne Roudeix <eroudeix@openstudio.fr>
*/
class OrderCoupon extends BaseLoop implements PropelSearchLoopInterface
{
/**
* Define all args used in your loop
*
* @return ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntTypeArgument('order', null, true)
);
}
public function buildModelCriteria()
{
$search = OrderCouponQuery::create();
$order = $this->getOrder();
$search->filterByOrderId($order, Criteria::EQUAL);
$search->orderById(Criteria::ASC);
return $search;
}
public function parseResults(LoopResult $loopResult)
{
$conditionFactory = $this->container->get('thelia.condition.factory');
/** @var OrderCoupon $orderCoupon */
foreach ($loopResult->getResultDataCollection() as $orderCoupon) {
$loopResultRow = new LoopResultRow($orderCoupon);
$conditions = $conditionFactory->unserializeConditionCollection(
$orderCoupon->getSerializedConditions()
);
$now = time();
$datediff = $orderCoupon->getExpirationDate()->getTimestamp() - $now;
$daysLeftBeforeExpiration = floor($datediff/(60*60*24));
$cleanedConditions = array();
foreach ($conditions->getConditions() as $condition) {
$cleanedConditions[] = $condition->getToolTip();
}
$loopResultRow->set("ID", $orderCoupon->getId())
->set("CODE", $orderCoupon->getCode())
->set("TITLE", $orderCoupon->getTitle())
->set("SHORT_DESCRIPTION", $orderCoupon->getShortDescription())
->set("DESCRIPTION", $orderCoupon->getDescription())
->set("EXPIRATION_DATE", $orderCoupon->getExpirationDate( OrderQuery::create()->findPk($this->getOrder())->getLangId() ))
->set("USAGE_LEFT", $orderCoupon->getMaxUsage())
->set("IS_CUMULATIVE", $orderCoupon->getIsCumulative())
->set("IS_REMOVING_POSTAGE", $orderCoupon->getIsRemovingPostage())
->set("IS_AVAILABLE_ON_SPECIAL_OFFERS", $orderCoupon->getIsAvailableOnSpecialOffers())
->set("AMOUNT", $orderCoupon->getAmount())
->set("APPLICATION_CONDITIONS", $cleanedConditions)
->set("DAY_LEFT_BEFORE_EXPIRATION", $daysLeftBeforeExpiration)
;
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}

View File

@@ -465,7 +465,7 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
return $this->parseComplex($loopResult); return $this->parseComplex($loopResult);
} }
$taxCountry = TaxEngine::getInstance($this->request->getSession())->getTaxCountry(); $taxCountry = TaxEngine::getInstance($this->request->getSession())->getDeliveryCountry();
foreach ($loopResult->getResultDataCollection() as $product) { foreach ($loopResult->getResultDataCollection() as $product) {
@@ -983,7 +983,7 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
{ {
$loopResult = new LoopResult($results); $loopResult = new LoopResult($results);
$taxCountry = TaxEngine::getInstance($this->request->getSession())->getTaxCountry(); $taxCountry = TaxEngine::getInstance($this->request->getSession())->getDeliveryCountry();
foreach ($loopResult->getResultDataCollection() as $product) { foreach ($loopResult->getResultDataCollection() as $product) {

View File

@@ -37,6 +37,7 @@ use Thelia\Model\Base\ProductSaleElementsQuery;
use Thelia\Model\CountryQuery; use Thelia\Model\CountryQuery;
use Thelia\Model\CurrencyQuery; use Thelia\Model\CurrencyQuery;
use Thelia\Model\Map\ProductSaleElementsTableMap; use Thelia\Model\Map\ProductSaleElementsTableMap;
use Thelia\TaxEngine\TaxEngine;
use Thelia\Type\TypeCollection; use Thelia\Type\TypeCollection;
use Thelia\Type; use Thelia\Type;
@@ -145,7 +146,7 @@ class ProductSaleElements extends BaseLoop implements PropelSearchLoopInterface
public function parseResults(LoopResult $loopResult) public function parseResults(LoopResult $loopResult)
{ {
$taxCountry = CountryQuery::create()->findPk(64); // @TODO : make it magic $taxCountry = TaxEngine::getInstance($this->request->getSession())->getDeliveryCountry();
foreach ($loopResult->getResultDataCollection() as $PSEValue) { foreach ($loopResult->getResultDataCollection() as $PSEValue) {
$loopResultRow = new LoopResultRow($PSEValue); $loopResultRow = new LoopResultRow($PSEValue);

View File

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

View File

@@ -23,12 +23,19 @@
namespace Thelia\Core\Template\Loop; namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Security\AccessManager;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\ModuleQuery;
use Thelia\Module\BaseModule;
use Thelia\Type; use Thelia\Type;
use Thelia\Core\Template\TemplateHelper; use Thelia\Core\Template\TemplateHelper;
use Thelia\Core\Template\TemplateDefinition; use Thelia\Core\Template\TemplateDefinition;
@@ -65,14 +72,8 @@ class Template extends BaseLoop implements ArraySearchLoopInterface
); );
} }
<<<<<<< HEAD
public function buildArray() { public function buildArray() {
$type = $this->getArg('template-type')->getValue(); $type = $this->getArg('template-type')->getValue();
=======
public function buildArray()
{
$type = $this->getArg(template_type);
>>>>>>> master
if ($type == 'front-office') if ($type == 'front-office')
$templateType = TemplateDefinition::FRONT_OFFICE; $templateType = TemplateDefinition::FRONT_OFFICE;

View File

@@ -42,9 +42,9 @@ class SmartyAssetsManager
/** /**
* Creates a new SmartyAssetsManager instance * Creates a new SmartyAssetsManager instance
* *
* @param AssetManagerInterface $assetsManager an asset manager instance * @param AssetManagerInterface $assetsManager an asset manager instance
* @param string $web_root the disk path to the web root (with final /) * @param string $web_root the disk path to the web root (with final /)
* @param string $path_relative_to_web_root the path (relative to web root) where the assets will be generated * @param string $path_relative_to_web_root the path (relative to web root) where the assets will be generated
*/ */
public function __construct(AssetManagerInterface $assetsManager, $web_root, $path_relative_to_web_root) public function __construct(AssetManagerInterface $assetsManager, $web_root, $path_relative_to_web_root)
{ {

View File

@@ -27,6 +27,8 @@ use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Tools\URL; use Thelia\Tools\URL;
use Thelia\Core\Security\SecurityContext; use Thelia\Core\Security\SecurityContext;
use Thelia\Model\Config;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Template\TemplateHelper; use Thelia\Core\Template\TemplateHelper;
/** /**
@@ -43,8 +45,8 @@ class AdminUtilities extends AbstractSmartyPlugin
$this->securityContext = $securityContext; $this->securityContext = $securityContext;
} }
protected function fetch_snippet($smarty, $templateName, $variablesArray) protected function fetch_snippet($smarty, $templateName, $variablesArray) {
{
$data = ''; $data = '';
$snippet_path = sprintf('%s/%s/%s.html', $snippet_path = sprintf('%s/%s/%s.html',
@@ -97,6 +99,7 @@ class AdminUtilities extends AbstractSmartyPlugin
$module === null ? array() : array($module), $module === null ? array() : array($module),
array($access)) array($access))
) { ) {
return $this->fetch_snippet($smarty, 'includes/admin-utilities-position-block', array( return $this->fetch_snippet($smarty, 'includes/admin-utilities-position-block', array(
'admin_utilities_go_up_url' => URL::getInstance()->absoluteUrl($path, array('mode' => 'up', $url_parameter => $id)), 'admin_utilities_go_up_url' => URL::getInstance()->absoluteUrl($path, array('mode' => 'up', $url_parameter => $id)),
'admin_utilities_in_place_edit_class' => $in_place_edit_class, 'admin_utilities_in_place_edit_class' => $in_place_edit_class,

View File

@@ -56,11 +56,10 @@ class Assets extends AbstractSmartyPlugin
{ {
try { try {
return $this->assetManager->processSmartyPluginCall('js', $params, $content, $template, $repeat); return $this->assetManager->processSmartyPluginCall('js', $params, $content, $template, $repeat);
} catch (\Exception $e) { } catch(\Exception $e) {
$catchException = $this->getNormalizedParam($params, array('catchException')); $catchException = $this->getNormalizedParam($params, array('catchException'));
if ($catchException == "true") { if($catchException == "true") {
$repeat = false; $repeat = false;
return null; return null;
} else { } else {
throw $e; throw $e;

View File

@@ -184,7 +184,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
if (array_key_exists('currentCountry', self::$dataAccessCache)) { if (array_key_exists('currentCountry', self::$dataAccessCache)) {
$taxCountry = self::$dataAccessCache['currentCountry']; $taxCountry = self::$dataAccessCache['currentCountry'];
} else { } else {
$taxCountry = TaxEngine::getInstance($this->request->getSession())->getTaxCountry(); $taxCountry = TaxEngine::getInstance($this->request->getSession())->getDeliveryCountry();
self::$dataAccessCache['currentCountry'] = $taxCountry; self::$dataAccessCache['currentCountry'] = $taxCountry;
} }
@@ -212,8 +212,6 @@ class DataAccessFunctions extends AbstractSmartyPlugin
switch ($attribute) { switch ($attribute) {
case 'postage': case 'postage':
return $order->getPostage(); return $order->getPostage();
case 'discount':
return $order->getDiscount();
case 'delivery_address': case 'delivery_address':
return $order->chosenDeliveryAddress; return $order->chosenDeliveryAddress;
case 'invoice_address': case 'invoice_address':
@@ -269,69 +267,69 @@ class DataAccessFunctions extends AbstractSmartyPlugin
$includeShipping = true; $includeShipping = true;
} }
if ($params['startDate'] == 'today') { if($params['startDate'] == 'today') {
$startDate = new \DateTime(); $startDate = new \DateTime();
$startDate->setTime(0, 0, 0); $startDate->setTime(0, 0, 0);
} elseif ($params['startDate'] == 'yesterday') { } elseif($params['startDate'] == 'yesterday') {
$startDate = new \DateTime(); $startDate = new \DateTime();
$startDate->setTime(0, 0, 0); $startDate->setTime(0, 0, 0);
$startDate->modify('-1 day'); $startDate->modify('-1 day');
} elseif ($params['startDate'] == 'this_month') { } elseif($params['startDate'] == 'this_month') {
$startDate = new \DateTime(); $startDate = new \DateTime();
$startDate->modify('first day of this month'); $startDate->modify('first day of this month');
$startDate->setTime(0, 0, 0); $startDate->setTime(0, 0, 0);
} elseif ($params['startDate'] == 'last_month') { } elseif($params['startDate'] == 'last_month') {
$startDate = new \DateTime(); $startDate = new \DateTime();
$startDate->modify('first day of last month'); $startDate->modify('first day of last month');
$startDate->setTime(0, 0, 0); $startDate->setTime(0, 0, 0);
} elseif ($params['startDate'] == 'this_year') { } elseif($params['startDate'] == 'this_year') {
$startDate = new \DateTime(); $startDate = new \DateTime();
$startDate->modify('first day of January this year'); $startDate->modify('first day of January this year');
$startDate->setTime(0, 0, 0); $startDate->setTime(0, 0, 0);
} elseif ($params['startDate'] == 'last_year') { } elseif($params['startDate'] == 'last_year') {
$startDate = new \DateTime(); $startDate = new \DateTime();
$startDate->modify('first day of December last year'); $startDate->modify('first day of December last year');
$startDate->setTime(0, 0, 0); $startDate->setTime(0, 0, 0);
} else { } else {
try { try {
$startDate = new \DateTime($params['startDate']); $startDate = new \DateTime($params['startDate']);
} catch (\Exception $e) { } catch(\Exception $e) {
throw new \InvalidArgumentException(sprintf("invalid startDate attribute '%s' in stats access function", $params['startDate'])); throw new \InvalidArgumentException(sprintf("invalid startDate attribute '%s' in stats access function", $params['startDate']));
} }
} }
if ($params['endDate'] == 'today') { if($params['endDate'] == 'today') {
$endDate = new \DateTime(); $endDate = new \DateTime();
$endDate->setTime(0, 0, 0); $endDate->setTime(0, 0, 0);
} elseif ($params['endDate'] == 'yesterday') { } elseif($params['endDate'] == 'yesterday') {
$endDate = new \DateTime(); $endDate = new \DateTime();
$endDate->setTime(0, 0, 0); $endDate->setTime(0, 0, 0);
$endDate->modify('-1 day'); $endDate->modify('-1 day');
} elseif ($params['endDate'] == 'this_month') { } elseif($params['endDate'] == 'this_month') {
$endDate = new \DateTime(); $endDate = new \DateTime();
$endDate->modify('last day of this month'); $endDate->modify('last day of this month');
$endDate->setTime(0, 0, 0); $endDate->setTime(0, 0, 0);
} elseif ($params['endDate'] == 'last_month') { } elseif($params['endDate'] == 'last_month') {
$endDate = new \DateTime(); $endDate = new \DateTime();
$endDate->modify('last day of last month'); $endDate->modify('last day of last month');
$endDate->setTime(0, 0, 0); $endDate->setTime(0, 0, 0);
} elseif ($params['endDate'] == 'this_year') { } elseif($params['endDate'] == 'this_year') {
$endDate = new \DateTime(); $endDate = new \DateTime();
$endDate->modify('last day of December this year'); $endDate->modify('last day of December this year');
$endDate->setTime(0, 0, 0); $endDate->setTime(0, 0, 0);
} elseif ($params['endDate'] == 'last_year') { } elseif($params['endDate'] == 'last_year') {
$endDate = new \DateTime(); $endDate = new \DateTime();
$endDate->modify('last day of January last year'); $endDate->modify('last day of January last year');
$endDate->setTime(0, 0, 0); $endDate->setTime(0, 0, 0);
} else { } else {
try { try {
$endDate = new \DateTime($params['endDate']); $endDate = new \DateTime($params['endDate']);
} catch (\Exception $e) { } catch(\Exception $e) {
throw new \InvalidArgumentException(sprintf("invalid endDate attribute '%s' in stats access function", $params['endDate'])); throw new \InvalidArgumentException(sprintf("invalid endDate attribute '%s' in stats access function", $params['endDate']));
} }
} }
switch ($params['key']) { switch( $params['key'] ) {
case 'sales' : case 'sales' :
return OrderQuery::getSaleStats($startDate, $endDate, $includeShipping); return OrderQuery::getSaleStats($startDate, $endDate, $includeShipping);
case 'orders' : case 'orders' :

View File

@@ -28,6 +28,7 @@ use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Core\Template\Smarty\an; use Thelia\Core\Template\Smarty\an;
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor; use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
/** /**
* Class Esi * Class Esi
* @package Thelia\Core\Template\Smarty\Plugins * @package Thelia\Core\Template\Smarty\Plugins
@@ -52,7 +53,7 @@ class Esi extends AbstractSmartyPlugin
$ignore_errors = $this->getParam($params, 'ignore_errors'); $ignore_errors = $this->getParam($params, 'ignore_errors');
$comment = $this->getParam($params, 'comment'); $comment = $this->getParam($params, 'comment');
if (null === $path) { if(null === $path) {
return; return;
} }

View File

@@ -48,7 +48,7 @@ class Module extends AbstractSmartyPlugin
/** /**
* Process theliaModule template inclusion function * Process theliaModule template inclusion function
* *
* @param unknown $params * @param unknown $params
* @param \Smarty_Internal_Template $template * @param \Smarty_Internal_Template $template
* @internal param \Thelia\Core\Template\Smarty\Plugins\unknown $smarty * @internal param \Thelia\Core\Template\Smarty\Plugins\unknown $smarty
* *
@@ -60,7 +60,7 @@ class Module extends AbstractSmartyPlugin
if (false !== $location = $this->getParam($params, 'location', false)) { if (false !== $location = $this->getParam($params, 'location', false)) {
if ($this->debug === true && $this->request->get('SHOW_INCLUDE')) { if($this->debug === true && $this->request->get('SHOW_INCLUDE')) {
echo sprintf('<div style="background-color: #C82D26; border-color: #000000; border: solid;">%s</div>', $location); echo sprintf('<div style="background-color: #C82D26; border-color: #000000; border: solid;">%s</div>', $location);
} }
@@ -70,7 +70,7 @@ class Module extends AbstractSmartyPlugin
foreach ($modules as $module) { foreach ($modules as $module) {
if (null !== $moduleLimit && $moduleLimit != $module->getCode()) { if(null !== $moduleLimit && $moduleLimit != $module->getCode()) {
continue; continue;
} }

View File

@@ -14,7 +14,6 @@ use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Core\Template\Exception\ResourceNotFoundException; use Thelia\Core\Template\Exception\ResourceNotFoundException;
use Thelia\Core\Template\ParserContext; use Thelia\Core\Template\ParserContext;
use Thelia\Core\Template\TemplateDefinition; use Thelia\Core\Template\TemplateDefinition;
use Thelia\Model\ConfigQuery; use Thelia\Model\ConfigQuery;
use Thelia\Core\Template\TemplateHelper; use Thelia\Core\Template\TemplateHelper;
use Imagine\Exception\InvalidArgumentException; use Imagine\Exception\InvalidArgumentException;
@@ -73,6 +72,7 @@ class SmartyParser extends Smarty implements ParserInterface
$this->setCompileDir($compile_dir); $this->setCompileDir($compile_dir);
$this->setCacheDir($cache_dir); $this->setCacheDir($cache_dir);
$this->debugging = $debug; $this->debugging = $debug;
// Prevent smarty ErrorException: Notice: Undefined index bla bla bla... // Prevent smarty ErrorException: Notice: Undefined index bla bla bla...
@@ -80,7 +80,7 @@ class SmartyParser extends Smarty implements ParserInterface
// Si on n'est pas en mode debug, activer le cache, avec une lifetime de 15mn, et en vérifiant que les templates sources n'ont pas été modifiés. // Si on n'est pas en mode debug, activer le cache, avec une lifetime de 15mn, et en vérifiant que les templates sources n'ont pas été modifiés.
if ($debug) { if($debug) {
$this->setCaching(Smarty::CACHING_OFF); $this->setCaching(Smarty::CACHING_OFF);
$this->setForceCompile(true); $this->setForceCompile(true);
} else { } else {
@@ -89,6 +89,7 @@ class SmartyParser extends Smarty implements ParserInterface
//$this->enableSecurity(); //$this->enableSecurity();
// The default HTTP status // The default HTTP status
$this->status = 200; $this->status = 200;
@@ -190,7 +191,6 @@ class SmartyParser extends Smarty implements ParserInterface
{ {
return $this->templateDefinition->getPath(); return $this->templateDefinition->getPath();
} }
/** /**
* Return a rendered template, either from file or ftom a string * Return a rendered template, either from file or ftom a string
* *

View File

@@ -57,12 +57,13 @@ class TemplateDefinition
*/ */
protected $type; protected $type;
public function __construct($name, $type) public function __construct($name, $type)
{ {
$this->name = $name; $this->name = $name;
$this->type = $type; $this->type = $type;
switch ($type) { switch($type) {
case TemplateDefinition::FRONT_OFFICE: case TemplateDefinition::FRONT_OFFICE:
$this->path = self::FRONT_OFFICE_SUBDIR . $name; $this->path = self::FRONT_OFFICE_SUBDIR . $name;
break; break;
@@ -89,17 +90,14 @@ class TemplateDefinition
public function setName($name) public function setName($name)
{ {
$this->name = $name; $this->name = $name;
return $this; return $this;
} }
public function getI18nPath() public function getI18nPath() {
{
return $this->getPath() . DS . 'I18n'; return $this->getPath() . DS . 'I18n';
} }
public function getAbsoluteI18nPath() public function getAbsoluteI18nPath() {
{
return THELIA_TEMPLATE_DIR . $this->getI18nPath(); return THELIA_TEMPLATE_DIR . $this->getI18nPath();
} }
@@ -108,8 +106,7 @@ class TemplateDefinition
return $this->path; return $this->path;
} }
public function getAbsolutePath() public function getAbsolutePath() {
{
return THELIA_TEMPLATE_DIR . $this->getPath(); return THELIA_TEMPLATE_DIR . $this->getPath();
} }
@@ -118,15 +115,13 @@ class TemplateDefinition
return $this->getPath() . DS . 'configs'; return $this->getPath() . DS . 'configs';
} }
public function getAbsoluteConfigPath() public function getAbsoluteConfigPath() {
{
return THELIA_TEMPLATE_DIR . $this->getConfigPath(); return THELIA_TEMPLATE_DIR . $this->getConfigPath();
} }
public function setPath($path) public function setPath($path)
{ {
$this->path = $path; $this->path = $path;
return $this; return $this;
} }
@@ -138,7 +133,6 @@ class TemplateDefinition
public function setType($type) public function setType($type)
{ {
$this->type = $type; $this->type = $type;
return $this; return $this;
} }
@@ -149,4 +143,3 @@ class TemplateDefinition
return new \ArrayIterator(self::$standardTemplatesSubdirs); return new \ArrayIterator(self::$standardTemplatesSubdirs);
} }
} }

View File

@@ -40,17 +40,16 @@ class TemplateHelper
private function __construct() {} private function __construct() {}
public static function getInstance() public static function getInstance() {
{
if (self::$instance == null) self::$instance = new TemplateHelper(); if (self::$instance == null) self::$instance = new TemplateHelper();
return self::$instance; return self::$instance;
} }
/** /**
* @return TemplateDefinition * @return TemplateDefinition
*/ */
public function getActiveMailTemplate() public function getActiveMailTemplate() {
{
return new TemplateDefinition( return new TemplateDefinition(
ConfigQuery::read('active-mail-template', 'default'), ConfigQuery::read('active-mail-template', 'default'),
TemplateDefinition::EMAIL TemplateDefinition::EMAIL
@@ -60,8 +59,7 @@ class TemplateHelper
/** /**
* @return TemplateDefinition * @return TemplateDefinition
*/ */
public function getActivePdfTemplate() public function getActivePdfTemplate() {
{
return new TemplateDefinition( return new TemplateDefinition(
ConfigQuery::read('active-pdf-template', 'default'), ConfigQuery::read('active-pdf-template', 'default'),
TemplateDefinition::PDF TemplateDefinition::PDF
@@ -71,8 +69,7 @@ class TemplateHelper
/** /**
* @return TemplateDefinition * @return TemplateDefinition
*/ */
public function getActiveAdminTemplate() public function getActiveAdminTemplate() {
{
return new TemplateDefinition( return new TemplateDefinition(
ConfigQuery::read('active-admin-template', 'default'), ConfigQuery::read('active-admin-template', 'default'),
TemplateDefinition::BACK_OFFICE TemplateDefinition::BACK_OFFICE
@@ -82,8 +79,7 @@ class TemplateHelper
/** /**
* @return TemplateDefinition * @return TemplateDefinition
*/ */
public function getActiveFrontTemplate() public function getActiveFrontTemplate() {
{
return new TemplateDefinition( return new TemplateDefinition(
ConfigQuery::read('active-front-template', 'default'), ConfigQuery::read('active-front-template', 'default'),
TemplateDefinition::FRONT_OFFICE TemplateDefinition::FRONT_OFFICE
@@ -138,6 +134,7 @@ class TemplateHelper
} }
} }
protected function normalize_path($path) protected function normalize_path($path)
{ {
$path = str_replace( $path = str_replace(
@@ -158,27 +155,28 @@ class TemplateHelper
* 'translation' => the text translation, or an empty string if none available. * 'translation' => the text translation, or an empty string if none available.
* 'dollar' => true if the translatable text contains a $ * 'dollar' => true if the translatable text contains a $
* *
* @param string $directory the path to the directory to examine * @param string $directory the path to the directory to examine
* @param string $walkMode type of file scanning: WALK_MODE_PHP or WALK_MODE_TEMPLATE * @param string $walkMode type of file scanning: WALK_MODE_PHP or WALK_MODE_TEMPLATE
* @param \Thelia\Core\Translation\Translator $translator the current translator * @param \Thelia\Core\Translation\Translator $translator the current translator
* @param string $currentLocale the current locale * @param string $currentLocale the current locale
* @param array $strings the list of strings * @param array $strings the list of strings
* @throws \InvalidArgumentException if $walkMode contains an invalid value * @throws \InvalidArgumentException if $walkMode contains an invalid value
* @return number the total number of translatable texts * @return number the total number of translatable texts
*/ */
public function walkDir($directory, $walkMode, Translator $translator, $currentLocale, &$strings) public function walkDir($directory, $walkMode, Translator $translator, $currentLocale, &$strings) {
{
$num_texts = 0; $num_texts = 0;
if ($walkMode == self::WALK_MODE_PHP) { if ($walkMode == self::WALK_MODE_PHP) {
$prefix = '\-\>[\s]*trans[\s]*\('; $prefix = '\-\>[\s]*trans[\s]*\(';
$allowed_exts = array('php'); $allowed_exts = array('php');
} elseif ($walkMode == self::WALK_MODE_TEMPLATE) { } else if ($walkMode == self::WALK_MODE_TEMPLATE) {
$prefix = '\{intl[\s]l='; $prefix = '\{intl[\s]l=';
$allowed_exts = array('html', 'tpl', 'xml'); $allowed_exts = array('html', 'tpl', 'xml');
} else { }
else {
throw new \InvalidArgumentException( throw new \InvalidArgumentException(
Translator::getInstance()->trans('Invalid value for walkMode parameter: %value', array('%value' => $walkMode)) Translator::getInstance()->trans('Invalid value for walkMode parameter: %value', array('%value' => $walkMode))
); );
@@ -212,15 +210,18 @@ class TemplateHelper
Tlog::getInstance()->debug("Strings found: ", $matches[2]); Tlog::getInstance()->debug("Strings found: ", $matches[2]);
foreach ($matches[2] as $match) { foreach($matches[2] as $match) {
$hash = md5($match); $hash = md5($match);
if (isset($strings[$hash])) { if (isset($strings[$hash]))
if (! in_array($short_path, $strings[$hash]['files'])) { {
if (! in_array($short_path, $strings[$hash]['files']))
{
$strings[$hash]['files'][] = $short_path; $strings[$hash]['files'][] = $short_path;
} }
} else { }
else {
$num_texts++; $num_texts++;
// remove \' // remove \'
@@ -272,7 +273,9 @@ class TemplateHelper
fwrite($fp, ");\n"); fwrite($fp, ");\n");
@fclose($fp); @fclose($fp);
} else { }
else
{
throw new \RuntimeException( throw new \RuntimeException(
Translator::getInstance()->trans( Translator::getInstance()->trans(
'Failed to open translation file %file. Please be sure that this file is writable by your Web server', 'Failed to open translation file %file. Please be sure that this file is writable by your Web server',

View File

@@ -49,6 +49,7 @@ use Thelia\Config\DefinePropel;
use Thelia\Core\Template\TemplateDefinition; use Thelia\Core\Template\TemplateDefinition;
use Thelia\Core\TheliaContainerBuilder; use Thelia\Core\TheliaContainerBuilder;
use Thelia\Core\DependencyInjection\Loader\XmlFileLoader; use Thelia\Core\DependencyInjection\Loader\XmlFileLoader;
use Thelia\Model\ConfigQuery;
use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\FileLocator;
use Propel\Runtime\Propel; use Propel\Runtime\Propel;
@@ -175,7 +176,7 @@ class Thelia extends Kernel
->depth(0) ->depth(0)
->in(THELIA_ROOT . "/core/lib/Thelia/Config/Resources"); ->in(THELIA_ROOT . "/core/lib/Thelia/Config/Resources");
foreach ($finder as $file) { foreach($finder as $file) {
$loader->load($file->getBaseName()); $loader->load($file->getBaseName());
} }

View File

@@ -215,7 +215,7 @@ class TheliaHttpKernel extends HttpKernel
protected function initSession(Request $request) protected function initSession(Request $request)
{ {
if (null === self::$session) { if(null === self::$session) {
$storage = new Session\Storage\NativeSessionStorage(); $storage = new Session\Storage\NativeSessionStorage();
if (Model\ConfigQuery::read("session_config.default")) { if (Model\ConfigQuery::read("session_config.default")) {

View File

@@ -40,7 +40,7 @@ class Translator extends BaseTranslator
public function getLocale() public function getLocale()
{ {
if ($this->container->isScopeActive('request') && $this->container->has('request')) { if($this->container->isScopeActive('request') && $this->container->has('request')) {
return $this->container->get('request')->getSession()->getLang()->getLocale(); return $this->container->get('request')->getSession()->getLang()->getLocale();
} }

View File

@@ -82,8 +82,15 @@ class CouponManager
if (count($this->coupons) > 0) { if (count($this->coupons) > 0) {
$couponsKept = $this->sortCoupons($this->coupons); $couponsKept = $this->sortCoupons($this->coupons);
$isRemovingPostage = $this->isCouponRemovingPostage($couponsKept);
$discount = $this->getEffect($couponsKept); $discount = $this->getEffect($couponsKept);
if ($isRemovingPostage) {
$postage = $this->facade->getCheckoutPostagePrice();
$discount += $postage;
}
// Just In Case test // Just In Case test
$checkoutTotalPrice = $this->facade->getCartTotalPrice(); $checkoutTotalPrice = $this->facade->getCartTotalPrice();
if ($discount >= $checkoutTotalPrice) { if ($discount >= $checkoutTotalPrice) {
@@ -96,24 +103,23 @@ class CouponManager
/** /**
* Check if there is a Coupon removing Postage * Check if there is a Coupon removing Postage
*
* @param array $couponsKept Array of CouponInterface sorted
*
* @return bool * @return bool
*/ */
public function isCouponRemovingPostage() protected function isCouponRemovingPostage(array $couponsKept)
{ {
if (count($this->coupons) == 0) { $isRemovingPostage = false;
return false;
}
$couponsKept = $this->sortCoupons($this->coupons);
/** @var CouponInterface $coupon */ /** @var CouponInterface $coupon */
foreach ($couponsKept as $coupon) { foreach ($couponsKept as $coupon) {
if ($coupon->isRemovingPostage()) { if ($coupon->isRemovingPostage()) {
return true; $isRemovingPostage = true;
} }
} }
return false; return $isRemovingPostage;
} }
/** /**

View File

@@ -23,6 +23,7 @@
namespace Thelia\Form; namespace Thelia\Form;
use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Model\CustomerQuery; use Thelia\Model\CustomerQuery;
/** /**

View File

@@ -23,6 +23,7 @@
namespace Thelia\Form; namespace Thelia\Form;
use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Translation\Translator; use Thelia\Core\Translation\Translator;
use Thelia\Model\ProfileQuery; use Thelia\Model\ProfileQuery;

View File

@@ -23,6 +23,7 @@
namespace Thelia\Form; namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan; use Symfony\Component\Validator\Constraints\GreaterThan;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Model\Currency; use Thelia\Model\Currency;
use Thelia\Core\Translation\Translator; use Thelia\Core\Translation\Translator;

View File

@@ -25,6 +25,7 @@ namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan; use Symfony\Component\Validator\Constraints\GreaterThan;
use Thelia\Core\Translation\Translator; use Thelia\Core\Translation\Translator;
class ProductModificationForm extends ProductCreationForm class ProductModificationForm extends ProductCreationForm
{ {
use StandardDescriptionFieldsTrait; use StandardDescriptionFieldsTrait;

View File

@@ -35,7 +35,7 @@ trait SeoFieldsTrait
/** /**
* Add seo meta title, meta description and meta keywords fields * Add seo meta title, meta description and meta keywords fields
* *
* @param array $exclude name of the fields that should not be added to the form * @param array $exclude name of the fields that should not be added to the form
*/ */
protected function addSeoFields($exclude = array()) protected function addSeoFields($exclude = array())
{ {

View File

@@ -23,6 +23,8 @@
namespace Thelia\Form; namespace Thelia\Form;
use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Constraints;
use Thelia\Model\ConfigQuery;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Log\Tlog; use Thelia\Log\Tlog;
use Thelia\Core\Translation\Translator; use Thelia\Core\Translation\Translator;

View File

@@ -58,7 +58,7 @@ class CheckPermission extends BaseInstall
/** @var array Minimum server configuration necessary */ /** @var array Minimum server configuration necessary */
protected $minServerConfigurationNecessary = array( protected $minServerConfigurationNecessary = array(
'memory_limit' => 134217728, 'memory_limit' => 157286400,
'post_max_size' => 20971520, 'post_max_size' => 20971520,
'upload_max_filesize' => 2097152 'upload_max_filesize' => 2097152
); );

View File

@@ -25,29 +25,27 @@ namespace Thelia\Log\Destination;
use Thelia\Log\AbstractTlogDestination; use Thelia\Log\AbstractTlogDestination;
class TlogDestinationJavascriptConsole extends AbstractTlogDestination class TlogDestinationJavascriptConsole extends AbstractTlogDestination {
{
public function getTitle()
{
return "Browser's Javascript console";
}
public function getDescription() public function getTitle() {
{ return "Browser's Javascript console";
return "The Thelia logs are displayed in your browser's Javascript console."; }
}
public function write(&$res) public function getDescription() {
{ return "The Thelia logs are displayed in your browser's Javascript console.";
$content = '<script>try {'."\n"; }
foreach ($this->_logs as $line) { public function write(&$res) {
$content .= "console.log('".str_replace("'", "\\'", str_replace(array("\r\n", "\r", "\n"), '\\n', $line))."');\n";
}
$content .= '} catch (ex) { alert("Les logs Thelia ne peuvent être affichés dans la console javascript:" + ex); }</script>'."\n"; $content = '<script>try {'."\n";
if (preg_match("|</body>|i", $res)) foreach($this->_logs as $line) {
$res = preg_replace("|</body>|i", "$content</html>", $res); $content .= "console.log('".str_replace("'", "\\'", str_replace(array("\r\n", "\r", "\n"), '\\n', $line))."');\n";
}
$content .= '} catch(ex) { alert("Les logs Thelia ne peuvent être affichés dans la console javascript:" + ex); }</script>'."\n";
if (preg_match("|</body>|i", $res))
$res = preg_replace("|</body>|i", "$content</html>", $res);
} }
} }

View File

@@ -26,88 +26,86 @@ namespace Thelia\Log\Destination;
use Thelia\Log\AbstractTlogDestination; use Thelia\Log\AbstractTlogDestination;
use Thelia\Log\TlogDestinationConfig; use Thelia\Log\TlogDestinationConfig;
class TlogDestinationPopup extends AbstractTlogDestination class TlogDestinationPopup extends AbstractTlogDestination {
{
// Nom des variables de configuration
// ----------------------------------
const VAR_POPUP_WIDTH = "tlog_destinationpopup_width";
const VALEUR_POPUP_WIDTH_DEFAUT = "600";
const VAR_POPUP_HEIGHT = "tlog_destinationpopup_height"; // Nom des variables de configuration
const VALEUR_POPUP_HEIGHT_DEFAUT = "600"; // ----------------------------------
const VAR_POPUP_WIDTH = "tlog_destinationpopup_width";
const VALEUR_POPUP_WIDTH_DEFAUT = "600";
const VAR_POPUP_TPL = "tlog_destinationpopup_template"; const VAR_POPUP_HEIGHT = "tlog_destinationpopup_height";
// Ce fichier doit se trouver dans le même répertoire que TlogDestinationPopup.class.php const VALEUR_POPUP_HEIGHT_DEFAUT = "600";
const VALEUR_POPUP_TPL_DEFAUT = "TlogDestinationPopup.tpl";
public function getTitle() const VAR_POPUP_TPL = "tlog_destinationpopup_template";
{ // Ce fichier doit se trouver dans le même répertoire que TlogDestinationPopup.class.php
return "Javascript popup window"; const VALEUR_POPUP_TPL_DEFAUT = "TlogDestinationPopup.tpl";
}
public function getDescription() public function getTitle() {
{ return "Javascript popup window";
return "Display logs in a popup window, separate from the main window ."; }
}
public function getConfigs() public function getDescription() {
{ return "Display logs in a popup window, separate from the main window .";
return array( }
new TlogDestinationConfig(
self::VAR_POPUP_TPL,
"Popup windows template",
"Put #LOGTEXT in the template text where you want to display logs..",
file_get_contents(__DIR__.DS. self::VALEUR_POPUP_TPL_DEFAUT),
TlogDestinationConfig::TYPE_TEXTAREA
),
new TlogDestinationConfig(
self::VAR_POPUP_HEIGHT,
"Height of the popup window",
"In pixels",
self::VALEUR_POPUP_HEIGHT_DEFAUT,
TlogDestinationConfig::TYPE_TEXTFIELD
),
new TlogDestinationConfig(
self::VAR_POPUP_WIDTH,
"Width of the popup window",
"In pixels",
self::VALEUR_POPUP_WIDTH_DEFAUT,
TlogDestinationConfig::TYPE_TEXTFIELD
)
);
}
public function write(&$res) public function getConfigs() {
{ return array(
$content = ""; $count = 1; new TlogDestinationConfig(
self::VAR_POPUP_TPL,
"Popup windows template",
"Put #LOGTEXT in the template text where you want to display logs..",
file_get_contents(__DIR__.DS. self::VALEUR_POPUP_TPL_DEFAUT),
TlogDestinationConfig::TYPE_TEXTAREA
),
new TlogDestinationConfig(
self::VAR_POPUP_HEIGHT,
"Height of the popup window",
"In pixels",
self::VALEUR_POPUP_HEIGHT_DEFAUT,
TlogDestinationConfig::TYPE_TEXTFIELD
),
new TlogDestinationConfig(
self::VAR_POPUP_WIDTH,
"Width of the popup window",
"In pixels",
self::VALEUR_POPUP_WIDTH_DEFAUT,
TlogDestinationConfig::TYPE_TEXTFIELD
)
);
}
foreach ($this->_logs as $line) { public function write(&$res) {
$content .= "<div class=\"".($count++ % 2 ? "paire" : "impaire")."\">".htmlspecialchars($line)."</div>";
}
$tpl = $this->getConfig(self::VAR_POPUP_TPL); $content = ""; $count = 1;
$tpl = str_replace('#LOGTEXT', $content, $tpl); foreach($this->_logs as $line) {
$tpl = str_replace(array("\r\n", "\r", "\n"), '\\n', $tpl); $content .= "<div class=\"".($count++ % 2 ? "paire" : "impaire")."\">".htmlspecialchars($line)."</div>";
}
$wop = sprintf(' $tpl = $this->getConfig(self::VAR_POPUP_TPL);
<script>
_thelia_console = window.open("","thelia_console","width=%s,height=%s,resizable,scrollbars=yes");
if (_thelia_console == null) {
alert("The log popup window could not be opened. Please disable your popup blocker for this site.");
} else {
_thelia_console.document.write("%s");
_thelia_console.document.close();
}
</script>',
$this->getConfig(self::VAR_POPUP_WIDTH),
$this->getConfig(self::VAR_POPUP_HEIGHT),
str_replace('"', '\\"', $tpl)
);
if (preg_match("|</body>|i", $res)) $tpl = str_replace('#LOGTEXT', $content, $tpl);
$res = preg_replace("|</body>|i", "$wop\n</body>", $res); $tpl = str_replace(array("\r\n", "\r", "\n"), '\\n', $tpl);
else
$res .= $wop; $wop = sprintf('
<script>
_thelia_console = window.open("","thelia_console","width=%s,height=%s,resizable,scrollbars=yes");
if (_thelia_console == null) {
alert("The log popup window could not be opened. Please disable your popup blocker for this site.");
}
else {
_thelia_console.document.write("%s");
_thelia_console.document.close();
}
</script>',
$this->getConfig(self::VAR_POPUP_WIDTH),
$this->getConfig(self::VAR_POPUP_HEIGHT),
str_replace('"', '\\"', $tpl)
);
if (preg_match("|</body>|i", $res))
$res = preg_replace("|</body>|i", "$wop\n</body>", $res);
else
$res .= $wop;
} }
} }

View File

@@ -171,8 +171,7 @@ class Tlog Implements LoggerInterface
* *
* @return array of directories * @return array of directories
*/ */
public function getDestinationsDirectories() public function getDestinationsDirectories() {
{
return $this->dir_destinations; return $this->dir_destinations;
} }

View File

@@ -22,6 +22,7 @@
/*************************************************************************************/ /*************************************************************************************/
namespace Thelia\Log; namespace Thelia\Log;
use Thelia\Model\Config;
use Thelia\Model\ConfigQuery; use Thelia\Model\ConfigQuery;
class TlogDestinationConfig class TlogDestinationConfig

View File

@@ -109,6 +109,13 @@ abstract class CartItem implements ActiveRecordInterface
*/ */
protected $price_end_of_life; protected $price_end_of_life;
/**
* The value for the discount field.
* Note: this column has a database default value of: 0
* @var double
*/
protected $discount;
/** /**
* The value for the promo field. * The value for the promo field.
* @var int * @var int
@@ -159,6 +166,7 @@ abstract class CartItem implements ActiveRecordInterface
public function applyDefaultValues() public function applyDefaultValues()
{ {
$this->quantity = 1; $this->quantity = 1;
$this->discount = 0;
} }
/** /**
@@ -518,6 +526,17 @@ abstract class CartItem implements ActiveRecordInterface
} }
} }
/**
* Get the [discount] column value.
*
* @return double
*/
public function getDiscount()
{
return $this->discount;
}
/** /**
* Get the [promo] column value. * Get the [promo] column value.
* *
@@ -749,6 +768,27 @@ abstract class CartItem implements ActiveRecordInterface
return $this; return $this;
} // setPriceEndOfLife() } // setPriceEndOfLife()
/**
* Set the value of [discount] column.
*
* @param double $v new value
* @return \Thelia\Model\CartItem The current object (for fluent API support)
*/
public function setDiscount($v)
{
if ($v !== null) {
$v = (double) $v;
}
if ($this->discount !== $v) {
$this->discount = $v;
$this->modifiedColumns[] = CartItemTableMap::DISCOUNT;
}
return $this;
} // setDiscount()
/** /**
* Set the value of [promo] column. * Set the value of [promo] column.
* *
@@ -826,6 +866,10 @@ abstract class CartItem implements ActiveRecordInterface
return false; return false;
} }
if ($this->discount !== 0) {
return false;
}
// otherwise, everything was equal, so return TRUE // otherwise, everything was equal, so return TRUE
return true; return true;
} // hasOnlyDefaultValues() } // hasOnlyDefaultValues()
@@ -880,16 +924,19 @@ abstract class CartItem implements ActiveRecordInterface
} }
$this->price_end_of_life = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; $this->price_end_of_life = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CartItemTableMap::translateFieldName('Promo', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CartItemTableMap::translateFieldName('Discount', TableMap::TYPE_PHPNAME, $indexType)];
$this->discount = (null !== $col) ? (double) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CartItemTableMap::translateFieldName('Promo', TableMap::TYPE_PHPNAME, $indexType)];
$this->promo = (null !== $col) ? (int) $col : null; $this->promo = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CartItemTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CartItemTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CartItemTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CartItemTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
@@ -902,7 +949,7 @@ abstract class CartItem implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 11; // 11 = CartItemTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 12; // 12 = CartItemTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\CartItem object", 0, $e); throw new PropelException("Error populating \Thelia\Model\CartItem object", 0, $e);
@@ -1184,6 +1231,9 @@ abstract class CartItem implements ActiveRecordInterface
if ($this->isColumnModified(CartItemTableMap::PRICE_END_OF_LIFE)) { if ($this->isColumnModified(CartItemTableMap::PRICE_END_OF_LIFE)) {
$modifiedColumns[':p' . $index++] = 'PRICE_END_OF_LIFE'; $modifiedColumns[':p' . $index++] = 'PRICE_END_OF_LIFE';
} }
if ($this->isColumnModified(CartItemTableMap::DISCOUNT)) {
$modifiedColumns[':p' . $index++] = 'DISCOUNT';
}
if ($this->isColumnModified(CartItemTableMap::PROMO)) { if ($this->isColumnModified(CartItemTableMap::PROMO)) {
$modifiedColumns[':p' . $index++] = 'PROMO'; $modifiedColumns[':p' . $index++] = 'PROMO';
} }
@@ -1228,6 +1278,9 @@ abstract class CartItem implements ActiveRecordInterface
case 'PRICE_END_OF_LIFE': case 'PRICE_END_OF_LIFE':
$stmt->bindValue($identifier, $this->price_end_of_life ? $this->price_end_of_life->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->price_end_of_life ? $this->price_end_of_life->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break; break;
case 'DISCOUNT':
$stmt->bindValue($identifier, $this->discount, PDO::PARAM_STR);
break;
case 'PROMO': case 'PROMO':
$stmt->bindValue($identifier, $this->promo, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->promo, PDO::PARAM_INT);
break; break;
@@ -1324,12 +1377,15 @@ abstract class CartItem implements ActiveRecordInterface
return $this->getPriceEndOfLife(); return $this->getPriceEndOfLife();
break; break;
case 8: case 8:
return $this->getPromo(); return $this->getDiscount();
break; break;
case 9: case 9:
return $this->getCreatedAt(); return $this->getPromo();
break; break;
case 10: case 10:
return $this->getCreatedAt();
break;
case 11:
return $this->getUpdatedAt(); return $this->getUpdatedAt();
break; break;
default: default:
@@ -1369,9 +1425,10 @@ abstract class CartItem implements ActiveRecordInterface
$keys[5] => $this->getPrice(), $keys[5] => $this->getPrice(),
$keys[6] => $this->getPromoPrice(), $keys[6] => $this->getPromoPrice(),
$keys[7] => $this->getPriceEndOfLife(), $keys[7] => $this->getPriceEndOfLife(),
$keys[8] => $this->getPromo(), $keys[8] => $this->getDiscount(),
$keys[9] => $this->getCreatedAt(), $keys[9] => $this->getPromo(),
$keys[10] => $this->getUpdatedAt(), $keys[10] => $this->getCreatedAt(),
$keys[11] => $this->getUpdatedAt(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) { foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1447,12 +1504,15 @@ abstract class CartItem implements ActiveRecordInterface
$this->setPriceEndOfLife($value); $this->setPriceEndOfLife($value);
break; break;
case 8: case 8:
$this->setPromo($value); $this->setDiscount($value);
break; break;
case 9: case 9:
$this->setCreatedAt($value); $this->setPromo($value);
break; break;
case 10: case 10:
$this->setCreatedAt($value);
break;
case 11:
$this->setUpdatedAt($value); $this->setUpdatedAt($value);
break; break;
} // switch() } // switch()
@@ -1487,9 +1547,10 @@ abstract class CartItem implements ActiveRecordInterface
if (array_key_exists($keys[5], $arr)) $this->setPrice($arr[$keys[5]]); if (array_key_exists($keys[5], $arr)) $this->setPrice($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setPromoPrice($arr[$keys[6]]); if (array_key_exists($keys[6], $arr)) $this->setPromoPrice($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setPriceEndOfLife($arr[$keys[7]]); if (array_key_exists($keys[7], $arr)) $this->setPriceEndOfLife($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setPromo($arr[$keys[8]]); if (array_key_exists($keys[8], $arr)) $this->setDiscount($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setCreatedAt($arr[$keys[9]]); if (array_key_exists($keys[9], $arr)) $this->setPromo($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setUpdatedAt($arr[$keys[10]]); if (array_key_exists($keys[10], $arr)) $this->setCreatedAt($arr[$keys[10]]);
if (array_key_exists($keys[11], $arr)) $this->setUpdatedAt($arr[$keys[11]]);
} }
/** /**
@@ -1509,6 +1570,7 @@ abstract class CartItem implements ActiveRecordInterface
if ($this->isColumnModified(CartItemTableMap::PRICE)) $criteria->add(CartItemTableMap::PRICE, $this->price); if ($this->isColumnModified(CartItemTableMap::PRICE)) $criteria->add(CartItemTableMap::PRICE, $this->price);
if ($this->isColumnModified(CartItemTableMap::PROMO_PRICE)) $criteria->add(CartItemTableMap::PROMO_PRICE, $this->promo_price); if ($this->isColumnModified(CartItemTableMap::PROMO_PRICE)) $criteria->add(CartItemTableMap::PROMO_PRICE, $this->promo_price);
if ($this->isColumnModified(CartItemTableMap::PRICE_END_OF_LIFE)) $criteria->add(CartItemTableMap::PRICE_END_OF_LIFE, $this->price_end_of_life); if ($this->isColumnModified(CartItemTableMap::PRICE_END_OF_LIFE)) $criteria->add(CartItemTableMap::PRICE_END_OF_LIFE, $this->price_end_of_life);
if ($this->isColumnModified(CartItemTableMap::DISCOUNT)) $criteria->add(CartItemTableMap::DISCOUNT, $this->discount);
if ($this->isColumnModified(CartItemTableMap::PROMO)) $criteria->add(CartItemTableMap::PROMO, $this->promo); if ($this->isColumnModified(CartItemTableMap::PROMO)) $criteria->add(CartItemTableMap::PROMO, $this->promo);
if ($this->isColumnModified(CartItemTableMap::CREATED_AT)) $criteria->add(CartItemTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(CartItemTableMap::CREATED_AT)) $criteria->add(CartItemTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(CartItemTableMap::UPDATED_AT)) $criteria->add(CartItemTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(CartItemTableMap::UPDATED_AT)) $criteria->add(CartItemTableMap::UPDATED_AT, $this->updated_at);
@@ -1582,6 +1644,7 @@ abstract class CartItem implements ActiveRecordInterface
$copyObj->setPrice($this->getPrice()); $copyObj->setPrice($this->getPrice());
$copyObj->setPromoPrice($this->getPromoPrice()); $copyObj->setPromoPrice($this->getPromoPrice());
$copyObj->setPriceEndOfLife($this->getPriceEndOfLife()); $copyObj->setPriceEndOfLife($this->getPriceEndOfLife());
$copyObj->setDiscount($this->getDiscount());
$copyObj->setPromo($this->getPromo()); $copyObj->setPromo($this->getPromo());
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
@@ -1779,6 +1842,7 @@ abstract class CartItem implements ActiveRecordInterface
$this->price = null; $this->price = null;
$this->promo_price = null; $this->promo_price = null;
$this->price_end_of_life = null; $this->price_end_of_life = null;
$this->discount = null;
$this->promo = null; $this->promo = null;
$this->created_at = null; $this->created_at = null;
$this->updated_at = null; $this->updated_at = null;

View File

@@ -29,6 +29,7 @@ use Thelia\Model\Map\CartItemTableMap;
* @method ChildCartItemQuery orderByPrice($order = Criteria::ASC) Order by the price column * @method ChildCartItemQuery orderByPrice($order = Criteria::ASC) Order by the price column
* @method ChildCartItemQuery orderByPromoPrice($order = Criteria::ASC) Order by the promo_price column * @method ChildCartItemQuery orderByPromoPrice($order = Criteria::ASC) Order by the promo_price column
* @method ChildCartItemQuery orderByPriceEndOfLife($order = Criteria::ASC) Order by the price_end_of_life column * @method ChildCartItemQuery orderByPriceEndOfLife($order = Criteria::ASC) Order by the price_end_of_life column
* @method ChildCartItemQuery orderByDiscount($order = Criteria::ASC) Order by the discount column
* @method ChildCartItemQuery orderByPromo($order = Criteria::ASC) Order by the promo column * @method ChildCartItemQuery orderByPromo($order = Criteria::ASC) Order by the promo column
* @method ChildCartItemQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildCartItemQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildCartItemQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildCartItemQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
@@ -41,6 +42,7 @@ use Thelia\Model\Map\CartItemTableMap;
* @method ChildCartItemQuery groupByPrice() Group by the price column * @method ChildCartItemQuery groupByPrice() Group by the price column
* @method ChildCartItemQuery groupByPromoPrice() Group by the promo_price column * @method ChildCartItemQuery groupByPromoPrice() Group by the promo_price column
* @method ChildCartItemQuery groupByPriceEndOfLife() Group by the price_end_of_life column * @method ChildCartItemQuery groupByPriceEndOfLife() Group by the price_end_of_life column
* @method ChildCartItemQuery groupByDiscount() Group by the discount column
* @method ChildCartItemQuery groupByPromo() Group by the promo column * @method ChildCartItemQuery groupByPromo() Group by the promo column
* @method ChildCartItemQuery groupByCreatedAt() Group by the created_at column * @method ChildCartItemQuery groupByCreatedAt() Group by the created_at column
* @method ChildCartItemQuery groupByUpdatedAt() Group by the updated_at column * @method ChildCartItemQuery groupByUpdatedAt() Group by the updated_at column
@@ -72,6 +74,7 @@ use Thelia\Model\Map\CartItemTableMap;
* @method ChildCartItem findOneByPrice(double $price) Return the first ChildCartItem filtered by the price column * @method ChildCartItem findOneByPrice(double $price) Return the first ChildCartItem filtered by the price column
* @method ChildCartItem findOneByPromoPrice(double $promo_price) Return the first ChildCartItem filtered by the promo_price column * @method ChildCartItem findOneByPromoPrice(double $promo_price) Return the first ChildCartItem filtered by the promo_price column
* @method ChildCartItem findOneByPriceEndOfLife(string $price_end_of_life) Return the first ChildCartItem filtered by the price_end_of_life column * @method ChildCartItem findOneByPriceEndOfLife(string $price_end_of_life) Return the first ChildCartItem filtered by the price_end_of_life column
* @method ChildCartItem findOneByDiscount(double $discount) Return the first ChildCartItem filtered by the discount column
* @method ChildCartItem findOneByPromo(int $promo) Return the first ChildCartItem filtered by the promo column * @method ChildCartItem findOneByPromo(int $promo) Return the first ChildCartItem filtered by the promo column
* @method ChildCartItem findOneByCreatedAt(string $created_at) Return the first ChildCartItem filtered by the created_at column * @method ChildCartItem findOneByCreatedAt(string $created_at) Return the first ChildCartItem filtered by the created_at column
* @method ChildCartItem findOneByUpdatedAt(string $updated_at) Return the first ChildCartItem filtered by the updated_at column * @method ChildCartItem findOneByUpdatedAt(string $updated_at) Return the first ChildCartItem filtered by the updated_at column
@@ -84,6 +87,7 @@ use Thelia\Model\Map\CartItemTableMap;
* @method array findByPrice(double $price) Return ChildCartItem objects filtered by the price column * @method array findByPrice(double $price) Return ChildCartItem objects filtered by the price column
* @method array findByPromoPrice(double $promo_price) Return ChildCartItem objects filtered by the promo_price column * @method array findByPromoPrice(double $promo_price) Return ChildCartItem objects filtered by the promo_price column
* @method array findByPriceEndOfLife(string $price_end_of_life) Return ChildCartItem objects filtered by the price_end_of_life column * @method array findByPriceEndOfLife(string $price_end_of_life) Return ChildCartItem objects filtered by the price_end_of_life column
* @method array findByDiscount(double $discount) Return ChildCartItem objects filtered by the discount column
* @method array findByPromo(int $promo) Return ChildCartItem objects filtered by the promo column * @method array findByPromo(int $promo) Return ChildCartItem objects filtered by the promo column
* @method array findByCreatedAt(string $created_at) Return ChildCartItem objects filtered by the created_at column * @method array findByCreatedAt(string $created_at) Return ChildCartItem objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildCartItem objects filtered by the updated_at column * @method array findByUpdatedAt(string $updated_at) Return ChildCartItem objects filtered by the updated_at column
@@ -175,7 +179,7 @@ abstract class CartItemQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT ID, CART_ID, PRODUCT_ID, QUANTITY, PRODUCT_SALE_ELEMENTS_ID, PRICE, PROMO_PRICE, PRICE_END_OF_LIFE, PROMO, CREATED_AT, UPDATED_AT FROM cart_item WHERE ID = :p0'; $sql = 'SELECT ID, CART_ID, PRODUCT_ID, QUANTITY, PRODUCT_SALE_ELEMENTS_ID, PRICE, PROMO_PRICE, PRICE_END_OF_LIFE, DISCOUNT, PROMO, CREATED_AT, UPDATED_AT FROM cart_item WHERE ID = :p0';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -600,6 +604,47 @@ abstract class CartItemQuery extends ModelCriteria
return $this->addUsingAlias(CartItemTableMap::PRICE_END_OF_LIFE, $priceEndOfLife, $comparison); return $this->addUsingAlias(CartItemTableMap::PRICE_END_OF_LIFE, $priceEndOfLife, $comparison);
} }
/**
* Filter the query on the discount column
*
* Example usage:
* <code>
* $query->filterByDiscount(1234); // WHERE discount = 1234
* $query->filterByDiscount(array(12, 34)); // WHERE discount IN (12, 34)
* $query->filterByDiscount(array('min' => 12)); // WHERE discount > 12
* </code>
*
* @param mixed $discount 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 ChildCartItemQuery The current query, for fluid interface
*/
public function filterByDiscount($discount = null, $comparison = null)
{
if (is_array($discount)) {
$useMinMax = false;
if (isset($discount['min'])) {
$this->addUsingAlias(CartItemTableMap::DISCOUNT, $discount['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($discount['max'])) {
$this->addUsingAlias(CartItemTableMap::DISCOUNT, $discount['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CartItemTableMap::DISCOUNT, $discount, $comparison);
}
/** /**
* Filter the query on the promo column * Filter the query on the promo column
* *

View File

@@ -0,0 +1,678 @@
<?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\CouponOrder as ChildCouponOrder;
use Thelia\Model\CouponOrderQuery as ChildCouponOrderQuery;
use Thelia\Model\Map\CouponOrderTableMap;
/**
* Base class that represents a query for the 'coupon_order' table.
*
*
*
* @method ChildCouponOrderQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildCouponOrderQuery orderByOrderId($order = Criteria::ASC) Order by the order_id column
* @method ChildCouponOrderQuery orderByValue($order = Criteria::ASC) Order by the value column
* @method ChildCouponOrderQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildCouponOrderQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildCouponOrderQuery groupById() Group by the id column
* @method ChildCouponOrderQuery groupByOrderId() Group by the order_id column
* @method ChildCouponOrderQuery groupByValue() Group by the value column
* @method ChildCouponOrderQuery groupByCreatedAt() Group by the created_at column
* @method ChildCouponOrderQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildCouponOrderQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildCouponOrderQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildCouponOrderQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildCouponOrderQuery leftJoinOrder($relationAlias = null) Adds a LEFT JOIN clause to the query using the Order relation
* @method ChildCouponOrderQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation
* @method ChildCouponOrderQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation
*
* @method ChildCouponOrder findOne(ConnectionInterface $con = null) Return the first ChildCouponOrder matching the query
* @method ChildCouponOrder findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCouponOrder matching the query, or a new ChildCouponOrder object populated from the query conditions when no match is found
*
* @method ChildCouponOrder findOneById(int $id) Return the first ChildCouponOrder filtered by the id column
* @method ChildCouponOrder findOneByOrderId(int $order_id) Return the first ChildCouponOrder filtered by the order_id column
* @method ChildCouponOrder findOneByValue(double $value) Return the first ChildCouponOrder filtered by the value column
* @method ChildCouponOrder findOneByCreatedAt(string $created_at) Return the first ChildCouponOrder filtered by the created_at column
* @method ChildCouponOrder findOneByUpdatedAt(string $updated_at) Return the first ChildCouponOrder filtered by the updated_at column
*
* @method array findById(int $id) Return ChildCouponOrder objects filtered by the id column
* @method array findByOrderId(int $order_id) Return ChildCouponOrder objects filtered by the order_id column
* @method array findByValue(double $value) Return ChildCouponOrder objects filtered by the value column
* @method array findByCreatedAt(string $created_at) Return ChildCouponOrder objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildCouponOrder objects filtered by the updated_at column
*
*/
abstract class CouponOrderQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\CouponOrderQuery 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\\CouponOrder', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildCouponOrderQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildCouponOrderQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\CouponOrderQuery) {
return $criteria;
}
$query = new \Thelia\Model\CouponOrderQuery();
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 ChildCouponOrder|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CouponOrderTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(CouponOrderTableMap::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 ChildCouponOrder A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, ORDER_ID, VALUE, CREATED_AT, UPDATED_AT FROM coupon_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 ChildCouponOrder();
$obj->hydrate($row);
CouponOrderTableMap::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 ChildCouponOrder|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 ChildCouponOrderQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CouponOrderTableMap::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 ChildCouponOrderQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CouponOrderTableMap::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 ChildCouponOrderQuery 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(CouponOrderTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(CouponOrderTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponOrderTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the order_id column
*
* Example usage:
* <code>
* $query->filterByOrderId(1234); // WHERE order_id = 1234
* $query->filterByOrderId(array(12, 34)); // WHERE order_id IN (12, 34)
* $query->filterByOrderId(array('min' => 12)); // WHERE order_id > 12
* </code>
*
* @see filterByOrder()
*
* @param mixed $orderId 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 ChildCouponOrderQuery The current query, for fluid interface
*/
public function filterByOrderId($orderId = null, $comparison = null)
{
if (is_array($orderId)) {
$useMinMax = false;
if (isset($orderId['min'])) {
$this->addUsingAlias(CouponOrderTableMap::ORDER_ID, $orderId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($orderId['max'])) {
$this->addUsingAlias(CouponOrderTableMap::ORDER_ID, $orderId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponOrderTableMap::ORDER_ID, $orderId, $comparison);
}
/**
* Filter the query on the value column
*
* Example usage:
* <code>
* $query->filterByValue(1234); // WHERE value = 1234
* $query->filterByValue(array(12, 34)); // WHERE value IN (12, 34)
* $query->filterByValue(array('min' => 12)); // WHERE value > 12
* </code>
*
* @param mixed $value 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 ChildCouponOrderQuery The current query, for fluid interface
*/
public function filterByValue($value = null, $comparison = null)
{
if (is_array($value)) {
$useMinMax = false;
if (isset($value['min'])) {
$this->addUsingAlias(CouponOrderTableMap::VALUE, $value['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($value['max'])) {
$this->addUsingAlias(CouponOrderTableMap::VALUE, $value['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponOrderTableMap::VALUE, $value, $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 ChildCouponOrderQuery 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(CouponOrderTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(CouponOrderTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponOrderTableMap::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 ChildCouponOrderQuery 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(CouponOrderTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(CouponOrderTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponOrderTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Order object
*
* @param \Thelia\Model\Order|ObjectCollection $order The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function filterByOrder($order, $comparison = null)
{
if ($order instanceof \Thelia\Model\Order) {
return $this
->addUsingAlias(CouponOrderTableMap::ORDER_ID, $order->getId(), $comparison);
} elseif ($order instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CouponOrderTableMap::ORDER_ID, $order->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByOrder() only accepts arguments of type \Thelia\Model\Order or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Order relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function joinOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Order');
// 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, 'Order');
}
return $this;
}
/**
* Use the Order relation Order 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\OrderQuery A secondary query class using the current class as primary query
*/
public function useOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinOrder($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Order', '\Thelia\Model\OrderQuery');
}
/**
* Exclude object from result
*
* @param ChildCouponOrder $couponOrder Object to remove from the list of results
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function prune($couponOrder = null)
{
if ($couponOrder) {
$this->addUsingAlias(CouponOrderTableMap::ID, $couponOrder->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the coupon_order 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(CouponOrderTableMap::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).
CouponOrderTableMap::clearInstancePool();
CouponOrderTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildCouponOrder or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildCouponOrder 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(CouponOrderTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(CouponOrderTableMap::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();
CouponOrderTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
CouponOrderTableMap::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 ChildCouponOrderQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(CouponOrderTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(CouponOrderTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(CouponOrderTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(CouponOrderTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(CouponOrderTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(CouponOrderTableMap::CREATED_AT);
}
} // CouponOrderQuery

View File

@@ -17,6 +17,8 @@ use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\TableMap; use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime; use Propel\Runtime\Util\PropelDateTime;
use Thelia\Model\CouponOrder as ChildCouponOrder;
use Thelia\Model\CouponOrderQuery as ChildCouponOrderQuery;
use Thelia\Model\Currency as ChildCurrency; use Thelia\Model\Currency as ChildCurrency;
use Thelia\Model\CurrencyQuery as ChildCurrencyQuery; use Thelia\Model\CurrencyQuery as ChildCurrencyQuery;
use Thelia\Model\Customer as ChildCustomer; use Thelia\Model\Customer as ChildCustomer;
@@ -28,8 +30,6 @@ use Thelia\Model\ModuleQuery as ChildModuleQuery;
use Thelia\Model\Order as ChildOrder; use Thelia\Model\Order as ChildOrder;
use Thelia\Model\OrderAddress as ChildOrderAddress; use Thelia\Model\OrderAddress as ChildOrderAddress;
use Thelia\Model\OrderAddressQuery as ChildOrderAddressQuery; use Thelia\Model\OrderAddressQuery as ChildOrderAddressQuery;
use Thelia\Model\OrderCoupon as ChildOrderCoupon;
use Thelia\Model\OrderCouponQuery as ChildOrderCouponQuery;
use Thelia\Model\OrderProduct as ChildOrderProduct; use Thelia\Model\OrderProduct as ChildOrderProduct;
use Thelia\Model\OrderProductQuery as ChildOrderProductQuery; use Thelia\Model\OrderProductQuery as ChildOrderProductQuery;
use Thelia\Model\OrderQuery as ChildOrderQuery; use Thelia\Model\OrderQuery as ChildOrderQuery;
@@ -137,12 +137,6 @@ abstract class Order implements ActiveRecordInterface
*/ */
protected $invoice_ref; protected $invoice_ref;
/**
* The value for the discount field.
* @var double
*/
protected $discount;
/** /**
* The value for the postage field. * The value for the postage field.
* @var double * @var double
@@ -232,10 +226,10 @@ abstract class Order implements ActiveRecordInterface
protected $collOrderProductsPartial; protected $collOrderProductsPartial;
/** /**
* @var ObjectCollection|ChildOrderCoupon[] Collection to store aggregation of ChildOrderCoupon objects. * @var ObjectCollection|ChildCouponOrder[] Collection to store aggregation of ChildCouponOrder objects.
*/ */
protected $collOrderCoupons; protected $collCouponOrders;
protected $collOrderCouponsPartial; protected $collCouponOrdersPartial;
/** /**
* Flag to prevent endless save loop, if this object is referenced * Flag to prevent endless save loop, if this object is referenced
@@ -255,7 +249,7 @@ abstract class Order implements ActiveRecordInterface
* An array of objects scheduled for deletion. * An array of objects scheduled for deletion.
* @var ObjectCollection * @var ObjectCollection
*/ */
protected $orderCouponsScheduledForDeletion = null; protected $couponOrdersScheduledForDeletion = null;
/** /**
* Initializes internal state of Thelia\Model\Base\Order object. * Initializes internal state of Thelia\Model\Base\Order object.
@@ -645,17 +639,6 @@ abstract class Order implements ActiveRecordInterface
return $this->invoice_ref; return $this->invoice_ref;
} }
/**
* Get the [discount] column value.
*
* @return double
*/
public function getDiscount()
{
return $this->discount;
}
/** /**
* Get the [postage] column value. * Get the [postage] column value.
* *
@@ -998,27 +981,6 @@ abstract class Order implements ActiveRecordInterface
return $this; return $this;
} // setInvoiceRef() } // setInvoiceRef()
/**
* Set the value of [discount] column.
*
* @param double $v new value
* @return \Thelia\Model\Order The current object (for fluent API support)
*/
public function setDiscount($v)
{
if ($v !== null) {
$v = (double) $v;
}
if ($this->discount !== $v) {
$this->discount = $v;
$this->modifiedColumns[] = OrderTableMap::DISCOUNT;
}
return $this;
} // setDiscount()
/** /**
* Set the value of [postage] column. * Set the value of [postage] column.
* *
@@ -1255,31 +1217,28 @@ abstract class Order implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : OrderTableMap::translateFieldName('InvoiceRef', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : OrderTableMap::translateFieldName('InvoiceRef', TableMap::TYPE_PHPNAME, $indexType)];
$this->invoice_ref = (null !== $col) ? (string) $col : null; $this->invoice_ref = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : OrderTableMap::translateFieldName('Discount', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : OrderTableMap::translateFieldName('Postage', TableMap::TYPE_PHPNAME, $indexType)];
$this->discount = (null !== $col) ? (double) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : OrderTableMap::translateFieldName('Postage', TableMap::TYPE_PHPNAME, $indexType)];
$this->postage = (null !== $col) ? (double) $col : null; $this->postage = (null !== $col) ? (double) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : OrderTableMap::translateFieldName('PaymentModuleId', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : OrderTableMap::translateFieldName('PaymentModuleId', TableMap::TYPE_PHPNAME, $indexType)];
$this->payment_module_id = (null !== $col) ? (int) $col : null; $this->payment_module_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : OrderTableMap::translateFieldName('DeliveryModuleId', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : OrderTableMap::translateFieldName('DeliveryModuleId', TableMap::TYPE_PHPNAME, $indexType)];
$this->delivery_module_id = (null !== $col) ? (int) $col : null; $this->delivery_module_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : OrderTableMap::translateFieldName('StatusId', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : OrderTableMap::translateFieldName('StatusId', TableMap::TYPE_PHPNAME, $indexType)];
$this->status_id = (null !== $col) ? (int) $col : null; $this->status_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : OrderTableMap::translateFieldName('LangId', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : OrderTableMap::translateFieldName('LangId', TableMap::TYPE_PHPNAME, $indexType)];
$this->lang_id = (null !== $col) ? (int) $col : null; $this->lang_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : OrderTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : OrderTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 18 + $startcol : OrderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : OrderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
@@ -1292,7 +1251,7 @@ abstract class Order implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 19; // 19 = OrderTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 18; // 18 = OrderTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Order object", 0, $e); throw new PropelException("Error populating \Thelia\Model\Order object", 0, $e);
@@ -1387,7 +1346,7 @@ abstract class Order implements ActiveRecordInterface
$this->aLang = null; $this->aLang = null;
$this->collOrderProducts = null; $this->collOrderProducts = null;
$this->collOrderCoupons = null; $this->collCouponOrders = null;
} // if (deep) } // if (deep)
} }
@@ -1600,17 +1559,17 @@ abstract class Order implements ActiveRecordInterface
} }
} }
if ($this->orderCouponsScheduledForDeletion !== null) { if ($this->couponOrdersScheduledForDeletion !== null) {
if (!$this->orderCouponsScheduledForDeletion->isEmpty()) { if (!$this->couponOrdersScheduledForDeletion->isEmpty()) {
\Thelia\Model\OrderCouponQuery::create() \Thelia\Model\CouponOrderQuery::create()
->filterByPrimaryKeys($this->orderCouponsScheduledForDeletion->getPrimaryKeys(false)) ->filterByPrimaryKeys($this->couponOrdersScheduledForDeletion->getPrimaryKeys(false))
->delete($con); ->delete($con);
$this->orderCouponsScheduledForDeletion = null; $this->couponOrdersScheduledForDeletion = null;
} }
} }
if ($this->collOrderCoupons !== null) { if ($this->collCouponOrders !== null) {
foreach ($this->collOrderCoupons as $referrerFK) { foreach ($this->collCouponOrders as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con); $affectedRows += $referrerFK->save($con);
} }
@@ -1676,9 +1635,6 @@ abstract class Order implements ActiveRecordInterface
if ($this->isColumnModified(OrderTableMap::INVOICE_REF)) { if ($this->isColumnModified(OrderTableMap::INVOICE_REF)) {
$modifiedColumns[':p' . $index++] = 'INVOICE_REF'; $modifiedColumns[':p' . $index++] = 'INVOICE_REF';
} }
if ($this->isColumnModified(OrderTableMap::DISCOUNT)) {
$modifiedColumns[':p' . $index++] = 'DISCOUNT';
}
if ($this->isColumnModified(OrderTableMap::POSTAGE)) { if ($this->isColumnModified(OrderTableMap::POSTAGE)) {
$modifiedColumns[':p' . $index++] = 'POSTAGE'; $modifiedColumns[':p' . $index++] = 'POSTAGE';
} }
@@ -1744,9 +1700,6 @@ abstract class Order implements ActiveRecordInterface
case 'INVOICE_REF': case 'INVOICE_REF':
$stmt->bindValue($identifier, $this->invoice_ref, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->invoice_ref, PDO::PARAM_STR);
break; break;
case 'DISCOUNT':
$stmt->bindValue($identifier, $this->discount, PDO::PARAM_STR);
break;
case 'POSTAGE': case 'POSTAGE':
$stmt->bindValue($identifier, $this->postage, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->postage, PDO::PARAM_STR);
break; break;
@@ -1864,27 +1817,24 @@ abstract class Order implements ActiveRecordInterface
return $this->getInvoiceRef(); return $this->getInvoiceRef();
break; break;
case 11: case 11:
return $this->getDiscount();
break;
case 12:
return $this->getPostage(); return $this->getPostage();
break; break;
case 13: case 12:
return $this->getPaymentModuleId(); return $this->getPaymentModuleId();
break; break;
case 14: case 13:
return $this->getDeliveryModuleId(); return $this->getDeliveryModuleId();
break; break;
case 15: case 14:
return $this->getStatusId(); return $this->getStatusId();
break; break;
case 16: case 15:
return $this->getLangId(); return $this->getLangId();
break; break;
case 17: case 16:
return $this->getCreatedAt(); return $this->getCreatedAt();
break; break;
case 18: case 17:
return $this->getUpdatedAt(); return $this->getUpdatedAt();
break; break;
default: default:
@@ -1927,14 +1877,13 @@ abstract class Order implements ActiveRecordInterface
$keys[8] => $this->getTransactionRef(), $keys[8] => $this->getTransactionRef(),
$keys[9] => $this->getDeliveryRef(), $keys[9] => $this->getDeliveryRef(),
$keys[10] => $this->getInvoiceRef(), $keys[10] => $this->getInvoiceRef(),
$keys[11] => $this->getDiscount(), $keys[11] => $this->getPostage(),
$keys[12] => $this->getPostage(), $keys[12] => $this->getPaymentModuleId(),
$keys[13] => $this->getPaymentModuleId(), $keys[13] => $this->getDeliveryModuleId(),
$keys[14] => $this->getDeliveryModuleId(), $keys[14] => $this->getStatusId(),
$keys[15] => $this->getStatusId(), $keys[15] => $this->getLangId(),
$keys[16] => $this->getLangId(), $keys[16] => $this->getCreatedAt(),
$keys[17] => $this->getCreatedAt(), $keys[17] => $this->getUpdatedAt(),
$keys[18] => $this->getUpdatedAt(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) { foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1969,8 +1918,8 @@ abstract class Order implements ActiveRecordInterface
if (null !== $this->collOrderProducts) { if (null !== $this->collOrderProducts) {
$result['OrderProducts'] = $this->collOrderProducts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); $result['OrderProducts'] = $this->collOrderProducts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
} }
if (null !== $this->collOrderCoupons) { if (null !== $this->collCouponOrders) {
$result['OrderCoupons'] = $this->collOrderCoupons->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); $result['CouponOrders'] = $this->collCouponOrders->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
} }
} }
@@ -2040,27 +1989,24 @@ abstract class Order implements ActiveRecordInterface
$this->setInvoiceRef($value); $this->setInvoiceRef($value);
break; break;
case 11: case 11:
$this->setDiscount($value);
break;
case 12:
$this->setPostage($value); $this->setPostage($value);
break; break;
case 13: case 12:
$this->setPaymentModuleId($value); $this->setPaymentModuleId($value);
break; break;
case 14: case 13:
$this->setDeliveryModuleId($value); $this->setDeliveryModuleId($value);
break; break;
case 15: case 14:
$this->setStatusId($value); $this->setStatusId($value);
break; break;
case 16: case 15:
$this->setLangId($value); $this->setLangId($value);
break; break;
case 17: case 16:
$this->setCreatedAt($value); $this->setCreatedAt($value);
break; break;
case 18: case 17:
$this->setUpdatedAt($value); $this->setUpdatedAt($value);
break; break;
} // switch() } // switch()
@@ -2098,14 +2044,13 @@ abstract class Order implements ActiveRecordInterface
if (array_key_exists($keys[8], $arr)) $this->setTransactionRef($arr[$keys[8]]); if (array_key_exists($keys[8], $arr)) $this->setTransactionRef($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setDeliveryRef($arr[$keys[9]]); if (array_key_exists($keys[9], $arr)) $this->setDeliveryRef($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setInvoiceRef($arr[$keys[10]]); if (array_key_exists($keys[10], $arr)) $this->setInvoiceRef($arr[$keys[10]]);
if (array_key_exists($keys[11], $arr)) $this->setDiscount($arr[$keys[11]]); if (array_key_exists($keys[11], $arr)) $this->setPostage($arr[$keys[11]]);
if (array_key_exists($keys[12], $arr)) $this->setPostage($arr[$keys[12]]); if (array_key_exists($keys[12], $arr)) $this->setPaymentModuleId($arr[$keys[12]]);
if (array_key_exists($keys[13], $arr)) $this->setPaymentModuleId($arr[$keys[13]]); if (array_key_exists($keys[13], $arr)) $this->setDeliveryModuleId($arr[$keys[13]]);
if (array_key_exists($keys[14], $arr)) $this->setDeliveryModuleId($arr[$keys[14]]); if (array_key_exists($keys[14], $arr)) $this->setStatusId($arr[$keys[14]]);
if (array_key_exists($keys[15], $arr)) $this->setStatusId($arr[$keys[15]]); if (array_key_exists($keys[15], $arr)) $this->setLangId($arr[$keys[15]]);
if (array_key_exists($keys[16], $arr)) $this->setLangId($arr[$keys[16]]); if (array_key_exists($keys[16], $arr)) $this->setCreatedAt($arr[$keys[16]]);
if (array_key_exists($keys[17], $arr)) $this->setCreatedAt($arr[$keys[17]]); if (array_key_exists($keys[17], $arr)) $this->setUpdatedAt($arr[$keys[17]]);
if (array_key_exists($keys[18], $arr)) $this->setUpdatedAt($arr[$keys[18]]);
} }
/** /**
@@ -2128,7 +2073,6 @@ abstract class Order implements ActiveRecordInterface
if ($this->isColumnModified(OrderTableMap::TRANSACTION_REF)) $criteria->add(OrderTableMap::TRANSACTION_REF, $this->transaction_ref); if ($this->isColumnModified(OrderTableMap::TRANSACTION_REF)) $criteria->add(OrderTableMap::TRANSACTION_REF, $this->transaction_ref);
if ($this->isColumnModified(OrderTableMap::DELIVERY_REF)) $criteria->add(OrderTableMap::DELIVERY_REF, $this->delivery_ref); if ($this->isColumnModified(OrderTableMap::DELIVERY_REF)) $criteria->add(OrderTableMap::DELIVERY_REF, $this->delivery_ref);
if ($this->isColumnModified(OrderTableMap::INVOICE_REF)) $criteria->add(OrderTableMap::INVOICE_REF, $this->invoice_ref); if ($this->isColumnModified(OrderTableMap::INVOICE_REF)) $criteria->add(OrderTableMap::INVOICE_REF, $this->invoice_ref);
if ($this->isColumnModified(OrderTableMap::DISCOUNT)) $criteria->add(OrderTableMap::DISCOUNT, $this->discount);
if ($this->isColumnModified(OrderTableMap::POSTAGE)) $criteria->add(OrderTableMap::POSTAGE, $this->postage); if ($this->isColumnModified(OrderTableMap::POSTAGE)) $criteria->add(OrderTableMap::POSTAGE, $this->postage);
if ($this->isColumnModified(OrderTableMap::PAYMENT_MODULE_ID)) $criteria->add(OrderTableMap::PAYMENT_MODULE_ID, $this->payment_module_id); if ($this->isColumnModified(OrderTableMap::PAYMENT_MODULE_ID)) $criteria->add(OrderTableMap::PAYMENT_MODULE_ID, $this->payment_module_id);
if ($this->isColumnModified(OrderTableMap::DELIVERY_MODULE_ID)) $criteria->add(OrderTableMap::DELIVERY_MODULE_ID, $this->delivery_module_id); if ($this->isColumnModified(OrderTableMap::DELIVERY_MODULE_ID)) $criteria->add(OrderTableMap::DELIVERY_MODULE_ID, $this->delivery_module_id);
@@ -2209,7 +2153,6 @@ abstract class Order implements ActiveRecordInterface
$copyObj->setTransactionRef($this->getTransactionRef()); $copyObj->setTransactionRef($this->getTransactionRef());
$copyObj->setDeliveryRef($this->getDeliveryRef()); $copyObj->setDeliveryRef($this->getDeliveryRef());
$copyObj->setInvoiceRef($this->getInvoiceRef()); $copyObj->setInvoiceRef($this->getInvoiceRef());
$copyObj->setDiscount($this->getDiscount());
$copyObj->setPostage($this->getPostage()); $copyObj->setPostage($this->getPostage());
$copyObj->setPaymentModuleId($this->getPaymentModuleId()); $copyObj->setPaymentModuleId($this->getPaymentModuleId());
$copyObj->setDeliveryModuleId($this->getDeliveryModuleId()); $copyObj->setDeliveryModuleId($this->getDeliveryModuleId());
@@ -2229,9 +2172,9 @@ abstract class Order implements ActiveRecordInterface
} }
} }
foreach ($this->getOrderCoupons() as $relObj) { foreach ($this->getCouponOrders() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addOrderCoupon($relObj->copy($deepCopy)); $copyObj->addCouponOrder($relObj->copy($deepCopy));
} }
} }
@@ -2687,8 +2630,8 @@ abstract class Order implements ActiveRecordInterface
if ('OrderProduct' == $relationName) { if ('OrderProduct' == $relationName) {
return $this->initOrderProducts(); return $this->initOrderProducts();
} }
if ('OrderCoupon' == $relationName) { if ('CouponOrder' == $relationName) {
return $this->initOrderCoupons(); return $this->initCouponOrders();
} }
} }
@@ -2911,31 +2854,31 @@ abstract class Order implements ActiveRecordInterface
} }
/** /**
* Clears out the collOrderCoupons collection * Clears out the collCouponOrders collection
* *
* This does not modify the database; however, it will remove any associated objects, causing * This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method. * them to be refetched by subsequent calls to accessor method.
* *
* @return void * @return void
* @see addOrderCoupons() * @see addCouponOrders()
*/ */
public function clearOrderCoupons() public function clearCouponOrders()
{ {
$this->collOrderCoupons = null; // important to set this to NULL since that means it is uninitialized $this->collCouponOrders = null; // important to set this to NULL since that means it is uninitialized
} }
/** /**
* Reset is the collOrderCoupons collection loaded partially. * Reset is the collCouponOrders collection loaded partially.
*/ */
public function resetPartialOrderCoupons($v = true) public function resetPartialCouponOrders($v = true)
{ {
$this->collOrderCouponsPartial = $v; $this->collCouponOrdersPartial = $v;
} }
/** /**
* Initializes the collOrderCoupons collection. * Initializes the collCouponOrders collection.
* *
* By default this just sets the collOrderCoupons collection to an empty array (like clearcollOrderCoupons()); * By default this just sets the collCouponOrders collection to an empty array (like clearcollCouponOrders());
* however, you may wish to override this method in your stub class to provide setting appropriate * however, you may wish to override this method in your stub class to provide setting appropriate
* to your application -- for example, setting the initial array to the values stored in database. * to your application -- for example, setting the initial array to the values stored in database.
* *
@@ -2944,17 +2887,17 @@ abstract class Order implements ActiveRecordInterface
* *
* @return void * @return void
*/ */
public function initOrderCoupons($overrideExisting = true) public function initCouponOrders($overrideExisting = true)
{ {
if (null !== $this->collOrderCoupons && !$overrideExisting) { if (null !== $this->collCouponOrders && !$overrideExisting) {
return; return;
} }
$this->collOrderCoupons = new ObjectCollection(); $this->collCouponOrders = new ObjectCollection();
$this->collOrderCoupons->setModel('\Thelia\Model\OrderCoupon'); $this->collCouponOrders->setModel('\Thelia\Model\CouponOrder');
} }
/** /**
* Gets an array of ChildOrderCoupon objects which contain a foreign key that references this object. * Gets an array of ChildCouponOrder objects which contain a foreign key that references this object.
* *
* If the $criteria is not null, it is used to always fetch the results from the database. * If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached. * Otherwise the results are fetched from the database the first time, then cached.
@@ -2964,109 +2907,109 @@ abstract class Order implements ActiveRecordInterface
* *
* @param Criteria $criteria optional Criteria object to narrow the query * @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object * @param ConnectionInterface $con optional connection object
* @return Collection|ChildOrderCoupon[] List of ChildOrderCoupon objects * @return Collection|ChildCouponOrder[] List of ChildCouponOrder objects
* @throws PropelException * @throws PropelException
*/ */
public function getOrderCoupons($criteria = null, ConnectionInterface $con = null) public function getCouponOrders($criteria = null, ConnectionInterface $con = null)
{ {
$partial = $this->collOrderCouponsPartial && !$this->isNew(); $partial = $this->collCouponOrdersPartial && !$this->isNew();
if (null === $this->collOrderCoupons || null !== $criteria || $partial) { if (null === $this->collCouponOrders || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collOrderCoupons) { if ($this->isNew() && null === $this->collCouponOrders) {
// return empty collection // return empty collection
$this->initOrderCoupons(); $this->initCouponOrders();
} else { } else {
$collOrderCoupons = ChildOrderCouponQuery::create(null, $criteria) $collCouponOrders = ChildCouponOrderQuery::create(null, $criteria)
->filterByOrder($this) ->filterByOrder($this)
->find($con); ->find($con);
if (null !== $criteria) { if (null !== $criteria) {
if (false !== $this->collOrderCouponsPartial && count($collOrderCoupons)) { if (false !== $this->collCouponOrdersPartial && count($collCouponOrders)) {
$this->initOrderCoupons(false); $this->initCouponOrders(false);
foreach ($collOrderCoupons as $obj) { foreach ($collCouponOrders as $obj) {
if (false == $this->collOrderCoupons->contains($obj)) { if (false == $this->collCouponOrders->contains($obj)) {
$this->collOrderCoupons->append($obj); $this->collCouponOrders->append($obj);
} }
} }
$this->collOrderCouponsPartial = true; $this->collCouponOrdersPartial = true;
} }
$collOrderCoupons->getInternalIterator()->rewind(); $collCouponOrders->getInternalIterator()->rewind();
return $collOrderCoupons; return $collCouponOrders;
} }
if ($partial && $this->collOrderCoupons) { if ($partial && $this->collCouponOrders) {
foreach ($this->collOrderCoupons as $obj) { foreach ($this->collCouponOrders as $obj) {
if ($obj->isNew()) { if ($obj->isNew()) {
$collOrderCoupons[] = $obj; $collCouponOrders[] = $obj;
} }
} }
} }
$this->collOrderCoupons = $collOrderCoupons; $this->collCouponOrders = $collCouponOrders;
$this->collOrderCouponsPartial = false; $this->collCouponOrdersPartial = false;
} }
} }
return $this->collOrderCoupons; return $this->collCouponOrders;
} }
/** /**
* Sets a collection of OrderCoupon objects related by a one-to-many relationship * Sets a collection of CouponOrder objects related by a one-to-many relationship
* to the current object. * to the current object.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted) * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection. * and new objects from the given Propel collection.
* *
* @param Collection $orderCoupons A Propel collection. * @param Collection $couponOrders A Propel collection.
* @param ConnectionInterface $con Optional connection object * @param ConnectionInterface $con Optional connection object
* @return ChildOrder The current object (for fluent API support) * @return ChildOrder The current object (for fluent API support)
*/ */
public function setOrderCoupons(Collection $orderCoupons, ConnectionInterface $con = null) public function setCouponOrders(Collection $couponOrders, ConnectionInterface $con = null)
{ {
$orderCouponsToDelete = $this->getOrderCoupons(new Criteria(), $con)->diff($orderCoupons); $couponOrdersToDelete = $this->getCouponOrders(new Criteria(), $con)->diff($couponOrders);
$this->orderCouponsScheduledForDeletion = $orderCouponsToDelete; $this->couponOrdersScheduledForDeletion = $couponOrdersToDelete;
foreach ($orderCouponsToDelete as $orderCouponRemoved) { foreach ($couponOrdersToDelete as $couponOrderRemoved) {
$orderCouponRemoved->setOrder(null); $couponOrderRemoved->setOrder(null);
} }
$this->collOrderCoupons = null; $this->collCouponOrders = null;
foreach ($orderCoupons as $orderCoupon) { foreach ($couponOrders as $couponOrder) {
$this->addOrderCoupon($orderCoupon); $this->addCouponOrder($couponOrder);
} }
$this->collOrderCoupons = $orderCoupons; $this->collCouponOrders = $couponOrders;
$this->collOrderCouponsPartial = false; $this->collCouponOrdersPartial = false;
return $this; return $this;
} }
/** /**
* Returns the number of related OrderCoupon objects. * Returns the number of related CouponOrder objects.
* *
* @param Criteria $criteria * @param Criteria $criteria
* @param boolean $distinct * @param boolean $distinct
* @param ConnectionInterface $con * @param ConnectionInterface $con
* @return int Count of related OrderCoupon objects. * @return int Count of related CouponOrder objects.
* @throws PropelException * @throws PropelException
*/ */
public function countOrderCoupons(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) public function countCouponOrders(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{ {
$partial = $this->collOrderCouponsPartial && !$this->isNew(); $partial = $this->collCouponOrdersPartial && !$this->isNew();
if (null === $this->collOrderCoupons || null !== $criteria || $partial) { if (null === $this->collCouponOrders || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collOrderCoupons) { if ($this->isNew() && null === $this->collCouponOrders) {
return 0; return 0;
} }
if ($partial && !$criteria) { if ($partial && !$criteria) {
return count($this->getOrderCoupons()); return count($this->getCouponOrders());
} }
$query = ChildOrderCouponQuery::create(null, $criteria); $query = ChildCouponOrderQuery::create(null, $criteria);
if ($distinct) { if ($distinct) {
$query->distinct(); $query->distinct();
} }
@@ -3076,53 +3019,53 @@ abstract class Order implements ActiveRecordInterface
->count($con); ->count($con);
} }
return count($this->collOrderCoupons); return count($this->collCouponOrders);
} }
/** /**
* Method called to associate a ChildOrderCoupon object to this object * Method called to associate a ChildCouponOrder object to this object
* through the ChildOrderCoupon foreign key attribute. * through the ChildCouponOrder foreign key attribute.
* *
* @param ChildOrderCoupon $l ChildOrderCoupon * @param ChildCouponOrder $l ChildCouponOrder
* @return \Thelia\Model\Order The current object (for fluent API support) * @return \Thelia\Model\Order The current object (for fluent API support)
*/ */
public function addOrderCoupon(ChildOrderCoupon $l) public function addCouponOrder(ChildCouponOrder $l)
{ {
if ($this->collOrderCoupons === null) { if ($this->collCouponOrders === null) {
$this->initOrderCoupons(); $this->initCouponOrders();
$this->collOrderCouponsPartial = true; $this->collCouponOrdersPartial = true;
} }
if (!in_array($l, $this->collOrderCoupons->getArrayCopy(), true)) { // only add it if the **same** object is not already associated if (!in_array($l, $this->collCouponOrders->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddOrderCoupon($l); $this->doAddCouponOrder($l);
} }
return $this; return $this;
} }
/** /**
* @param OrderCoupon $orderCoupon The orderCoupon object to add. * @param CouponOrder $couponOrder The couponOrder object to add.
*/ */
protected function doAddOrderCoupon($orderCoupon) protected function doAddCouponOrder($couponOrder)
{ {
$this->collOrderCoupons[]= $orderCoupon; $this->collCouponOrders[]= $couponOrder;
$orderCoupon->setOrder($this); $couponOrder->setOrder($this);
} }
/** /**
* @param OrderCoupon $orderCoupon The orderCoupon object to remove. * @param CouponOrder $couponOrder The couponOrder object to remove.
* @return ChildOrder The current object (for fluent API support) * @return ChildOrder The current object (for fluent API support)
*/ */
public function removeOrderCoupon($orderCoupon) public function removeCouponOrder($couponOrder)
{ {
if ($this->getOrderCoupons()->contains($orderCoupon)) { if ($this->getCouponOrders()->contains($couponOrder)) {
$this->collOrderCoupons->remove($this->collOrderCoupons->search($orderCoupon)); $this->collCouponOrders->remove($this->collCouponOrders->search($couponOrder));
if (null === $this->orderCouponsScheduledForDeletion) { if (null === $this->couponOrdersScheduledForDeletion) {
$this->orderCouponsScheduledForDeletion = clone $this->collOrderCoupons; $this->couponOrdersScheduledForDeletion = clone $this->collCouponOrders;
$this->orderCouponsScheduledForDeletion->clear(); $this->couponOrdersScheduledForDeletion->clear();
} }
$this->orderCouponsScheduledForDeletion[]= clone $orderCoupon; $this->couponOrdersScheduledForDeletion[]= clone $couponOrder;
$orderCoupon->setOrder(null); $couponOrder->setOrder(null);
} }
return $this; return $this;
@@ -3144,7 +3087,6 @@ abstract class Order implements ActiveRecordInterface
$this->transaction_ref = null; $this->transaction_ref = null;
$this->delivery_ref = null; $this->delivery_ref = null;
$this->invoice_ref = null; $this->invoice_ref = null;
$this->discount = null;
$this->postage = null; $this->postage = null;
$this->payment_module_id = null; $this->payment_module_id = null;
$this->delivery_module_id = null; $this->delivery_module_id = null;
@@ -3176,8 +3118,8 @@ abstract class Order implements ActiveRecordInterface
$o->clearAllReferences($deep); $o->clearAllReferences($deep);
} }
} }
if ($this->collOrderCoupons) { if ($this->collCouponOrders) {
foreach ($this->collOrderCoupons as $o) { foreach ($this->collCouponOrders as $o) {
$o->clearAllReferences($deep); $o->clearAllReferences($deep);
} }
} }
@@ -3187,10 +3129,10 @@ abstract class Order implements ActiveRecordInterface
$this->collOrderProducts->clearIterator(); $this->collOrderProducts->clearIterator();
} }
$this->collOrderProducts = null; $this->collOrderProducts = null;
if ($this->collOrderCoupons instanceof Collection) { if ($this->collCouponOrders instanceof Collection) {
$this->collOrderCoupons->clearIterator(); $this->collCouponOrders->clearIterator();
} }
$this->collOrderCoupons = null; $this->collCouponOrders = null;
$this->aCurrency = null; $this->aCurrency = null;
$this->aCustomer = null; $this->aCustomer = null;
$this->aOrderAddressRelatedByInvoiceOrderAddressId = null; $this->aOrderAddressRelatedByInvoiceOrderAddressId = null;

View File

@@ -32,7 +32,6 @@ use Thelia\Model\Map\OrderTableMap;
* @method ChildOrderQuery orderByTransactionRef($order = Criteria::ASC) Order by the transaction_ref column * @method ChildOrderQuery orderByTransactionRef($order = Criteria::ASC) Order by the transaction_ref column
* @method ChildOrderQuery orderByDeliveryRef($order = Criteria::ASC) Order by the delivery_ref column * @method ChildOrderQuery orderByDeliveryRef($order = Criteria::ASC) Order by the delivery_ref column
* @method ChildOrderQuery orderByInvoiceRef($order = Criteria::ASC) Order by the invoice_ref column * @method ChildOrderQuery orderByInvoiceRef($order = Criteria::ASC) Order by the invoice_ref column
* @method ChildOrderQuery orderByDiscount($order = Criteria::ASC) Order by the discount column
* @method ChildOrderQuery orderByPostage($order = Criteria::ASC) Order by the postage column * @method ChildOrderQuery orderByPostage($order = Criteria::ASC) Order by the postage column
* @method ChildOrderQuery orderByPaymentModuleId($order = Criteria::ASC) Order by the payment_module_id column * @method ChildOrderQuery orderByPaymentModuleId($order = Criteria::ASC) Order by the payment_module_id column
* @method ChildOrderQuery orderByDeliveryModuleId($order = Criteria::ASC) Order by the delivery_module_id column * @method ChildOrderQuery orderByDeliveryModuleId($order = Criteria::ASC) Order by the delivery_module_id column
@@ -52,7 +51,6 @@ use Thelia\Model\Map\OrderTableMap;
* @method ChildOrderQuery groupByTransactionRef() Group by the transaction_ref column * @method ChildOrderQuery groupByTransactionRef() Group by the transaction_ref column
* @method ChildOrderQuery groupByDeliveryRef() Group by the delivery_ref column * @method ChildOrderQuery groupByDeliveryRef() Group by the delivery_ref column
* @method ChildOrderQuery groupByInvoiceRef() Group by the invoice_ref column * @method ChildOrderQuery groupByInvoiceRef() Group by the invoice_ref column
* @method ChildOrderQuery groupByDiscount() Group by the discount column
* @method ChildOrderQuery groupByPostage() Group by the postage column * @method ChildOrderQuery groupByPostage() Group by the postage column
* @method ChildOrderQuery groupByPaymentModuleId() Group by the payment_module_id column * @method ChildOrderQuery groupByPaymentModuleId() Group by the payment_module_id column
* @method ChildOrderQuery groupByDeliveryModuleId() Group by the delivery_module_id column * @method ChildOrderQuery groupByDeliveryModuleId() Group by the delivery_module_id column
@@ -101,9 +99,9 @@ use Thelia\Model\Map\OrderTableMap;
* @method ChildOrderQuery rightJoinOrderProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderProduct relation * @method ChildOrderQuery rightJoinOrderProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderProduct relation
* @method ChildOrderQuery innerJoinOrderProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderProduct relation * @method ChildOrderQuery innerJoinOrderProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderProduct relation
* *
* @method ChildOrderQuery leftJoinOrderCoupon($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderCoupon relation * @method ChildOrderQuery leftJoinCouponOrder($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponOrder relation
* @method ChildOrderQuery rightJoinOrderCoupon($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderCoupon relation * @method ChildOrderQuery rightJoinCouponOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponOrder relation
* @method ChildOrderQuery innerJoinOrderCoupon($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderCoupon relation * @method ChildOrderQuery innerJoinCouponOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponOrder relation
* *
* @method ChildOrder findOne(ConnectionInterface $con = null) Return the first ChildOrder matching the query * @method ChildOrder findOne(ConnectionInterface $con = null) Return the first ChildOrder matching the query
* @method ChildOrder findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrder matching the query, or a new ChildOrder object populated from the query conditions when no match is found * @method ChildOrder findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrder matching the query, or a new ChildOrder object populated from the query conditions when no match is found
@@ -119,7 +117,6 @@ use Thelia\Model\Map\OrderTableMap;
* @method ChildOrder findOneByTransactionRef(string $transaction_ref) Return the first ChildOrder filtered by the transaction_ref column * @method ChildOrder findOneByTransactionRef(string $transaction_ref) Return the first ChildOrder filtered by the transaction_ref column
* @method ChildOrder findOneByDeliveryRef(string $delivery_ref) Return the first ChildOrder filtered by the delivery_ref column * @method ChildOrder findOneByDeliveryRef(string $delivery_ref) Return the first ChildOrder filtered by the delivery_ref column
* @method ChildOrder findOneByInvoiceRef(string $invoice_ref) Return the first ChildOrder filtered by the invoice_ref column * @method ChildOrder findOneByInvoiceRef(string $invoice_ref) Return the first ChildOrder filtered by the invoice_ref column
* @method ChildOrder findOneByDiscount(double $discount) Return the first ChildOrder filtered by the discount column
* @method ChildOrder findOneByPostage(double $postage) Return the first ChildOrder filtered by the postage column * @method ChildOrder findOneByPostage(double $postage) Return the first ChildOrder filtered by the postage column
* @method ChildOrder findOneByPaymentModuleId(int $payment_module_id) Return the first ChildOrder filtered by the payment_module_id column * @method ChildOrder findOneByPaymentModuleId(int $payment_module_id) Return the first ChildOrder filtered by the payment_module_id column
* @method ChildOrder findOneByDeliveryModuleId(int $delivery_module_id) Return the first ChildOrder filtered by the delivery_module_id column * @method ChildOrder findOneByDeliveryModuleId(int $delivery_module_id) Return the first ChildOrder filtered by the delivery_module_id column
@@ -139,7 +136,6 @@ use Thelia\Model\Map\OrderTableMap;
* @method array findByTransactionRef(string $transaction_ref) Return ChildOrder objects filtered by the transaction_ref column * @method array findByTransactionRef(string $transaction_ref) Return ChildOrder objects filtered by the transaction_ref column
* @method array findByDeliveryRef(string $delivery_ref) Return ChildOrder objects filtered by the delivery_ref column * @method array findByDeliveryRef(string $delivery_ref) Return ChildOrder objects filtered by the delivery_ref column
* @method array findByInvoiceRef(string $invoice_ref) Return ChildOrder objects filtered by the invoice_ref column * @method array findByInvoiceRef(string $invoice_ref) Return ChildOrder objects filtered by the invoice_ref column
* @method array findByDiscount(double $discount) Return ChildOrder objects filtered by the discount column
* @method array findByPostage(double $postage) Return ChildOrder objects filtered by the postage column * @method array findByPostage(double $postage) Return ChildOrder objects filtered by the postage column
* @method array findByPaymentModuleId(int $payment_module_id) Return ChildOrder objects filtered by the payment_module_id column * @method array findByPaymentModuleId(int $payment_module_id) Return ChildOrder objects filtered by the payment_module_id column
* @method array findByDeliveryModuleId(int $delivery_module_id) Return ChildOrder objects filtered by the delivery_module_id column * @method array findByDeliveryModuleId(int $delivery_module_id) Return ChildOrder objects filtered by the delivery_module_id column
@@ -235,7 +231,7 @@ abstract class OrderQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) 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, DISCOUNT, POSTAGE, PAYMENT_MODULE_ID, DELIVERY_MODULE_ID, STATUS_ID, LANG_ID, CREATED_AT, UPDATED_AT FROM order WHERE ID = :p0'; $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 { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -737,47 +733,6 @@ abstract class OrderQuery extends ModelCriteria
return $this->addUsingAlias(OrderTableMap::INVOICE_REF, $invoiceRef, $comparison); return $this->addUsingAlias(OrderTableMap::INVOICE_REF, $invoiceRef, $comparison);
} }
/**
* Filter the query on the discount column
*
* Example usage:
* <code>
* $query->filterByDiscount(1234); // WHERE discount = 1234
* $query->filterByDiscount(array(12, 34)); // WHERE discount IN (12, 34)
* $query->filterByDiscount(array('min' => 12)); // WHERE discount > 12
* </code>
*
* @param mixed $discount 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 ChildOrderQuery The current query, for fluid interface
*/
public function filterByDiscount($discount = null, $comparison = null)
{
if (is_array($discount)) {
$useMinMax = false;
if (isset($discount['min'])) {
$this->addUsingAlias(OrderTableMap::DISCOUNT, $discount['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($discount['max'])) {
$this->addUsingAlias(OrderTableMap::DISCOUNT, $discount['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderTableMap::DISCOUNT, $discount, $comparison);
}
/** /**
* Filter the query on the postage column * Filter the query on the postage column
* *
@@ -1751,40 +1706,40 @@ abstract class OrderQuery extends ModelCriteria
} }
/** /**
* Filter the query by a related \Thelia\Model\OrderCoupon object * Filter the query by a related \Thelia\Model\CouponOrder object
* *
* @param \Thelia\Model\OrderCoupon|ObjectCollection $orderCoupon the related object to use as filter * @param \Thelia\Model\CouponOrder|ObjectCollection $couponOrder the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildOrderQuery The current query, for fluid interface * @return ChildOrderQuery The current query, for fluid interface
*/ */
public function filterByOrderCoupon($orderCoupon, $comparison = null) public function filterByCouponOrder($couponOrder, $comparison = null)
{ {
if ($orderCoupon instanceof \Thelia\Model\OrderCoupon) { if ($couponOrder instanceof \Thelia\Model\CouponOrder) {
return $this return $this
->addUsingAlias(OrderTableMap::ID, $orderCoupon->getOrderId(), $comparison); ->addUsingAlias(OrderTableMap::ID, $couponOrder->getOrderId(), $comparison);
} elseif ($orderCoupon instanceof ObjectCollection) { } elseif ($couponOrder instanceof ObjectCollection) {
return $this return $this
->useOrderCouponQuery() ->useCouponOrderQuery()
->filterByPrimaryKeys($orderCoupon->getPrimaryKeys()) ->filterByPrimaryKeys($couponOrder->getPrimaryKeys())
->endUse(); ->endUse();
} else { } else {
throw new PropelException('filterByOrderCoupon() only accepts arguments of type \Thelia\Model\OrderCoupon or Collection'); throw new PropelException('filterByCouponOrder() only accepts arguments of type \Thelia\Model\CouponOrder or Collection');
} }
} }
/** /**
* Adds a JOIN clause to the query using the OrderCoupon relation * Adds a JOIN clause to the query using the CouponOrder relation
* *
* @param string $relationAlias optional alias for the relation * @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return ChildOrderQuery The current query, for fluid interface * @return ChildOrderQuery The current query, for fluid interface
*/ */
public function joinOrderCoupon($relationAlias = null, $joinType = Criteria::INNER_JOIN) public function joinCouponOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('OrderCoupon'); $relationMap = $tableMap->getRelation('CouponOrder');
// create a ModelJoin object for this join // create a ModelJoin object for this join
$join = new ModelJoin(); $join = new ModelJoin();
@@ -1799,14 +1754,14 @@ abstract class OrderQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias); $this->addJoinObject($join, $relationAlias);
} else { } else {
$this->addJoinObject($join, 'OrderCoupon'); $this->addJoinObject($join, 'CouponOrder');
} }
return $this; return $this;
} }
/** /**
* Use the OrderCoupon relation OrderCoupon object * Use the CouponOrder relation CouponOrder object
* *
* @see useQuery() * @see useQuery()
* *
@@ -1814,13 +1769,13 @@ abstract class OrderQuery extends ModelCriteria
* to be used as main alias in the secondary query * to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return \Thelia\Model\OrderCouponQuery A secondary query class using the current class as primary query * @return \Thelia\Model\CouponOrderQuery A secondary query class using the current class as primary query
*/ */
public function useOrderCouponQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) public function useCouponOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinOrderCoupon($relationAlias, $joinType) ->joinCouponOrder($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'OrderCoupon', '\Thelia\Model\OrderCouponQuery'); ->useQuery($relationAlias ? $relationAlias : 'CouponOrder', '\Thelia\Model\CouponOrderQuery');
} }
/** /**

View File

@@ -83,6 +83,7 @@ class Cart extends BaseCart
foreach($this->getCartItems() as $cartItem) { foreach($this->getCartItems() as $cartItem) {
$subtotal = $cartItem->getRealPrice(); $subtotal = $cartItem->getRealPrice();
$subtotal -= $cartItem->getDiscount();
/* we round it for the unit price, before the quantity factor */ /* we round it for the unit price, before the quantity factor */
$subtotal = round($taxCalculator->load($cartItem->getProduct(), $country)->getTaxedPrice($subtotal), 2); $subtotal = round($taxCalculator->load($cartItem->getProduct(), $country)->getTaxedPrice($subtotal), 2);
$subtotal *= $cartItem->getQuantity(); $subtotal *= $cartItem->getQuantity();
@@ -101,6 +102,7 @@ class Cart extends BaseCart
foreach($this->getCartItems() as $cartItem) { foreach($this->getCartItems() as $cartItem) {
$subtotal = $cartItem->getRealPrice(); $subtotal = $cartItem->getRealPrice();
$subtotal -= $cartItem->getDiscount();
$subtotal *= $cartItem->getQuantity(); $subtotal *= $cartItem->getQuantity();
$total += $subtotal; $total += $subtotal;

View File

@@ -0,0 +1,9 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\CouponOrder as BaseCouponOrder;
class CouponOrder extends BaseCouponOrder {
}

View File

@@ -2,11 +2,11 @@
namespace Thelia\Model; namespace Thelia\Model;
use Thelia\Model\Base\OrderCouponQuery as BaseOrderCouponQuery; use Thelia\Model\Base\CouponOrderQuery as BaseCouponOrderQuery;
/** /**
* Skeleton subclass for performing query and update operations on the 'order_coupon' table. * Skeleton subclass for performing query and update operations on the 'coupon_order' table.
* *
* *
* *
@@ -15,7 +15,6 @@ use Thelia\Model\Base\OrderCouponQuery as BaseOrderCouponQuery;
* long as it does not already exist in the output directory. * long as it does not already exist in the output directory.
* *
*/ */
class OrderCouponQuery extends BaseOrderCouponQuery class CouponOrderQuery extends BaseCouponOrderQuery {
{
} // OrderCouponQuery } // CouponOrderQuery

View File

@@ -57,7 +57,7 @@ class CartItemTableMap extends TableMap
/** /**
* The total number of columns * The total number of columns
*/ */
const NUM_COLUMNS = 11; const NUM_COLUMNS = 12;
/** /**
* The number of lazy-loaded columns * The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class CartItemTableMap extends TableMap
/** /**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/ */
const NUM_HYDRATE_COLUMNS = 11; const NUM_HYDRATE_COLUMNS = 12;
/** /**
* the column name for the ID field * the column name for the ID field
@@ -109,6 +109,11 @@ class CartItemTableMap extends TableMap
*/ */
const PRICE_END_OF_LIFE = 'cart_item.PRICE_END_OF_LIFE'; const PRICE_END_OF_LIFE = 'cart_item.PRICE_END_OF_LIFE';
/**
* the column name for the DISCOUNT field
*/
const DISCOUNT = 'cart_item.DISCOUNT';
/** /**
* the column name for the PROMO field * the column name for the PROMO field
*/ */
@@ -136,12 +141,12 @@ class CartItemTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'CartId', 'ProductId', 'Quantity', 'ProductSaleElementsId', 'Price', 'PromoPrice', 'PriceEndOfLife', 'Promo', 'CreatedAt', 'UpdatedAt', ), self::TYPE_PHPNAME => array('Id', 'CartId', 'ProductId', 'Quantity', 'ProductSaleElementsId', 'Price', 'PromoPrice', 'PriceEndOfLife', 'Discount', 'Promo', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'cartId', 'productId', 'quantity', 'productSaleElementsId', 'price', 'promoPrice', 'priceEndOfLife', 'promo', 'createdAt', 'updatedAt', ), self::TYPE_STUDLYPHPNAME => array('id', 'cartId', 'productId', 'quantity', 'productSaleElementsId', 'price', 'promoPrice', 'priceEndOfLife', 'discount', 'promo', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(CartItemTableMap::ID, CartItemTableMap::CART_ID, CartItemTableMap::PRODUCT_ID, CartItemTableMap::QUANTITY, CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID, CartItemTableMap::PRICE, CartItemTableMap::PROMO_PRICE, CartItemTableMap::PRICE_END_OF_LIFE, CartItemTableMap::PROMO, CartItemTableMap::CREATED_AT, CartItemTableMap::UPDATED_AT, ), self::TYPE_COLNAME => array(CartItemTableMap::ID, CartItemTableMap::CART_ID, CartItemTableMap::PRODUCT_ID, CartItemTableMap::QUANTITY, CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID, CartItemTableMap::PRICE, CartItemTableMap::PROMO_PRICE, CartItemTableMap::PRICE_END_OF_LIFE, CartItemTableMap::DISCOUNT, CartItemTableMap::PROMO, CartItemTableMap::CREATED_AT, CartItemTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'CART_ID', 'PRODUCT_ID', 'QUANTITY', 'PRODUCT_SALE_ELEMENTS_ID', 'PRICE', 'PROMO_PRICE', 'PRICE_END_OF_LIFE', 'PROMO', 'CREATED_AT', 'UPDATED_AT', ), self::TYPE_RAW_COLNAME => array('ID', 'CART_ID', 'PRODUCT_ID', 'QUANTITY', 'PRODUCT_SALE_ELEMENTS_ID', 'PRICE', 'PROMO_PRICE', 'PRICE_END_OF_LIFE', 'DISCOUNT', 'PROMO', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'cart_id', 'product_id', 'quantity', 'product_sale_elements_id', 'price', 'promo_price', 'price_end_of_life', 'promo', 'created_at', 'updated_at', ), self::TYPE_FIELDNAME => array('id', 'cart_id', 'product_id', 'quantity', 'product_sale_elements_id', 'price', 'promo_price', 'price_end_of_life', 'discount', 'promo', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
); );
/** /**
@@ -151,12 +156,12 @@ class CartItemTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'CartId' => 1, 'ProductId' => 2, 'Quantity' => 3, 'ProductSaleElementsId' => 4, 'Price' => 5, 'PromoPrice' => 6, 'PriceEndOfLife' => 7, 'Promo' => 8, 'CreatedAt' => 9, 'UpdatedAt' => 10, ), self::TYPE_PHPNAME => array('Id' => 0, 'CartId' => 1, 'ProductId' => 2, 'Quantity' => 3, 'ProductSaleElementsId' => 4, 'Price' => 5, 'PromoPrice' => 6, 'PriceEndOfLife' => 7, 'Discount' => 8, 'Promo' => 9, 'CreatedAt' => 10, 'UpdatedAt' => 11, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'cartId' => 1, 'productId' => 2, 'quantity' => 3, 'productSaleElementsId' => 4, 'price' => 5, 'promoPrice' => 6, 'priceEndOfLife' => 7, 'promo' => 8, 'createdAt' => 9, 'updatedAt' => 10, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'cartId' => 1, 'productId' => 2, 'quantity' => 3, 'productSaleElementsId' => 4, 'price' => 5, 'promoPrice' => 6, 'priceEndOfLife' => 7, 'discount' => 8, 'promo' => 9, 'createdAt' => 10, 'updatedAt' => 11, ),
self::TYPE_COLNAME => array(CartItemTableMap::ID => 0, CartItemTableMap::CART_ID => 1, CartItemTableMap::PRODUCT_ID => 2, CartItemTableMap::QUANTITY => 3, CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID => 4, CartItemTableMap::PRICE => 5, CartItemTableMap::PROMO_PRICE => 6, CartItemTableMap::PRICE_END_OF_LIFE => 7, CartItemTableMap::PROMO => 8, CartItemTableMap::CREATED_AT => 9, CartItemTableMap::UPDATED_AT => 10, ), self::TYPE_COLNAME => array(CartItemTableMap::ID => 0, CartItemTableMap::CART_ID => 1, CartItemTableMap::PRODUCT_ID => 2, CartItemTableMap::QUANTITY => 3, CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID => 4, CartItemTableMap::PRICE => 5, CartItemTableMap::PROMO_PRICE => 6, CartItemTableMap::PRICE_END_OF_LIFE => 7, CartItemTableMap::DISCOUNT => 8, CartItemTableMap::PROMO => 9, CartItemTableMap::CREATED_AT => 10, CartItemTableMap::UPDATED_AT => 11, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CART_ID' => 1, 'PRODUCT_ID' => 2, 'QUANTITY' => 3, 'PRODUCT_SALE_ELEMENTS_ID' => 4, 'PRICE' => 5, 'PROMO_PRICE' => 6, 'PRICE_END_OF_LIFE' => 7, 'PROMO' => 8, 'CREATED_AT' => 9, 'UPDATED_AT' => 10, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'CART_ID' => 1, 'PRODUCT_ID' => 2, 'QUANTITY' => 3, 'PRODUCT_SALE_ELEMENTS_ID' => 4, 'PRICE' => 5, 'PROMO_PRICE' => 6, 'PRICE_END_OF_LIFE' => 7, 'DISCOUNT' => 8, 'PROMO' => 9, 'CREATED_AT' => 10, 'UPDATED_AT' => 11, ),
self::TYPE_FIELDNAME => array('id' => 0, 'cart_id' => 1, 'product_id' => 2, 'quantity' => 3, 'product_sale_elements_id' => 4, 'price' => 5, 'promo_price' => 6, 'price_end_of_life' => 7, 'promo' => 8, 'created_at' => 9, 'updated_at' => 10, ), self::TYPE_FIELDNAME => array('id' => 0, 'cart_id' => 1, 'product_id' => 2, 'quantity' => 3, 'product_sale_elements_id' => 4, 'price' => 5, 'promo_price' => 6, 'price_end_of_life' => 7, 'discount' => 8, 'promo' => 9, 'created_at' => 10, 'updated_at' => 11, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
); );
/** /**
@@ -183,6 +188,7 @@ class CartItemTableMap extends TableMap
$this->addColumn('PRICE', 'Price', 'FLOAT', false, null, null); $this->addColumn('PRICE', 'Price', 'FLOAT', false, null, null);
$this->addColumn('PROMO_PRICE', 'PromoPrice', 'FLOAT', false, null, null); $this->addColumn('PROMO_PRICE', 'PromoPrice', 'FLOAT', false, null, null);
$this->addColumn('PRICE_END_OF_LIFE', 'PriceEndOfLife', 'TIMESTAMP', false, null, null); $this->addColumn('PRICE_END_OF_LIFE', 'PriceEndOfLife', 'TIMESTAMP', false, null, null);
$this->addColumn('DISCOUNT', 'Discount', 'FLOAT', false, null, 0);
$this->addColumn('PROMO', 'Promo', 'INTEGER', false, null, null); $this->addColumn('PROMO', 'Promo', 'INTEGER', false, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
@@ -357,6 +363,7 @@ class CartItemTableMap extends TableMap
$criteria->addSelectColumn(CartItemTableMap::PRICE); $criteria->addSelectColumn(CartItemTableMap::PRICE);
$criteria->addSelectColumn(CartItemTableMap::PROMO_PRICE); $criteria->addSelectColumn(CartItemTableMap::PROMO_PRICE);
$criteria->addSelectColumn(CartItemTableMap::PRICE_END_OF_LIFE); $criteria->addSelectColumn(CartItemTableMap::PRICE_END_OF_LIFE);
$criteria->addSelectColumn(CartItemTableMap::DISCOUNT);
$criteria->addSelectColumn(CartItemTableMap::PROMO); $criteria->addSelectColumn(CartItemTableMap::PROMO);
$criteria->addSelectColumn(CartItemTableMap::CREATED_AT); $criteria->addSelectColumn(CartItemTableMap::CREATED_AT);
$criteria->addSelectColumn(CartItemTableMap::UPDATED_AT); $criteria->addSelectColumn(CartItemTableMap::UPDATED_AT);
@@ -369,6 +376,7 @@ class CartItemTableMap extends TableMap
$criteria->addSelectColumn($alias . '.PRICE'); $criteria->addSelectColumn($alias . '.PRICE');
$criteria->addSelectColumn($alias . '.PROMO_PRICE'); $criteria->addSelectColumn($alias . '.PROMO_PRICE');
$criteria->addSelectColumn($alias . '.PRICE_END_OF_LIFE'); $criteria->addSelectColumn($alias . '.PRICE_END_OF_LIFE');
$criteria->addSelectColumn($alias . '.DISCOUNT');
$criteria->addSelectColumn($alias . '.PROMO'); $criteria->addSelectColumn($alias . '.PROMO');
$criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT');

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