order admin
This commit is contained in:
@@ -72,7 +72,7 @@ class CustomerController extends BaseAdminController
|
||||
$customer = CustomerQuery::create()->findPk($customer_id);
|
||||
|
||||
if(null === $customer) {
|
||||
throw new \InvalidArgumentException(sprintf("%d customer id does not exists", $customer_id));
|
||||
throw new \InvalidArgumentException(sprintf("%d customer id does not exist", $customer_id));
|
||||
}
|
||||
|
||||
$form = $this->validateForm($customerModification);
|
||||
@@ -127,7 +127,7 @@ class CustomerController extends BaseAdminController
|
||||
$customer = CustomerQuery::create()->findPk($customer_id);
|
||||
|
||||
if(null === $customer) {
|
||||
throw new \InvalidArgumentException(Translator::getInstance("The customer you want to delete does not exists"));
|
||||
throw new \InvalidArgumentException(Translator::getInstance("The customer you want to delete does not exist"));
|
||||
}
|
||||
|
||||
$event = new CustomerEvent($customer);
|
||||
|
||||
@@ -23,6 +23,12 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Model\OrderQuery;
|
||||
use Thelia\Model\OrderStatusQuery;
|
||||
|
||||
/**
|
||||
* Class OrderController
|
||||
* @package Thelia\Controller\Admin
|
||||
@@ -44,4 +50,52 @@ class OrderController extends BaseAdminController
|
||||
));
|
||||
}
|
||||
|
||||
public function updateStatus()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.order.update")) return $response;
|
||||
|
||||
$message = null;
|
||||
|
||||
try {
|
||||
$orderId = $this->getRequest()->get("order_id");
|
||||
$order = OrderQuery::create()->findPk($orderId);
|
||||
|
||||
$statusId = $this->getRequest()->get("status_id");
|
||||
$status = OrderStatusQuery::create()->findPk($statusId);
|
||||
|
||||
if(null === $order) {
|
||||
throw new \InvalidArgumentException("The order you want to update status does not exist");
|
||||
}
|
||||
if(null === $status) {
|
||||
throw new \InvalidArgumentException("The status you want to set to the order does not exist");
|
||||
}
|
||||
|
||||
$event = new OrderEvent($order);
|
||||
$event->setStatus($statusId);
|
||||
|
||||
$this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
|
||||
} catch(\Exception $e) {
|
||||
$message = $e->getMessage();
|
||||
}
|
||||
|
||||
$params = array();
|
||||
|
||||
if ($message) {
|
||||
$params["update_status_error_message"] = $message;
|
||||
}
|
||||
|
||||
$browsedPage = $this->getRequest()->get("order_page");
|
||||
|
||||
if($browsedPage) {
|
||||
$params["order_page"] = $browsedPage;
|
||||
$this->redirectToRoute("admin.order.list", $params);
|
||||
} else {
|
||||
$params["order_id"] = $orderId;
|
||||
$this->redirectToRoute("admin.order.update.view", $params);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user