order admin

This commit is contained in:
Etienne Roudeix
2013-09-25 13:26:12 +02:00
parent 7bd511c420
commit d967242a59
15 changed files with 278 additions and 71 deletions

View File

@@ -35,6 +35,7 @@ class OrderEvent extends ActionEvent
protected $paymentModule = null;
protected $postage = null;
protected $ref = null;
protected $status = null;
/**
* @param Order $order
@@ -108,6 +109,14 @@ class OrderEvent extends ActionEvent
$this->ref = $ref;
}
/**
* @param $status
*/
public function setStatus($status)
{
$this->status = $status;
}
/**
* @return null|Order
*/
@@ -171,4 +180,12 @@ class OrderEvent extends ActionEvent
{
return $this->ref;
}
/**
* @return null|int
*/
public function getStatus()
{
return $this->status;
}
}

View File

@@ -301,9 +301,12 @@ final class TheliaEvents
const ORDER_AFTER_CREATE = "action.order.afterCreate";
const ORDER_BEFORE_PAYMENT = "action.order.beforePayment";
const ORDER_UPDATE_STATUS = "action.order.updateStatus";
const ORDER_PRODUCT_BEFORE_CREATE = "action.orderProduct.beforeCreate";
const ORDER_PRODUCT_AFTER_CREATE = "action.orderProduct.afterCreate";
/**
* Sent on image processing
*/

View File

@@ -57,7 +57,13 @@ class Order extends BaseLoop
),
'current'
),
Argument::createIntListTypeArgument('status'),
new Argument(
'status',
new TypeCollection(
new Type\IntListType(),
new Type\EnumType(array('*'))
)
),
new Argument(
'order',
new TypeCollection(
@@ -98,7 +104,7 @@ class Order extends BaseLoop
$status = $this->getStatus();
if (null !== $status) {
if (null !== $status && $status != '*') {
$search->filterByStatusId($status, Criteria::IN);
}

View File

@@ -0,0 +1,63 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Template\Smarty\Plugins;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Core\Security\SecurityContext;
use Thelia\Core\Security\Exception\AuthenticationException;
use Thelia\Exception\OrderException;
use Thelia\Model\AddressQuery;
use Thelia\Model\ModuleQuery;
class Type extends AbstractSmartyPlugin
{
public function assertTypeModifier($value, $option)
{
$typeClass = "\\Thelia\\Type\\$option";
if(!class_exists($typeClass)) {
throw new \InvalidArgumentException(sprintf("Invalid type name `%s` in `assertType` modifier", $option));
}
$typeInstance = new $typeClass();
if(!$typeInstance->isValid($value)) {
return '';
}
return $value;
}
/**
* Define the various smarty plugins handled by this class
*
* @return an array of smarty plugin descriptors
*/
public function getPluginDescriptors()
{
return array(
new SmartyPluginDescriptor('modifier', 'assertType', $this, 'assertTypeModifier'),
);
}
}

View File

@@ -105,6 +105,10 @@ class SmartyParser extends Smarty implements ParserInterface
$this->template = $template_path_from_template_base;
$this->setTemplateDir(THELIA_TEMPLATE_DIR.$this->template);
$config_dir = THELIA_TEMPLATE_DIR.$this->template.'/configs';
$this->setConfigDir($config_dir);
}
public function getTemplate()