Merge branches 'coupon' and 'master' of https://github.com/thelia/thelia into coupon
* 'coupon' of https://github.com/thelia/thelia: # By Manuel Raynaud (10) and others # Via Manuel Raynaud (3) and others * 'master' of https://github.com/thelia/thelia: (27 commits) AttributesAv management update cart model Using "update" instead of "change" Finished admin controllers refactoriing Created AbstractCrudController, and refactored existing controllers Continuer attributes management Change script file declaration order for bootstrap-editable fix Delete form on the orders view translate error message - Creation of order-edit view valid customer removal pse ref in faker pse ref loop tests test product loop limit update customer general info fix tests product loop test remove not needed flag in customer part change method to retrieve data in customer create process ...
This commit is contained in:
149
core/lib/Thelia/Action/Attribute.php
Normal file
149
core/lib/Thelia/Action/Attribute.php
Normal file
@@ -0,0 +1,149 @@
|
||||
<?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\Action;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
use Thelia\Model\AttributeQuery;
|
||||
use Thelia\Model\Attribute as AttributeModel;
|
||||
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
|
||||
use Thelia\Core\Event\AttributeUpdateEvent;
|
||||
use Thelia\Core\Event\AttributeCreateEvent;
|
||||
use Thelia\Core\Event\AttributeDeleteEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\AttributeAv;
|
||||
use Thelia\Model\AttributeAvQuery;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
|
||||
class Attribute extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
/**
|
||||
* Create a new attribute entry
|
||||
*
|
||||
* @param AttributeCreateEvent $event
|
||||
*/
|
||||
public function create(AttributeCreateEvent $event)
|
||||
{
|
||||
$attribute = new AttributeModel();
|
||||
|
||||
$attribute
|
||||
->setDispatcher($this->getDispatcher())
|
||||
|
||||
->setLocale($event->getLocale())
|
||||
->setTitle($event->getTitle())
|
||||
|
||||
->save()
|
||||
;
|
||||
|
||||
$event->setAttribute($attribute);
|
||||
|
||||
// Add atribute to all product templates if required
|
||||
if ($event->getAddToAllTemplates() != 0) {
|
||||
// TODO: add to all product template
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change a product attribute
|
||||
*
|
||||
* @param AttributeUpdateEvent $event
|
||||
*/
|
||||
public function update(AttributeUpdateEvent $event)
|
||||
{
|
||||
$search = AttributeQuery::create();
|
||||
|
||||
if (null !== $attribute = AttributeQuery::create()->findPk($event->getAttributeId())) {
|
||||
|
||||
$attribute
|
||||
->setDispatcher($this->getDispatcher())
|
||||
|
||||
->setLocale($event->getLocale())
|
||||
->setTitle($event->getTitle())
|
||||
->setDescription($event->getDescription())
|
||||
->setChapo($event->getChapo())
|
||||
->setPostscriptum($event->getPostscriptum())
|
||||
|
||||
->save();
|
||||
|
||||
$event->setAttribute($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a product attribute entry
|
||||
*
|
||||
* @param AttributeDeleteEvent $event
|
||||
*/
|
||||
public function delete(AttributeDeleteEvent $event)
|
||||
{
|
||||
|
||||
if (null !== ($attribute = AttributeQuery::create()->findPk($event->getAttributeId()))) {
|
||||
|
||||
$attribute
|
||||
->setDispatcher($this->getDispatcher())
|
||||
->delete()
|
||||
;
|
||||
|
||||
$event->setAttribute($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes position, selecting absolute ou relative change.
|
||||
*
|
||||
* @param CategoryChangePositionEvent $event
|
||||
*/
|
||||
public function updatePosition(UpdatePositionEvent $event)
|
||||
{
|
||||
if (null !== $attribute = AttributeQuery::create()->findPk($event->getObjectId())) {
|
||||
|
||||
$attribute->setDispatcher($this->getDispatcher());
|
||||
|
||||
$mode = $event->getMode();
|
||||
|
||||
if ($mode == UpdatePositionEvent::POSITION_ABSOLUTE)
|
||||
return $attribute->changeAbsolutePosition($event->getPosition());
|
||||
else if ($mode == UpdatePositionEvent::POSITION_UP)
|
||||
return $attribute->movePositionUp();
|
||||
else if ($mode == UpdatePositionEvent::POSITION_DOWN)
|
||||
return $attribute->movePositionDown();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
TheliaEvents::ATTRIBUTE_CREATE => array("create", 128),
|
||||
TheliaEvents::ATTRIBUTE_UPDATE => array("update", 128),
|
||||
TheliaEvents::ATTRIBUTE_DELETE => array("delete", 128),
|
||||
TheliaEvents::ATTRIBUTE_UPDATE_POSITION => array("updatePosition", 128),
|
||||
);
|
||||
}
|
||||
}
|
||||
143
core/lib/Thelia/Action/AttributeAv.php
Normal file
143
core/lib/Thelia/Action/AttributeAv.php
Normal file
@@ -0,0 +1,143 @@
|
||||
<?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\Action;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
use Thelia\Model\AttributeAvQuery;
|
||||
use Thelia\Model\AttributeAv as AttributeAvModel;
|
||||
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
|
||||
use Thelia\Core\Event\AttributeAvUpdateEvent;
|
||||
use Thelia\Core\Event\AttributeAvCreateEvent;
|
||||
use Thelia\Core\Event\AttributeAvDeleteEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
|
||||
class AttributeAv extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
/**
|
||||
* Create a new attribute entry
|
||||
*
|
||||
* @param AttributeAvCreateEvent $event
|
||||
*/
|
||||
public function create(AttributeAvCreateEvent $event)
|
||||
{
|
||||
$attribute = new AttributeAvModel();
|
||||
|
||||
$attribute
|
||||
->setDispatcher($this->getDispatcher())
|
||||
|
||||
->setAttributeId($event->getAttributeId())
|
||||
->setLocale($event->getLocale())
|
||||
->setTitle($event->getTitle())
|
||||
|
||||
->save()
|
||||
;
|
||||
|
||||
$event->setAttributeAv($attribute);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change a product attribute
|
||||
*
|
||||
* @param AttributeAvUpdateEvent $event
|
||||
*/
|
||||
public function update(AttributeAvUpdateEvent $event)
|
||||
{
|
||||
$search = AttributeAvQuery::create();
|
||||
|
||||
if (null !== $attribute = AttributeAvQuery::create()->findPk($event->getAttributeAvId())) {
|
||||
|
||||
$attribute
|
||||
->setDispatcher($this->getDispatcher())
|
||||
|
||||
->setLocale($event->getLocale())
|
||||
->setTitle($event->getTitle())
|
||||
->setDescription($event->getDescription())
|
||||
->setChapo($event->getChapo())
|
||||
->setPostscriptum($event->getPostscriptum())
|
||||
|
||||
->save();
|
||||
|
||||
$event->setAttributeAv($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a product attribute entry
|
||||
*
|
||||
* @param AttributeAvDeleteEvent $event
|
||||
*/
|
||||
public function delete(AttributeAvDeleteEvent $event)
|
||||
{
|
||||
|
||||
if (null !== ($attribute = AttributeAvQuery::create()->findPk($event->getAttributeAvId()))) {
|
||||
|
||||
$attribute
|
||||
->setDispatcher($this->getDispatcher())
|
||||
->delete()
|
||||
;
|
||||
|
||||
$event->setAttributeAv($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes position, selecting absolute ou relative change.
|
||||
*
|
||||
* @param CategoryChangePositionEvent $event
|
||||
*/
|
||||
public function updatePosition(UpdatePositionEvent $event)
|
||||
{
|
||||
if (null !== $attribute = AttributeAvQuery::create()->findPk($event->getObjectId())) {
|
||||
|
||||
$attribute->setDispatcher($this->getDispatcher());
|
||||
|
||||
$mode = $event->getMode();
|
||||
|
||||
if ($mode == UpdatePositionEvent::POSITION_ABSOLUTE)
|
||||
return $attribute->changeAbsolutePosition($event->getPosition());
|
||||
else if ($mode == UpdatePositionEvent::POSITION_UP)
|
||||
return $attribute->movePositionUp();
|
||||
else if ($mode == UpdatePositionEvent::POSITION_DOWN)
|
||||
return $attribute->movePositionDown();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
TheliaEvents::ATTRIBUTE_AV_CREATE => array("create", 128),
|
||||
TheliaEvents::ATTRIBUTE_AV_UPDATE => array("update", 128),
|
||||
TheliaEvents::ATTRIBUTE_AV_DELETE => array("delete", 128),
|
||||
TheliaEvents::ATTRIBUTE_AV_UPDATE_POSITION => array("updatePosition", 128),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ use Thelia\Core\Event\CurrencyUpdateEvent;
|
||||
use Thelia\Core\Event\CurrencyCreateEvent;
|
||||
use Thelia\Core\Event\CurrencyDeleteEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Core\Event\CurrencyUpdatePositionEvent;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
|
||||
class Currency extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
@@ -164,19 +164,20 @@ class Currency extends BaseAction implements EventSubscriberInterface
|
||||
*
|
||||
* @param CategoryChangePositionEvent $event
|
||||
*/
|
||||
public function updatePosition(CurrencyUpdatePositionEvent $event)
|
||||
public function updatePosition(UpdatePositionEvent $event)
|
||||
{
|
||||
if (null !== $currency = CurrencyQuery::create()->findOneById($event->getObjectId())) {
|
||||
if (null !== $currency = CurrencyQuery::create()->findPk($event->getObjectId())) {
|
||||
|
||||
$currency->setDispatcher($this->getDispatcher());
|
||||
|
||||
$mode = $event->getMode();
|
||||
echo "loaded $mode !";
|
||||
|
||||
if ($mode == CurrencyUpdatePositionEvent::POSITION_ABSOLUTE)
|
||||
if ($mode == UpdatePositionEvent::POSITION_ABSOLUTE)
|
||||
return $currency->changeAbsolutePosition($event->getPosition());
|
||||
else if ($mode == CurrencyUpdatePositionEvent::POSITION_UP)
|
||||
else if ($mode == UpdatePositionEvent::POSITION_UP)
|
||||
return $currency->movePositionUp();
|
||||
else if ($mode == CurrencyUpdatePositionEvent::POSITION_DOWN)
|
||||
else if ($mode == UpdatePositionEvent::POSITION_DOWN)
|
||||
return $currency->movePositionDown();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace Thelia\Action;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
use Thelia\Core\Event\CustomerCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\CustomerEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\Customer as CustomerModel;
|
||||
use Thelia\Core\Event\CustomerLoginEvent;
|
||||
@@ -59,6 +60,13 @@ class Customer extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
}
|
||||
|
||||
public function delete(CustomerEvent $event)
|
||||
{
|
||||
$customer = $event->getCustomer();
|
||||
|
||||
$customer->delete();
|
||||
}
|
||||
|
||||
private function createOrUpdateCustomer(CustomerModel $customer, CustomerCreateOrUpdateEvent $event)
|
||||
{
|
||||
$customer->setDispatcher($this->getDispatcher());
|
||||
@@ -80,7 +88,8 @@ class Customer extends BaseAction implements EventSubscriberInterface
|
||||
$event->getLang(),
|
||||
$event->getReseller(),
|
||||
$event->getSponsor(),
|
||||
$event->getDiscount()
|
||||
$event->getDiscount(),
|
||||
$event->getCompany()
|
||||
);
|
||||
|
||||
$event->setCustomer($customer);
|
||||
@@ -143,6 +152,7 @@ class Customer extends BaseAction implements EventSubscriberInterface
|
||||
TheliaEvents::CUSTOMER_UPDATEACCOUNT => array("modify", 128),
|
||||
TheliaEvents::CUSTOMER_LOGOUT => array("logout", 128),
|
||||
TheliaEvents::CUSTOMER_LOGIN => array("login" , 128),
|
||||
TheliaEvents::CUSTOMER_DELETEACCOUNT => array("delete", 128),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,157 +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\Action;
|
||||
|
||||
use Thelia\Core\Event\BaseChangePositionEvent;
|
||||
|
||||
trait PositionManagementTrait
|
||||
{
|
||||
const POSITION_UP
|
||||
/**
|
||||
* Changes object position, selecting absolute ou relative change.
|
||||
*
|
||||
* @param BaseChangePositionEvent $event
|
||||
*/
|
||||
public function changePosition(BaseChangePositionEvent $event)
|
||||
{
|
||||
if ($event->getMode() == BaseChangePositionEvent::POSITION_ABSOLUTE)
|
||||
return $this->changeAbsolutePosition($event);
|
||||
else
|
||||
return $this->exchangePosition($event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move up or down a object
|
||||
*
|
||||
* @param BaseChangePositionEvent $event
|
||||
*/
|
||||
protected function exchangePosition(BaseChangePositionEvent $event)
|
||||
{
|
||||
$object = CategoryQuery::create()->findPk($event->getCategoryId());
|
||||
|
||||
if ($object !== null) {
|
||||
|
||||
// The current position of the object
|
||||
$my_position = $object->getPosition();
|
||||
|
||||
// Find object to exchange position with
|
||||
$search = CategoryQuery::create()
|
||||
->filterByParent($object->getParent());
|
||||
|
||||
// Up or down ?
|
||||
if ($event->getMode() == BaseChangePositionEvent::POSITION_UP) {
|
||||
// Find the object immediately before me
|
||||
$search->filterByPosition(array('max' => $my_position-1))->orderByPosition(Criteria::DESC);
|
||||
} elseif ($event->getMode() == BaseChangePositionEvent::POSITION_DOWN) {
|
||||
// Find the object immediately after me
|
||||
$search->filterByPosition(array('min' => $my_position+1))->orderByPosition(Criteria::ASC);
|
||||
} else
|
||||
|
||||
return;
|
||||
|
||||
$result = $search->findOne();
|
||||
|
||||
// If we found the proper object, exchange their positions
|
||||
if ($result) {
|
||||
|
||||
$cnx = Propel::getWriteConnection(CategoryTableMap::DATABASE_NAME);
|
||||
|
||||
$cnx->beginTransaction();
|
||||
|
||||
try {
|
||||
$object
|
||||
->setDispatcher($this->getDispatcher())
|
||||
->setPosition($result->getPosition())
|
||||
->save()
|
||||
;
|
||||
|
||||
$result->setPosition($my_position)->save();
|
||||
|
||||
$cnx->commit();
|
||||
} catch (Exception $e) {
|
||||
$cnx->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes object position
|
||||
*
|
||||
* @param BaseChangePositionEvent $event
|
||||
*/
|
||||
protected function changeAbsolutePosition(BaseChangePositionEvent $event)
|
||||
{
|
||||
$object = CategoryQuery::create()->findPk($event->getCategoryId());
|
||||
|
||||
if ($object !== null) {
|
||||
|
||||
// The required position
|
||||
$new_position = $event->getPosition();
|
||||
|
||||
// The current position
|
||||
$current_position = $object->getPosition();
|
||||
|
||||
if ($new_position != null && $new_position > 0 && $new_position != $current_position) {
|
||||
|
||||
// Find categories to offset
|
||||
$search = CategoryQuery::create()->filterByParent($object->getParent());
|
||||
|
||||
if ($new_position > $current_position) {
|
||||
// The new position is after the current position -> we will offset + 1 all categories located between us and the new position
|
||||
$search->filterByPosition(array('min' => 1+$current_position, 'max' => $new_position));
|
||||
|
||||
$delta = -1;
|
||||
} else {
|
||||
// The new position is brefore the current position -> we will offset - 1 all categories located between us and the new position
|
||||
$search->filterByPosition(array('min' => $new_position, 'max' => $current_position - 1));
|
||||
|
||||
$delta = 1;
|
||||
}
|
||||
|
||||
$results = $search->find();
|
||||
|
||||
$cnx = Propel::getWriteConnection(CategoryTableMap::DATABASE_NAME);
|
||||
|
||||
$cnx->beginTransaction();
|
||||
|
||||
try {
|
||||
foreach ($results as $result) {
|
||||
$result->setPosition($result->getPosition() + $delta)->save($cnx);
|
||||
}
|
||||
|
||||
$object
|
||||
->setDispatcher($this->getDispatcher())
|
||||
->setPosition($new_position)
|
||||
->save($cnx)
|
||||
;
|
||||
|
||||
$cnx->commit();
|
||||
} catch (Exception $e) {
|
||||
$cnx->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,16 @@
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
<service id="thelia.action.attribute" class="Thelia\Action\Attribute">
|
||||
<argument type="service" id="service_container"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
<service id="thelia.action.attributeav" class="Thelia\Action\AttributeAv">
|
||||
<argument type="service" id="service_container"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
<service id="thelia.action.pageNotFound" class="Thelia\Action\PageNotFound">
|
||||
<argument type="service" id="service_container"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
|
||||
@@ -67,6 +67,11 @@
|
||||
<form name="thelia.admin.currency.modification" class="Thelia\Form\CurrencyModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.coupon.creation" class="Thelia\Form\CouponCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.attribute.creation" class="Thelia\Form\AttributeCreationForm"/>
|
||||
<form name="thelia.admin.attribute.modification" class="Thelia\Form\AttributeModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.attributeav.creation" class="Thelia\Form\AttributeAvCreationForm"/>
|
||||
</forms>
|
||||
|
||||
|
||||
|
||||
@@ -37,11 +37,20 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\CustomerController::indexAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.customer.update.view" path="/admin/customer/update/{customer_id}">
|
||||
<route id="admin.customer.update.view" path="/admin/customer/update/{customer_id}" methods="get">
|
||||
<default key="_controller">Thelia\Controller\Admin\CustomerController::viewAction</default>
|
||||
<requirement key="customer_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="admin.customer.update.process" path="/admin/customer/update/{customer_id}" methods="post">
|
||||
<default key="_controller">Thelia\Controller\Admin\CustomerController::updateAction</default>
|
||||
<requirement key="customer_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="admin.customer.delete" path="/admin/customer/delete">
|
||||
<default key="_controller">Thelia\Controller\Admin\CustomerController::deleteAction</default>
|
||||
</route>
|
||||
|
||||
<!-- end Customer rule management -->
|
||||
|
||||
<!-- Order rule management -->
|
||||
@@ -50,6 +59,11 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\OrderController::indexAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.order.update.view" path="/admin/order/update/{order_id}">
|
||||
<default key="_controller">Thelia\Controller\Admin\OrderController::viewAction</default>
|
||||
<requirement key="order_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<!-- end Customer rule management -->
|
||||
|
||||
<!-- Categories management -->
|
||||
@@ -63,11 +77,11 @@
|
||||
</route>
|
||||
|
||||
<route id="admin.categories.update" path="/admin/categories/update">
|
||||
<default key="_controller">Thelia\Controller\Admin\CategoryController::changeAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\CategoryController::updateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.categories.save" path="/admin/categories/save">
|
||||
<default key="_controller">Thelia\Controller\Admin\CategoryController::saveChangeAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\CategoryController::processUpdateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.categories.set-default" path="/admin/categories/toggle-online">
|
||||
@@ -87,12 +101,8 @@
|
||||
</route>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Route to the Coupon controller (process Coupon browsing) -->
|
||||
|
||||
<route id="admin.coupon.list" path="/admin/coupon">
|
||||
<default key="_controller">Thelia\Controller\Admin\CouponController::browseAction</default>
|
||||
</route>
|
||||
@@ -115,10 +125,6 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\CouponController::consumeAction</default>
|
||||
</route>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Routes to the Config (system variables) controller -->
|
||||
|
||||
<route id="admin.configuration.variables.default" path="/admin/configuration/variables">
|
||||
@@ -134,11 +140,11 @@
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.variables.update" path="/admin/configuration/variables/update">
|
||||
<default key="_controller">Thelia\Controller\Admin\ConfigController::changeAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\ConfigController::updateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.variables.save" path="/admin/configuration/variables/save">
|
||||
<default key="_controller">Thelia\Controller\Admin\ConfigController::saveChangeAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\ConfigController::processUpdateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.variables.delete" path="/admin/configuration/variables/delete">
|
||||
@@ -156,11 +162,11 @@
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.messages.update" path="/admin/configuration/messages/update">
|
||||
<default key="_controller">Thelia\Controller\Admin\MessageController::changeAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\MessageController::updateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.messages.save" path="/admin/configuration/messages/save">
|
||||
<default key="_controller">Thelia\Controller\Admin\MessageController::saveChangeAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\MessageController::processUpdateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.messages.delete" path="/admin/configuration/messages/delete">
|
||||
@@ -178,11 +184,11 @@
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.currencies.update" path="/admin/configuration/currencies/update">
|
||||
<default key="_controller">Thelia\Controller\Admin\CurrencyController::changeAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\CurrencyController::updateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.currencies.save" path="/admin/configuration/currencies/save">
|
||||
<default key="_controller">Thelia\Controller\Admin\CurrencyController::saveChangeAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\CurrencyController::processUpdateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.currencies.set-default" path="/admin/configuration/currencies/set-default">
|
||||
@@ -205,16 +211,54 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\CurrencyController::updatePositionAction</default>
|
||||
</route>
|
||||
|
||||
<!-- attribute and feature routes management -->
|
||||
|
||||
<route id="admin.configuration.product-attribute.default" path="/admin/configuration/product-attributes">
|
||||
<!-- attribute and attributes value management -->
|
||||
|
||||
<route id="admin.configuration.attributes.default" path="/admin/configuration/attributes">
|
||||
<default key="_controller">Thelia\Controller\Admin\AttributeController::defaultAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.product-attribute.edit" path="/admin/configuration/product-attributes/update">
|
||||
<route id="admin.configuration.attributes.create" path="/admin/configuration/attributes/create">
|
||||
<default key="_controller">Thelia\Controller\Admin\AttributeController::createAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.attributes.update" path="/admin/configuration/attributes/update">
|
||||
<default key="_controller">Thelia\Controller\Admin\AttributeController::updateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.attributes.save" path="/admin/configuration/attributes/save">
|
||||
<default key="_controller">Thelia\Controller\Admin\AttributeController::processUpdateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.attributes.delete" path="/admin/configuration/attributes/delete">
|
||||
<default key="_controller">Thelia\Controller\Admin\AttributeController::deleteAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.attributes.update-position" path="/admin/configuration/attributes/update-position">
|
||||
<default key="_controller">Thelia\Controller\Admin\AttributeController::updatePositionAction</default>
|
||||
</route>
|
||||
|
||||
|
||||
<route id="admin.configuration.attributes-av.create" path="/admin/configuration/attributes-av/create">
|
||||
<default key="_controller">Thelia\Controller\Admin\AttributeAvController::createAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.attributes-av.update" path="/admin/configuration/attributes-av/update">
|
||||
<default key="_controller">Thelia\Controller\Admin\AttributeAvController::updateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.attributes-av.save" path="/admin/configuration/attributes-av/save">
|
||||
<default key="_controller">Thelia\Controller\Admin\AttributeAvController::processUpdateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.attributes-av.delete" path="/admin/configuration/attributes-av/delete">
|
||||
<default key="_controller">Thelia\Controller\Admin\AttributeAvController::deleteAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.attributes-av.update-position" path="/admin/configuration/attributes-av/update-position">
|
||||
<default key="_controller">Thelia\Controller\Admin\AttributeAvController::updatePositionAction</default>
|
||||
</route>
|
||||
|
||||
<!-- end attribute and feature routes management -->
|
||||
|
||||
<!-- The default route, to display a template -->
|
||||
|
||||
@@ -10,15 +10,31 @@
|
||||
</route>
|
||||
|
||||
<!-- Customer routes -->
|
||||
<route id="customer.create.view" path="/register">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_view">register</default>
|
||||
</route>
|
||||
|
||||
|
||||
<route id="customer.login.view" path="/login">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_view">login</default>
|
||||
</route>
|
||||
|
||||
<route id="customer.logout.process" path="/logout">
|
||||
<default key="_controller">Thelia\Controller\Front\CustomerController::logoutAction</default>
|
||||
</route>
|
||||
|
||||
<route id="customer.account.view" path="/customer/account">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_view">account</default>
|
||||
</route>
|
||||
|
||||
<route id="customer.create.process" path="/customer/create" methods="post">
|
||||
<default key="_controller">Thelia\Controller\Front\CustomerController::createAction</default>
|
||||
<default key="_view">register</default>
|
||||
</route>
|
||||
|
||||
<route id="customer.create.view" path="/register">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_view">register</default>
|
||||
</route>
|
||||
|
||||
<route id="customer.update.process" path="/customer/update" methods="post">
|
||||
<default key="_controller">Thelia\Controller\Front\CustomerController::updateAction</default>
|
||||
@@ -29,14 +45,6 @@
|
||||
<default key="_view">login</default>
|
||||
</route>
|
||||
|
||||
<route id="customer.login.view" path="/login">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_view">login</default>
|
||||
</route>
|
||||
|
||||
<route id="customer.logout.process" path="/logout">
|
||||
<default key="_controller">Thelia\Controller\Front\CustomerController::logoutAction</default>
|
||||
</route>
|
||||
|
||||
<route id="customer.password.retrieve.view" path="/password" methods="get">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
|
||||
473
core/lib/Thelia/Controller/Admin/AbstractCrudController.php
Normal file
473
core/lib/Thelia/Controller/Admin/AbstractCrudController.php
Normal file
@@ -0,0 +1,473 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Core\Event\ToggleVisibilityEvent;
|
||||
|
||||
/**
|
||||
* An abstract CRUD controller for Thelia ADMIN, to manage basic CRUD operations on a givent object.
|
||||
*
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
abstract class AbstractCrudController extends BaseAdminController
|
||||
{
|
||||
protected $objectName;
|
||||
|
||||
// List ordering
|
||||
protected $defaultListOrder;
|
||||
|
||||
// Permissions
|
||||
protected $viewPermissionIdentifier;
|
||||
protected $createPermissionIdentifier;
|
||||
protected $updatePermissionIdentifier;
|
||||
protected $deletePermissionIdentifier;
|
||||
|
||||
// Events
|
||||
protected $createEventIdentifier;
|
||||
protected $updateEventIdentifier;
|
||||
protected $deleteEventIdentifier;
|
||||
protected $visibilityToggleEventIdentifier;
|
||||
protected $changePositionEventIdentifier;
|
||||
|
||||
|
||||
/**
|
||||
* @param string $objectName the lower case object name. Example. "message"
|
||||
*
|
||||
* @param string $defaultListOrder the default object list order, or null if list is not sortable. Example: manual
|
||||
*
|
||||
* @param string $viewPermissionIdentifier the 'view' permission identifier. Example: "admin.configuration.message.view"
|
||||
* @param string $createPermissionIdentifier the 'create' permission identifier. Example: "admin.configuration.message.create"
|
||||
* @param string $updatePermissionIdentifier the 'update' permission identifier. Example: "admin.configuration.message.update"
|
||||
* @param string $deletePermissionIdentifier the 'delete' permission identifier. Example: "admin.configuration.message.delete"
|
||||
*
|
||||
* @param string $createEventIdentifier the dispatched create TheliaEvent identifier. Example: TheliaEvents::MESSAGE_CREATE
|
||||
* @param string $updateEventIdentifier the dispatched update TheliaEvent identifier. Example: TheliaEvents::MESSAGE_UPDATE
|
||||
* @param string $deleteEventIdentifier the dispatched delete TheliaEvent identifier. Example: TheliaEvents::MESSAGE_DELETE
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public function __construct(
|
||||
$objectName,
|
||||
|
||||
$defaultListOrder = null,
|
||||
|
||||
$viewPermissionIdentifier,
|
||||
$createPermissionIdentifier,
|
||||
$updatePermissionIdentifier,
|
||||
$deletePermissionIdentifier,
|
||||
|
||||
$createEventIdentifier,
|
||||
$updateEventIdentifier,
|
||||
$deleteEventIdentifier,
|
||||
$visibilityToggleEventIdentifier = null,
|
||||
$changePositionEventIdentifier = null
|
||||
) {
|
||||
$this->objectName = $objectName;
|
||||
|
||||
$this->defaultListOrder = $defaultListOrder;
|
||||
|
||||
$this->viewPermissionIdentifier = $viewPermissionIdentifier;
|
||||
$this->createPermissionIdentifier = $createPermissionIdentifier;
|
||||
$this->updatePermissionIdentifier = $updatePermissionIdentifier;
|
||||
$this->deletePermissionIdentifier = $deletePermissionIdentifier;
|
||||
|
||||
$this->createEventIdentifier = $createEventIdentifier;
|
||||
$this->updateEventIdentifier = $updateEventIdentifier;
|
||||
$this->deleteEventIdentifier = $deleteEventIdentifier;
|
||||
$this->visibilityToggleEventIdentifier = $visibilityToggleEventIdentifier;
|
||||
$this->changePositionEventIdentifier = $changePositionEventIdentifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the creation form for this object
|
||||
*/
|
||||
protected abstract function getCreationForm();
|
||||
|
||||
/**
|
||||
* Return the update form for this object
|
||||
*/
|
||||
protected abstract function getUpdateForm();
|
||||
|
||||
/**
|
||||
* Hydrate the update form for this object, before passing it to the update template
|
||||
*
|
||||
* @param unknown $object
|
||||
*/
|
||||
protected abstract function hydrateObjectForm($object);
|
||||
|
||||
/**
|
||||
* Creates the creation event with the provided form data
|
||||
*
|
||||
* @param unknown $formData
|
||||
*/
|
||||
protected abstract function getCreationEvent($formData);
|
||||
|
||||
/**
|
||||
* Creates the update event with the provided form data
|
||||
*
|
||||
* @param unknown $formData
|
||||
*/
|
||||
protected abstract function getUpdateEvent($formData);
|
||||
|
||||
/**
|
||||
* Creates the delete event with the provided form data
|
||||
*/
|
||||
protected abstract function getDeleteEvent();
|
||||
|
||||
/**
|
||||
* Return true if the event contains the object, e.g. the action has updated the object in the event.
|
||||
*
|
||||
* @param unknown $event
|
||||
*/
|
||||
protected abstract function eventContainsObject($event);
|
||||
|
||||
/**
|
||||
* Get the created object from an event.
|
||||
*
|
||||
* @param unknown $createEvent
|
||||
*/
|
||||
protected abstract function getObjectFromEvent($event);
|
||||
|
||||
/**
|
||||
* Load an existing object from the database
|
||||
*/
|
||||
protected abstract function getExistingObject();
|
||||
|
||||
/**
|
||||
* Returns the object label form the object event (name, title, etc.)
|
||||
*
|
||||
* @param unknown $object
|
||||
*/
|
||||
protected abstract function getObjectLabel($object);
|
||||
|
||||
/**
|
||||
* Returns the object ID from the object
|
||||
*
|
||||
* @param unknown $object
|
||||
*/
|
||||
protected abstract function getObjectId($object);
|
||||
|
||||
/**
|
||||
* Render the main list template
|
||||
*
|
||||
* @param unknown $currentOrder, if any, null otherwise.
|
||||
*/
|
||||
protected abstract function renderListTemplate($currentOrder);
|
||||
|
||||
/**
|
||||
* Render the edition template
|
||||
*/
|
||||
protected abstract function renderEditionTemplate();
|
||||
|
||||
/**
|
||||
* Redirect to the edition template
|
||||
*/
|
||||
protected abstract function redirectToEditionTemplate();
|
||||
|
||||
/**
|
||||
* Redirect to the list template
|
||||
*/
|
||||
protected abstract function redirectToListTemplate();
|
||||
|
||||
|
||||
protected function createUpdatePositionEvent($positionChangeMode, $positionValue) {
|
||||
throw new \LogicException ("Position Update is not supported for this object");
|
||||
}
|
||||
|
||||
protected function createToggleVisibilityEvent() {
|
||||
|
||||
throw new \LogicException ("Toggle Visibility is not supported for this object");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current list order identifier, updating it in the same time.
|
||||
*/
|
||||
protected function getCurrentListOrder($update_session = true) {
|
||||
|
||||
$order = null;
|
||||
|
||||
if ($this->defaultListOrder) {
|
||||
|
||||
$orderSessionIdentifier = sprintf("admin.%s.currentListOrder", $this->objectName);
|
||||
|
||||
// Find the current order
|
||||
$order = $this->getRequest()->get(
|
||||
'order',
|
||||
$this->getSession()->get($orderSessionIdentifier, $this->defaultListOrder)
|
||||
);
|
||||
|
||||
if ($update_session) $this->getSession()->set($orderSessionIdentifier, $order);
|
||||
}
|
||||
|
||||
return $order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the object list, ensuring the sort order is set.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
protected function renderList()
|
||||
{
|
||||
return $this->renderListTemplate($this->getCurrentListOrder());
|
||||
}
|
||||
|
||||
/**
|
||||
* The default action is displaying the list.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth($this->viewPermissionIdentifier)) return $response;
|
||||
|
||||
return $this->renderList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new object
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function createAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->createPermissionIdentifier)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
// Create the Creation Form
|
||||
$creationForm = $this->getCreationForm($this->getRequest());
|
||||
|
||||
try {
|
||||
|
||||
// Validate the form, create the event and dispatch it.
|
||||
$form = $this->validateForm($creationForm, "POST");
|
||||
|
||||
$data = $form->getData();
|
||||
|
||||
$createEvent = $this->getCreationEvent($data);
|
||||
|
||||
$this->dispatch($this->createEventIdentifier, $createEvent);
|
||||
|
||||
if (! $this->eventContainsObject($createEvent))
|
||||
throw new \LogicException(
|
||||
$this->getTranslator()->trans("No %obj was created.", array('%obj', $this->objectName)));
|
||||
|
||||
if (null !== $createdObject = $this->getObjectFromEvent($createEvent)) {
|
||||
// Log object creation
|
||||
$this->adminLogAppend(sprintf("%s %s (ID %s) created", ucfirst($this->objectName), $this->getObjectLabel($createdObject), $this->getObjectId($createdObject)));
|
||||
}
|
||||
|
||||
// Substitute _ID_ in the URL with the ID of the created object
|
||||
$successUrl = str_replace('_ID_', $this->getObjectId($createdObject), $creationForm->getSuccessUrl());
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($successUrl);
|
||||
|
||||
}
|
||||
catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$error_msg = $ex->getMessage();
|
||||
}
|
||||
|
||||
$this->setupFormErrorContext(
|
||||
$this->getTranslator()->trans("%obj creation", array('%obj' => $this->objectName)), $error_msg, $creationForm, $ex);
|
||||
|
||||
// At this point, the form has error, and should be redisplayed.
|
||||
return $this->renderList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a object for modification, and display the edit template.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function updateAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
// Load the object
|
||||
$object = $this->getExistingObject($this->getRequest());
|
||||
|
||||
if ($object != null) {
|
||||
|
||||
// Hydrate the form abd pass it to the parser
|
||||
$changeForm = $this->hydrateObjectForm($object);
|
||||
|
||||
// Pass it to the parser
|
||||
$this->getParserContext()->addForm($changeForm);
|
||||
}
|
||||
|
||||
// Render the edition template.
|
||||
return $this->renderEditionTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save changes on a modified object, and either go back to the object list, or stay on the edition page.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function processUpdateAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
// Create the form from the request
|
||||
$changeForm = $this->getUpdateForm($this->getRequest());
|
||||
|
||||
try {
|
||||
|
||||
// Check the form against constraints violations
|
||||
$form = $this->validateForm($changeForm, "POST");
|
||||
|
||||
// Get the form field values
|
||||
$data = $form->getData();
|
||||
|
||||
$changeEvent = $this->getUpdateEvent($data);
|
||||
|
||||
$this->dispatch($this->updateEventIdentifier, $changeEvent);
|
||||
|
||||
if (! $this->eventContainsObject($changeEvent))
|
||||
throw new \LogicException(
|
||||
$this->getTranslator()->trans("No %obj was updated.", array('%obj', $this->objectName)));
|
||||
|
||||
// Log object modification
|
||||
if (null !== $changedObject = $this->getObjectFromEvent($changeEvent)) {
|
||||
$this->adminLogAppend(sprintf("%s %s (ID %s) modified", ucfirst($this->objectName), $this->getObjectLabel($changedObject), $this->getObjectId($changedObject)));
|
||||
}
|
||||
|
||||
// If we have to stay on the same page, do not redirect to the succesUrl,
|
||||
// just redirect to the edit page again.
|
||||
if ($this->getRequest()->get('save_mode') == 'stay') {
|
||||
$this->redirectToEditionTemplate($this->getRequest());
|
||||
}
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($changeForm->getSuccessUrl());
|
||||
}
|
||||
catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$error_msg = $ex->getMessage();
|
||||
}
|
||||
|
||||
$this->setupFormErrorContext(
|
||||
$this->getTranslator()->trans("%obj modification", array('%obj' => $this->objectName)), $error_msg, $changeForm, $ex);
|
||||
|
||||
// At this point, the form has errors, and should be redisplayed.
|
||||
return $this->renderEditionTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update object position (only for objects whichsupport that)
|
||||
*/
|
||||
public function updatePositionAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
try {
|
||||
$mode = $this->getRequest()->get('mode', null);
|
||||
|
||||
if ($mode == 'up')
|
||||
$mode = UpdatePositionEvent::POSITION_UP;
|
||||
else if ($mode == 'down')
|
||||
$mode = UpdatePositionEvent::POSITION_DOWN;
|
||||
else
|
||||
$mode = UpdatePositionEvent::POSITION_ABSOLUTE;
|
||||
|
||||
$position = $this->getRequest()->get('position', null);
|
||||
|
||||
$event = $this->createUpdatePositionEvent($mode, $position);
|
||||
|
||||
$this->dispatch($this->changePositionEventIdentifier, $event);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
|
||||
$this->redirectToListTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Online status toggle (only for object which support it)
|
||||
*/
|
||||
public function setToggleVisibilityAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$changeEvent = $this->createToggleVisibilityEvent($this->getRequest());
|
||||
|
||||
// Create and dispatch the change event
|
||||
$changeEvent->setIsDefault(true);
|
||||
|
||||
try {
|
||||
$this->dispatch($this->visibilityToggleEventIdentifier, $changeEvent);
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
|
||||
$this->redirectToRoute('admin.categories.default');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an object
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function deleteAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->deletePermissionIdentifier)) return $response;
|
||||
|
||||
// Get the currency id, and dispatch the delet request
|
||||
$deleteEvent = $this->getDeleteEvent();
|
||||
|
||||
$this->dispatch($this->deleteEventIdentifier, $deleteEvent);
|
||||
|
||||
if (null !== $deletedObject = $this->getObjectFromEvent($deleteEvent)) {
|
||||
$this->adminLogAppend(
|
||||
sprintf("%s %s (ID %s) deleted", ucfirst($this->objectName), $this->getObjectLabel($deletedObject), $this->getObjectId($deletedObject)));
|
||||
}
|
||||
|
||||
$this->redirectToListTemplate();
|
||||
}
|
||||
}
|
||||
180
core/lib/Thelia/Controller/Admin/AttributeAvController.php
Normal file
180
core/lib/Thelia/Controller/Admin/AttributeAvController.php
Normal file
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AttributeAvDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\AttributeAvUpdateEvent;
|
||||
use Thelia\Core\Event\AttributeAvCreateEvent;
|
||||
use Thelia\Model\AttributeAvQuery;
|
||||
use Thelia\Form\AttributeAvModificationForm;
|
||||
use Thelia\Form\AttributeAvCreationForm;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
|
||||
/**
|
||||
* Manages attributes-av sent by mail
|
||||
*
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class AttributeAvController extends AbstractCrudController
|
||||
{
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'attribute',
|
||||
'manual',
|
||||
|
||||
'admin.configuration.attributes-av.view',
|
||||
'admin.configuration.attributes-av.create',
|
||||
'admin.configuration.attributes-av.update',
|
||||
'admin.configuration.attributes-av.delete',
|
||||
|
||||
TheliaEvents::ATTRIBUTE_AV_CREATE,
|
||||
TheliaEvents::ATTRIBUTE_AV_UPDATE,
|
||||
TheliaEvents::ATTRIBUTE_AV_DELETE,
|
||||
null, // No visibility toggle
|
||||
TheliaEvents::ATTRIBUTE_AV_UPDATE_POSITION
|
||||
);
|
||||
}
|
||||
|
||||
protected function getCreationForm() {
|
||||
return new AttributeAvCreationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getUpdateForm() {
|
||||
return new AttributeAvModificationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getCreationEvent($formData) {
|
||||
$createEvent = new AttributeAvCreateEvent();
|
||||
|
||||
$createEvent
|
||||
->setAttributeId($formData['attribute_id'])
|
||||
->setTitle($formData['title'])
|
||||
->setLocale($formData["locale"])
|
||||
;
|
||||
|
||||
return $createEvent;
|
||||
}
|
||||
|
||||
protected function getUpdateEvent($formData) {
|
||||
|
||||
$changeEvent = new AttributeAvUpdateEvent($formData['id']);
|
||||
|
||||
// Create and dispatch the change event
|
||||
$changeEvent
|
||||
->setLocale($formData["locale"])
|
||||
->setTitle($formData['title'])
|
||||
->setChapo($formData['chapo'])
|
||||
->setDescription($formData['description'])
|
||||
->setPostscriptum($formData['postscriptum'])
|
||||
;
|
||||
|
||||
return $changeEvent;
|
||||
}
|
||||
|
||||
protected function createUpdatePositionEvent($positionChangeMode, $positionValue) {
|
||||
|
||||
return new UpdatePositionEvent(
|
||||
$this->getRequest()->get('attributeav_id', null),
|
||||
$positionChangeMode,
|
||||
$positionValue
|
||||
);
|
||||
}
|
||||
|
||||
protected function getDeleteEvent() {
|
||||
return new AttributeAvDeleteEvent($this->getRequest()->get('attributeav_id'));
|
||||
}
|
||||
|
||||
protected function eventContainsObject($event) {
|
||||
return $event->hasAttributeAv();
|
||||
}
|
||||
|
||||
protected function hydrateObjectForm($object) {
|
||||
|
||||
$data = array(
|
||||
'id' => $object->getId(),
|
||||
'locale' => $object->getLocale(),
|
||||
'title' => $object->getTitle(),
|
||||
'chapo' => $object->getChapo(),
|
||||
'description' => $object->getDescription(),
|
||||
'postscriptum' => $object->getPostscriptum()
|
||||
);
|
||||
|
||||
// Setup the object form
|
||||
return new AttributeAvModificationForm($this->getRequest(), "form", $data);
|
||||
}
|
||||
|
||||
protected function getObjectFromEvent($event) {
|
||||
return $event->hasAttributeAv() ? $event->getAttributeAv() : null;
|
||||
}
|
||||
|
||||
protected function getExistingObject() {
|
||||
return AttributeAvQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->findOneById($this->getRequest()->get('attributeav_id'));
|
||||
}
|
||||
|
||||
protected function getObjectLabel($object) {
|
||||
return $object->getTitle();
|
||||
}
|
||||
|
||||
protected function getObjectId($object) {
|
||||
return $object->getId();
|
||||
}
|
||||
|
||||
protected function getViewArguments() {
|
||||
return array(
|
||||
'attribute_id' => $this->getRequest()->get('attribute_id'),
|
||||
'order' => $this->getCurrentListOrder()
|
||||
);
|
||||
}
|
||||
|
||||
protected function renderListTemplate($currentOrder) {
|
||||
// We always return to the attribute edition form
|
||||
return $this->render(
|
||||
'attribute-edit',
|
||||
$this->getViewArguments()
|
||||
);
|
||||
}
|
||||
|
||||
protected function renderEditionTemplate() {
|
||||
// We always return to the attribute edition form
|
||||
return $this->render('attribute-edit', $this->getViewArguments());
|
||||
}
|
||||
|
||||
protected function redirectToEditionTemplate() {
|
||||
// We always return to the attribute edition form
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.attributes.update",
|
||||
$this->getViewArguments()
|
||||
);
|
||||
}
|
||||
|
||||
protected function redirectToListTemplate() {
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.attributes.update",
|
||||
$this->getViewArguments()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -23,27 +23,142 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AttributeDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\AttributeUpdateEvent;
|
||||
use Thelia\Core\Event\AttributeCreateEvent;
|
||||
use Thelia\Model\AttributeQuery;
|
||||
use Thelia\Form\AttributeModificationForm;
|
||||
use Thelia\Form\AttributeCreationForm;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
|
||||
/**
|
||||
* Manages messages sent by mail
|
||||
* Manages attributes sent by mail
|
||||
*
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class AttributeController extends BaseAdminController
|
||||
class AttributeController extends AbstractCrudController
|
||||
{
|
||||
/**
|
||||
* The default action is displaying the attributes list.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.attributes.view")) return $response;
|
||||
return $this->render('product-attributes');
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'attribute',
|
||||
'manual',
|
||||
|
||||
'admin.configuration.attributes.view',
|
||||
'admin.configuration.attributes.create',
|
||||
'admin.configuration.attributes.update',
|
||||
'admin.configuration.attributes.delete',
|
||||
|
||||
TheliaEvents::ATTRIBUTE_CREATE,
|
||||
TheliaEvents::ATTRIBUTE_UPDATE,
|
||||
TheliaEvents::ATTRIBUTE_DELETE,
|
||||
null, // No visibility toggle
|
||||
TheliaEvents::ATTRIBUTE_UPDATE_POSITION
|
||||
);
|
||||
}
|
||||
|
||||
public function updateAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.attributes.update")) return $response;
|
||||
return $this->render('product-attributes-edit');
|
||||
protected function getCreationForm() {
|
||||
return new AttributeCreationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getUpdateForm() {
|
||||
return new AttributeModificationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getCreationEvent($formData) {
|
||||
$createEvent = new AttributeCreateEvent();
|
||||
|
||||
$createEvent
|
||||
->setTitle($formData['title'])
|
||||
->setLocale($formData["locale"])
|
||||
->setAddToAllTemplates($formData['add_to_all'])
|
||||
;
|
||||
|
||||
return $createEvent;
|
||||
}
|
||||
|
||||
protected function getUpdateEvent($formData) {
|
||||
|
||||
$changeEvent = new AttributeUpdateEvent($formData['id']);
|
||||
|
||||
// Create and dispatch the change event
|
||||
$changeEvent
|
||||
->setLocale($formData["locale"])
|
||||
->setTitle($formData['title'])
|
||||
->setChapo($formData['chapo'])
|
||||
->setDescription($formData['description'])
|
||||
->setPostscriptum($formData['postscriptum'])
|
||||
;
|
||||
|
||||
return $changeEvent;
|
||||
}
|
||||
|
||||
protected function createUpdatePositionEvent($positionChangeMode, $positionValue) {
|
||||
|
||||
return new UpdatePositionEvent(
|
||||
$this->getRequest()->get('attribute_id', null),
|
||||
$positionChangeMode,
|
||||
$positionValue
|
||||
);
|
||||
}
|
||||
|
||||
protected function getDeleteEvent() {
|
||||
return new AttributeDeleteEvent($this->getRequest()->get('attribute_id'));
|
||||
}
|
||||
|
||||
protected function eventContainsObject($event) {
|
||||
return $event->hasAttribute();
|
||||
}
|
||||
|
||||
protected function hydrateObjectForm($object) {
|
||||
|
||||
$data = array(
|
||||
'id' => $object->getId(),
|
||||
'locale' => $object->getLocale(),
|
||||
'title' => $object->getTitle(),
|
||||
'chapo' => $object->getChapo(),
|
||||
'description' => $object->getDescription(),
|
||||
'postscriptum' => $object->getPostscriptum()
|
||||
);
|
||||
|
||||
// Setup the object form
|
||||
return new AttributeModificationForm($this->getRequest(), "form", $data);
|
||||
}
|
||||
|
||||
protected function getObjectFromEvent($event) {
|
||||
return $event->hasAttribute() ? $event->getAttribute() : null;
|
||||
}
|
||||
|
||||
protected function getExistingObject() {
|
||||
return AttributeQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->findOneById($this->getRequest()->get('attribute_id'));
|
||||
}
|
||||
|
||||
protected function getObjectLabel($object) {
|
||||
return $object->getTitle();
|
||||
}
|
||||
|
||||
protected function getObjectId($object) {
|
||||
return $object->getId();
|
||||
}
|
||||
|
||||
protected function renderListTemplate($currentOrder) {
|
||||
return $this->render('attributes', array('order' => $currentOrder));
|
||||
}
|
||||
|
||||
protected function renderEditionTemplate() {
|
||||
return $this->render('attribute-edit', array('attribute_id' => $this->getRequest()->get('attribute_id')));
|
||||
}
|
||||
|
||||
protected function redirectToEditionTemplate() {
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.attributes.update",
|
||||
array('attribute_id' => $this->getRequest()->get('attribute_id'))
|
||||
);
|
||||
}
|
||||
|
||||
protected function redirectToListTemplate() {
|
||||
$this->redirectToRoute('admin.configuration.attributes.default');
|
||||
}
|
||||
}
|
||||
@@ -25,228 +25,144 @@ namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\ConfigDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Core\Event\ConfigUpdateEvent;
|
||||
use Thelia\Core\Event\ConfigCreateEvent;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Form\ConfigModificationForm;
|
||||
use Thelia\Form\ConfigCreationForm;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
|
||||
/**
|
||||
* Manages Thelmia system variables, aka Config objects.
|
||||
* Manages variables sent by mail
|
||||
*
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class ConfigController extends BaseAdminController
|
||||
class ConfigController extends AbstractCrudController
|
||||
{
|
||||
/**
|
||||
* Render the currencies list, ensuring the sort order is set.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
protected function renderList()
|
||||
{
|
||||
// Find the current order
|
||||
$order = $this->getRequest()->get(
|
||||
'order',
|
||||
$this->getSession()->get('admin.variables_order', 'name')
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'variable',
|
||||
'name',
|
||||
|
||||
'admin.configuration.variables.view',
|
||||
'admin.configuration.variables.create',
|
||||
'admin.configuration.variables.update',
|
||||
'admin.configuration.variables.delete',
|
||||
|
||||
TheliaEvents::CONFIG_CREATE,
|
||||
TheliaEvents::CONFIG_UPDATE,
|
||||
TheliaEvents::CONFIG_DELETE,
|
||||
null, // No visibility toggle
|
||||
null // no position change
|
||||
);
|
||||
}
|
||||
|
||||
protected function getCreationForm() {
|
||||
return new ConfigCreationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getUpdateForm() {
|
||||
return new ConfigModificationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getCreationEvent($data) {
|
||||
$createEvent = new ConfigCreateEvent();
|
||||
|
||||
$createEvent
|
||||
->setEventName($data['name'])
|
||||
->setValue($data['value'])
|
||||
->setLocale($data["locale"])
|
||||
->setTitle($data['title'])
|
||||
->setHidden($data['hidden'])
|
||||
->setSecured($data['secured'])
|
||||
;
|
||||
|
||||
|
||||
return $createEvent;
|
||||
}
|
||||
|
||||
protected function getUpdateEvent($data) {
|
||||
$changeEvent = new ConfigUpdateEvent($data['id']);
|
||||
|
||||
// Create and dispatch the change event
|
||||
$changeEvent
|
||||
->setEventName($data['name'])
|
||||
->setValue($data['value'])
|
||||
->setHidden($data['hidden'])
|
||||
->setSecured($data['secured'])
|
||||
->setLocale($data["locale"])
|
||||
->setTitle($data['title'])
|
||||
->setChapo($data['chapo'])
|
||||
->setDescription($data['description'])
|
||||
->setPostscriptum($data['postscriptum'])
|
||||
;
|
||||
|
||||
return $changeEvent;
|
||||
}
|
||||
|
||||
protected function getDeleteEvent() {
|
||||
return new ConfigDeleteEvent($this->getRequest()->get('variable_id'));
|
||||
}
|
||||
|
||||
protected function eventContainsObject($event) {
|
||||
return $event->hasConfig();
|
||||
}
|
||||
|
||||
protected function hydrateObjectForm($object) {
|
||||
|
||||
// Prepare the data that will hydrate the form
|
||||
$data = array(
|
||||
'id' => $object->getId(),
|
||||
'name' => $object->getName(),
|
||||
'value' => $object->getValue(),
|
||||
'hidden' => $object->getHidden(),
|
||||
'secured' => $object->getSecured(),
|
||||
'locale' => $object->getLocale(),
|
||||
'title' => $object->getTitle(),
|
||||
'chapo' => $object->getChapo(),
|
||||
'description' => $object->getDescription(),
|
||||
'postscriptum' => $object->getPostscriptum()
|
||||
);
|
||||
|
||||
// Store the current sort order in session
|
||||
$this->getSession()->set('admin.variables_order', $order);
|
||||
|
||||
return $this->render('variables', array('order' => $order));
|
||||
// Setup the object form
|
||||
return new ConfigModificationForm($this->getRequest(), "form", $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* The default action is displaying the variables list.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.view")) return $response;
|
||||
return $this->renderList();
|
||||
protected function getObjectFromEvent($event) {
|
||||
return $event->hasConfig() ? $event->getConfig() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new config object
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function createAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.create")) return $response;
|
||||
|
||||
$message = false;
|
||||
|
||||
// Create the Creation Form
|
||||
$creationForm = new ConfigCreationForm($this->getRequest());
|
||||
|
||||
try {
|
||||
|
||||
// Validate the form, create the ConfigCreation event and dispatch it.
|
||||
$form = $this->validateForm($creationForm, "POST");
|
||||
|
||||
$data = $form->getData();
|
||||
|
||||
$createEvent = new ConfigCreateEvent();
|
||||
|
||||
$createEvent
|
||||
->setEventName($data['name'])
|
||||
->setValue($data['value'])
|
||||
->setLocale($data["locale"])
|
||||
->setTitle($data['title'])
|
||||
->setHidden($data['hidden'])
|
||||
->setSecured($data['secured'])
|
||||
;
|
||||
|
||||
$this->dispatch(TheliaEvents::CONFIG_CREATE, $createEvent);
|
||||
|
||||
if (! $createEvent->hasConfig()) throw new \LogicException($this->getTranslator()->trans("No variable was created."));
|
||||
|
||||
$createdObject = $createEvent->getConfig();
|
||||
|
||||
// Log config creation
|
||||
$this->adminLogAppend(sprintf("Variable %s (ID %s) created", $createdObject->getName(), $createdObject->getId()));
|
||||
|
||||
// Substitute _ID_ in the URL with the ID of the created object
|
||||
$successUrl = str_replace('_ID_', $createdObject->getId(), $creationForm->getSuccessUrl());
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($successUrl);
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$message = $ex->getMessage();
|
||||
}
|
||||
|
||||
$this->setupFormErrorContext("variable creation", $message, $creationForm, $ex);
|
||||
|
||||
// At this point, the form has error, and should be redisplayed.
|
||||
return $this->renderList();
|
||||
protected function getExistingObject() {
|
||||
return ConfigQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->findOneById($this->getRequest()->get('variable_id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a config object for modification, and display the edit template.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function changeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response;
|
||||
protected function getObjectLabel($object) {
|
||||
return $object->getName();
|
||||
}
|
||||
|
||||
// Load the config object
|
||||
$config = ConfigQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->findOneById($this->getRequest()->get('variable_id'));
|
||||
protected function getObjectId($object) {
|
||||
return $object->getId();
|
||||
}
|
||||
|
||||
if ($config != null) {
|
||||
protected function renderListTemplate($currentOrder) {
|
||||
return $this->render('variables', array('order' => $currentOrder));
|
||||
}
|
||||
|
||||
// Prepare the data that will hydrate the form
|
||||
$data = array(
|
||||
'id' => $config->getId(),
|
||||
'name' => $config->getName(),
|
||||
'value' => $config->getValue(),
|
||||
'hidden' => $config->getHidden(),
|
||||
'secured' => $config->getSecured(),
|
||||
'locale' => $config->getLocale(),
|
||||
'title' => $config->getTitle(),
|
||||
'chapo' => $config->getChapo(),
|
||||
'description' => $config->getDescription(),
|
||||
'postscriptum' => $config->getPostscriptum()
|
||||
);
|
||||
|
||||
// Setup the object form
|
||||
$changeForm = new ConfigModificationForm($this->getRequest(), "form", $data);
|
||||
|
||||
// Pass it to the parser
|
||||
$this->getParserContext()->addForm($changeForm);
|
||||
}
|
||||
|
||||
// Render the edition template.
|
||||
protected function renderEditionTemplate() {
|
||||
return $this->render('variable-edit', array('variable_id' => $this->getRequest()->get('variable_id')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Save changes on a modified config object, and either go back to the variable list, or stay on the edition page.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function saveChangeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response;
|
||||
protected function redirectToEditionTemplate() {
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.variables.update",
|
||||
array('variable_id' => $this->getRequest()->get('variable_id'))
|
||||
);
|
||||
}
|
||||
|
||||
$message = false;
|
||||
|
||||
// Create the form from the request
|
||||
$changeForm = new ConfigModificationForm($this->getRequest());
|
||||
|
||||
// Get the variable ID
|
||||
$variable_id = $this->getRequest()->get('variable_id');
|
||||
|
||||
try {
|
||||
|
||||
// Check the form against constraints violations
|
||||
$form = $this->validateForm($changeForm, "POST");
|
||||
|
||||
// Get the form field values
|
||||
$data = $form->getData();
|
||||
|
||||
$changeEvent = new ConfigUpdateEvent($data['id']);
|
||||
|
||||
// Create and dispatch the change event
|
||||
$changeEvent
|
||||
->setEventName($data['name'])
|
||||
->setValue($data['value'])
|
||||
->setHidden($data['hidden'])
|
||||
->setSecured($data['secured'])
|
||||
->setLocale($data["locale"])
|
||||
->setTitle($data['title'])
|
||||
->setChapo($data['chapo'])
|
||||
->setDescription($data['description'])
|
||||
->setPostscriptum($data['postscriptum'])
|
||||
;
|
||||
|
||||
$this->dispatch(TheliaEvents::CONFIG_UPDATE, $changeEvent);
|
||||
|
||||
if (! $changeEvent->hasConfig()) throw new \LogicException($this->getTranslator()->trans("No variable was updated."));
|
||||
|
||||
// Log config modification
|
||||
$changedObject = $changeEvent->getConfig();
|
||||
|
||||
$this->adminLogAppend(sprintf("Variable %s (ID %s) modified", $changedObject->getName(), $changedObject->getId()));
|
||||
|
||||
// If we have to stay on the same page, do not redirect to the succesUrl,
|
||||
// just redirect to the edit page again.
|
||||
if ($this->getRequest()->get('save_mode') == 'stay') {
|
||||
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.variables.update",
|
||||
array('variable_id' => $variable_id)
|
||||
);
|
||||
}
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($changeForm->getSuccessUrl());
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$message = $ex->getMessage();
|
||||
}
|
||||
|
||||
$this->setupFormErrorContext("variable edition", $message, $changeForm, $ex);
|
||||
|
||||
// At this point, the form has errors, and should be redisplayed.
|
||||
return $this->render('variable-edit', array('variable_id' => $variable_id));
|
||||
protected function redirectToListTemplate() {
|
||||
$this->redirectToRoute('admin.configuration.variables.default');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -271,25 +187,4 @@ class ConfigController extends BaseAdminController
|
||||
|
||||
$this->redirectToRoute('admin.configuration.variables.default');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a config object
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function deleteAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.delete")) return $response;
|
||||
|
||||
// Get the config id, and dispatch the delet request
|
||||
$event = new ConfigDeleteEvent($this->getRequest()->get('variable_id'));
|
||||
|
||||
$this->dispatch(TheliaEvents::CONFIG_DELETE, $event);
|
||||
|
||||
if ($event->hasConfig())
|
||||
$this->adminLogAppend(sprintf("Variable %s (ID %s) modified", $event->getConfig()->getName(), $event->getConfig()->getId()));
|
||||
|
||||
$this->redirectToRoute('admin.configuration.variables.default');
|
||||
}
|
||||
}
|
||||
@@ -25,219 +25,162 @@ namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\CurrencyDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Core\Event\CurrencyUpdateEvent;
|
||||
use Thelia\Core\Event\CurrencyCreateEvent;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
use Thelia\Form\CurrencyModificationForm;
|
||||
use Thelia\Form\CurrencyCreationForm;
|
||||
use Thelia\Core\Event\CurrencyUpdatePositionEvent;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
|
||||
/**
|
||||
* Manages currencies sent by mail
|
||||
*
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class CurrencyController extends BaseAdminController
|
||||
class CurrencyController extends AbstractCrudController
|
||||
{
|
||||
/**
|
||||
* Render the currencies list, ensuring the sort order is set.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
protected function renderList()
|
||||
{
|
||||
// Find the current order
|
||||
$order = $this->getRequest()->get(
|
||||
'order',
|
||||
$this->getSession()->get('admin.currency_order', 'manual')
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'currency',
|
||||
'manual',
|
||||
|
||||
'admin.configuration.currencies.view',
|
||||
'admin.configuration.currencies.create',
|
||||
'admin.configuration.currencies.update',
|
||||
'admin.configuration.currencies.delete',
|
||||
|
||||
TheliaEvents::CURRENCY_CREATE,
|
||||
TheliaEvents::CURRENCY_UPDATE,
|
||||
TheliaEvents::CURRENCY_DELETE,
|
||||
null, // No visibility toggle
|
||||
TheliaEvents::CURRENCY_UPDATE_POSITION
|
||||
);
|
||||
}
|
||||
|
||||
protected function getCreationForm() {
|
||||
return new CurrencyCreationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getUpdateForm() {
|
||||
return new CurrencyModificationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getCreationEvent($formData) {
|
||||
$createEvent = new CurrencyCreateEvent();
|
||||
|
||||
$createEvent
|
||||
->setCurrencyName($formData['name'])
|
||||
->setLocale($formData["locale"])
|
||||
->setSymbol($formData['symbol'])
|
||||
->setCode($formData['code'])
|
||||
->setRate($formData['rate'])
|
||||
;
|
||||
|
||||
return $createEvent;
|
||||
}
|
||||
|
||||
protected function getUpdateEvent($formData) {
|
||||
$changeEvent = new CurrencyUpdateEvent($formData['id']);
|
||||
|
||||
// Create and dispatch the change event
|
||||
$changeEvent
|
||||
->setCurrencyName($formData['name'])
|
||||
->setLocale($formData["locale"])
|
||||
->setSymbol($formData['symbol'])
|
||||
->setCode($formData['code'])
|
||||
->setRate($formData['rate'])
|
||||
;
|
||||
|
||||
return $changeEvent;
|
||||
}
|
||||
|
||||
protected function createUpdatePositionEvent($positionChangeMode, $positionValue) {
|
||||
|
||||
return new UpdatePositionEvent(
|
||||
$this->getRequest()->get('currency_id', null),
|
||||
$positionChangeMode,
|
||||
$positionValue
|
||||
);
|
||||
}
|
||||
|
||||
protected function getDeleteEvent() {
|
||||
return new CurrencyDeleteEvent($this->getRequest()->get('currency_id'));
|
||||
}
|
||||
|
||||
protected function eventContainsObject($event) {
|
||||
return $event->hasCurrency();
|
||||
}
|
||||
|
||||
protected function hydrateObjectForm($object) {
|
||||
|
||||
// Prepare the data that will hydrate the form
|
||||
$data = array(
|
||||
'id' => $object->getId(),
|
||||
'name' => $object->getName(),
|
||||
'locale' => $object->getLocale(),
|
||||
'code' => $object->getCode(),
|
||||
'symbol' => $object->getSymbol(),
|
||||
'rate' => $object->getRate()
|
||||
);
|
||||
|
||||
// Store the current sort order in session
|
||||
$this->getSession()->set('admin.currency_order', $order);
|
||||
|
||||
return $this->render('currencies', array('order' => $order));
|
||||
// Setup the object form
|
||||
return new CurrencyModificationForm($this->getRequest(), "form", $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* The default action is displaying the currencies list.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.view")) return $response;
|
||||
return $this->renderList();
|
||||
protected function getObjectFromEvent($event) {
|
||||
return $event->hasCurrency() ? $event->getCurrency() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new currency object
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function createAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.create")) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
// Create the Creation Form
|
||||
$creationForm = new CurrencyCreationForm($this->getRequest());
|
||||
|
||||
try {
|
||||
|
||||
// Validate the form, create the CurrencyCreation event and dispatch it.
|
||||
$form = $this->validateForm($creationForm, "POST");
|
||||
|
||||
$data = $form->getData();
|
||||
|
||||
$createEvent = new CurrencyCreateEvent();
|
||||
|
||||
$createEvent
|
||||
->setCurrencyName($data['name'])
|
||||
->setLocale($data["locale"])
|
||||
->setSymbol($data['symbol'])
|
||||
->setCode($data['code'])
|
||||
->setRate($data['rate'])
|
||||
;
|
||||
|
||||
$this->dispatch(TheliaEvents::CURRENCY_CREATE, $createEvent);
|
||||
|
||||
if (! $createEvent->hasCurrency()) throw new \LogicException($this->getTranslator()->trans("No currency was created."));
|
||||
|
||||
$createdObject = $createEvent->getCurrency();
|
||||
|
||||
// Log currency creation
|
||||
$this->adminLogAppend(sprintf("Currency %s (ID %s) created", $createdObject->getName(), $createdObject->getId()));
|
||||
|
||||
// Substitute _ID_ in the URL with the ID of the created object
|
||||
$successUrl = str_replace('_ID_', $createdObject->getId(), $creationForm->getSuccessUrl());
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($successUrl);
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$error_msg = $ex->getMessage();
|
||||
}
|
||||
|
||||
$this->setupFormErrorContext("currency creation", $error_msg, $creationForm, $ex);
|
||||
|
||||
// At this point, the form has error, and should be redisplayed.
|
||||
return $this->renderList();
|
||||
protected function getExistingObject() {
|
||||
return CurrencyQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->findOneById($this->getRequest()->get('currency_id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a currency object for modification, and display the edit template.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function changeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||
protected function getObjectLabel($object) {
|
||||
return $object->getName();
|
||||
}
|
||||
|
||||
// Load the currency object
|
||||
$currency = CurrencyQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->findOneById($this->getRequest()->get('currency_id'));
|
||||
protected function getObjectId($object) {
|
||||
return $object->getId();
|
||||
}
|
||||
|
||||
if ($currency != null) {
|
||||
protected function renderListTemplate($currentOrder) {
|
||||
return $this->render('currencies', array('order' => $currentOrder));
|
||||
}
|
||||
|
||||
// Prepare the data that will hydrate the form
|
||||
$data = array(
|
||||
'id' => $currency->getId(),
|
||||
'name' => $currency->getName(),
|
||||
'locale' => $currency->getLocale(),
|
||||
'code' => $currency->getCode(),
|
||||
'symbol' => $currency->getSymbol(),
|
||||
'rate' => $currency->getRate()
|
||||
);
|
||||
|
||||
// Setup the object form
|
||||
$changeForm = new CurrencyModificationForm($this->getRequest(), "form", $data);
|
||||
|
||||
// Pass it to the parser
|
||||
$this->getParserContext()->addForm($changeForm);
|
||||
}
|
||||
|
||||
// Render the edition template.
|
||||
protected function renderEditionTemplate() {
|
||||
return $this->render('currency-edit', array('currency_id' => $this->getRequest()->get('currency_id')));
|
||||
}
|
||||
|
||||
protected function redirectToEditionTemplate() {
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.currencies.update",
|
||||
array('currency_id' => $this->getRequest()->get('currency_id'))
|
||||
);
|
||||
}
|
||||
|
||||
protected function redirectToListTemplate() {
|
||||
$this->redirectToRoute('admin.configuration.currencies.default');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save changes on a modified currency object, and either go back to the currency list, or stay on the edition page.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
* Update currencies rates
|
||||
*/
|
||||
public function saveChangeAction()
|
||||
public function updateRatesAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
// Create the form from the request
|
||||
$changeForm = new CurrencyModificationForm($this->getRequest());
|
||||
|
||||
// Get the currency ID
|
||||
$currency_id = $this->getRequest()->get('currency_id');
|
||||
|
||||
try {
|
||||
|
||||
// Check the form against constraints violations
|
||||
$form = $this->validateForm($changeForm, "POST");
|
||||
|
||||
// Get the form field values
|
||||
$data = $form->getData();
|
||||
|
||||
$changeEvent = new CurrencyUpdateEvent($data['id']);
|
||||
|
||||
// Create and dispatch the change event
|
||||
$changeEvent
|
||||
->setCurrencyName($data['name'])
|
||||
->setLocale($data["locale"])
|
||||
->setSymbol($data['symbol'])
|
||||
->setCode($data['code'])
|
||||
->setRate($data['rate'])
|
||||
;
|
||||
|
||||
$this->dispatch(TheliaEvents::CURRENCY_UPDATE, $changeEvent);
|
||||
|
||||
if (! $changeEvent->hasCurrency()) throw new \LogicException($this->getTranslator()->trans("No currency was updated."));
|
||||
|
||||
// Log currency modification
|
||||
$changedObject = $changeEvent->getCurrency();
|
||||
|
||||
$this->adminLogAppend(sprintf("Currency %s (ID %s) modified", $changedObject->getName(), $changedObject->getId()));
|
||||
|
||||
// If we have to stay on the same page, do not redirect to the succesUrl,
|
||||
// just redirect to the edit page again.
|
||||
if ($this->getRequest()->get('save_mode') == 'stay') {
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.currencies.update",
|
||||
array('currency_id' => $currency_id)
|
||||
);
|
||||
}
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($changeForm->getSuccessUrl());
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||
$this->dispatch(TheliaEvents::CURRENCY_UPDATE_RATES);
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$error_msg = $ex->getMessage();
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
|
||||
$this->setupFormErrorContext("currency modification", $error_msg, $changeForm, $ex);
|
||||
|
||||
// At this point, the form has errors, and should be redisplayed.
|
||||
return $this->render('currency-edit', array('currency_id' => $currency_id));
|
||||
$this->redirectToListTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -260,80 +203,7 @@ class CurrencyController extends BaseAdminController
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
|
||||
$this->redirectToRoute('admin.configuration.currencies.default');
|
||||
$this->redirectToListTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update currencies rates
|
||||
*/
|
||||
public function updateRatesAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::CURRENCY_UPDATE_RATES);
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
|
||||
$this->redirectToRoute('admin.configuration.currencies.default');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update currencyposition
|
||||
*/
|
||||
public function updatePositionAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||
|
||||
try {
|
||||
$mode = $this->getRequest()->get('mode', null);
|
||||
|
||||
if ($mode == 'up')
|
||||
$mode = CurrencyUpdatePositionEvent::POSITION_UP;
|
||||
else if ($mode == 'down')
|
||||
$mode = CurrencyUpdatePositionEvent::POSITION_DOWN;
|
||||
else
|
||||
$mode = CurrencyUpdatePositionEvent::POSITION_ABSOLUTE;
|
||||
|
||||
$position = $this->getRequest()->get('position', null);
|
||||
|
||||
$event = new CurrencyUpdatePositionEvent(
|
||||
$this->getRequest()->get('currency_id', null),
|
||||
$mode,
|
||||
$this->getRequest()->get('position', null)
|
||||
);
|
||||
|
||||
$this->dispatch(TheliaEvents::CURRENCY_UPDATE_POSITION, $event);
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
|
||||
$this->redirectToRoute('admin.configuration.currencies.default');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a currency object
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function deleteAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.delete")) return $response;
|
||||
|
||||
// Get the currency id, and dispatch the delet request
|
||||
$event = new CurrencyDeleteEvent($this->getRequest()->get('currency_id'));
|
||||
|
||||
$this->dispatch(TheliaEvents::CURRENCY_DELETE, $event);
|
||||
|
||||
if ($event->hasCurrency())
|
||||
$this->adminLogAppend(sprintf("Currency %s (ID %s) modified", $event->getCurrency()->getName(), $event->getCurrency()->getId()));
|
||||
|
||||
$this->redirectToRoute('admin.configuration.currencies.default');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,15 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Symfony\Component\Form\Form;
|
||||
use Thelia\Core\Event\CustomerCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\CustomerEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Form\CustomerModification;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Model\CustomerQuery;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
/**
|
||||
* Class CustomerController
|
||||
@@ -32,15 +41,141 @@ class CustomerController extends BaseAdminController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.customers.view")) return $response;
|
||||
if (null !== $response = $this->checkAuth("admin.customer.view")) return $response;
|
||||
return $this->render("customers", array("display_customer" => 20));
|
||||
}
|
||||
|
||||
public function viewAction($customer_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.customer.view")) return $response;
|
||||
|
||||
return $this->render("customer-edit", array(
|
||||
"customer_id" => $customer_id
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* update customer action
|
||||
*
|
||||
* @param $customer_id
|
||||
* @return mixed|\Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function updateAction($customer_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.customer.update")) return $response;
|
||||
|
||||
$message = false;
|
||||
|
||||
$customerModification = new CustomerModification($this->getRequest());
|
||||
|
||||
try {
|
||||
$customer = CustomerQuery::create()->findPk($customer_id);
|
||||
|
||||
if(null === $customer) {
|
||||
throw new \InvalidArgumentException(sprintf("%d customer id does not exists", $customer_id));
|
||||
}
|
||||
|
||||
$form = $this->validateForm($customerModification);
|
||||
|
||||
$event = $this->createEventInstance($form->getData());
|
||||
$event->setCustomer($customer);
|
||||
|
||||
$this->dispatch(TheliaEvents::CUSTOMER_UPDATEACCOUNT, $event);
|
||||
|
||||
$customerUpdated = $event->getCustomer();
|
||||
|
||||
$this->adminLogAppend(sprintf("Customer with Ref %s (ID %d) modified", $customerUpdated->getRef() , $customerUpdated->getId()));
|
||||
|
||||
if($this->getRequest()->get("save_mode") == "close") {
|
||||
$this->redirectToRoute("admin.customers");
|
||||
} else {
|
||||
$this->redirectSuccess($customerModification);
|
||||
}
|
||||
|
||||
} catch (FormValidationException $e) {
|
||||
$message = sprintf("Please check your input: %s", $e->getMessage());
|
||||
} catch (PropelException $e) {
|
||||
$message = $e->getMessage();
|
||||
} catch (\Exception $e) {
|
||||
$message = sprintf("Sorry, an error occured: %s", $e->getMessage()." ".$e->getFile());
|
||||
}
|
||||
|
||||
if ($message !== false) {
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("Error during customer login process : %s.", $message));
|
||||
|
||||
$customerModification->setErrorMessage($message);
|
||||
|
||||
$this->getParserContext()
|
||||
->addForm($customerModification)
|
||||
->setGeneralError($message)
|
||||
;
|
||||
}
|
||||
|
||||
return $this->render("customer-edit", array(
|
||||
"customer_id" => $customer_id
|
||||
));
|
||||
}
|
||||
|
||||
public function deleteAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.customer.delete")) return $response;
|
||||
|
||||
$message = null;
|
||||
|
||||
try {
|
||||
$customer_id = $this->getRequest()->get("customer_id");
|
||||
$customer = CustomerQuery::create()->findPk($customer_id);
|
||||
|
||||
if(null === $customer) {
|
||||
throw new \InvalidArgumentException(Translator::getInstance("The customer you want to delete does not exists"));
|
||||
}
|
||||
|
||||
$event = new CustomerEvent($customer);
|
||||
|
||||
$this->dispatch(TheliaEvents::CUSTOMER_DELETEACCOUNT, $event);
|
||||
} catch(\Exception $e) {
|
||||
$message = $e->getMessage();
|
||||
}
|
||||
|
||||
$params = array(
|
||||
"customer_page" => $this->getRequest()->get("customer_page", 1)
|
||||
);
|
||||
|
||||
if ($message) {
|
||||
$params["delete_error_message"] = $message;
|
||||
}
|
||||
|
||||
$this->redirectToRoute("admin.customers", $params);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @return CustomerCreateOrUpdateEvent
|
||||
*/
|
||||
private function createEventInstance($data)
|
||||
{
|
||||
$customerCreateEvent = new CustomerCreateOrUpdateEvent(
|
||||
$data["title"],
|
||||
$data["firstname"],
|
||||
$data["lastname"],
|
||||
$data["address1"],
|
||||
$data["address2"],
|
||||
$data["address3"],
|
||||
$data["phone"],
|
||||
$data["cellphone"],
|
||||
$data["zipcode"],
|
||||
$data["city"],
|
||||
$data["country"],
|
||||
isset($data["email"])?$data["email"]:null,
|
||||
isset($data["password"]) ? $data["password"]:null,
|
||||
$this->getRequest()->getSession()->getLang()->getId(),
|
||||
isset($data["reseller"])?$data["reseller"]:null,
|
||||
isset($data["sponsor"])?$data["sponsor"]:null,
|
||||
isset($data["discount"])?$data["discount"]:null,
|
||||
isset($data["company"])?$data["company"]:null
|
||||
);
|
||||
|
||||
return $customerCreateEvent;
|
||||
}
|
||||
}
|
||||
@@ -24,11 +24,8 @@
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\MessageDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Core\Event\MessageUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;use Thelia\Core\Event\MessageUpdateEvent;
|
||||
use Thelia\Core\Event\MessageCreateEvent;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Model\MessageQuery;
|
||||
use Thelia\Form\MessageModificationForm;
|
||||
use Thelia\Form\MessageCreationForm;
|
||||
@@ -38,217 +35,124 @@ use Thelia\Form\MessageCreationForm;
|
||||
*
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class MessageController extends BaseAdminController
|
||||
class MessageController extends AbstractCrudController
|
||||
{
|
||||
/**
|
||||
* Render the messages list
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
protected function renderList()
|
||||
{
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'message',
|
||||
null,
|
||||
|
||||
'admin.configuration.messages.view',
|
||||
'admin.configuration.messages.create',
|
||||
'admin.configuration.messages.update',
|
||||
'admin.configuration.messages.delete',
|
||||
|
||||
TheliaEvents::MESSAGE_CREATE,
|
||||
TheliaEvents::MESSAGE_UPDATE,
|
||||
TheliaEvents::MESSAGE_DELETE,
|
||||
null, // No visibility toggle
|
||||
null // No position update
|
||||
);
|
||||
}
|
||||
|
||||
protected function getCreationForm() {
|
||||
return new MessageCreationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getUpdateForm() {
|
||||
return new MessageModificationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getCreationEvent($formData) {
|
||||
$createEvent = new MessageCreateEvent();
|
||||
|
||||
$createEvent
|
||||
->setMessageName($formData['name'])
|
||||
->setLocale($formData["locale"])
|
||||
->setTitle($formData['title'])
|
||||
->setSecured($formData['secured'])
|
||||
;
|
||||
|
||||
return $createEvent;
|
||||
}
|
||||
|
||||
protected function getUpdateEvent($formData) {
|
||||
$changeEvent = new MessageUpdateEvent($formData['id']);
|
||||
|
||||
// Create and dispatch the change event
|
||||
$changeEvent
|
||||
->setMessageName($formData['name'])
|
||||
->setSecured($formData['secured'])
|
||||
->setLocale($formData["locale"])
|
||||
->setTitle($formData['title'])
|
||||
->setSubject($formData['subject'])
|
||||
->setHtmlMessage($formData['html_message'])
|
||||
->setTextMessage($formData['text_message'])
|
||||
;
|
||||
|
||||
return $changeEvent;
|
||||
}
|
||||
|
||||
protected function getDeleteEvent() {
|
||||
return new MessageDeleteEvent($this->getRequest()->get('message_id'));
|
||||
}
|
||||
|
||||
protected function eventContainsObject($event) {
|
||||
return $event->hasMessage();
|
||||
}
|
||||
|
||||
protected function hydrateObjectForm($object) {
|
||||
|
||||
// Prepare the data that will hydrate the form
|
||||
$data = array(
|
||||
'id' => $object->getId(),
|
||||
'name' => $object->getName(),
|
||||
'secured' => $object->getSecured(),
|
||||
'locale' => $object->getLocale(),
|
||||
'title' => $object->getTitle(),
|
||||
'subject' => $object->getSubject(),
|
||||
'html_message' => $object->getHtmlMessage(),
|
||||
'text_message' => $object->getTextMessage()
|
||||
);
|
||||
|
||||
// Setup the object form
|
||||
return new MessageModificationForm($this->getRequest(), "form", $data);
|
||||
}
|
||||
|
||||
protected function getObjectFromEvent($event) {
|
||||
return $event->hasMessage() ? $event->getMessage() : null;
|
||||
}
|
||||
|
||||
protected function getExistingObject() {
|
||||
return MessageQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->findOneById($this->getRequest()->get('message_id'));
|
||||
}
|
||||
|
||||
protected function getObjectLabel($object) {
|
||||
return $object->getName();
|
||||
}
|
||||
|
||||
protected function getObjectId($object) {
|
||||
return $object->getId();
|
||||
}
|
||||
|
||||
protected function renderListTemplate($currentOrder) {
|
||||
return $this->render('messages');
|
||||
}
|
||||
|
||||
/**
|
||||
* The default action is displaying the messages list.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.view")) return $response;
|
||||
return $this->renderList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new message object
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function createAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.create")) return $response;
|
||||
|
||||
$message = false;
|
||||
|
||||
// Create the creation Form
|
||||
$creationForm = new MessageCreationForm($this->getRequest());
|
||||
|
||||
try {
|
||||
|
||||
// Validate the form, create the MessageCreation event and dispatch it.
|
||||
$form = $this->validateForm($creationForm, "POST");
|
||||
|
||||
$data = $form->getData();
|
||||
|
||||
$createEvent = new MessageCreateEvent();
|
||||
|
||||
$createEvent
|
||||
->setMessageName($data['name'])
|
||||
->setLocale($data["locale"])
|
||||
->setTitle($data['title'])
|
||||
->setSecured($data['secured'])
|
||||
;
|
||||
|
||||
$this->dispatch(TheliaEvents::MESSAGE_CREATE, $createEvent);
|
||||
|
||||
if (! $createEvent->hasMessage()) throw new \LogicException($this->getTranslator()->trans("No message was created."));
|
||||
|
||||
$createdObject = $createEvent->getMessage();
|
||||
|
||||
$this->adminLogAppend(sprintf("Message %s (ID %s) created", $createdObject->getName(), $createdObject->getId()));
|
||||
|
||||
// Substitute _ID_ in the URL with the ID of the created object
|
||||
$successUrl = str_replace('_ID_', $createdObject->getId(), $creationForm->getSuccessUrl());
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($successUrl);
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$message = $ex->getMessage();
|
||||
}
|
||||
|
||||
$this->setupFormErrorContext("message modification", $message, $creationForm, $ex);
|
||||
|
||||
// At this point, the form has error, and should be redisplayed.
|
||||
return $this->render('messages');
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a message object for modification, and display the edit template.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function changeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.update")) return $response;
|
||||
|
||||
// Load the message object
|
||||
$message = MessageQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->findOneById($this->getRequest()->get('message_id'));
|
||||
|
||||
if ($message != null) {
|
||||
|
||||
// Prepare the data that will hydrate the form
|
||||
$data = array(
|
||||
'id' => $message->getId(),
|
||||
'name' => $message->getName(),
|
||||
'secured' => $message->getSecured(),
|
||||
'locale' => $message->getLocale(),
|
||||
'title' => $message->getTitle(),
|
||||
'subject' => $message->getSubject(),
|
||||
'html_message' => $message->getHtmlMessage(),
|
||||
'text_message' => $message->getTextMessage()
|
||||
);
|
||||
|
||||
// Setup the object form
|
||||
$changeForm = new MessageModificationForm($this->getRequest(), "form", $data);
|
||||
|
||||
// Pass it to the parser
|
||||
$this->getParserContext()->addForm($changeForm);
|
||||
}
|
||||
|
||||
// Render the edition template.
|
||||
protected function renderEditionTemplate() {
|
||||
return $this->render('message-edit', array('message_id' => $this->getRequest()->get('message_id')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Save changes on a modified message object, and either go back to the message list, or stay on the edition page.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function saveChangeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.update")) return $response;
|
||||
|
||||
$message = false;
|
||||
|
||||
// Create the form from the request
|
||||
$changeForm = new MessageModificationForm($this->getRequest());
|
||||
|
||||
// Get the message ID
|
||||
$message_id = $this->getRequest()->get('message_id');
|
||||
|
||||
try {
|
||||
|
||||
// Check the form against constraints violations
|
||||
$form = $this->validateForm($changeForm, "POST");
|
||||
|
||||
// Get the form field values
|
||||
$data = $form->getData();
|
||||
|
||||
$changeEvent = new MessageUpdateEvent($data['id']);
|
||||
|
||||
// Create and dispatch the change event
|
||||
$changeEvent
|
||||
->setMessageName($data['name'])
|
||||
->setSecured($data['secured'])
|
||||
->setLocale($data["locale"])
|
||||
->setTitle($data['title'])
|
||||
->setSubject($data['subject'])
|
||||
->setHtmlMessage($data['html_message'])
|
||||
->setTextMessage($data['text_message'])
|
||||
;
|
||||
|
||||
$this->dispatch(TheliaEvents::MESSAGE_UPDATE, $changeEvent);
|
||||
|
||||
if (! $changeEvent->hasMessage()) throw new \LogicException($this->getTranslator()->trans("No message was updated."));
|
||||
|
||||
$changedObject = $changeEvent->getMessage();
|
||||
|
||||
$this->adminLogAppend(sprintf("Variable %s (ID %s) modified", $changedObject->getName(), $changedObject->getId()));
|
||||
|
||||
// If we have to stay on the same page, do not redirect to the succesUrl,
|
||||
// just redirect to the edit page again.
|
||||
if ($this->getRequest()->get('save_mode') == 'stay') {
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.messages.update",
|
||||
array('message_id' => $message_id)
|
||||
);
|
||||
}
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($changeForm->getSuccessUrl());
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$message = $ex->getMessage();
|
||||
}
|
||||
|
||||
$this->setupFormErrorContext("message modification", $message, $changeForm, $ex);
|
||||
|
||||
// At this point, the form has errors, and should be redisplayed.
|
||||
return $this->render('message-edit', array('message_id' => $message_id));
|
||||
protected function redirectToEditionTemplate() {
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.messages.update",
|
||||
array('message_id' => $this->getRequest()->get('message_id'))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a message object
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function deleteAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.delete")) return $response;
|
||||
|
||||
// Get the message id, and dispatch the delet request
|
||||
$event = new MessageDeleteEvent($this->getRequest()->get('message_id'));
|
||||
|
||||
$this->dispatch(TheliaEvents::MESSAGE_DELETE, $event);
|
||||
|
||||
if ($event->hasMessage())
|
||||
$this->adminLogAppend(sprintf("Message %s (ID %s) modified", $event->getMessage()->getName(), $event->getMessage()->getId()));
|
||||
|
||||
protected function redirectToListTemplate() {
|
||||
$this->redirectToRoute('admin.configuration.messages.default');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,4 +36,12 @@ class OrderController extends BaseAdminController
|
||||
return $this->render("orders", array("display_order" => 20));
|
||||
}
|
||||
|
||||
public function viewAction($order_id)
|
||||
{
|
||||
|
||||
return $this->render("order-edit", array(
|
||||
"order_id" => $order_id
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -278,7 +278,8 @@ class CustomerController extends BaseFrontController
|
||||
$this->getRequest()->getSession()->getLang()->getId(),
|
||||
isset($data["reseller"])?$data["reseller"]:null,
|
||||
isset($data["sponsor"])?$data["sponsor"]:null,
|
||||
isset($data["discount"])?$data["discount"]:null
|
||||
isset($data["discount"])?$data["discount"]:null,
|
||||
isset($data["company"])?$data["company"]:null
|
||||
);
|
||||
|
||||
return $customerCreateEvent;
|
||||
|
||||
68
core/lib/Thelia/Core/Event/AttributeAvCreateEvent.php
Normal file
68
core/lib/Thelia/Core/Event/AttributeAvCreateEvent.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
class AttributeAvCreateEvent extends AttributeAvEvent
|
||||
{
|
||||
protected $title;
|
||||
protected $locale;
|
||||
protected $attribute_id;
|
||||
|
||||
public function getLocale()
|
||||
{
|
||||
return $this->locale;
|
||||
}
|
||||
|
||||
public function setLocale($locale)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAttributeId()
|
||||
{
|
||||
return $this->attribute_id;
|
||||
}
|
||||
|
||||
public function setAttributeId($attribute_id)
|
||||
{
|
||||
$this->attribute_id = $attribute_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
@@ -17,12 +17,30 @@
|
||||
/* 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/>. */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
class CategoryToggleVisibilityEvent extends BaseToggleVisibilityEvent
|
||||
class AttributeAvDeleteEvent extends AttributeAvEvent
|
||||
{
|
||||
protected $attributeAv_id;
|
||||
|
||||
public function __construct($attributeAv_id)
|
||||
{
|
||||
$this->setAttributeAvId($attributeAv_id);
|
||||
}
|
||||
|
||||
public function getAttributeAvId()
|
||||
{
|
||||
return $this->attributeAv_id;
|
||||
}
|
||||
|
||||
public function setAttributeAvId($attributeAv_id)
|
||||
{
|
||||
$this->attributeAv_id = $attributeAv_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
52
core/lib/Thelia/Core/Event/AttributeAvEvent.php
Normal file
52
core/lib/Thelia/Core/Event/AttributeAvEvent.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
use Thelia\Model\AttributeAv;
|
||||
|
||||
class AttributeAvEvent extends ActionEvent
|
||||
{
|
||||
protected $attributeAv = null;
|
||||
|
||||
public function __construct(AttributeAv $attributeAv = null)
|
||||
{
|
||||
$this->attributeAv = $attributeAv;
|
||||
}
|
||||
|
||||
public function hasAttributeAv()
|
||||
{
|
||||
return ! is_null($this->attributeAv);
|
||||
}
|
||||
|
||||
public function getAttributeAv()
|
||||
{
|
||||
return $this->attributeAv;
|
||||
}
|
||||
|
||||
public function setAttributeAv($attributeAv)
|
||||
{
|
||||
$this->attributeAv = $attributeAv;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
86
core/lib/Thelia/Core/Event/AttributeAvUpdateEvent.php
Normal file
86
core/lib/Thelia/Core/Event/AttributeAvUpdateEvent.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
class AttributeAvUpdateEvent extends AttributeAvCreateEvent
|
||||
{
|
||||
protected $attributeAv_id;
|
||||
|
||||
protected $description;
|
||||
protected $chapo;
|
||||
protected $postscriptum;
|
||||
|
||||
public function __construct($attributeAv_id)
|
||||
{
|
||||
$this->setAttributeAvId($attributeAv_id);
|
||||
}
|
||||
|
||||
public function getAttributeAvId()
|
||||
{
|
||||
return $this->attributeAv_id;
|
||||
}
|
||||
|
||||
public function setAttributeAvId($attributeAv_id)
|
||||
{
|
||||
$this->attributeAv_id = $attributeAv_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getChapo()
|
||||
{
|
||||
return $this->chapo;
|
||||
}
|
||||
|
||||
public function setChapo($chapo)
|
||||
{
|
||||
$this->chapo = $chapo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPostscriptum()
|
||||
{
|
||||
return $this->postscriptum;
|
||||
}
|
||||
|
||||
public function setPostscriptum($postscriptum)
|
||||
{
|
||||
$this->postscriptum = $postscriptum;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
68
core/lib/Thelia/Core/Event/AttributeCreateEvent.php
Normal file
68
core/lib/Thelia/Core/Event/AttributeCreateEvent.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
class AttributeCreateEvent extends AttributeEvent
|
||||
{
|
||||
protected $title;
|
||||
protected $locale;
|
||||
protected $add_to_all_templates;
|
||||
|
||||
public function getLocale()
|
||||
{
|
||||
return $this->locale;
|
||||
}
|
||||
|
||||
public function setLocale($locale)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAddToAllTemplates()
|
||||
{
|
||||
return $this->add_to_all_templates;
|
||||
}
|
||||
|
||||
public function setAddToAllTemplates($add_to_all_templates)
|
||||
{
|
||||
$this->add_to_all_templates = $add_to_all_templates;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
@@ -17,12 +17,30 @@
|
||||
/* 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/>. */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
class CurrencyUpdatePositionEvent extends BaseUpdatePositionEvent
|
||||
class AttributeDeleteEvent extends AttributeEvent
|
||||
{
|
||||
protected $attribute_id;
|
||||
|
||||
public function __construct($attribute_id)
|
||||
{
|
||||
$this->setAttributeId($attribute_id);
|
||||
}
|
||||
|
||||
public function getAttributeId()
|
||||
{
|
||||
return $this->attribute_id;
|
||||
}
|
||||
|
||||
public function setAttributeId($attribute_id)
|
||||
{
|
||||
$this->attribute_id = $attribute_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
52
core/lib/Thelia/Core/Event/AttributeEvent.php
Normal file
52
core/lib/Thelia/Core/Event/AttributeEvent.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
use Thelia\Model\Attribute;
|
||||
|
||||
class AttributeEvent extends ActionEvent
|
||||
{
|
||||
protected $attribute = null;
|
||||
|
||||
public function __construct(Attribute $attribute = null)
|
||||
{
|
||||
$this->attribute = $attribute;
|
||||
}
|
||||
|
||||
public function hasAttribute()
|
||||
{
|
||||
return ! is_null($this->attribute);
|
||||
}
|
||||
|
||||
public function getAttribute()
|
||||
{
|
||||
return $this->attribute;
|
||||
}
|
||||
|
||||
public function setAttribute($attribute)
|
||||
{
|
||||
$this->attribute = $attribute;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
86
core/lib/Thelia/Core/Event/AttributeUpdateEvent.php
Normal file
86
core/lib/Thelia/Core/Event/AttributeUpdateEvent.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
class AttributeUpdateEvent extends AttributeCreateEvent
|
||||
{
|
||||
protected $attribute_id;
|
||||
|
||||
protected $description;
|
||||
protected $chapo;
|
||||
protected $postscriptum;
|
||||
|
||||
public function __construct($attribute_id)
|
||||
{
|
||||
$this->setAttributeId($attribute_id);
|
||||
}
|
||||
|
||||
public function getAttributeId()
|
||||
{
|
||||
return $this->attribute_id;
|
||||
}
|
||||
|
||||
public function setAttributeId($attribute_id)
|
||||
{
|
||||
$this->attribute_id = $attribute_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getChapo()
|
||||
{
|
||||
return $this->chapo;
|
||||
}
|
||||
|
||||
public function setChapo($chapo)
|
||||
{
|
||||
$this->chapo = $chapo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPostscriptum()
|
||||
{
|
||||
return $this->postscriptum;
|
||||
}
|
||||
|
||||
public function setPostscriptum($postscriptum)
|
||||
{
|
||||
$this->postscriptum = $postscriptum;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
* User: manu
|
||||
* Date: 16/08/13
|
||||
* Time: 10:24
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Thelia\Model\Customer;
|
||||
|
||||
/**
|
||||
* Class CustomerCreateOrUpdateEvent
|
||||
* @package Thelia\Core\Event
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class CustomerCreateOrUpdateEvent extends ActionEvent
|
||||
{
|
||||
//base parameters for creating new customer
|
||||
@@ -32,6 +50,7 @@ class CustomerCreateOrUpdateEvent extends ActionEvent
|
||||
protected $reseller;
|
||||
protected $sponsor;
|
||||
protected $discount;
|
||||
protected $company;
|
||||
|
||||
/**
|
||||
* @var \Thelia\Model\Customer
|
||||
@@ -39,7 +58,7 @@ class CustomerCreateOrUpdateEvent extends ActionEvent
|
||||
protected $customer;
|
||||
|
||||
/**
|
||||
* @param int $title the title customer id
|
||||
* @param int $title the title customer id
|
||||
* @param string $firstname
|
||||
* @param string $lastname
|
||||
* @param string $address1
|
||||
@@ -49,15 +68,16 @@ class CustomerCreateOrUpdateEvent extends ActionEvent
|
||||
* @param string $cellphone
|
||||
* @param string $zipcode
|
||||
* @param string $city
|
||||
* @param int $country the country id
|
||||
* @param int $country the country id
|
||||
* @param string $email
|
||||
* @param string $password plain password, don't put hash password, it will hashes again
|
||||
* @param $lang
|
||||
* @param int $reseller if customer is a reseller
|
||||
* @param int $sponsor customer's id sponsor
|
||||
* @param int $reseller if customer is a reseller
|
||||
* @param int $sponsor customer's id sponsor
|
||||
* @param float $discount
|
||||
* @param string $company
|
||||
*/
|
||||
public function __construct($title, $firstname, $lastname, $address1, $address2, $address3, $phone, $cellphone, $zipcode, $city, $country, $email, $password, $lang, $reseller, $sponsor, $discount)
|
||||
public function __construct($title, $firstname, $lastname, $address1, $address2, $address3, $phone, $cellphone, $zipcode, $city, $country, $email, $password, $lang, $reseller, $sponsor, $discount, $company)
|
||||
{
|
||||
$this->address1 = $address1;
|
||||
$this->address2 = $address2;
|
||||
@@ -72,9 +92,18 @@ class CustomerCreateOrUpdateEvent extends ActionEvent
|
||||
$this->cellphone = $cellphone;
|
||||
$this->title = $title;
|
||||
$this->zipcode = $zipcode;
|
||||
$this->city = $city;
|
||||
$this->reseller = $reseller;
|
||||
$this->sponsor = $sponsor;
|
||||
$this->discount = $discount;
|
||||
$this->company = $company;
|
||||
}
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCompany()
|
||||
{
|
||||
return $this->company;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -71,6 +71,11 @@ final class TheliaEvents
|
||||
*/
|
||||
const CUSTOMER_UPDATEACCOUNT = "action.updateCustomer";
|
||||
|
||||
/**
|
||||
* sent on customer removal
|
||||
*/
|
||||
const CUSTOMER_DELETEACCOUNT = "action.deleteCustomer";
|
||||
|
||||
/**
|
||||
* sent when a customer need a new password
|
||||
*/
|
||||
@@ -103,6 +108,16 @@ final class TheliaEvents
|
||||
*/
|
||||
const AFTER_UPDATECUSTOMER = "action.after_updateCustomer";
|
||||
|
||||
/**
|
||||
* sent just before customer removal
|
||||
*/
|
||||
const BEFORE_DELETECUSTOMER = "action.before_updateCustomer";
|
||||
|
||||
/**
|
||||
* sent just after customer removal
|
||||
*/
|
||||
const AFTER_DELETECUSTOMER = "action.after_deleteCustomer";
|
||||
|
||||
// -- ADDRESS MANAGEMENT ---------------------------------------------------------
|
||||
/**
|
||||
* sent for address creation
|
||||
@@ -317,5 +332,35 @@ final class TheliaEvents
|
||||
const BEFORE_DELETECURRENCY = "action.before_deleteCurrency";
|
||||
const AFTER_DELETECURRENCY = "action.after_deleteCurrency";
|
||||
|
||||
// -- Attributes management ---------------------------------------------
|
||||
|
||||
const ATTRIBUTE_CREATE = "action.createAttribute";
|
||||
const ATTRIBUTE_UPDATE = "action.updateAttribute";
|
||||
const ATTRIBUTE_DELETE = "action.deleteAttribute";
|
||||
const ATTRIBUTE_UPDATE_POSITION = "action.updateAttributePosition";
|
||||
|
||||
const BEFORE_CREATEATTRIBUTE = "action.before_createAttribute";
|
||||
const AFTER_CREATEATTRIBUTE = "action.after_createAttribute";
|
||||
|
||||
const BEFORE_UPDATEATTRIBUTE = "action.before_updateAttribute";
|
||||
const AFTER_UPDATEATTRIBUTE = "action.after_updateAttribute";
|
||||
|
||||
const BEFORE_DELETEATTRIBUTE = "action.before_deleteAttribute";
|
||||
const AFTER_DELETEATTRIBUTE = "action.after_deleteAttribute";
|
||||
|
||||
// -- Attributes values management ----------------------------------------
|
||||
|
||||
const ATTRIBUTE_AV_CREATE = "action.createAttributeAv";
|
||||
const ATTRIBUTE_AV_UPDATE = "action.updateAttributeAv";
|
||||
const ATTRIBUTE_AV_DELETE = "action.deleteAttributeAv";
|
||||
const ATTRIBUTE_AV_UPDATE_POSITION = "action.updateAttributeAvPosition";
|
||||
|
||||
const BEFORE_CREATEATTRIBUTE_AV = "action.before_createAttributeAv";
|
||||
const AFTER_CREATEATTRIBUTE_AV = "action.after_createAttributeAv";
|
||||
|
||||
const BEFORE_UPDATEATTRIBUTE_AV = "action.before_updateAttributeAv";
|
||||
const AFTER_UPDATEATTRIBUTE_AV = "action.after_updateAttributeAv";
|
||||
|
||||
const BEFORE_DELETEATTRIBUTE_AV = "action.before_deleteAttributeAv";
|
||||
const AFTER_DELETEATTRIBUTE_AV = "action.after_deleteAttributeAv";
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
class BaseToggleVisibilityEvent extends ActionEvent
|
||||
class ToggleVisibilityEvent extends ActionEvent
|
||||
{
|
||||
protected $object_id;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
class BaseUpdatePositionEvent extends ActionEvent
|
||||
class UpdatePositionEvent extends ActionEvent
|
||||
{
|
||||
const POSITION_UP = 1;
|
||||
const POSITION_DOWN = 2;
|
||||
@@ -129,6 +129,7 @@ abstract class BaseLoop
|
||||
$loopType = isset($nameValuePairs['type']) ? $nameValuePairs['type'] : "undefined";
|
||||
$loopName = isset($nameValuePairs['name']) ? $nameValuePairs['name'] : "undefined";
|
||||
|
||||
$this->args->rewind();
|
||||
while (($argument = $this->args->current()) !== false) {
|
||||
$this->args->next();
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class Address extends BaseLoop
|
||||
),
|
||||
'current'
|
||||
),
|
||||
Argument::createBooleanTypeArgument('default', false),
|
||||
Argument::createBooleanTypeArgument('default'),
|
||||
Argument::createIntListTypeArgument('exclude')
|
||||
);
|
||||
}
|
||||
@@ -100,6 +100,8 @@ class Address extends BaseLoop
|
||||
|
||||
if ($default === true) {
|
||||
$search->filterByIsDefault(1, Criteria::EQUAL);
|
||||
} else if($default === false) {
|
||||
$search->filterByIsDefault(0, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
$exclude = $this->getExclude();
|
||||
|
||||
@@ -66,7 +66,7 @@ class Attribute extends BaseI18nLoop
|
||||
new Argument(
|
||||
'order',
|
||||
new TypeCollection(
|
||||
new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse'))
|
||||
new Type\EnumListType(array('id', 'id_reverse', 'alpha', 'alpha_reverse', 'manual', 'manual_reverse'))
|
||||
),
|
||||
'manual'
|
||||
)
|
||||
@@ -129,6 +129,12 @@ class Attribute extends BaseI18nLoop
|
||||
|
||||
foreach ($orders as $order) {
|
||||
switch ($order) {
|
||||
case "id":
|
||||
$search->orderById(Criteria::ASC);
|
||||
break;
|
||||
case "id_reverse":
|
||||
$search->orderById(Criteria::DESC);
|
||||
break;
|
||||
case "alpha":
|
||||
$search->addAscendingOrderByColumn('i18n_TITLE');
|
||||
break;
|
||||
|
||||
@@ -79,7 +79,7 @@ class Category extends BaseI18nLoop
|
||||
new Argument(
|
||||
'order',
|
||||
new TypeCollection(
|
||||
new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse', 'visible', 'visible_reverse', 'random'))
|
||||
new Type\EnumListType(array('id', 'id_reverse', 'alpha', 'alpha_reverse', 'manual', 'manual_reverse', 'visible', 'visible_reverse', 'random'))
|
||||
),
|
||||
'manual'
|
||||
),
|
||||
@@ -132,6 +132,12 @@ class Category extends BaseI18nLoop
|
||||
|
||||
foreach ($orders as $order) {
|
||||
switch ($order) {
|
||||
case "id":
|
||||
$search->orderById(Criteria::ASC);
|
||||
break;
|
||||
case "id_reverse":
|
||||
$search->orderById(Criteria::DESC);
|
||||
break;
|
||||
case "alpha":
|
||||
$search->addAscendingOrderByColumn('i18n_TITLE');
|
||||
break;
|
||||
|
||||
62
core/lib/Thelia/Form/AttributeAvCreationForm.php
Normal file
62
core/lib/Thelia/Form/AttributeAvCreationForm.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
class AttributeAvCreationForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add("title" , "text" , array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Title *"),
|
||||
"label_attr" => array(
|
||||
"for" => "title"
|
||||
))
|
||||
)
|
||||
->add("locale" , "text" , array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
))
|
||||
)
|
||||
->add("attribute_id", "hidden", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
))
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return "thelia_attributeav_creation";
|
||||
}
|
||||
}
|
||||
66
core/lib/Thelia/Form/AttributeCreationForm.php
Normal file
66
core/lib/Thelia/Form/AttributeCreationForm.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
class AttributeCreationForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add("title" , "text" , array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Title *"),
|
||||
"label_attr" => array(
|
||||
"for" => "title"
|
||||
))
|
||||
)
|
||||
->add("locale" , "text" , array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
))
|
||||
)
|
||||
->add("add_to_all" , "checkbox" , array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Add to all product templates"),
|
||||
"label_attr" => array(
|
||||
"for" => "add_to_all"
|
||||
))
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return "thelia_attribute_creation";
|
||||
}
|
||||
}
|
||||
60
core/lib/Thelia/Form/AttributeModificationForm.php
Normal file
60
core/lib/Thelia/Form/AttributeModificationForm.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThan;
|
||||
|
||||
class AttributeModificationForm extends AttributeCreationForm
|
||||
{
|
||||
use StandardDescriptionFieldsTrait;
|
||||
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add("id", "hidden", array(
|
||||
"constraints" => array(
|
||||
new GreaterThan(
|
||||
array('value' => 0)
|
||||
)
|
||||
)
|
||||
))
|
||||
->add('attribute_values', 'collection', array(
|
||||
'type' => 'text',
|
||||
'options' => array('required' => false)
|
||||
))
|
||||
;
|
||||
|
||||
// Add standard description fields
|
||||
$this->addStandardDescFields();
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return "thelia_attribute_modification";
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,12 @@ class CustomerModification extends BaseForm
|
||||
|
||||
$this->formBuilder
|
||||
->add('update_logged_in_user', 'integer') // In a front office context, update the in-memory logged-in user data
|
||||
->add("company", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Company"),
|
||||
"label_attr" => array(
|
||||
"for" => "company"
|
||||
)
|
||||
))
|
||||
->add("firstname", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
|
||||
@@ -3,7 +3,69 @@
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\Attribute as BaseAttribute;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\AttributeEvent;
|
||||
|
||||
class Attribute extends BaseAttribute {
|
||||
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
use \Thelia\Model\Tools\PositionManagementTrait;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function preInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_CREATEATTRIBUTE, new AttributeEvent($this));
|
||||
|
||||
// Set the current position for the new object
|
||||
$this->setPosition($this->getNextPosition());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function postInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_CREATEATTRIBUTE, new AttributeEvent($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function preUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_UPDATEATTRIBUTE, new AttributeEvent($this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function postUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_UPDATEATTRIBUTE, new AttributeEvent($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function preDelete(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_DELETEATTRIBUTE, new AttributeEvent($this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function postDelete(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_DELETEATTRIBUTE, new AttributeEvent($this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,78 @@
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\AttributeAv as BaseAttributeAv;
|
||||
use Thelia\Core\Event\AttributeAvEvent;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
|
||||
class AttributeAv extends BaseAttributeAv {
|
||||
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
|
||||
use \Thelia\Model\Tools\PositionManagementTrait;
|
||||
|
||||
/**
|
||||
* when dealing with position, be sure to work insite the current attribute.
|
||||
*/
|
||||
protected function addCriteriaToPositionQuery($query) {
|
||||
$query->filterByAttributeId($this->getAttributeId());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function preInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
// Set the current position for the new object
|
||||
$this->setPosition($this->getNextPosition());
|
||||
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_CREATEATTRIBUTE_AV, new AttributeAvEvent($this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function postInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_CREATEATTRIBUTE_AV, new AttributeAvEvent($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function preUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_UPDATEATTRIBUTE_AV, new AttributeAvEvent($this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function postUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_UPDATEATTRIBUTE_AV, new AttributeAvEvent($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function preDelete(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_DELETEATTRIBUTE_AV, new AttributeAvEvent($this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function postDelete(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_DELETEATTRIBUTE_AV, new AttributeAvEvent($this));
|
||||
}
|
||||
}
|
||||
@@ -99,6 +99,13 @@ abstract class Cart implements ActiveRecordInterface
|
||||
*/
|
||||
protected $currency_id;
|
||||
|
||||
/**
|
||||
* The value for the discount field.
|
||||
* Note: this column has a database default value of: 0
|
||||
* @var double
|
||||
*/
|
||||
protected $discount;
|
||||
|
||||
/**
|
||||
* The value for the created_at field.
|
||||
* @var string
|
||||
@@ -151,11 +158,24 @@ abstract class Cart implements ActiveRecordInterface
|
||||
*/
|
||||
protected $cartItemsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* Applies default values to this object.
|
||||
* This method should be called from the object's constructor (or
|
||||
* equivalent initialization method).
|
||||
* @see __construct()
|
||||
*/
|
||||
public function applyDefaultValues()
|
||||
{
|
||||
$this->discount = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes internal state of Thelia\Model\Base\Cart object.
|
||||
* @see applyDefaults()
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->applyDefaultValues();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -471,6 +491,17 @@ abstract class Cart implements ActiveRecordInterface
|
||||
return $this->currency_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [discount] column value.
|
||||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getDiscount()
|
||||
{
|
||||
|
||||
return $this->discount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [created_at] column value.
|
||||
*
|
||||
@@ -653,6 +684,27 @@ abstract class Cart implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setCurrencyId()
|
||||
|
||||
/**
|
||||
* Set the value of [discount] column.
|
||||
*
|
||||
* @param double $v new value
|
||||
* @return \Thelia\Model\Cart 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[] = CartTableMap::DISCOUNT;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setDiscount()
|
||||
|
||||
/**
|
||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
@@ -705,6 +757,10 @@ abstract class Cart implements ActiveRecordInterface
|
||||
*/
|
||||
public function hasOnlyDefaultValues()
|
||||
{
|
||||
if ($this->discount !== 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// otherwise, everything was equal, so return TRUE
|
||||
return true;
|
||||
} // hasOnlyDefaultValues()
|
||||
@@ -750,13 +806,16 @@ abstract class Cart implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CartTableMap::translateFieldName('CurrencyId', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->currency_id = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CartTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CartTableMap::translateFieldName('Discount', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->discount = (null !== $col) ? (double) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CartTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CartTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CartTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -769,7 +828,7 @@ abstract class Cart implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 8; // 8 = CartTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 9; // 9 = CartTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\Cart object", 0, $e);
|
||||
@@ -1075,6 +1134,9 @@ abstract class Cart implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CartTableMap::CURRENCY_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CURRENCY_ID';
|
||||
}
|
||||
if ($this->isColumnModified(CartTableMap::DISCOUNT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'DISCOUNT';
|
||||
}
|
||||
if ($this->isColumnModified(CartTableMap::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
||||
}
|
||||
@@ -1110,6 +1172,9 @@ abstract class Cart implements ActiveRecordInterface
|
||||
case 'CURRENCY_ID':
|
||||
$stmt->bindValue($identifier, $this->currency_id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'DISCOUNT':
|
||||
$stmt->bindValue($identifier, $this->discount, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'CREATED_AT':
|
||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1197,9 +1262,12 @@ abstract class Cart implements ActiveRecordInterface
|
||||
return $this->getCurrencyId();
|
||||
break;
|
||||
case 6:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getDiscount();
|
||||
break;
|
||||
case 7:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 8:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1237,8 +1305,9 @@ abstract class Cart implements ActiveRecordInterface
|
||||
$keys[3] => $this->getAddressDeliveryId(),
|
||||
$keys[4] => $this->getAddressInvoiceId(),
|
||||
$keys[5] => $this->getCurrencyId(),
|
||||
$keys[6] => $this->getCreatedAt(),
|
||||
$keys[7] => $this->getUpdatedAt(),
|
||||
$keys[6] => $this->getDiscount(),
|
||||
$keys[7] => $this->getCreatedAt(),
|
||||
$keys[8] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach($virtualColumns as $key => $virtualColumn)
|
||||
@@ -1315,9 +1384,12 @@ abstract class Cart implements ActiveRecordInterface
|
||||
$this->setCurrencyId($value);
|
||||
break;
|
||||
case 6:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setDiscount($value);
|
||||
break;
|
||||
case 7:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 8:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1350,8 +1422,9 @@ abstract class Cart implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[3], $arr)) $this->setAddressDeliveryId($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setAddressInvoiceId($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setCurrencyId($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setDiscount($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1369,6 +1442,7 @@ abstract class Cart implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CartTableMap::ADDRESS_DELIVERY_ID)) $criteria->add(CartTableMap::ADDRESS_DELIVERY_ID, $this->address_delivery_id);
|
||||
if ($this->isColumnModified(CartTableMap::ADDRESS_INVOICE_ID)) $criteria->add(CartTableMap::ADDRESS_INVOICE_ID, $this->address_invoice_id);
|
||||
if ($this->isColumnModified(CartTableMap::CURRENCY_ID)) $criteria->add(CartTableMap::CURRENCY_ID, $this->currency_id);
|
||||
if ($this->isColumnModified(CartTableMap::DISCOUNT)) $criteria->add(CartTableMap::DISCOUNT, $this->discount);
|
||||
if ($this->isColumnModified(CartTableMap::CREATED_AT)) $criteria->add(CartTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(CartTableMap::UPDATED_AT)) $criteria->add(CartTableMap::UPDATED_AT, $this->updated_at);
|
||||
|
||||
@@ -1439,6 +1513,7 @@ abstract class Cart implements ActiveRecordInterface
|
||||
$copyObj->setAddressDeliveryId($this->getAddressDeliveryId());
|
||||
$copyObj->setAddressInvoiceId($this->getAddressInvoiceId());
|
||||
$copyObj->setCurrencyId($this->getCurrencyId());
|
||||
$copyObj->setDiscount($this->getDiscount());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
|
||||
@@ -1982,10 +2057,12 @@ abstract class Cart implements ActiveRecordInterface
|
||||
$this->address_delivery_id = null;
|
||||
$this->address_invoice_id = null;
|
||||
$this->currency_id = null;
|
||||
$this->discount = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
$this->alreadyInSave = false;
|
||||
$this->clearAllReferences();
|
||||
$this->applyDefaultValues();
|
||||
$this->resetModified();
|
||||
$this->setNew(true);
|
||||
$this->setDeleted(false);
|
||||
|
||||
@@ -109,6 +109,13 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
*/
|
||||
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 created_at field.
|
||||
* @var string
|
||||
@@ -153,6 +160,7 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
public function applyDefaultValues()
|
||||
{
|
||||
$this->quantity = 1;
|
||||
$this->discount = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -508,6 +516,17 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [discount] column value.
|
||||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getDiscount()
|
||||
{
|
||||
|
||||
return $this->discount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [created_at] column value.
|
||||
*
|
||||
@@ -728,6 +747,27 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // 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()
|
||||
|
||||
/**
|
||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
@@ -784,6 +824,10 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->discount !== 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// otherwise, everything was equal, so return TRUE
|
||||
return true;
|
||||
} // hasOnlyDefaultValues()
|
||||
@@ -838,13 +882,16 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
}
|
||||
$this->price_end_of_life = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CartItemTableMap::translateFieldName('CreatedAt', 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('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CartItemTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CartItemTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -857,7 +904,7 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 10; // 10 = CartItemTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 11; // 11 = CartItemTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\CartItem object", 0, $e);
|
||||
@@ -1139,6 +1186,9 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CartItemTableMap::PRICE_END_OF_LIFE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'PRICE_END_OF_LIFE';
|
||||
}
|
||||
if ($this->isColumnModified(CartItemTableMap::DISCOUNT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'DISCOUNT';
|
||||
}
|
||||
if ($this->isColumnModified(CartItemTableMap::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
||||
}
|
||||
@@ -1180,6 +1230,9 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
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);
|
||||
break;
|
||||
case 'DISCOUNT':
|
||||
$stmt->bindValue($identifier, $this->discount, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'CREATED_AT':
|
||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1273,9 +1326,12 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
return $this->getPriceEndOfLife();
|
||||
break;
|
||||
case 8:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getDiscount();
|
||||
break;
|
||||
case 9:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 10:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1315,8 +1371,9 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
$keys[5] => $this->getPrice(),
|
||||
$keys[6] => $this->getPromoPrice(),
|
||||
$keys[7] => $this->getPriceEndOfLife(),
|
||||
$keys[8] => $this->getCreatedAt(),
|
||||
$keys[9] => $this->getUpdatedAt(),
|
||||
$keys[8] => $this->getDiscount(),
|
||||
$keys[9] => $this->getCreatedAt(),
|
||||
$keys[10] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach($virtualColumns as $key => $virtualColumn)
|
||||
@@ -1393,9 +1450,12 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
$this->setPriceEndOfLife($value);
|
||||
break;
|
||||
case 8:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setDiscount($value);
|
||||
break;
|
||||
case 9:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 10:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1430,8 +1490,9 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
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[7], $arr)) $this->setPriceEndOfLife($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setCreatedAt($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setUpdatedAt($arr[$keys[9]]);
|
||||
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[10], $arr)) $this->setUpdatedAt($arr[$keys[10]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1451,6 +1512,7 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
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::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::CREATED_AT)) $criteria->add(CartItemTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(CartItemTableMap::UPDATED_AT)) $criteria->add(CartItemTableMap::UPDATED_AT, $this->updated_at);
|
||||
|
||||
@@ -1523,6 +1585,7 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
$copyObj->setPrice($this->getPrice());
|
||||
$copyObj->setPromoPrice($this->getPromoPrice());
|
||||
$copyObj->setPriceEndOfLife($this->getPriceEndOfLife());
|
||||
$copyObj->setDiscount($this->getDiscount());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
if ($makeNew) {
|
||||
@@ -1719,6 +1782,7 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
$this->price = null;
|
||||
$this->promo_price = null;
|
||||
$this->price_end_of_life = null;
|
||||
$this->discount = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
@@ -29,6 +29,7 @@ use Thelia\Model\Map\CartItemTableMap;
|
||||
* @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 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 orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildCartItemQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
@@ -40,6 +41,7 @@ use Thelia\Model\Map\CartItemTableMap;
|
||||
* @method ChildCartItemQuery groupByPrice() Group by the price column
|
||||
* @method ChildCartItemQuery groupByPromoPrice() Group by the promo_price column
|
||||
* @method ChildCartItemQuery groupByPriceEndOfLife() Group by the price_end_of_life column
|
||||
* @method ChildCartItemQuery groupByDiscount() Group by the discount column
|
||||
* @method ChildCartItemQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildCartItemQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
@@ -70,6 +72,7 @@ use Thelia\Model\Map\CartItemTableMap;
|
||||
* @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 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 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
|
||||
*
|
||||
@@ -81,6 +84,7 @@ use Thelia\Model\Map\CartItemTableMap;
|
||||
* @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 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 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
|
||||
*
|
||||
@@ -171,7 +175,7 @@ abstract class CartItemQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, CART_ID, PRODUCT_ID, QUANTITY, PRODUCT_SALE_ELEMENTS_ID, PRICE, PROMO_PRICE, PRICE_END_OF_LIFE, 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, CREATED_AT, UPDATED_AT FROM cart_item WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -596,6 +600,47 @@ abstract class CartItemQuery extends ModelCriteria
|
||||
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 created_at column
|
||||
*
|
||||
|
||||
@@ -27,6 +27,7 @@ use Thelia\Model\Map\CartTableMap;
|
||||
* @method ChildCartQuery orderByAddressDeliveryId($order = Criteria::ASC) Order by the address_delivery_id column
|
||||
* @method ChildCartQuery orderByAddressInvoiceId($order = Criteria::ASC) Order by the address_invoice_id column
|
||||
* @method ChildCartQuery orderByCurrencyId($order = Criteria::ASC) Order by the currency_id column
|
||||
* @method ChildCartQuery orderByDiscount($order = Criteria::ASC) Order by the discount column
|
||||
* @method ChildCartQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildCartQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
@@ -36,6 +37,7 @@ use Thelia\Model\Map\CartTableMap;
|
||||
* @method ChildCartQuery groupByAddressDeliveryId() Group by the address_delivery_id column
|
||||
* @method ChildCartQuery groupByAddressInvoiceId() Group by the address_invoice_id column
|
||||
* @method ChildCartQuery groupByCurrencyId() Group by the currency_id column
|
||||
* @method ChildCartQuery groupByDiscount() Group by the discount column
|
||||
* @method ChildCartQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildCartQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
@@ -72,6 +74,7 @@ use Thelia\Model\Map\CartTableMap;
|
||||
* @method ChildCart findOneByAddressDeliveryId(int $address_delivery_id) Return the first ChildCart filtered by the address_delivery_id column
|
||||
* @method ChildCart findOneByAddressInvoiceId(int $address_invoice_id) Return the first ChildCart filtered by the address_invoice_id column
|
||||
* @method ChildCart findOneByCurrencyId(int $currency_id) Return the first ChildCart filtered by the currency_id column
|
||||
* @method ChildCart findOneByDiscount(double $discount) Return the first ChildCart filtered by the discount column
|
||||
* @method ChildCart findOneByCreatedAt(string $created_at) Return the first ChildCart filtered by the created_at column
|
||||
* @method ChildCart findOneByUpdatedAt(string $updated_at) Return the first ChildCart filtered by the updated_at column
|
||||
*
|
||||
@@ -81,6 +84,7 @@ use Thelia\Model\Map\CartTableMap;
|
||||
* @method array findByAddressDeliveryId(int $address_delivery_id) Return ChildCart objects filtered by the address_delivery_id column
|
||||
* @method array findByAddressInvoiceId(int $address_invoice_id) Return ChildCart objects filtered by the address_invoice_id column
|
||||
* @method array findByCurrencyId(int $currency_id) Return ChildCart objects filtered by the currency_id column
|
||||
* @method array findByDiscount(double $discount) Return ChildCart objects filtered by the discount column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildCart objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildCart objects filtered by the updated_at column
|
||||
*
|
||||
@@ -171,7 +175,7 @@ abstract class CartQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, TOKEN, CUSTOMER_ID, ADDRESS_DELIVERY_ID, ADDRESS_INVOICE_ID, CURRENCY_ID, CREATED_AT, UPDATED_AT FROM cart WHERE ID = :p0';
|
||||
$sql = 'SELECT ID, TOKEN, CUSTOMER_ID, ADDRESS_DELIVERY_ID, ADDRESS_INVOICE_ID, CURRENCY_ID, DISCOUNT, CREATED_AT, UPDATED_AT FROM cart WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -502,6 +506,47 @@ abstract class CartQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(CartTableMap::CURRENCY_ID, $currencyId, $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 ChildCartQuery 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(CartTableMap::DISCOUNT, $discount['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($discount['max'])) {
|
||||
$this->addUsingAlias(CartTableMap::DISCOUNT, $discount['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CartTableMap::DISCOUNT, $discount, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
|
||||
@@ -75,6 +75,12 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
*/
|
||||
protected $product_id;
|
||||
|
||||
/**
|
||||
* The value for the ref field.
|
||||
* @var string
|
||||
*/
|
||||
protected $ref;
|
||||
|
||||
/**
|
||||
* The value for the quantity field.
|
||||
* @var double
|
||||
@@ -452,6 +458,17 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
return $this->product_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [ref] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRef()
|
||||
{
|
||||
|
||||
return $this->ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [quantity] column value.
|
||||
*
|
||||
@@ -582,6 +599,27 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setProductId()
|
||||
|
||||
/**
|
||||
* Set the value of [ref] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\ProductSaleElements The current object (for fluent API support)
|
||||
*/
|
||||
public function setRef($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->ref !== $v) {
|
||||
$this->ref = $v;
|
||||
$this->modifiedColumns[] = ProductSaleElementsTableMap::REF;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setRef()
|
||||
|
||||
/**
|
||||
* Set the value of [quantity] column.
|
||||
*
|
||||
@@ -759,25 +797,28 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ProductSaleElementsTableMap::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->product_id = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProductSaleElementsTableMap::translateFieldName('Quantity', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProductSaleElementsTableMap::translateFieldName('Ref', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->ref = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProductSaleElementsTableMap::translateFieldName('Quantity', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->quantity = (null !== $col) ? (double) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProductSaleElementsTableMap::translateFieldName('Promo', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductSaleElementsTableMap::translateFieldName('Promo', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->promo = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductSaleElementsTableMap::translateFieldName('Newness', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductSaleElementsTableMap::translateFieldName('Newness', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->newness = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductSaleElementsTableMap::translateFieldName('Weight', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductSaleElementsTableMap::translateFieldName('Weight', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->weight = (null !== $col) ? (double) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductSaleElementsTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductSaleElementsTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductSaleElementsTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductSaleElementsTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -790,7 +831,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 8; // 8 = ProductSaleElementsTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 9; // 9 = ProductSaleElementsTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\ProductSaleElements object", 0, $e);
|
||||
@@ -1089,6 +1130,9 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(ProductSaleElementsTableMap::PRODUCT_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'PRODUCT_ID';
|
||||
}
|
||||
if ($this->isColumnModified(ProductSaleElementsTableMap::REF)) {
|
||||
$modifiedColumns[':p' . $index++] = 'REF';
|
||||
}
|
||||
if ($this->isColumnModified(ProductSaleElementsTableMap::QUANTITY)) {
|
||||
$modifiedColumns[':p' . $index++] = 'QUANTITY';
|
||||
}
|
||||
@@ -1124,6 +1168,9 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
case 'PRODUCT_ID':
|
||||
$stmt->bindValue($identifier, $this->product_id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'REF':
|
||||
$stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'QUANTITY':
|
||||
$stmt->bindValue($identifier, $this->quantity, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1211,21 +1258,24 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
return $this->getProductId();
|
||||
break;
|
||||
case 2:
|
||||
return $this->getQuantity();
|
||||
return $this->getRef();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getPromo();
|
||||
return $this->getQuantity();
|
||||
break;
|
||||
case 4:
|
||||
return $this->getNewness();
|
||||
return $this->getPromo();
|
||||
break;
|
||||
case 5:
|
||||
return $this->getWeight();
|
||||
return $this->getNewness();
|
||||
break;
|
||||
case 6:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getWeight();
|
||||
break;
|
||||
case 7:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 8:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1259,12 +1309,13 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
$result = array(
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getProductId(),
|
||||
$keys[2] => $this->getQuantity(),
|
||||
$keys[3] => $this->getPromo(),
|
||||
$keys[4] => $this->getNewness(),
|
||||
$keys[5] => $this->getWeight(),
|
||||
$keys[6] => $this->getCreatedAt(),
|
||||
$keys[7] => $this->getUpdatedAt(),
|
||||
$keys[2] => $this->getRef(),
|
||||
$keys[3] => $this->getQuantity(),
|
||||
$keys[4] => $this->getPromo(),
|
||||
$keys[5] => $this->getNewness(),
|
||||
$keys[6] => $this->getWeight(),
|
||||
$keys[7] => $this->getCreatedAt(),
|
||||
$keys[8] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach($virtualColumns as $key => $virtualColumn)
|
||||
@@ -1326,21 +1377,24 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
$this->setProductId($value);
|
||||
break;
|
||||
case 2:
|
||||
$this->setQuantity($value);
|
||||
$this->setRef($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setPromo($value);
|
||||
$this->setQuantity($value);
|
||||
break;
|
||||
case 4:
|
||||
$this->setNewness($value);
|
||||
$this->setPromo($value);
|
||||
break;
|
||||
case 5:
|
||||
$this->setWeight($value);
|
||||
$this->setNewness($value);
|
||||
break;
|
||||
case 6:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setWeight($value);
|
||||
break;
|
||||
case 7:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 8:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1369,12 +1423,13 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
|
||||
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setProductId($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setQuantity($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setPromo($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setNewness($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setWeight($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setRef($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setQuantity($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setPromo($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setNewness($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setWeight($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1388,6 +1443,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
|
||||
if ($this->isColumnModified(ProductSaleElementsTableMap::ID)) $criteria->add(ProductSaleElementsTableMap::ID, $this->id);
|
||||
if ($this->isColumnModified(ProductSaleElementsTableMap::PRODUCT_ID)) $criteria->add(ProductSaleElementsTableMap::PRODUCT_ID, $this->product_id);
|
||||
if ($this->isColumnModified(ProductSaleElementsTableMap::REF)) $criteria->add(ProductSaleElementsTableMap::REF, $this->ref);
|
||||
if ($this->isColumnModified(ProductSaleElementsTableMap::QUANTITY)) $criteria->add(ProductSaleElementsTableMap::QUANTITY, $this->quantity);
|
||||
if ($this->isColumnModified(ProductSaleElementsTableMap::PROMO)) $criteria->add(ProductSaleElementsTableMap::PROMO, $this->promo);
|
||||
if ($this->isColumnModified(ProductSaleElementsTableMap::NEWNESS)) $criteria->add(ProductSaleElementsTableMap::NEWNESS, $this->newness);
|
||||
@@ -1458,6 +1514,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
|
||||
{
|
||||
$copyObj->setProductId($this->getProductId());
|
||||
$copyObj->setRef($this->getRef());
|
||||
$copyObj->setQuantity($this->getQuantity());
|
||||
$copyObj->setPromo($this->getPromo());
|
||||
$copyObj->setNewness($this->getNewness());
|
||||
@@ -2383,6 +2440,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
{
|
||||
$this->id = null;
|
||||
$this->product_id = null;
|
||||
$this->ref = null;
|
||||
$this->quantity = null;
|
||||
$this->promo = null;
|
||||
$this->newness = null;
|
||||
|
||||
@@ -23,6 +23,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
|
||||
*
|
||||
* @method ChildProductSaleElementsQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildProductSaleElementsQuery orderByProductId($order = Criteria::ASC) Order by the product_id column
|
||||
* @method ChildProductSaleElementsQuery orderByRef($order = Criteria::ASC) Order by the ref column
|
||||
* @method ChildProductSaleElementsQuery orderByQuantity($order = Criteria::ASC) Order by the quantity column
|
||||
* @method ChildProductSaleElementsQuery orderByPromo($order = Criteria::ASC) Order by the promo column
|
||||
* @method ChildProductSaleElementsQuery orderByNewness($order = Criteria::ASC) Order by the newness column
|
||||
@@ -32,6 +33,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
|
||||
*
|
||||
* @method ChildProductSaleElementsQuery groupById() Group by the id column
|
||||
* @method ChildProductSaleElementsQuery groupByProductId() Group by the product_id column
|
||||
* @method ChildProductSaleElementsQuery groupByRef() Group by the ref column
|
||||
* @method ChildProductSaleElementsQuery groupByQuantity() Group by the quantity column
|
||||
* @method ChildProductSaleElementsQuery groupByPromo() Group by the promo column
|
||||
* @method ChildProductSaleElementsQuery groupByNewness() Group by the newness column
|
||||
@@ -64,6 +66,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
|
||||
*
|
||||
* @method ChildProductSaleElements findOneById(int $id) Return the first ChildProductSaleElements filtered by the id column
|
||||
* @method ChildProductSaleElements findOneByProductId(int $product_id) Return the first ChildProductSaleElements filtered by the product_id column
|
||||
* @method ChildProductSaleElements findOneByRef(string $ref) Return the first ChildProductSaleElements filtered by the ref column
|
||||
* @method ChildProductSaleElements findOneByQuantity(double $quantity) Return the first ChildProductSaleElements filtered by the quantity column
|
||||
* @method ChildProductSaleElements findOneByPromo(int $promo) Return the first ChildProductSaleElements filtered by the promo column
|
||||
* @method ChildProductSaleElements findOneByNewness(int $newness) Return the first ChildProductSaleElements filtered by the newness column
|
||||
@@ -73,6 +76,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
|
||||
*
|
||||
* @method array findById(int $id) Return ChildProductSaleElements objects filtered by the id column
|
||||
* @method array findByProductId(int $product_id) Return ChildProductSaleElements objects filtered by the product_id column
|
||||
* @method array findByRef(string $ref) Return ChildProductSaleElements objects filtered by the ref column
|
||||
* @method array findByQuantity(double $quantity) Return ChildProductSaleElements objects filtered by the quantity column
|
||||
* @method array findByPromo(int $promo) Return ChildProductSaleElements objects filtered by the promo column
|
||||
* @method array findByNewness(int $newness) Return ChildProductSaleElements objects filtered by the newness column
|
||||
@@ -167,7 +171,7 @@ abstract class ProductSaleElementsQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, PRODUCT_ID, QUANTITY, PROMO, NEWNESS, WEIGHT, CREATED_AT, UPDATED_AT FROM product_sale_elements WHERE ID = :p0';
|
||||
$sql = 'SELECT ID, PRODUCT_ID, REF, QUANTITY, PROMO, NEWNESS, WEIGHT, CREATED_AT, UPDATED_AT FROM product_sale_elements WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -340,6 +344,35 @@ abstract class ProductSaleElementsQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(ProductSaleElementsTableMap::PRODUCT_ID, $productId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the ref column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByRef('fooValue'); // WHERE ref = 'fooValue'
|
||||
* $query->filterByRef('%fooValue%'); // WHERE ref LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $ref The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildProductSaleElementsQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByRef($ref = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($ref)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $ref)) {
|
||||
$ref = str_replace('*', '%', $ref);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ProductSaleElementsTableMap::REF, $ref, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the quantity column
|
||||
*
|
||||
|
||||
@@ -54,7 +54,7 @@ class Customer extends BaseCustomer implements UserInterface
|
||||
* @param int $discount
|
||||
* @throws \Exception|\Symfony\Component\Config\Definition\Exception\Exception
|
||||
*/
|
||||
public function createOrUpdate($titleId, $firstname, $lastname, $address1, $address2, $address3, $phone, $cellphone, $zipcode, $city, $countryId, $email = null, $plainPassword = null, $lang = null, $reseller = 0, $sponsor = null, $discount = 0)
|
||||
public function createOrUpdate($titleId, $firstname, $lastname, $address1, $address2, $address3, $phone, $cellphone, $zipcode, $city, $countryId, $email = null, $plainPassword = null, $lang = null, $reseller = 0, $sponsor = null, $discount = 0, $company = null)
|
||||
{
|
||||
$this
|
||||
->setTitleId($titleId)
|
||||
@@ -79,6 +79,7 @@ class Customer extends BaseCustomer implements UserInterface
|
||||
$address = new Address();
|
||||
|
||||
$address
|
||||
->setCompany($company)
|
||||
->setTitleId($titleId)
|
||||
->setFirstname($firstname)
|
||||
->setLastname($lastname)
|
||||
@@ -88,6 +89,7 @@ class Customer extends BaseCustomer implements UserInterface
|
||||
->setPhone($phone)
|
||||
->setCellphone($cellphone)
|
||||
->setZipcode($zipcode)
|
||||
->setCity($city)
|
||||
->setCountryId($countryId)
|
||||
->setIsDefault(1)
|
||||
;
|
||||
@@ -98,6 +100,7 @@ class Customer extends BaseCustomer implements UserInterface
|
||||
$address = $this->getDefaultAddress();
|
||||
|
||||
$address
|
||||
->setCompany($company)
|
||||
->setTitleId($titleId)
|
||||
->setFirstname($firstname)
|
||||
->setLastname($lastname)
|
||||
@@ -107,6 +110,7 @@ class Customer extends BaseCustomer implements UserInterface
|
||||
->setPhone($phone)
|
||||
->setCellphone($cellphone)
|
||||
->setZipcode($zipcode)
|
||||
->setCity($city)
|
||||
->setCountryId($countryId)
|
||||
->save($con)
|
||||
;
|
||||
@@ -242,7 +246,7 @@ class Customer extends BaseCustomer implements UserInterface
|
||||
*/
|
||||
public function preDelete(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_DELETECONFIG, new CustomerEvent($this));
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_DELETECUSTOMER, new CustomerEvent($this));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -251,6 +255,6 @@ class Customer extends BaseCustomer implements UserInterface
|
||||
*/
|
||||
public function postDelete(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_DELETECONFIG, new CustomerEvent($this));
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_DELETECUSTOMER, new CustomerEvent($this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class CartItemTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 10;
|
||||
const NUM_COLUMNS = 11;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 10;
|
||||
const NUM_HYDRATE_COLUMNS = 11;
|
||||
|
||||
/**
|
||||
* 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';
|
||||
|
||||
/**
|
||||
* the column name for the DISCOUNT field
|
||||
*/
|
||||
const DISCOUNT = 'cart_item.DISCOUNT';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
@@ -131,12 +136,12 @@ class CartItemTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'CartId', 'ProductId', 'Quantity', 'ProductSaleElementsId', 'Price', 'PromoPrice', 'PriceEndOfLife', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'cartId', 'productId', 'quantity', 'productSaleElementsId', 'price', 'promoPrice', 'priceEndOfLife', '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::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', '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', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
|
||||
self::TYPE_PHPNAME => array('Id', 'CartId', 'ProductId', 'Quantity', 'ProductSaleElementsId', 'Price', 'PromoPrice', 'PriceEndOfLife', 'Discount', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'cartId', 'productId', 'quantity', 'productSaleElementsId', 'price', 'promoPrice', 'priceEndOfLife', 'discount', '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::DISCOUNT, 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', 'DISCOUNT', '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', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -146,12 +151,12 @@ class CartItemTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'CartId' => 1, 'ProductId' => 2, 'Quantity' => 3, 'ProductSaleElementsId' => 4, 'Price' => 5, 'PromoPrice' => 6, 'PriceEndOfLife' => 7, 'CreatedAt' => 8, 'UpdatedAt' => 9, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'cartId' => 1, 'productId' => 2, 'quantity' => 3, 'productSaleElementsId' => 4, 'price' => 5, 'promoPrice' => 6, 'priceEndOfLife' => 7, 'createdAt' => 8, 'updatedAt' => 9, ),
|
||||
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::CREATED_AT => 8, CartItemTableMap::UPDATED_AT => 9, ),
|
||||
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, 'CREATED_AT' => 8, 'UPDATED_AT' => 9, ),
|
||||
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, 'created_at' => 8, 'updated_at' => 9, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'CartId' => 1, 'ProductId' => 2, 'Quantity' => 3, 'ProductSaleElementsId' => 4, 'Price' => 5, 'PromoPrice' => 6, 'PriceEndOfLife' => 7, 'Discount' => 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, 'createdAt' => 9, 'updatedAt' => 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::CREATED_AT => 9, CartItemTableMap::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, '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, 'created_at' => 9, 'updated_at' => 10, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -178,6 +183,7 @@ class CartItemTableMap extends TableMap
|
||||
$this->addColumn('PRICE', 'Price', '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('DISCOUNT', 'Discount', 'FLOAT', false, null, 0);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
@@ -351,6 +357,7 @@ class CartItemTableMap extends TableMap
|
||||
$criteria->addSelectColumn(CartItemTableMap::PRICE);
|
||||
$criteria->addSelectColumn(CartItemTableMap::PROMO_PRICE);
|
||||
$criteria->addSelectColumn(CartItemTableMap::PRICE_END_OF_LIFE);
|
||||
$criteria->addSelectColumn(CartItemTableMap::DISCOUNT);
|
||||
$criteria->addSelectColumn(CartItemTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(CartItemTableMap::UPDATED_AT);
|
||||
} else {
|
||||
@@ -362,6 +369,7 @@ class CartItemTableMap extends TableMap
|
||||
$criteria->addSelectColumn($alias . '.PRICE');
|
||||
$criteria->addSelectColumn($alias . '.PROMO_PRICE');
|
||||
$criteria->addSelectColumn($alias . '.PRICE_END_OF_LIFE');
|
||||
$criteria->addSelectColumn($alias . '.DISCOUNT');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class CartTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 8;
|
||||
const NUM_COLUMNS = 9;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class CartTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 8;
|
||||
const NUM_HYDRATE_COLUMNS = 9;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -99,6 +99,11 @@ class CartTableMap extends TableMap
|
||||
*/
|
||||
const CURRENCY_ID = 'cart.CURRENCY_ID';
|
||||
|
||||
/**
|
||||
* the column name for the DISCOUNT field
|
||||
*/
|
||||
const DISCOUNT = 'cart.DISCOUNT';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
@@ -121,12 +126,12 @@ class CartTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'Token', 'CustomerId', 'AddressDeliveryId', 'AddressInvoiceId', 'CurrencyId', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'token', 'customerId', 'addressDeliveryId', 'addressInvoiceId', 'currencyId', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(CartTableMap::ID, CartTableMap::TOKEN, CartTableMap::CUSTOMER_ID, CartTableMap::ADDRESS_DELIVERY_ID, CartTableMap::ADDRESS_INVOICE_ID, CartTableMap::CURRENCY_ID, CartTableMap::CREATED_AT, CartTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'TOKEN', 'CUSTOMER_ID', 'ADDRESS_DELIVERY_ID', 'ADDRESS_INVOICE_ID', 'CURRENCY_ID', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'token', 'customer_id', 'address_delivery_id', 'address_invoice_id', 'currency_id', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
|
||||
self::TYPE_PHPNAME => array('Id', 'Token', 'CustomerId', 'AddressDeliveryId', 'AddressInvoiceId', 'CurrencyId', 'Discount', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'token', 'customerId', 'addressDeliveryId', 'addressInvoiceId', 'currencyId', 'discount', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(CartTableMap::ID, CartTableMap::TOKEN, CartTableMap::CUSTOMER_ID, CartTableMap::ADDRESS_DELIVERY_ID, CartTableMap::ADDRESS_INVOICE_ID, CartTableMap::CURRENCY_ID, CartTableMap::DISCOUNT, CartTableMap::CREATED_AT, CartTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'TOKEN', 'CUSTOMER_ID', 'ADDRESS_DELIVERY_ID', 'ADDRESS_INVOICE_ID', 'CURRENCY_ID', 'DISCOUNT', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'token', 'customer_id', 'address_delivery_id', 'address_invoice_id', 'currency_id', 'discount', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -136,12 +141,12 @@ class CartTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Token' => 1, 'CustomerId' => 2, 'AddressDeliveryId' => 3, 'AddressInvoiceId' => 4, 'CurrencyId' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'token' => 1, 'customerId' => 2, 'addressDeliveryId' => 3, 'addressInvoiceId' => 4, 'currencyId' => 5, 'createdAt' => 6, 'updatedAt' => 7, ),
|
||||
self::TYPE_COLNAME => array(CartTableMap::ID => 0, CartTableMap::TOKEN => 1, CartTableMap::CUSTOMER_ID => 2, CartTableMap::ADDRESS_DELIVERY_ID => 3, CartTableMap::ADDRESS_INVOICE_ID => 4, CartTableMap::CURRENCY_ID => 5, CartTableMap::CREATED_AT => 6, CartTableMap::UPDATED_AT => 7, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'TOKEN' => 1, 'CUSTOMER_ID' => 2, 'ADDRESS_DELIVERY_ID' => 3, 'ADDRESS_INVOICE_ID' => 4, 'CURRENCY_ID' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'token' => 1, 'customer_id' => 2, 'address_delivery_id' => 3, 'address_invoice_id' => 4, 'currency_id' => 5, 'created_at' => 6, 'updated_at' => 7, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Token' => 1, 'CustomerId' => 2, 'AddressDeliveryId' => 3, 'AddressInvoiceId' => 4, 'CurrencyId' => 5, 'Discount' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'token' => 1, 'customerId' => 2, 'addressDeliveryId' => 3, 'addressInvoiceId' => 4, 'currencyId' => 5, 'discount' => 6, 'createdAt' => 7, 'updatedAt' => 8, ),
|
||||
self::TYPE_COLNAME => array(CartTableMap::ID => 0, CartTableMap::TOKEN => 1, CartTableMap::CUSTOMER_ID => 2, CartTableMap::ADDRESS_DELIVERY_ID => 3, CartTableMap::ADDRESS_INVOICE_ID => 4, CartTableMap::CURRENCY_ID => 5, CartTableMap::DISCOUNT => 6, CartTableMap::CREATED_AT => 7, CartTableMap::UPDATED_AT => 8, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'TOKEN' => 1, 'CUSTOMER_ID' => 2, 'ADDRESS_DELIVERY_ID' => 3, 'ADDRESS_INVOICE_ID' => 4, 'CURRENCY_ID' => 5, 'DISCOUNT' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'token' => 1, 'customer_id' => 2, 'address_delivery_id' => 3, 'address_invoice_id' => 4, 'currency_id' => 5, 'discount' => 6, 'created_at' => 7, 'updated_at' => 8, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -166,6 +171,7 @@ class CartTableMap extends TableMap
|
||||
$this->addForeignKey('ADDRESS_DELIVERY_ID', 'AddressDeliveryId', 'INTEGER', 'address', 'ID', false, null, null);
|
||||
$this->addForeignKey('ADDRESS_INVOICE_ID', 'AddressInvoiceId', 'INTEGER', 'address', 'ID', false, null, null);
|
||||
$this->addForeignKey('CURRENCY_ID', 'CurrencyId', 'INTEGER', 'currency', 'ID', false, null, null);
|
||||
$this->addColumn('DISCOUNT', 'Discount', 'FLOAT', false, null, 0);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
@@ -339,6 +345,7 @@ class CartTableMap extends TableMap
|
||||
$criteria->addSelectColumn(CartTableMap::ADDRESS_DELIVERY_ID);
|
||||
$criteria->addSelectColumn(CartTableMap::ADDRESS_INVOICE_ID);
|
||||
$criteria->addSelectColumn(CartTableMap::CURRENCY_ID);
|
||||
$criteria->addSelectColumn(CartTableMap::DISCOUNT);
|
||||
$criteria->addSelectColumn(CartTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(CartTableMap::UPDATED_AT);
|
||||
} else {
|
||||
@@ -348,6 +355,7 @@ class CartTableMap extends TableMap
|
||||
$criteria->addSelectColumn($alias . '.ADDRESS_DELIVERY_ID');
|
||||
$criteria->addSelectColumn($alias . '.ADDRESS_INVOICE_ID');
|
||||
$criteria->addSelectColumn($alias . '.CURRENCY_ID');
|
||||
$criteria->addSelectColumn($alias . '.DISCOUNT');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class ProductSaleElementsTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 8;
|
||||
const NUM_COLUMNS = 9;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class ProductSaleElementsTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 8;
|
||||
const NUM_HYDRATE_COLUMNS = 9;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -79,6 +79,11 @@ class ProductSaleElementsTableMap extends TableMap
|
||||
*/
|
||||
const PRODUCT_ID = 'product_sale_elements.PRODUCT_ID';
|
||||
|
||||
/**
|
||||
* the column name for the REF field
|
||||
*/
|
||||
const REF = 'product_sale_elements.REF';
|
||||
|
||||
/**
|
||||
* the column name for the QUANTITY field
|
||||
*/
|
||||
@@ -121,12 +126,12 @@ class ProductSaleElementsTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'ProductId', 'Quantity', 'Promo', 'Newness', 'Weight', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'productId', 'quantity', 'promo', 'newness', 'weight', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(ProductSaleElementsTableMap::ID, ProductSaleElementsTableMap::PRODUCT_ID, ProductSaleElementsTableMap::QUANTITY, ProductSaleElementsTableMap::PROMO, ProductSaleElementsTableMap::NEWNESS, ProductSaleElementsTableMap::WEIGHT, ProductSaleElementsTableMap::CREATED_AT, ProductSaleElementsTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'PRODUCT_ID', 'QUANTITY', 'PROMO', 'NEWNESS', 'WEIGHT', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'product_id', 'quantity', 'promo', 'newness', 'weight', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
|
||||
self::TYPE_PHPNAME => array('Id', 'ProductId', 'Ref', 'Quantity', 'Promo', 'Newness', 'Weight', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'productId', 'ref', 'quantity', 'promo', 'newness', 'weight', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(ProductSaleElementsTableMap::ID, ProductSaleElementsTableMap::PRODUCT_ID, ProductSaleElementsTableMap::REF, ProductSaleElementsTableMap::QUANTITY, ProductSaleElementsTableMap::PROMO, ProductSaleElementsTableMap::NEWNESS, ProductSaleElementsTableMap::WEIGHT, ProductSaleElementsTableMap::CREATED_AT, ProductSaleElementsTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'PRODUCT_ID', 'REF', 'QUANTITY', 'PROMO', 'NEWNESS', 'WEIGHT', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'product_id', 'ref', 'quantity', 'promo', 'newness', 'weight', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -136,12 +141,12 @@ class ProductSaleElementsTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'ProductId' => 1, 'Quantity' => 2, 'Promo' => 3, 'Newness' => 4, 'Weight' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'productId' => 1, 'quantity' => 2, 'promo' => 3, 'newness' => 4, 'weight' => 5, 'createdAt' => 6, 'updatedAt' => 7, ),
|
||||
self::TYPE_COLNAME => array(ProductSaleElementsTableMap::ID => 0, ProductSaleElementsTableMap::PRODUCT_ID => 1, ProductSaleElementsTableMap::QUANTITY => 2, ProductSaleElementsTableMap::PROMO => 3, ProductSaleElementsTableMap::NEWNESS => 4, ProductSaleElementsTableMap::WEIGHT => 5, ProductSaleElementsTableMap::CREATED_AT => 6, ProductSaleElementsTableMap::UPDATED_AT => 7, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PRODUCT_ID' => 1, 'QUANTITY' => 2, 'PROMO' => 3, 'NEWNESS' => 4, 'WEIGHT' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'product_id' => 1, 'quantity' => 2, 'promo' => 3, 'newness' => 4, 'weight' => 5, 'created_at' => 6, 'updated_at' => 7, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'ProductId' => 1, 'Ref' => 2, 'Quantity' => 3, 'Promo' => 4, 'Newness' => 5, 'Weight' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'productId' => 1, 'ref' => 2, 'quantity' => 3, 'promo' => 4, 'newness' => 5, 'weight' => 6, 'createdAt' => 7, 'updatedAt' => 8, ),
|
||||
self::TYPE_COLNAME => array(ProductSaleElementsTableMap::ID => 0, ProductSaleElementsTableMap::PRODUCT_ID => 1, ProductSaleElementsTableMap::REF => 2, ProductSaleElementsTableMap::QUANTITY => 3, ProductSaleElementsTableMap::PROMO => 4, ProductSaleElementsTableMap::NEWNESS => 5, ProductSaleElementsTableMap::WEIGHT => 6, ProductSaleElementsTableMap::CREATED_AT => 7, ProductSaleElementsTableMap::UPDATED_AT => 8, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PRODUCT_ID' => 1, 'REF' => 2, 'QUANTITY' => 3, 'PROMO' => 4, 'NEWNESS' => 5, 'WEIGHT' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'product_id' => 1, 'ref' => 2, 'quantity' => 3, 'promo' => 4, 'newness' => 5, 'weight' => 6, 'created_at' => 7, 'updated_at' => 8, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -162,6 +167,7 @@ class ProductSaleElementsTableMap extends TableMap
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', true, null, null);
|
||||
$this->addColumn('REF', 'Ref', 'VARCHAR', true, 45, null);
|
||||
$this->addColumn('QUANTITY', 'Quantity', 'FLOAT', true, null, null);
|
||||
$this->addColumn('PROMO', 'Promo', 'TINYINT', false, null, 0);
|
||||
$this->addColumn('NEWNESS', 'Newness', 'TINYINT', false, null, 0);
|
||||
@@ -343,6 +349,7 @@ class ProductSaleElementsTableMap extends TableMap
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(ProductSaleElementsTableMap::ID);
|
||||
$criteria->addSelectColumn(ProductSaleElementsTableMap::PRODUCT_ID);
|
||||
$criteria->addSelectColumn(ProductSaleElementsTableMap::REF);
|
||||
$criteria->addSelectColumn(ProductSaleElementsTableMap::QUANTITY);
|
||||
$criteria->addSelectColumn(ProductSaleElementsTableMap::PROMO);
|
||||
$criteria->addSelectColumn(ProductSaleElementsTableMap::NEWNESS);
|
||||
@@ -352,6 +359,7 @@ class ProductSaleElementsTableMap extends TableMap
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.PRODUCT_ID');
|
||||
$criteria->addSelectColumn($alias . '.REF');
|
||||
$criteria->addSelectColumn($alias . '.QUANTITY');
|
||||
$criteria->addSelectColumn($alias . '.PROMO');
|
||||
$criteria->addSelectColumn($alias . '.NEWNESS');
|
||||
|
||||
@@ -40,13 +40,13 @@ class Tax extends BaseTax
|
||||
|
||||
/* test type */
|
||||
if(!class_exists($class)) {
|
||||
throw new TaxEngineException('Recorded type does not exists', TaxEngineException::BAD_RECORDED_TYPE);
|
||||
throw new TaxEngineException('Recorded type `' . $class . '` does not exists', TaxEngineException::BAD_RECORDED_TYPE);
|
||||
}
|
||||
|
||||
$instance = new $class;
|
||||
|
||||
if(!$instance instanceof BaseTaxType) {
|
||||
throw new TaxEngineException('Recorded type does not extends BaseTaxType', TaxEngineException::BAD_RECORDED_TYPE);
|
||||
throw new TaxEngineException('Recorded type `' . $class . '` does not extends BaseTaxType', TaxEngineException::BAD_RECORDED_TYPE);
|
||||
}
|
||||
|
||||
return $instance;
|
||||
@@ -54,7 +54,7 @@ class Tax extends BaseTax
|
||||
|
||||
public function setRequirements($requirements)
|
||||
{
|
||||
parent::setSerializedRequirements(base64_encode(json_encode($requirements)));
|
||||
return parent::setSerializedRequirements(base64_encode(json_encode($requirements)));
|
||||
}
|
||||
|
||||
public function getRequirements()
|
||||
|
||||
@@ -45,22 +45,28 @@ trait PositionManagementTrait {
|
||||
return $class->getConstant('DATABASE_NAME');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementors may add some search criteria (e.g., parent id) to the queries
|
||||
* used to change/get position by overloading this method.
|
||||
*/
|
||||
protected function addCriteriaToPositionQuery($query) {
|
||||
// Add required criteria here...
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the position of the next inserted object
|
||||
*/
|
||||
public function getNextPosition($parent = null) {
|
||||
public function getNextPosition() {
|
||||
|
||||
$query = $this->createQuery()
|
||||
->orderByPosition(Criteria::DESC)
|
||||
->limit(1);
|
||||
|
||||
if ($parent !== null) $query->filterByParent($parent);
|
||||
$this->addCriteriaToPositionQuery($query);
|
||||
|
||||
$last = $query->findOne()
|
||||
;
|
||||
$last = $query->findOne();
|
||||
|
||||
return $last != null ? $last->getPosition() + 1 : 1;
|
||||
return $last != null ? $last->getPosition() + 1 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,7 +96,7 @@ trait PositionManagementTrait {
|
||||
// Find object to exchange position with
|
||||
$search = $this->createQuery();
|
||||
|
||||
if (method_exists($this, 'getParent')) $search->filterByParent($this->getParent());
|
||||
$this->addCriteriaToPositionQuery($search);
|
||||
|
||||
// Up or down ?
|
||||
if ($up === true) {
|
||||
@@ -151,7 +157,7 @@ trait PositionManagementTrait {
|
||||
// Find categories to offset
|
||||
$search = $this->createQuery();
|
||||
|
||||
if (method_exists($this, 'getParent')) $search->filterByParent($this->getParent());
|
||||
$this->addCriteriaToPositionQuery($search);
|
||||
|
||||
if ($newPosition > $current_position) {
|
||||
// The new position is after the current position -> we will offset + 1 all categories located between us and the new position
|
||||
|
||||
@@ -39,6 +39,9 @@ class Calculator
|
||||
*/
|
||||
protected $taxRuleQuery = null;
|
||||
|
||||
/**
|
||||
* @var null|\Propel\Runtime\Collection\ObjectCollection
|
||||
*/
|
||||
protected $taxRulesCollection = null;
|
||||
|
||||
protected $product = null;
|
||||
@@ -71,6 +74,11 @@ class Calculator
|
||||
}
|
||||
|
||||
public function getTaxAmount($untaxedPrice)
|
||||
{
|
||||
return $this->getTaxedPrice($untaxedPrice) - $untaxedPrice;
|
||||
}
|
||||
|
||||
public function getTaxedPrice($untaxedPrice)
|
||||
{
|
||||
if(null === $this->taxRulesCollection) {
|
||||
throw new TaxEngineException('Tax rules collection is empty in Calculator::getTaxAmount', TaxEngineException::UNDEFINED_TAX_RULES_COLLECTION);
|
||||
@@ -80,23 +88,27 @@ class Calculator
|
||||
throw new TaxEngineException('BAD AMOUNT FORMAT', TaxEngineException::BAD_AMOUNT_FORMAT);
|
||||
}
|
||||
|
||||
$totalTaxAmount = 0;
|
||||
$taxedPrice = $untaxedPrice;
|
||||
$currentPosition = 1;
|
||||
$currentTax = 0;
|
||||
|
||||
foreach($this->taxRulesCollection as $taxRule) {
|
||||
$position = (int)$taxRule->getTaxRuleCountryPosition();
|
||||
|
||||
$taxType = $taxRule->getTypeInstance();
|
||||
$taxType->loadRequirements( $taxRule->getRequirements() );
|
||||
|
||||
$taxType->loadRequirements($taxRule->getRequirements());
|
||||
if($currentPosition !== $position) {
|
||||
$taxedPrice += $currentTax;
|
||||
$currentTax = 0;
|
||||
$currentPosition = $position;
|
||||
}
|
||||
|
||||
$taxAmount = $taxType->calculate($untaxedPrice);
|
||||
|
||||
$totalTaxAmount += $taxAmount;
|
||||
$untaxedPrice += $taxAmount;
|
||||
$currentTax += $taxType->calculate($taxedPrice);
|
||||
}
|
||||
|
||||
return $totalTaxAmount;
|
||||
}
|
||||
$taxedPrice += $currentTax;
|
||||
|
||||
public function getTaxedPrice($untaxedPrice)
|
||||
{
|
||||
return $untaxedPrice + $this->getTaxAmount($untaxedPrice);
|
||||
return $taxedPrice;
|
||||
}
|
||||
}
|
||||
|
||||
21
core/lib/Thelia/Core/Event/CategoryUpdatePositionEvent.php → core/lib/Thelia/TaxEngine/TaxType/FixAmountTaxType.php
Normal file → Executable file
21
core/lib/Thelia/Core/Event/CategoryUpdatePositionEvent.php → core/lib/Thelia/TaxEngine/TaxType/FixAmountTaxType.php
Normal file → Executable file
@@ -20,9 +20,26 @@
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\TaxEngine\TaxType;
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
use Thelia\Type\FloatType;
|
||||
|
||||
class CategoryUpdatePositionEvent extends BaseUpdatePositionEvent
|
||||
/**
|
||||
*
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class FixAmountTaxType extends BaseTaxType
|
||||
{
|
||||
public function calculate($untaxedPrice)
|
||||
{
|
||||
return $this->getRequirement("amount");
|
||||
}
|
||||
|
||||
public function getRequirementsList()
|
||||
{
|
||||
return array(
|
||||
'amount' => new FloatType(),
|
||||
);
|
||||
}
|
||||
}
|
||||
102
core/lib/Thelia/Tests/Action/CustomerTest.php
Normal file
102
core/lib/Thelia/Tests/Action/CustomerTest.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?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\Tests\Action\ImageTest;
|
||||
use Thelia\Action\Customer;
|
||||
use Thelia\Core\Event\CustomerCreateOrUpdateEvent;
|
||||
|
||||
|
||||
/**
|
||||
* Class CustomerTest
|
||||
* @package Thelia\Tests\Action\ImageTest
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class CustomerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function getContainer()
|
||||
{
|
||||
$container = new \Symfony\Component\DependencyInjection\ContainerBuilder();
|
||||
|
||||
$dispatcher = $this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface");
|
||||
|
||||
$container->set("event_dispatcher", $dispatcher);
|
||||
|
||||
return $container;
|
||||
}
|
||||
|
||||
public function testCreatedCustomer()
|
||||
{
|
||||
$customerCreateEvent = new CustomerCreateOrUpdateEvent(
|
||||
1,
|
||||
"thelia",
|
||||
"thelia",
|
||||
"street address 1",
|
||||
"street address 2",
|
||||
"street address 3",
|
||||
"0102030405",
|
||||
"0607080910",
|
||||
"63000",
|
||||
"clermont-ferrand",
|
||||
64,
|
||||
sprintf("%s@thelia.fr", uniqid()),
|
||||
uniqid(),
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
'My super company'
|
||||
);
|
||||
|
||||
$customerAction = new Customer($this->getContainer());
|
||||
|
||||
$customerAction->create($customerCreateEvent);
|
||||
|
||||
$customerCreated = $customerCreateEvent->getCustomer();
|
||||
|
||||
$this->assertInstanceOf("Thelia\Model\Customer", $customerCreated, "new customer created must be an instance of Thelia\Model\Customer");
|
||||
$this->assertFalse($customerCreated->isNew());
|
||||
|
||||
$this->assertEquals($customerCreateEvent->getFirstname(), $customerCreated->getFirstname());
|
||||
$this->assertEquals($customerCreateEvent->getLastname(), $customerCreated->getLastname());
|
||||
$this->assertEquals($customerCreateEvent->getTitle(), $customerCreated->getTitleId());
|
||||
$this->assertEquals($customerCreateEvent->getEmail(), $customerCreated->getEmail());
|
||||
$this->assertEquals($customerCreated->getReseller(), $customerCreated->getReseller());
|
||||
$this->assertEquals($customerCreated->getSponsor(), $customerCreated->getSponsor());
|
||||
$this->assertEquals($customerCreated->getDiscount(), $customerCreated->getDiscount());
|
||||
|
||||
$addressCreated = $customerCreated->getDefaultAddress();
|
||||
|
||||
$this->assertEquals($customerCreateEvent->getFirstname(), $addressCreated->getFirstname());
|
||||
$this->assertEquals($customerCreateEvent->getLastname(), $addressCreated->getLastname());
|
||||
$this->assertEquals($customerCreateEvent->getTitle(), $addressCreated->getTitleId());
|
||||
$this->assertEquals($customerCreateEvent->getAddress1(), $addressCreated->getAddress1());
|
||||
$this->assertEquals($customerCreateEvent->getAddress2(), $addressCreated->getAddress2());
|
||||
$this->assertEquals($customerCreateEvent->getAddress3(), $addressCreated->getAddress3());
|
||||
$this->assertEquals($customerCreateEvent->getZipcode(), $addressCreated->getZipcode());
|
||||
$this->assertEquals($customerCreateEvent->getCity(), $addressCreated->getCity());
|
||||
$this->assertEquals($customerCreateEvent->getCountry(), $addressCreated->getCountryId());
|
||||
$this->assertEquals($customerCreateEvent->getPhone(), $addressCreated->getPhone());
|
||||
$this->assertEquals($customerCreateEvent->getCellphone(), $addressCreated->getCellphone());
|
||||
$this->assertEquals($customerCreateEvent->getCompany(), $addressCreated->getCompany());
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Core\Security\SecurityContext;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
|
||||
use Thelia\Core\HttpFoundation\Session\Session;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -82,9 +83,32 @@ abstract class BaseLoopTestor extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->securityContext = new SecurityContext($this->request);*/
|
||||
|
||||
$stubRouterAdmin = $this->getMockBuilder('\Symfony\Component\Routing\Router')
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(array('getContext'))
|
||||
->getMock();
|
||||
|
||||
$stubRequestContext = $this->getMockBuilder('\Symfony\Component\Routing\RequestContext')
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(array('getHost'))
|
||||
->getMock();
|
||||
|
||||
$stubRequestContext->expects($this->any())
|
||||
->method('getHost')
|
||||
->will($this->returnValue('localhost'));
|
||||
|
||||
$stubRouterAdmin->expects($this->any())
|
||||
->method('getContext')
|
||||
->will($this->returnValue(
|
||||
$stubRequestContext
|
||||
));
|
||||
|
||||
|
||||
$this->container->set('request', $request);
|
||||
$this->container->set('event_dispatcher', new EventDispatcher());
|
||||
$this->container->set('thelia.securityContext', new SecurityContext($request));
|
||||
$this->container->set('router.admin', $stubRouterAdmin);
|
||||
$this->container->set('thelia.url.manager', new URL($this->container));
|
||||
|
||||
$this->instance = $this->getTestedInstance();
|
||||
$this->instance->initializeArgs($this->getMandatoryArguments());
|
||||
@@ -107,4 +131,42 @@ abstract class BaseLoopTestor extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertInstanceOf('\Thelia\Core\Template\Element\LoopResult', $methodReturn);
|
||||
}
|
||||
|
||||
public function baseTestSearchById($id)
|
||||
{
|
||||
$this->instance->initializeArgs(array_merge(
|
||||
$this->getMandatoryArguments(),
|
||||
array(
|
||||
"type" => "foo",
|
||||
"name" => "foo",
|
||||
"id" => $id,
|
||||
)
|
||||
));
|
||||
|
||||
$dummy = null;
|
||||
$loopResults = $this->instance->exec($dummy);
|
||||
|
||||
$this->assertEquals(1, $loopResults->getCount());
|
||||
|
||||
$substitutions = $loopResults->current()->getVarVal();
|
||||
|
||||
$this->assertEquals($id, $substitutions['ID']);
|
||||
}
|
||||
|
||||
public function baseTestSearchWithLimit($limit)
|
||||
{
|
||||
$this->instance->initializeArgs(array_merge(
|
||||
$this->getMandatoryArguments(),
|
||||
array(
|
||||
"type" => "foo",
|
||||
"name" => "foo",
|
||||
"limit" => $limit,
|
||||
)
|
||||
));
|
||||
|
||||
$dummy = null;
|
||||
$loopResults = $this->instance->exec($dummy);
|
||||
|
||||
$this->assertEquals($limit, $loopResults->getCount());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Tests\Core\Template\Loop;
|
||||
|
||||
use Thelia\Model\CategoryQuery;
|
||||
use Thelia\Tests\Core\Template\Element\BaseLoopTestor;
|
||||
|
||||
use Thelia\Core\Template\Loop\Category;
|
||||
@@ -48,4 +49,16 @@ class CategoryTest extends BaseLoopTestor
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function testSearchById()
|
||||
{
|
||||
$category = CategoryQuery::create()->findOne();
|
||||
|
||||
$this->baseTestSearchById($category->getId());
|
||||
}
|
||||
|
||||
public function testSearchLimit()
|
||||
{
|
||||
$this->baseTestSearchWithLimit(3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Tests\Core\Template\Loop;
|
||||
|
||||
use Thelia\Model\ContentQuery;
|
||||
use Thelia\Tests\Core\Template\Element\BaseLoopTestor;
|
||||
|
||||
use Thelia\Core\Template\Loop\Content;
|
||||
@@ -48,4 +49,16 @@ class ContentTest extends BaseLoopTestor
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function testSearchById()
|
||||
{
|
||||
$content = ContentQuery::create()->findOne();
|
||||
|
||||
$this->baseTestSearchById($content->getId());
|
||||
}
|
||||
|
||||
public function testSearchLimit()
|
||||
{
|
||||
$this->baseTestSearchWithLimit(3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Tests\Core\Template\Loop;
|
||||
|
||||
use Thelia\Model\FolderQuery;
|
||||
use Thelia\Tests\Core\Template\Element\BaseLoopTestor;
|
||||
|
||||
use Thelia\Core\Template\Loop\Folder;
|
||||
@@ -48,4 +49,16 @@ class FolderTest extends BaseLoopTestor
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function testSearchById()
|
||||
{
|
||||
$folder = FolderQuery::create()->findOne();
|
||||
|
||||
$this->baseTestSearchById($folder->getId());
|
||||
}
|
||||
|
||||
public function testSearchLimit()
|
||||
{
|
||||
$this->baseTestSearchWithLimit(3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Tests\Core\Template\Loop;
|
||||
|
||||
use Thelia\Model\ProductQuery;
|
||||
use Thelia\Tests\Core\Template\Element\BaseLoopTestor;
|
||||
|
||||
use Thelia\Core\Template\Loop\Product;
|
||||
@@ -48,4 +49,16 @@ class ProductTest extends BaseLoopTestor
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function testSearchById()
|
||||
{
|
||||
$product = ProductQuery::create()->findOne();
|
||||
|
||||
$this->baseTestSearchById($product->getId());
|
||||
}
|
||||
|
||||
public function testSearchLimit()
|
||||
{
|
||||
$this->baseTestSearchWithLimit(3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Tests\Rewriting;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Thelia\Model\RewritingUrl;
|
||||
use Thelia\Rewriting\RewritingRetriever;
|
||||
use Thelia\Tools\URL;
|
||||
@@ -34,6 +35,36 @@ use Thelia\Tools\URL;
|
||||
*/
|
||||
class RewritingRetrieverTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $container = null;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->container = new ContainerBuilder();
|
||||
|
||||
$stubRouterAdmin = $this->getMockBuilder('\Symfony\Component\Routing\Router')
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(array('getContext'))
|
||||
->getMock();
|
||||
|
||||
$stubRequestContext = $this->getMockBuilder('\Symfony\Component\Routing\RequestContext')
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(array('getHost'))
|
||||
->getMock();
|
||||
|
||||
$stubRequestContext->expects($this->any())
|
||||
->method('getHost')
|
||||
->will($this->returnValue('localhost'));
|
||||
|
||||
$stubRouterAdmin->expects($this->any())
|
||||
->method('getContext')
|
||||
->will($this->returnValue(
|
||||
$stubRequestContext
|
||||
));
|
||||
|
||||
$this->container->set('router.admin', $stubRouterAdmin);
|
||||
$this->container->set('thelia.url.manager', new URL($this->container));
|
||||
}
|
||||
|
||||
protected function getMethod($name)
|
||||
{
|
||||
$class = new \ReflectionClass('\Thelia\Rewriting\RewritingRetriever');
|
||||
|
||||
@@ -136,18 +136,21 @@ class CalculatorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testGetTaxAmountAndGetTaxedPrice()
|
||||
{
|
||||
/* consecutives taxes */
|
||||
$taxRulesCollection = new ObjectCollection();
|
||||
$taxRulesCollection->setModel('\Thelia\Model\Tax');
|
||||
|
||||
$tax = new Tax();
|
||||
$tax->setType('PricePercentTaxType')
|
||||
->setRequirements(array('percent' => 10));
|
||||
->setRequirements(array('percent' => 10))
|
||||
->setVirtualColumn('taxRuleCountryPosition', 1);
|
||||
|
||||
$taxRulesCollection->append($tax);
|
||||
|
||||
$tax = new Tax();
|
||||
$tax->setType('PricePercentTaxType')
|
||||
->setRequirements(array('percent' => 8));
|
||||
->setRequirements(array('percent' => 8))
|
||||
->setVirtualColumn('taxRuleCountryPosition', 2);
|
||||
|
||||
$taxRulesCollection->append($tax);
|
||||
|
||||
@@ -167,5 +170,40 @@ class CalculatorTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
$this->assertEquals(94, $taxAmount);
|
||||
$this->assertEquals(594, $taxedPrice);
|
||||
|
||||
/* same position taxes */
|
||||
$taxRulesCollection = new ObjectCollection();
|
||||
$taxRulesCollection->setModel('\Thelia\Model\Tax');
|
||||
|
||||
$tax = new Tax();
|
||||
$tax->setType('PricePercentTaxType')
|
||||
->setRequirements(array('percent' => 10))
|
||||
->setVirtualColumn('taxRuleCountryPosition', 1);
|
||||
|
||||
$taxRulesCollection->append($tax);
|
||||
|
||||
$tax = new Tax();
|
||||
$tax->setType('PricePercentTaxType')
|
||||
->setRequirements(array('percent' => 8))
|
||||
->setVirtualColumn('taxRuleCountryPosition', 1);
|
||||
|
||||
$taxRulesCollection->append($tax);
|
||||
|
||||
$calculator = new Calculator();
|
||||
|
||||
$rewritingUrlQuery = $this->getProperty('taxRulesCollection');
|
||||
$rewritingUrlQuery->setValue($calculator, $taxRulesCollection);
|
||||
|
||||
$taxAmount = $calculator->getTaxAmount(500);
|
||||
$taxedPrice = $calculator->getTaxedPrice(500);
|
||||
|
||||
/*
|
||||
* expect :
|
||||
* tax 1 = 500*0.10 = 50 // amout with tax 1 : 550
|
||||
* tax 2 = 500*0.08 = 40 // amout with tax 2 : 590
|
||||
* total tax amount = 90
|
||||
*/
|
||||
$this->assertEquals(90, $taxAmount);
|
||||
$this->assertEquals(590, $taxedPrice);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,3 +23,4 @@ Variables Config à initialiser:
|
||||
- images_library_path : chemin vers le répertoire où sont stockés les images source (defaut: local/media/images)
|
||||
- image_cache_dir_from_web_root : le repértoire de base où sont cachées les images, relatif à /web (cache/images)
|
||||
- imagine_graphic_driver : le drivers utilisé par Imagine (gd, imagik, gmagick), defaut: 'gd'
|
||||
- process_assets : ne pas processer les assets pour de meilleurs perfs (attention, les modifs sur les fichiers ne seront plus reportées !)
|
||||
|
||||
@@ -156,6 +156,45 @@ try {
|
||||
"azerty"
|
||||
);
|
||||
|
||||
for($i = 0; $i < 50; $i++) {
|
||||
$customer = new Thelia\Model\Customer();
|
||||
$customer->createOrUpdate(
|
||||
rand(1,3),
|
||||
$faker->firstname,
|
||||
$faker->lastname,
|
||||
$faker->streetAddress,
|
||||
$faker->streetAddress,
|
||||
$faker->streetAddress,
|
||||
$faker->phoneNumber,
|
||||
$faker->phoneNumber,
|
||||
$faker->postcode,
|
||||
$faker->city,
|
||||
64,
|
||||
$faker->email,
|
||||
"azerty".$i
|
||||
);
|
||||
|
||||
for ($j = 0; $j <= 3; $j++) {
|
||||
$address = new Thelia\Model\Address();
|
||||
$address->setLabel($faker->text(20))
|
||||
->setTitleId(rand(1,3))
|
||||
->setFirstname($faker->firstname)
|
||||
->setLastname($faker->lastname)
|
||||
->setAddress1($faker->streetAddress)
|
||||
->setAddress2($faker->streetAddress)
|
||||
->setAddress3($faker->streetAddress)
|
||||
->setCellphone($faker->phoneNumber)
|
||||
->setPhone($faker->phoneNumber)
|
||||
->setZipcode($faker->postcode)
|
||||
->setCity($faker->city)
|
||||
->setCountryId(64)
|
||||
->setCustomer($customer)
|
||||
->save()
|
||||
;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//features and features_av
|
||||
$featureList = array();
|
||||
for($i=0; $i<4; $i++) {
|
||||
@@ -319,6 +358,7 @@ try {
|
||||
for($i=0; $i<rand(1,7); $i++) {
|
||||
$stock = new \Thelia\Model\ProductSaleElements();
|
||||
$stock->setProductId($productId);
|
||||
$stock->setRef($productId . '_' . $i . '_' . $faker->randomNumber(8));
|
||||
$stock->setQuantity($faker->randomNumber(1,50));
|
||||
$stock->setPromo($faker->randomNumber(0,1));
|
||||
$stock->setNewness($faker->randomNumber(0,1));
|
||||
|
||||
@@ -32,10 +32,10 @@ INSERT INTO `customer_title`(`id`, `by_default`, `position`, `created_at`, `upda
|
||||
INSERT INTO `customer_title_i18n` (`id`, `locale`, `short`, `long`) VALUES
|
||||
(1, 'fr_FR', 'Mr', 'Monsieur'),
|
||||
(1, 'en_US', 'M', 'Mister'),
|
||||
(2, 'fr_FR', 'Mrs', 'Madame'),
|
||||
(2, 'en_US', 'Mme', 'Misses'),
|
||||
(3, 'fr_FR', 'Miss', 'Madamemoiselle'),
|
||||
(3, 'en_US', 'Mlle', 'Miss');
|
||||
(2, 'fr_FR', 'Mme', 'Madame'),
|
||||
(2, 'en_US', 'Mrs', 'Misses'),
|
||||
(3, 'fr_FR', 'Mlle', 'Madamemoiselle'),
|
||||
(3, 'en_US', 'Miss', 'Miss');
|
||||
|
||||
INSERT INTO `currency` (`id` ,`code` ,`symbol` ,`rate`, `position` ,`by_default` ,`created_at` ,`updated_at`)
|
||||
VALUES
|
||||
|
||||
116
install/tax_faker.php
Executable file
116
install/tax_faker.php
Executable file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
use Thelia\Constraint\ConstraintFactory;
|
||||
use Thelia\Constraint\ConstraintManager;
|
||||
use Thelia\Constraint\Rule\AvailableForTotalAmount;
|
||||
use Thelia\Constraint\Rule\AvailableForTotalAmountManager;
|
||||
use Thelia\Constraint\Rule\AvailableForXArticlesManager;
|
||||
use Thelia\Constraint\Rule\Operators;
|
||||
use Thelia\Coupon\CouponRuleCollection;
|
||||
use Thelia\Model\ProductImage;
|
||||
use Thelia\Model\CategoryImage;
|
||||
use Thelia\Model\FolderImage;
|
||||
use Thelia\Model\ContentImage;
|
||||
use Imagine\Image\Color;
|
||||
use Imagine\Image\Point;
|
||||
|
||||
require __DIR__ . '/../core/bootstrap.php';
|
||||
|
||||
$thelia = new Thelia\Core\Thelia("dev", true);
|
||||
$thelia->boot();
|
||||
|
||||
$faker = Faker\Factory::create();
|
||||
|
||||
$con = \Propel\Runtime\Propel::getConnection(
|
||||
Thelia\Model\Map\ProductTableMap::DATABASE_NAME
|
||||
);
|
||||
$con->beginTransaction();
|
||||
|
||||
$currency = \Thelia\Model\CurrencyQuery::create()->filterByCode('EUR')->findOne();
|
||||
|
||||
try {
|
||||
$stmt = $con->prepare("SET foreign_key_checks = 0");
|
||||
$stmt->execute();
|
||||
|
||||
\Thelia\Model\TaxQuery::create()
|
||||
->find()
|
||||
->delete();
|
||||
|
||||
\Thelia\Model\Base\TaxRuleQuery::create()
|
||||
->find()
|
||||
->delete();
|
||||
|
||||
\Thelia\Model\Base\TaxRuleCountryQuery::create()
|
||||
->find()
|
||||
->delete();
|
||||
|
||||
$stmt = $con->prepare("SET foreign_key_checks = 1");
|
||||
$stmt->execute();
|
||||
|
||||
/* 10% tax */
|
||||
$tax10p = new \Thelia\Model\Tax();
|
||||
$tax10p->setType('PricePercentTaxType')
|
||||
->setRequirements(array('percent' => 10))
|
||||
->save();
|
||||
|
||||
/* 8% tax */
|
||||
$tax8p = new \Thelia\Model\Tax();
|
||||
$tax8p->setType('PricePercentTaxType')
|
||||
->setRequirements(array('percent' => 8))
|
||||
->save();
|
||||
|
||||
/* fix 5 tax */
|
||||
$tax5 = new \Thelia\Model\Tax();
|
||||
$tax5->setType('FixAmountTaxType')
|
||||
->setRequirements(array('amount' => 5))
|
||||
->save();
|
||||
|
||||
/* 1% tax */
|
||||
$tax1p = new \Thelia\Model\Tax();
|
||||
$tax1p->setType('PricePercentTaxType')
|
||||
->setRequirements(array('percent' => 1))
|
||||
->save();
|
||||
|
||||
/* tax rule */
|
||||
$taxRule = new \Thelia\Model\TaxRule();
|
||||
$taxRule->save();
|
||||
|
||||
/* add 4 taxes to the rule for France (64) */
|
||||
$taxRuleCountry = new \Thelia\Model\TaxRuleCountry();
|
||||
$taxRuleCountry->setTaxRule($taxRule)
|
||||
->setCountryId(64)
|
||||
->setTax($tax10p)
|
||||
->setPosition(1)
|
||||
->save();
|
||||
|
||||
$taxRuleCountry = new \Thelia\Model\TaxRuleCountry();
|
||||
$taxRuleCountry->setTaxRule($taxRule)
|
||||
->setCountryId(64)
|
||||
->setTax($tax8p)
|
||||
->setPosition(1)
|
||||
->save();
|
||||
|
||||
$taxRuleCountry = new \Thelia\Model\TaxRuleCountry();
|
||||
$taxRuleCountry->setTaxRule($taxRule)
|
||||
->setCountryId(64)
|
||||
->setTax($tax5)
|
||||
->setPosition(2)
|
||||
->save();
|
||||
|
||||
$taxRuleCountry = new \Thelia\Model\TaxRuleCountry();
|
||||
$taxRuleCountry->setTaxRule($taxRule)
|
||||
->setCountryId(64)
|
||||
->setTax($tax1p)
|
||||
->setPosition(3)
|
||||
->save();
|
||||
|
||||
foreach(\Thelia\Model\ProductQuery::create()->find() as $productActiveRecord) {
|
||||
$productActiveRecord->setTaxRule($taxRule)
|
||||
->save();
|
||||
}
|
||||
|
||||
$con->commit();
|
||||
|
||||
} catch (Exception $e) {
|
||||
echo "error : ".$e->getMessage()."\n";
|
||||
$con->rollBack();
|
||||
}
|
||||
@@ -349,6 +349,7 @@ CREATE TABLE `product_sale_elements`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`product_id` INTEGER NOT NULL,
|
||||
`ref` VARCHAR(45) NOT NULL,
|
||||
`quantity` FLOAT NOT NULL,
|
||||
`promo` TINYINT DEFAULT 0,
|
||||
`newness` TINYINT DEFAULT 0,
|
||||
@@ -356,6 +357,7 @@ CREATE TABLE `product_sale_elements`
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `ref_UNIQUE` (`ref`),
|
||||
INDEX `idx_product_sale_element_product_id` (`product_id`),
|
||||
CONSTRAINT `fk_product_sale_element_product_id`
|
||||
FOREIGN KEY (`product_id`)
|
||||
@@ -1151,6 +1153,7 @@ CREATE TABLE `cart`
|
||||
`address_delivery_id` INTEGER,
|
||||
`address_invoice_id` INTEGER,
|
||||
`currency_id` INTEGER,
|
||||
`discount` FLOAT DEFAULT 0,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
@@ -1189,6 +1192,7 @@ CREATE TABLE `cart_item`
|
||||
`price` FLOAT,
|
||||
`promo_price` FLOAT,
|
||||
`price_end_of_life` DATETIME,
|
||||
`discount` FLOAT DEFAULT 0,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
|
||||
@@ -264,6 +264,7 @@
|
||||
<table name="product_sale_elements" namespace="Thelia\Model">
|
||||
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||
<column name="product_id" required="true" type="INTEGER" />
|
||||
<column name="ref" required="true" size="45" type="VARCHAR" />
|
||||
<column name="quantity" required="true" type="FLOAT" />
|
||||
<column defaultValue="0" name="promo" type="TINYINT" />
|
||||
<column defaultValue="0" name="newness" type="TINYINT" />
|
||||
@@ -274,6 +275,9 @@
|
||||
<index name="idx_product_sale_element_product_id">
|
||||
<index-column name="product_id" />
|
||||
</index>
|
||||
<unique name="ref_UNIQUE">
|
||||
<unique-column name="ref" />
|
||||
</unique>
|
||||
<behavior name="timestampable" />
|
||||
</table>
|
||||
<table isCrossRef="true" name="attribute_category" namespace="Thelia\Model">
|
||||
@@ -866,6 +870,7 @@
|
||||
<column name="address_delivery_id" type="INTEGER" />
|
||||
<column name="address_invoice_id" type="INTEGER" />
|
||||
<column name="currency_id" type="INTEGER" />
|
||||
<column defaultValue="0" name="discount" type="FLOAT" />
|
||||
<foreign-key foreignTable="customer" name="fk_cart_customer_id">
|
||||
<reference foreign="id" local="customer_id" />
|
||||
</foreign-key>
|
||||
@@ -904,6 +909,7 @@
|
||||
<column name="price" type="FLOAT" />
|
||||
<column name="promo_price" type="FLOAT" />
|
||||
<column name="price_end_of_life" type="TIMESTAMP" />
|
||||
<column defaultValue="0" name="discount" type="FLOAT" />
|
||||
<foreign-key foreignTable="cart" name="fk_cart_item_cart_id">
|
||||
<reference foreign="id" local="cart_id" />
|
||||
</foreign-key>
|
||||
|
||||
@@ -144,9 +144,9 @@
|
||||
</li>
|
||||
{/loop}
|
||||
|
||||
{loop name="menu-auth-discount" type="auth" roles="ADMIN" permissions="admin.discount.view"}
|
||||
<li class="{if $admin_current_location == 'discount'}active{/if}" id="discount_menu">
|
||||
<a href="{url path='/admin/discount'}">{intl l="Discount"}</a>
|
||||
{loop name="menu-auth-coupon" type="auth" roles="ADMIN" permissions="admin.coupon.view"}
|
||||
<li class="{if $admin_current_location == 'coupon'}active{/if}" id="coupon_menu">
|
||||
<a href="{url path='/admin/coupon-list'}">{intl l="Coupons"}</a>
|
||||
</li>
|
||||
{/loop}
|
||||
|
||||
@@ -224,17 +224,18 @@
|
||||
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
|
||||
|
||||
{debugbar_renderjs}
|
||||
|
||||
{debugbar_renderresult}
|
||||
|
||||
{block name="after-javascript-include"}{/block}
|
||||
|
||||
{javascripts file='assets/js/bootstrap/bootstrap.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
{block name="javascript-initialization"}{/block}
|
||||
|
||||
{* Modules scripts are included now *}
|
||||
{module_include location='footer_js'}
|
||||
|
||||
{javascripts file='assets/js/bootstrap/bootstrap.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
</body>
|
||||
</html>
|
||||
@@ -208,6 +208,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
.tab-pane{
|
||||
caption, .title{
|
||||
margin-top: 0.5em;
|
||||
|
||||
.btn{
|
||||
text-transform: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The overall form container
|
||||
.form-container {
|
||||
|
||||
|
||||
308
templates/admin/default/attribute-edit.html
Normal file
308
templates/admin/default/attribute-edit.html
Normal file
@@ -0,0 +1,308 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="page-title"}{intl l='Edit an attribute'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.attributes.edit{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="attributes edit-attribute">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
{loop name="attribute_edit" type="attribute" id=$attribute_id backend_context="1" lang=$edit_language_id}
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration/attributes'}">{intl l="Attributes"}</a></li>
|
||||
<li>{intl l='Editing attribute "%name"' name="{$TITLE}"}</li>
|
||||
</ul>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 general-block-decorator">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-12 title title-without-tabs">
|
||||
{intl l="Edit attribute $TITLE"}
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="form-container">
|
||||
{form name="thelia.admin.attribute.modification"}
|
||||
<form method="POST" action="{url path='/admin/configuration/attributes/save'}" {form_enctype form=$form} class="clearfix">
|
||||
|
||||
{include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/configuration/attributes'}"}
|
||||
|
||||
<div class="col-md-6">
|
||||
|
||||
<p class="title title-without-tabs">{intl l='Attribute information'}</p>
|
||||
|
||||
{* Be sure to get the attribute ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="attribute_id" value="{$attribute_id}" />
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/attributes'}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
|
||||
{/form_field}
|
||||
|
||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
|
||||
{include file="includes/standard-description-form-fields.html"}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
|
||||
<p class="title title-without-tabs">
|
||||
|
||||
{intl l='Attribute values'}
|
||||
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.attribute-av.create"}
|
||||
<span class="pull-right">
|
||||
<a data-toggle="modal" href="#creation_dialog" title="Add a new attribute value" class="btn btn-default btn-primary">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
</span>
|
||||
{/loop}
|
||||
</p>
|
||||
|
||||
<div class="alert alert-info">
|
||||
{intl l="Enter here all possible attribute values."}
|
||||
</div>
|
||||
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
{admin_sortable_header
|
||||
current_order=$order
|
||||
order='id'
|
||||
reverse_order='id_reverse'
|
||||
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
|
||||
label="{intl l='ID'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th>
|
||||
{admin_sortable_header
|
||||
current_order=$order
|
||||
order='alpha'
|
||||
reverse_order='alpha_reverse'
|
||||
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
|
||||
label="{intl l='Value'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th class="text-center">
|
||||
{admin_sortable_header
|
||||
current_order=$order
|
||||
order='manual'
|
||||
reverse_order='manual_reverse'
|
||||
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
|
||||
label="{intl l="Position"}"
|
||||
}
|
||||
</th>
|
||||
|
||||
{module_include location='attributes_value_table_header'}
|
||||
|
||||
<th class="actions">{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="list" type="attribute_availability" attribute=$attribute_id backend_context="1" lang=$edit_language_id order=$order}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
|
||||
<td>
|
||||
<input class="js-edit form-control" type="text" name="" value="{$TITLE}" />
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
permission="admin.attributes.edit"
|
||||
path={url path='/admin/configuration/attributes-av/update-position' attribute_id=$attribute_id}
|
||||
url_parameter="attributeav_id"
|
||||
in_place_edit_class="positionChange"
|
||||
position="$POSITION"
|
||||
id="$ID"
|
||||
}
|
||||
</td>
|
||||
|
||||
{module_include location='attributes_value_table_row'}
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.attribute-av.delete"}
|
||||
<a class="btn btn-default btn-xs value-delete" title="{intl l='Delete this value'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="list"}
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="alert alert-info">
|
||||
{intl l="No product attribute has been created yet. Click the + button to create one."}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/elseloop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="attribute_edit"}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-error">
|
||||
{intl l="Sorry, attribute ID=$attribute_id was not found."}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/elseloop}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* Adding a new attribute *}
|
||||
|
||||
{form name="thelia.admin.attributeav.creation"}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
|
||||
{capture "creation_dialog"}
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{* Be sure to get the attribute ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="attribute_id" value="{$attribute_id}" />
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to this page *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='attribute_id'}
|
||||
<input type="hidden" name="{$name}" value="{$attribute_id}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
|
||||
{loop type="lang" name="current-edit-lang" id="$edit_language_id"}
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Attribute title'}" placeholder="{intl l='Title'}">
|
||||
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" /></span>
|
||||
</div>
|
||||
|
||||
<div class="help-block">{intl l="Enter here the value in the current edit language ($TITLE)"}</div>
|
||||
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
||||
{/form_field}
|
||||
{/loop}
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='attribute_value_create_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "creation_dialog"
|
||||
dialog_title = {intl l="Create a new attribute value"}
|
||||
dialog_body = {$smarty.capture.creation_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create this value"}
|
||||
|
||||
form_action = {url path='/admin/configuration/attributes-av/create'}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
{/form}
|
||||
|
||||
{* Delete value confirmation dialog *}
|
||||
|
||||
{capture "delete_dialog"}
|
||||
<input type="hidden" name="attribute_id" value="{$attribute_id}" />
|
||||
<input type="hidden" name="attributeav_id" id="value_delete_id" value="" />
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "delete_dialog"
|
||||
dialog_title = {intl l="Delete attribute value"}
|
||||
dialog_message = {intl l="Do you really want to delete this attribute value ?"}
|
||||
|
||||
form_action = {url path='/admin/configuration/attributes-av/delete'}
|
||||
form_content = {$smarty.capture.delete_dialog nofilter}
|
||||
}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
|
||||
{javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
// Set proper attribute ID in delete from
|
||||
$('a.value-delete').click(function(ev) {
|
||||
$('#value_delete_id').val($(this).data('id'));
|
||||
});
|
||||
|
||||
// JS stuff for creation form
|
||||
{include
|
||||
file = "includes/generic-js-dialog.html"
|
||||
dialog_id = "creation_dialog"
|
||||
form_name = "thelia.admin.attributeav.creation"
|
||||
}
|
||||
|
||||
{* Inline editing of object position using bootstrap-editable *}
|
||||
|
||||
$('.positionChange').editable({
|
||||
type : 'text',
|
||||
title : '{intl l="Enter new value position"}',
|
||||
mode : 'popup',
|
||||
inputclass : 'input-mini',
|
||||
placement : 'left',
|
||||
success : function(response, newValue) {
|
||||
// The URL template
|
||||
var url = "{url path='/admin/configuration/attributes-av/update-position' attributeav_id='__ID__' position='__POS__' attribute_id=$attribute_id}";
|
||||
|
||||
// Perform subtitutions
|
||||
url = url.replace('__ID__', $(this).data('id')).replace('__POS__', newValue);
|
||||
|
||||
// Reload the page
|
||||
location.href = url;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
266
templates/admin/default/attributes.html
Normal file
266
templates/admin/default/attributes.html
Normal file
@@ -0,0 +1,266 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="page-title"}{intl l='Thelia Product Attributes'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.attributes.view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="attributes">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration/attributes'}">{intl l="Product attributes"}</a></li>
|
||||
</ul>
|
||||
|
||||
{module_include location='attributes_top'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<form action="#" method="post">
|
||||
<div class="general-block-decorator">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption>
|
||||
{intl l='Thelia product attributes'}
|
||||
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.attributes.create"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new product attribute'}" href="#creation_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
{admin_sortable_header
|
||||
current_order=$order
|
||||
order='id'
|
||||
reverse_order='id_reverse'
|
||||
path='/admin/configuration/attributes'
|
||||
label="{intl l='ID'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th>
|
||||
{admin_sortable_header
|
||||
current_order=$order
|
||||
order='alpha'
|
||||
reverse_order='alpha_reverse'
|
||||
path='/admin/configuration/attributes'
|
||||
label="{intl l='Title'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th class="text-center">
|
||||
{admin_sortable_header
|
||||
current_order=$order
|
||||
order='manual'
|
||||
reverse_order='manual_reverse'
|
||||
path='/admin/configuration/attributes'
|
||||
label="{intl l="Position"}"
|
||||
}
|
||||
</th>
|
||||
|
||||
{module_include location='attributes_table_header'}
|
||||
|
||||
<th class="actions">{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="list" type="attribute" backend_context="1" lang=$lang_id order=$order}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
|
||||
<td>
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.attributes.change"}
|
||||
<a title="{intl l='Change this attribute'}" href="{url path='/admin/configuration/attributes/update' attribute_id=$ID}">{$TITLE}</a>
|
||||
{/loop}
|
||||
{elseloop rel="can_change"}
|
||||
{$TITLE}
|
||||
{/elseloop}
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
permission="admin.attributes.edit"
|
||||
path="/admin/configuration/attributes/update-position"
|
||||
url_parameter="attribute_id"
|
||||
in_place_edit_class="positionChange"
|
||||
position="$POSITION"
|
||||
id="$ID"
|
||||
}
|
||||
</td>
|
||||
|
||||
{module_include location='attributes_table_row'}
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.attributes.change"}
|
||||
<a class="btn btn-default btn-xs attribute-change" title="{intl l='Change this product attribute'}" href="{url path='/admin/configuration/attributes/update' attribute_id=$ID}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.attributes.delete"}
|
||||
<a class="btn btn-default btn-xs attribute-delete" title="{intl l='Delete this product attribute'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="list"}
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="alert alert-info">
|
||||
{intl l="No product attribute has been created yet. Click the + button to create one."}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/elseloop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{module_include location='attributes_bottom'}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* Adding a new attribute *}
|
||||
|
||||
{form name="thelia.admin.attribute.creation"}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "creation_dialog"}
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to the edition page, _ID_ is replaced with the created attribute ID, see controller *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/attributes/update' attribute_id='_ID_'}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
|
||||
{loop type="lang" name="default-lang" default_only="1"}
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Attribute title'}" placeholder="{intl l='Title'}">
|
||||
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" /></span>
|
||||
</div>
|
||||
|
||||
<div class="help-block">{intl l="Enter here the attribute name in the default language ($TITLE)"}</div>
|
||||
|
||||
{* Switch edition to the current locale *}
|
||||
<input type="hidden" name="edit_language_id" value="{$ID}" />
|
||||
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
||||
{/form_field}
|
||||
{/loop}
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='add_to_all'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<div class="checkbox {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">
|
||||
<input type="checkbox" name="{$name}" value="1" {if $value != 0}checked="checked"{/if}>
|
||||
{$label}
|
||||
</label>
|
||||
<span class="help-block">{intl l='Check this box if you want to add this attributes to all product templates'}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='attribute_create_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "creation_dialog"
|
||||
dialog_title = {intl l="Create a new attribute"}
|
||||
dialog_body = {$smarty.capture.creation_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create this attribute"}
|
||||
|
||||
form_action = {url path='/admin/configuration/attributes/create'}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
{/form}
|
||||
|
||||
{* Delete confirmation dialog *}
|
||||
|
||||
{capture "delete_dialog"}
|
||||
<input type="hidden" name="attribute_id" id="attribute_delete_id" value="" />
|
||||
|
||||
{module_include location='attribute_delete_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "delete_dialog"
|
||||
dialog_title = {intl l="Delete attribute"}
|
||||
dialog_message = {intl l="Do you really want to delete this attribute ? It will be removed from all product templates."}
|
||||
|
||||
form_action = {url path='/admin/configuration/attributes/delete'}
|
||||
form_content = {$smarty.capture.delete_dialog nofilter}
|
||||
}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
|
||||
{javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
// Set proper attribute ID in delete from
|
||||
$('a.attribute-delete').click(function(ev) {
|
||||
$('#attribute_delete_id').val($(this).data('id'));
|
||||
});
|
||||
|
||||
// JS stuff for creation form
|
||||
{include
|
||||
file = "includes/generic-js-dialog.html"
|
||||
dialog_id = "creation_dialog"
|
||||
form_name = "thelia.admin.attribute.creation"
|
||||
}
|
||||
|
||||
{* Inline editing of object position using bootstrap-editable *}
|
||||
|
||||
$('.positionChange').editable({
|
||||
type : 'text',
|
||||
title : '{intl l="Enter new attribute position"}',
|
||||
mode : 'popup',
|
||||
inputclass : 'input-mini',
|
||||
placement : 'left',
|
||||
success : function(response, newValue) {
|
||||
// The URL template
|
||||
var url = "{url path='/admin/configuration/attributes/update-position' attribute_id='__ID__' position='__POS__'}";
|
||||
|
||||
// Perform subtitutions
|
||||
url = url.replace('__ID__', $(this).data('id'))
|
||||
.replace('__POS__', newValue);
|
||||
|
||||
// Reload the page
|
||||
location.href = url;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
@@ -327,7 +327,6 @@
|
||||
|
||||
{* Adding a new Category *}
|
||||
|
||||
|
||||
{form name="thelia.admin.category.creation"}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
@@ -366,6 +365,9 @@
|
||||
{/loop}
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='category_create_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
@@ -389,6 +391,9 @@
|
||||
{capture "category_delete_dialog"}
|
||||
<input type="hidden" name="current_category_id" value="{$current_category_id}" />
|
||||
<input type="hidden" name="category_id" id="delete_category_id" value"" />
|
||||
|
||||
{module_include location='category_delete_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<div class="form-horizontal col-md-12">
|
||||
<fieldset>
|
||||
|
||||
{include file="includes/inner-form-toolbar.html"}
|
||||
{include file="includes/inner-form-toolbar.html" close_url="{url path='admin/catalog/category/edit' category_id=$current_category_id}"}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@@ -136,7 +136,7 @@
|
||||
<div class="tab-pane form-container" id="details">
|
||||
<div class="form-horizontal col-md-12">
|
||||
<fieldset>
|
||||
{include file="includes/inner-form-toolbar.html"}
|
||||
{include file="includes/inner-form-toolbar.html" close_url="{url path='admin/catalog/category/edit' category_id=$current_category_id}"}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
|
||||
@@ -22,24 +22,24 @@
|
||||
|
||||
{module_include location='catalog_configuration_top'}
|
||||
|
||||
{loop type="auth" name="pcc1" roles="ADMIN" permissions="admin.configuration.product_templates"}
|
||||
{loop type="auth" name="pcc1" roles="ADMIN" permissions="admin.configuration.templates"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/product_templates'}">{intl l='Product templates'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/product-templates'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
<td><a href="{url path='/admin/configuration/templates'}">{intl l='Product templates'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/templates'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc2" roles="ADMIN" permissions="admin.configuration.product_attributes"}
|
||||
{loop type="auth" name="pcc2" roles="ADMIN" permissions="admin.configuration.attributes"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/product_attributes'}">{intl l='Product attributes'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/product-attributes'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
<td><a href="{url path='/admin/configuration/attributes'}">{intl l='Product attributes'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/attributes'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc3" roles="ADMIN" permissions="admin.configuration.product_features"}
|
||||
{loop type="auth" name="pcc3" roles="ADMIN" permissions="admin.configuration.features"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/product_features'}">{intl l='Product features'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/product-features'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
<td><a href="{url path='/admin/configuration/features'}">{intl l='Product features'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/features'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
|
||||
{javascripts file='assets/bootstrap-editable/js/bootstrap-editable.js'}
|
||||
{javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
|
||||
@@ -255,6 +255,8 @@
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='currency_create_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
@@ -277,6 +279,9 @@
|
||||
|
||||
{capture "delete_dialog"}
|
||||
<input type="hidden" name="currency_id" id="currency_delete_id" value="" />
|
||||
|
||||
{module_include location='currency_delete_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
{* Be sure to get the currency ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="currency_id" value="{$currency_id}" />
|
||||
|
||||
{include file="includes/inner-form-toolbar.html"}
|
||||
{include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/configuration/currencies'}"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
|
||||
@@ -29,17 +29,18 @@
|
||||
<div class="col-md-12">
|
||||
|
||||
{form name="thelia.customer.modification"}
|
||||
<form method="POST" action="{url path='/admin/customers/save'}" {form_enctype form=$form} class="clearfix">
|
||||
|
||||
{* Be sure to get the customer ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="customer_id" value="{$customer_id}" />
|
||||
|
||||
{include file="includes/inner-form-toolbar.html"}
|
||||
<form method="POST" action="{url path="/admin/customer/update/{$ID}"}" {form_enctype form=$form} class="clearfix">
|
||||
|
||||
<div class="row inner-toolbar clearfix">
|
||||
<div class="col-md-6 inner-actions pull-right">
|
||||
<button type="submit" name="save_mode" value="stay" class="btn btn-default btn-primary" title="{intl l='Save'}">{intl l='Save'} <span class="glyphicon glyphicon-ok"></span></button>
|
||||
<button type="submit" name="save_mode" value="close" class="btn btn-default btn-info" title="{intl l='Save and close'}">{intl l='Save and close'} <span class="glyphicon glyphicon-remove"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/customers'}" />
|
||||
<input type="hidden" name="{$name}" value="{url path="/admin/customer/update/{$ID}"}" />
|
||||
{/form_field}
|
||||
|
||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
@@ -52,8 +53,8 @@
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
|
||||
<select name="{$name}" id="{$label_attr.for}" class="form-control">
|
||||
{loop type="title" name="title1"}
|
||||
<option value="{$ID}">{$LONG}</option>
|
||||
{loop type="title" name="title1" backend_context="1"}
|
||||
<option value="{$ID}" {if $ID == $TITLE}selected{/if}>{$LONG}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
@@ -77,6 +78,13 @@
|
||||
|
||||
<p class="title title-without-tabs">{intl l="Default address"}</p>
|
||||
|
||||
{form_field form=$form field='company'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$COMPANY}" title="{intl l="{$label}"}" placeholder="{intl l='Company'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='address1'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
@@ -143,67 +151,20 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{loop name="address" type="address" customer="$customer_id" backend_context="1" default="0"}
|
||||
<tr>
|
||||
<td>
|
||||
<address>
|
||||
<strong>Twitter, Inc.</strong><br>
|
||||
795 Folsom Ave, Suite 600<br>
|
||||
San Francisco, CA 94107<br>
|
||||
<abbr title="Phone">P:</abbr> (123) 456-7890
|
||||
</address>
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this address'}" href="#edit_address_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-edit"></span>
|
||||
</a>
|
||||
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Use this address by default'}" href="#use_address_dialog" data-toggle="modal" rel="tooltip">
|
||||
<span class="glyphicon glyphicon-pushpin"></span>
|
||||
</a>
|
||||
|
||||
<a class="btn btn-default btn-xs customer-delete" title="{intl l='Delete this customer and all his orders'}" href="#delete_address_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<address>
|
||||
<strong>Twitter, Inc.</strong><br>
|
||||
795 Folsom Ave, Suite 600<br>
|
||||
San Francisco, CA 94107<br>
|
||||
<abbr title="Phone">P:</abbr> (123) 456-7890
|
||||
</address>
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this address'}" href="#edit_address_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-edit"></span>
|
||||
</a>
|
||||
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Use this address by default'}" href="#use_address_dialog" data-toggle="modal" rel="tooltip">
|
||||
<span class="glyphicon glyphicon-pushpin"></span>
|
||||
</a>
|
||||
|
||||
<a class="btn btn-default btn-xs customer-delete" title="{intl l='Delete this customer and all his orders'}" href="#delete_address_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<address>
|
||||
<strong>Twitter, Inc.</strong><br>
|
||||
795 Folsom Ave, Suite 600<br>
|
||||
San Francisco, CA 94107<br>
|
||||
<abbr title="Phone">P:</abbr> (123) 456-7890
|
||||
<strong>{loop name="address.title" type="title" id=$TITLE}{$SHORT}{/loop} {$FIRSTNAME} {$LASTNAME}</strong><br>
|
||||
{$ADDRESS1}<br>
|
||||
{$ADDRESS2}<br>
|
||||
{$ADDRESS3}<br>
|
||||
{if $PHONE}
|
||||
<abbr title="{intl l="Phone"}">P:</abbr> {$PHONE}<br>
|
||||
{/if}
|
||||
{if $CELLPHONE}
|
||||
<abbr title="{intl l="cell phone"}">P:</abbr> {$CELLPHONE}
|
||||
{/if}
|
||||
</address>
|
||||
</td>
|
||||
<td>
|
||||
@@ -224,6 +185,7 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -128,12 +128,13 @@
|
||||
<li class="active"><a href="#">{$PAGE}</a></li>
|
||||
{/if}
|
||||
|
||||
|
||||
{/pageloop}
|
||||
{if $PAGE == $LAST && $LAST != $CURRENT}
|
||||
<li><a href="{url path="/admin/customers" page="$PAGE"}">»</a></li>
|
||||
{else}
|
||||
<li class="disabled"><a href="#">»</a></li>
|
||||
{/if}
|
||||
{/pageloop}
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@@ -259,7 +260,8 @@
|
||||
{* Delete confirmation dialog *}
|
||||
|
||||
{capture "delete_customer_dialog"}
|
||||
<input type="hidden" name="customer_id" id="customer_delete_id" value="" />
|
||||
<input type="hidden" name="customer_page" value="{$customer_page}">
|
||||
<input type="hidden" name="customer_id" id="delete_customer_id">
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
@@ -270,7 +272,18 @@
|
||||
dialog_message = {intl l="Do you really want to delete this customer ?"}
|
||||
|
||||
form_action = {url path='/admin/customer/delete'}
|
||||
form_content = {$smarty.capture.delete_dialog nofilter}
|
||||
form_content = {$smarty.capture.delete_customer_dialog nofilter}
|
||||
form_id = "form_delete_customer"
|
||||
}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
|
||||
<script type="text/javascript">
|
||||
$(".customer-delete").click(function(){
|
||||
$("#delete_customer_id").val($(this).attr("data-id"));
|
||||
});
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
@@ -14,6 +14,7 @@ Parameters:
|
||||
form_action = the form action URL, subtitted by a click on OK button
|
||||
form_method = the form method, default "POST"
|
||||
form_content = the form content
|
||||
form_id = the form id
|
||||
|
||||
*}
|
||||
<div class="modal fade" id="{$dialog_id}" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
@@ -28,7 +29,7 @@ Parameters:
|
||||
{$dialog_message nofilter}
|
||||
</div>
|
||||
|
||||
<form method="{$form_method|default:POST}" action="{$form_action}">
|
||||
<form method="{$form_method|default:POST}" action="{$form_action}" id="{$form_id}">
|
||||
|
||||
{$form_content nofilter}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ Parameters:
|
||||
|
||||
{* Always reset create dialog on close *}
|
||||
|
||||
$('#{$dialog_id}').on('hidden', function() {
|
||||
$('#{$dialog_id}').on('hidden.bs.modal', function() {
|
||||
|
||||
// Hide error message
|
||||
$('#{$dialog_id}_error').remove();
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<ul class="nav nav-pills">
|
||||
{loop name="lang_list" type="lang" default_only={$default_only}}
|
||||
<li {if $ID == $edit_language_id}class="active"{/if}>
|
||||
<a href="{$current_url}&edit_language_id={$ID}" title="{intl l="Edit information in %lng" lng=$TITLE}">
|
||||
<a href="{$current_url nofilter}&edit_language_id={$ID}" title="{intl l="Edit information in %lng" lng=$TITLE}">
|
||||
<img src="{image file="../assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" />
|
||||
</a>
|
||||
</li>
|
||||
@@ -21,7 +21,10 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 inner-actions">
|
||||
<button type="submit" name="save_mode" value="stay" class="btn btn-default btn-primary" title="{intl l='Save'}">{intl l='Save'} <span class="glyphicon glyphicon-ok"></span></button>
|
||||
<button type="submit" name="save_mode" value="stay" class="btn btn-default btn-success" title="{intl l='Save'}">{intl l='Save'} <span class="glyphicon glyphicon-ok"></span></button>
|
||||
<button type="submit" name="save_mode" value="close" class="btn btn-default btn-info" title="{intl l='Save and close'}">{intl l='Save and close'} <span class="glyphicon glyphicon-remove"></span></button>
|
||||
{if ! empty($close_url)}
|
||||
<a href="{$close_url}" class="btn btn-default">{intl l='Close'} <span class="glyphicon glyphicon-remove"></span></a>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
{loop type="feed" name="thelia_feeds" url="http://thelia.net/Flux-rss.html?id_rubrique=8" limit="3"}
|
||||
<div class="span4 feed-list-item">
|
||||
<h3>{$DATE}</h3>
|
||||
<h2><a href="{$URL}" target="_blank" title="{intl l='Lire la suite'}">{$TITLE|strip_tags}</a></h2>
|
||||
<p>{$DESCRIPTION|strip_tags|truncate:250:"...":true}</p>
|
||||
<h2><a href="{$URL}" target="_blank" title="{intl l='Lire la suite'}">{$TITLE|strip_tags nofilter}</a></h2>
|
||||
<p>{$DESCRIPTION|strip_tags|truncate:250:"...":true nofilter}</p>
|
||||
<p><a class="btn" href="{$URL}" target="_blank">{intl l='Lire la suite »'}</a></p>
|
||||
</div>
|
||||
{/loop}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
{* Be sure to get the message ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="message_id" value="{$message_id}" />
|
||||
|
||||
{include file="includes/inner-form-toolbar.html"}
|
||||
{include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/configuration/messages'}"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
|
||||
@@ -152,6 +152,9 @@
|
||||
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='message_create_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
@@ -173,6 +176,9 @@
|
||||
|
||||
{capture "delete_dialog"}
|
||||
<input type="hidden" name="message_id" id="message_delete_id" value="" />
|
||||
|
||||
{module_include location='message_delete_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
|
||||
451
templates/admin/default/order-edit.html
Normal file
451
templates/admin/default/order-edit.html
Normal file
@@ -0,0 +1,451 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="page-title"}{intl l='Edit an order'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.order.edit{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="orders edit-order">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/orders'}">{intl l="Orders"}</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<div class="general-block-decorator">
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#cart" data-toggle="tab"><span class="glyphicon glyphicon-shopping-cart"></span> {intl l="Cart"}</a></li>
|
||||
<li><a href="#bill" data-toggle="tab"><span class="glyphicon glyphicon-list-alt"></span> {intl l="Bill"}</a></li>
|
||||
<li><a href="#carriage" data-toggle="tab"><span class="glyphicon glyphicon-send"></span> {intl l="Carriage"}</a></li>
|
||||
<li><a href="#settlement" data-toggle="tab"><span class="glyphicon glyphicon-credit-card"></span> {intl l="Settlement"}</a></li>
|
||||
<li><a href="#address" data-toggle="tab"><span class="glyphicon glyphicon-home"></span> {intl l="Address"}</a></li>
|
||||
<li><a href="#supplements" data-toggle="tab"><span class="glyphicon glyphicon-info-sign"></span> {intl l="Further information"}</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade active in" id="cart">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption class="clearfix">
|
||||
{intl l='Information about order 01201303540354'}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l="Designation"}</th>
|
||||
<th>{intl l="Price"}</th>
|
||||
<th>{intl l="Quantity"}</th>
|
||||
<th>{intl l="Total"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="#">T-Shirt F T1</a></td>
|
||||
<td>20.00 €</td>
|
||||
<td>3</td>
|
||||
<td>60.00 €</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#">T-Shirt F T1</a></td>
|
||||
<td>20.00 €</td>
|
||||
<td>3</td>
|
||||
<td>60.00 €</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#">T-Shirt F T1</a></td>
|
||||
<td>20.00 €</td>
|
||||
<td>3</td>
|
||||
<td>60.00 €</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="active">
|
||||
<td colspan="3"><strong>Total</strong></td>
|
||||
<td><strong>180.00 €</strong></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div> <!-- #cart -->
|
||||
|
||||
<div class="tab-pane fade" id="bill">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption>
|
||||
{intl l='Information about the bill'}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l="Bill n°"}</th>
|
||||
<th>{intl l="Compagny"}</th>
|
||||
<th>{intl l="Firstname & Lastname"}</th>
|
||||
<th>{intl l="Date & Hour"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="#">0001</a></td>
|
||||
<td>Thelia</td>
|
||||
<td>Dupont Jean</td>
|
||||
<td>11/01/2013 14:11:00</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- #bill -->
|
||||
|
||||
<div class="tab-pane fade" id="carriage">
|
||||
<p class="title title-without-tabs clearfix">
|
||||
{intl l='Information about the carriage'}
|
||||
<a class="btn btn-default btn-primary pull-right" title="{intl l='Download pdf bill'}" href="#">
|
||||
<span class="glyphicon glyphicon-cloud-download"></span> {intl l='Download pdf bill'}
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<dl class="dl-horizontal">
|
||||
<dt>{intl l="Mode of transportation"}</dt>
|
||||
<dd>Colissimo</dd>
|
||||
</dl>
|
||||
<dl class="dl-horizontal">
|
||||
<dt>{intl l="Description"}</dt>
|
||||
<dd>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ut, error, necessitatibus ipsam dolores ad quisquam provident sed repudiandae ullam quasi quae perferendis numquam voluptates doloribus laborum possimus dicta similique in?</dd>
|
||||
</dl>
|
||||
</div> <!-- #carriage -->
|
||||
|
||||
<div class="tab-pane fade" id="settlement">
|
||||
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption class="clearfix">
|
||||
{intl l='Information about the settlement'}
|
||||
</caption>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{intl l="Type of payment"}</th>
|
||||
<td>Unknown</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Transaction reference"}</th>
|
||||
<td>141100</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Total order before discount"}</th>
|
||||
<td>60 €</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Discount"}</th>
|
||||
<td>10%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Coupon code"}</th>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Total with discount"}</th>
|
||||
<td>50 €</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Freight"}</th>
|
||||
<td>6 €</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Total"}</th>
|
||||
<td>56 €</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div> <!-- #settlement -->
|
||||
|
||||
<div class="tab-pane fade clearfix" id="address">
|
||||
|
||||
<div class="col-md-6">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption class="clearfix">
|
||||
{intl l='Billing address'}
|
||||
<a class="btn btn-default btn-primary pull-right" title="{intl l='Edit this billing address'}" href="#edit_address_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-edit"></span>
|
||||
</a>
|
||||
</caption>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{intl l="Title"}</th>
|
||||
<td>Mr</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Compagny"}</th>
|
||||
<td>Thelia</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Firstname"}</th>
|
||||
<td>Espeche</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Lastname"}</th>
|
||||
<td>Michaël</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Street address"}</th>
|
||||
<td>5, rue Rochon</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Additional address"}</th>
|
||||
<td>Lorem ipsum dolor sit amet</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Additional address"}</th>
|
||||
<td>Lorem ipsum dolor sit</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Zip code"}</th>
|
||||
<td>63000</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="City"}</th>
|
||||
<td>Clermont-Fd</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Country"}</th>
|
||||
<td>France</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Phone"}</th>
|
||||
<td>01 02 03 04 05</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption class="clearfix">
|
||||
{intl l='Delivery address'}
|
||||
<a class="btn btn-default btn-primary pull-right" title="{intl l='Edit this delivery address'}" href="#edit_address_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-edit"></span>
|
||||
</a>
|
||||
</caption>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{intl l="Title"}</th>
|
||||
<td>Mr</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Compagny"}</th>
|
||||
<td>Thelia</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Firstname"}</th>
|
||||
<td>Espeche</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Lastname"}</th>
|
||||
<td>Michaël</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Street address"}</th>
|
||||
<td>5, rue Rochon</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Additional address"}</th>
|
||||
<td>Lorem ipsum dolor sit amet</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Additional address"}</th>
|
||||
<td>Lorem ipsum dolor sit</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Zip code"}</th>
|
||||
<td>63000</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="City"}</th>
|
||||
<td>Clermont-Fd</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Country"}</th>
|
||||
<td>France</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Phone"}</th>
|
||||
<td>01 02 03 04 05</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div> <!-- #address -->
|
||||
|
||||
<div class="tab-pane fade clearfix" id="supplements">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption>
|
||||
{intl l='Further information'}
|
||||
</caption>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><label for="">{intl l='Status'}</label></th>
|
||||
<td>
|
||||
<form action="" method="">
|
||||
<div class="row">
|
||||
<div class="col-lg-4">
|
||||
<select name="" id="" class="form-control">
|
||||
<option value="">Status 1</option>
|
||||
<option value="">Status 2</option>
|
||||
<option value="">Status 3</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><label for="">{intl l='Order Tracking'}</label></th>
|
||||
<td>
|
||||
<form action="" method="">
|
||||
<div class="row">
|
||||
<div class="col-lg-4">
|
||||
<input type="text" id="" name="" class="form-control" value="" title="" placeholder="">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-ok"></span></button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l='Bill'}</th>
|
||||
<td><a href="#" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-cloud-download"></span> {intl l='Download bill to pdf'}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l='Delivery'}</th>
|
||||
<td><a href="#" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-cloud-download"></span> {intl l='Download delivery to pdf'}</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div> <!-- #supplements -->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* Update an Address *}
|
||||
|
||||
{form name="thelia.address.update"}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "edit_address_dialog"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='label'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Label'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='company'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Company'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
|
||||
<select name="{$name}" id="{$label_attr.for}" class="form-control">
|
||||
{loop type="title" name="title1"}
|
||||
<option value="{$ID}">{$LONG}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='firstname'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Firstname'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='lastname'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Lastname'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='address1'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Address'}">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{form_field form=$form field='address2'}
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Additional address'}">
|
||||
{/form_field}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{form_field form=$form field='address3'}
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Additional address'}">
|
||||
{/form_field}
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='zipcode'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Zip code'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='city'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='City'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='country'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<select name="{$name}" id="{$label_attr.for}" class="form-control">
|
||||
{loop type="country" name="country1"}
|
||||
<option value="{$ID}">{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "edit_address_dialog"
|
||||
dialog_title = {intl l="Edit an address"}
|
||||
dialog_body = {$smarty.capture.edit_address_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Edit this address"}
|
||||
dialog_cancel_label = {intl l="Cancel"}
|
||||
|
||||
form_action = {url path='/admin/address/update'}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
|
||||
{/form}
|
||||
|
||||
{/block}
|
||||
@@ -18,118 +18,116 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<form action="{url path='/admin/orders/update-values'}" method="post">
|
||||
<div class="general-block-decorator">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption class="clearfix">
|
||||
{intl l='Orders'}
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.orders.create"}
|
||||
<a class="btn btn-default btn-primary pull-right" title="{intl l='Create an order'}" href="#creation_dialog">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l="Order n°"}</th>
|
||||
<th>{intl l="Date & Hour"}</th>
|
||||
<th>{intl l="Compagny"}</th>
|
||||
<th>{intl l="Name"}</th>
|
||||
<th>{intl l="Amount"}</th>
|
||||
<th>{intl l="Status"}</th>
|
||||
<div class="general-block-decorator">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption class="clearfix">
|
||||
{intl l='Orders'}
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.orders.create"}
|
||||
<a class="btn btn-default btn-primary pull-right" title="{intl l='Create an order'}" href="#creation_dialog">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l="Order n°"}</th>
|
||||
<th>{intl l="Date & Hour"}</th>
|
||||
<th>{intl l="Compagny"}</th>
|
||||
<th>{intl l="Name"}</th>
|
||||
<th>{intl l="Amount"}</th>
|
||||
<th>{intl l="Status"}</th>
|
||||
|
||||
{module_include location='orders_table_header'}
|
||||
{module_include location='orders_table_header'}
|
||||
|
||||
<th>{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<th>{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<tbody>
|
||||
<tr>
|
||||
|
||||
<td><a href="">01230450123045</a></td>
|
||||
<td>11/09/2013 10:24:31</td>
|
||||
<td>Thelia</td>
|
||||
<td><a href="">Dupont</a></td>
|
||||
<td>251 €</td>
|
||||
<td><span class="label label-success">Paid</span></td>
|
||||
<td><a href="">01230450123045</a></td>
|
||||
<td>11/09/2013 10:24:31</td>
|
||||
<td>Thelia</td>
|
||||
<td><a href="">Dupont</a></td>
|
||||
<td>251 €</td>
|
||||
<td><span class="label label-success">Paid</span></td>
|
||||
|
||||
{module_include location='orders_table_row'}
|
||||
{module_include location='orders_table_row'}
|
||||
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.orders.edit"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this order'}" href="{url path='/admin/orders/update/$ID'}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.orders.edit"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this order'}" href="{url path='/admin/order/update/$ID'}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.orders.delete"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Delete this order'}" href="#delete_order_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.orders.delete"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Delete this order'}" href="#delete_order_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
<td><a href="">01230450123045</a></td>
|
||||
<td>11/09/2013 10:24:31</td>
|
||||
<td>Thelia</td>
|
||||
<td><a href="">Dupont</a></td>
|
||||
<td>251 €</td>
|
||||
<td><span class="label label-danger">Canceled</span></td>
|
||||
<td><a href="">01230450123045</a></td>
|
||||
<td>11/09/2013 10:24:31</td>
|
||||
<td>Thelia</td>
|
||||
<td><a href="">Dupont</a></td>
|
||||
<td>251 €</td>
|
||||
<td><span class="label label-danger">Canceled</span></td>
|
||||
|
||||
{module_include location='orders_table_row'}
|
||||
{module_include location='orders_table_row'}
|
||||
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.orders.edit"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this order'}" href="{url path='/admin/orders/update/$ID'}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.orders.edit"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this order'}" href="{url path='/admin/order/update/$ID'}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.orders.delete"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Delete this order'}" href="#delete_order_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.orders.delete"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Delete this order'}" href="#delete_order_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
<td><a href="">01230450123045</a></td>
|
||||
<td>11/09/2013 10:24:31</td>
|
||||
<td>Thelia</td>
|
||||
<td><a href="">Dupont</a></td>
|
||||
<td>251 €</td>
|
||||
<td><span class="label label-info">Current</span></td>
|
||||
<td><a href="">01230450123045</a></td>
|
||||
<td>11/09/2013 10:24:31</td>
|
||||
<td>Thelia</td>
|
||||
<td><a href="">Dupont</a></td>
|
||||
<td>251 €</td>
|
||||
<td><span class="label label-info">Current</span></td>
|
||||
|
||||
{module_include location='orders_table_row'}
|
||||
{module_include location='orders_table_row'}
|
||||
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.orders.edit"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this order'}" href="{url path='/admin/orders/update/$ID'}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.orders.edit"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this order'}" href="{url path='/admin/order/update/$ID'}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.orders.delete"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Delete this order'}" href="#delete_order_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.orders.delete"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Delete this order'}" href="#delete_order_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- <tr>
|
||||
<td colspan="3">
|
||||
<div class="alert alert-info">
|
||||
{intl l="No mailing template has been created yet. Click the + button to create one."}
|
||||
</div>
|
||||
</td>
|
||||
</tr> -->
|
||||
<!-- <tr>
|
||||
<td colspan="3">
|
||||
<div class="alert alert-info">
|
||||
{intl l="No mailing template has been created yet. Click the + button to create one."}
|
||||
</div>
|
||||
</td>
|
||||
</tr> -->
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="page-title"}{intl l='Thelia Product Attributes'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.product_attributes.view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="attributes">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration/product_attributes'}">{intl l="Product attributes"}</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<form action="#" method="post">
|
||||
<div class="general-block-decorator">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption>
|
||||
{intl l='Thelia product attributes'}
|
||||
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new product attribute'}" href="#add_product_attribute_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l="Title"}</th>
|
||||
<th>{intl l="Position"}</th>
|
||||
<th>{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Title here</td>
|
||||
<td>1</td>
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-default btn-xs message-change" title="{intl l='Change this product attribute'}" href="{url path='/admin/configuration/product_attributes/update' product_attribute_id="$ID"}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
|
||||
<a class="btn btn-default btn-xs message-delete" title="{intl l='Delete this mailing template'}" href="#delete_product_attribute_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- <tr>
|
||||
<td colspan="3">
|
||||
<div class="alert alert-info">
|
||||
{intl l="No product attribute has been created yet. Click the + button to create one."}
|
||||
</div>
|
||||
</td>
|
||||
</tr> -->
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{* Adding a new message *}
|
||||
|
||||
<div class="modal fade" id="add_product_attribute_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>{intl l="Create a new product attribute"}</h3>
|
||||
</div>
|
||||
|
||||
|
||||
<form method="POST" action="">
|
||||
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="alert alert-danger" id="add_procut_attribute_dialog_error">Error message</div>
|
||||
|
||||
<div class="form-group has-error">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="Title"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value}" title="{intl l='Mailing template name'}" placeholder="{intl l='Mailing template name'}" class="form-control">
|
||||
</div>
|
||||
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox">
|
||||
Add this attribute to all sections
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {intl l="Cancel"}</button>
|
||||
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {intl l="Create this product attribute"}</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{* Delete confirmation dialog *}
|
||||
|
||||
<div class="modal fade" id="delete_product_attribute_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>{intl l="Delete a product attribute"}</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<p>{intl l="Do you really want to delete this product attribute ?"}</p>
|
||||
</div>
|
||||
|
||||
<form method="post" action="">
|
||||
<!-- <input type="hidden" name="message_id" id="message_delete_id" value="" /> -->
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {intl l="No"}</button>
|
||||
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {intl l="Yes"}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
@@ -34,7 +34,7 @@
|
||||
{* Be sure to get the variable ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="variable_id" value="{$variable_id}" />
|
||||
|
||||
{include file="includes/inner-form-toolbar.html"}
|
||||
{include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/configuration/variables'}"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
|
||||
@@ -194,6 +194,9 @@
|
||||
{/loop}
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
|
||||
{module_include location='variable_create_form'}
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
@@ -215,6 +218,9 @@
|
||||
|
||||
{capture "delete_dialog"}
|
||||
<input type="hidden" name="variable_id" id="variable_delete_id" value="" />
|
||||
|
||||
{module_include location='variable_delete_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
|
||||
175
templates/default/account.html
Normal file
175
templates/default/account.html
Normal file
@@ -0,0 +1,175 @@
|
||||
{extends file="layout.tpl"}
|
||||
|
||||
{block name="breadcrumb"}
|
||||
<nav class="nav-breadcrumb" role="navigation" aria-labelledby="breadcrumb-label">
|
||||
<strong id="breadcrumb-label">{intl l="You are here"}: </strong>
|
||||
<ul class="breadcrumb" itemprop="breadcrumb">
|
||||
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="index.php" itemprop="url"><span itemprop="title">{intl l="Home"}</span></a></li>
|
||||
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="active"><span itemprop="title">{intl l="Account"}</span></li>
|
||||
</ul>
|
||||
</nav><!-- /.nav-breadcrumb -->
|
||||
{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="main">
|
||||
|
||||
<article class="col-main" role="main" aria-labelledby="main-label">
|
||||
|
||||
<h1 id="main-label" class="page-header">{intl l="My Account"}</h1>
|
||||
|
||||
<div id="account" class="panel-group">
|
||||
<div class="panel account-info">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a class="accordion-toggle" data-toggle="collapse" data-parent="#account" href="#account-info">
|
||||
{intl l="Personal Informations"}
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="account-info" class="panel-collapse collapse in">
|
||||
{loop type="customer" name="customer.info"}
|
||||
<div class="panel-body">
|
||||
<p class="fn">{loop type="title" name="customer.title.info" id=$TITLE}{$SHORT}{/loop} {$FIRSTNAME} {$LASTNAME}</p>
|
||||
{loop type="address" name="address.default" default="true"}
|
||||
<ul class="list-info">
|
||||
<li>
|
||||
<address class="adr">
|
||||
<span class="street-address">{$ADDRESS1}</span><br>
|
||||
{if $ADDRESS2 != ""}
|
||||
<span class="street-address">{$ADDRESS2}</span><br>
|
||||
{/if}
|
||||
{if $ADDRESS3 != ""}
|
||||
<span class="street-address">{$ADDRESS3}</span><br>
|
||||
{/if}
|
||||
<span class="postal-code">{$ZIPCODE}</span>
|
||||
<span class="locality">{$CITY}, <span class="country-name">{loop type="country" name="customer.country.info" id=$COUNTRY}{$TITLE}{/loop}</span></span>
|
||||
</address>
|
||||
</li>
|
||||
<li>
|
||||
{if $CELLPHONE != ""}
|
||||
<span class="tel">{$CELLPHONE}</span>
|
||||
{/if}
|
||||
{if $PHONE != ""}
|
||||
<span class="tel">{$PHONE}</span>
|
||||
{/if}
|
||||
<span class="email"><a href="mailto:{$EMAIL}">{$EMAIL}</a></span>
|
||||
</li>
|
||||
<li class="group-btn">
|
||||
<a href="#" class="btn btn-change-account"><i class="icon-pencil"></i> Change my account informations</a>
|
||||
<a href="#" class="btn btn-change-password"><i class="icon-lock"></i> Change my password</a>
|
||||
</li>
|
||||
</ul>
|
||||
{/loop}
|
||||
</div>
|
||||
{/loop}
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel account-address">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#account" href="#account-address">
|
||||
{intl l="My Address book"}
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="account-address" class="panel-collapse collapse">
|
||||
<div class="panel-body">
|
||||
<a href="address.php" class="btn btn-add-address">{intl l="Add a new address"}</a>
|
||||
<table class="table table-address" role="presentation" summary="{intl l="My Address Books"}">
|
||||
<tbody>
|
||||
{loop type="address" name="customer.addresses"}
|
||||
<tr class="{if $DEFAULT == 1}address-primary{else}address-additional{/if}">
|
||||
<th>{$LABEL}</th>
|
||||
<td>
|
||||
<ul class="list-address">
|
||||
<li>
|
||||
<span class="fn">{loop type="title" name="customer.title.info" id=$TITLE}{$SHORT}{/loop} {$FIRSTNAME} {$LASTNAME}</span>
|
||||
{if $COMPANY}
|
||||
<span class="org">{$COMPANY}</span>
|
||||
{/if}
|
||||
</li>
|
||||
<li>
|
||||
<address class="adr">
|
||||
<span class="street-address">{$ADDRESS1}</span><br>
|
||||
{if $ADDRESS2 != ""}
|
||||
<span class="street-address">{$ADDRESS2}</span><br>
|
||||
{/if}
|
||||
{if $ADDRESS3 != ""}
|
||||
<span class="street-address">{$ADDRESS3}</span><br>
|
||||
{/if}
|
||||
<span class="postal-code">{$ZIPCODE}</span>
|
||||
<span class="locality">{$CITY}, <span class="country-name">{loop type="country" name="customer.country.info" id=$COUNTRY}{$TITLE}{/loop}</span></span>
|
||||
</address>
|
||||
</li>
|
||||
<li>
|
||||
{if $CELLPHONE != ""}
|
||||
<span class="tel">{$CELLPHONE}</span><br>
|
||||
{/if}
|
||||
{if $PHONE != ""}
|
||||
<span class="tel">{$PHONE}</span><br>
|
||||
{/if}
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div class="group-btn">
|
||||
<a href="{url path="/address/edit/{$ID}"}" class="btn btn-edit-address" data-toggle="tooltip" title="Edit this address"><i class="icon-pencil"></i> <span>{intl l="Edit"}</span></a>
|
||||
{if $DEFAULT != 1}
|
||||
<a href="#" class="btn btn-remove-address" data-toggle="tooltip" title="Remove this address"><i class="icon-remove"></i> <span>{intl l="Cancel"}</span></a>
|
||||
{/if}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel account-orders">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#account" href="#account-orders">
|
||||
{intl l="My Orders"}
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="account-orders" class="panel-collapse collapse">
|
||||
<div class="panel-body table-responsive">
|
||||
<table class="table table-orders" summary="{intl l="List of orders"}">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l="Order Number"}</th>
|
||||
<th>{intl l="Date"}</th>
|
||||
<th>{intl l="Amount"}</th>
|
||||
<th>{intl l="Status"}</th>
|
||||
<th>{intl l="View"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{loop type="order" name="customer.orders"}
|
||||
<tr>
|
||||
<td>{$REF}</td>
|
||||
<td>{format_date date=$CREATED_AT}</td>
|
||||
<td>{loop type="currency" name="order.currency" id={$CURRENCY}}{$SYMBOL}{/loop} {format_number number=$TOTAL}</td>
|
||||
<td><span class="label-delivered">{$STATUS}</span></td>
|
||||
<td><a href="#" class="btn btn-order-details" data-toggle="tooltip" title="{intl l="View order %ref as pdf document" ref={$REF}}"><span class="icon-cloud-download"></span> {intl l="Order details"}</a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
{elseloop rel="customer.orders"}
|
||||
<div class="orders-warning">
|
||||
<strong>{intl l="Warning"}!</strong> {intl l="You don't have orders yet"}
|
||||
</div>
|
||||
{/elseloop}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
</div><!-- /.layout -->
|
||||
|
||||
{/block}
|
||||
@@ -68,7 +68,7 @@ Index : {navigate to="index"}<br />
|
||||
{$ATTRIBUTE_TITLE} = {$ATTRIBUTE_AVAILABILITY_TITLE}<br />
|
||||
{/loop}
|
||||
<br />{$WEIGHT} g
|
||||
<br /><strong>{if $IS_PROMO == 1} {$PROMO_PRICE} {currency attr="symbol"} HT // TAX : {$PROMO_PRICE_TAX} ; {$TAXED_PROMO_PRICE} {currency attr="symbol"} TTC (instead of {$PRICE_HT} // TAX : {$PRICE_TAX} ; {$TAXED_PRICE} {currency attr="symbol"} TTC){else} {$PRICE} {currency attr="symbol"} HT // TAX : {$PRICE_TAX} ; {$TAXED_PRICE} {currency attr="symbol"} TTC{/if}</strong>
|
||||
<br /><strong>{if $IS_PROMO == 1} {$PROMO_PRICE} {currency attr="symbol"} HT // TAX : {$PROMO_PRICE_TAX} ; {$TAXED_PROMO_PRICE} {currency attr="symbol"} TTC (instead of {$PRICE} HT // TAX : {$PRICE_TAX} ; {$TAXED_PRICE} {currency attr="symbol"} TTC){else} {$PRICE} {currency attr="symbol"} HT // TAX : {$PRICE_TAX} ; {$TAXED_PRICE} {currency attr="symbol"} TTC{/if}</strong>
|
||||
<br /><br />
|
||||
Add
|
||||
<select>
|
||||
|
||||
BIN
tests/functionnal/casperjs/pictures/screenshot-category-rule.png
Normal file
BIN
tests/functionnal/casperjs/pictures/screenshot-category-rule.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 582 B |
Reference in New Issue
Block a user