Skip to content

Commit

Permalink
fix bug orderDisplayAction
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Lefebvre - Kitpages committed Apr 11, 2013
1 parent 563d25b commit 868cef9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Controller/OrderController.php
Expand Up @@ -52,22 +52,23 @@ public function displayOrderAction(
OrderUser $shippingUser = null
)
{

if (
! $this->get('security.context')->isGranted('ROLE_SHOP_USER')
) {
return new Response('The user should be authenticated on this page');
}

$em = $this->getDoctrine()->getManager();
$order = $em->getRepository("KitpagesShopBundle:Order")->find($orderId);

if (
($order->getUsername() != null) &&
($order->getUsername() != $this->get('security.context')->getToken()->getUsername())
) {
return new Response('You are not allowed to see this order');
}

$em = $this->getDoctrine()->getManager();
$order = $em->getRepository("KitpagesShopBundle:Order")->find($orderId);

// modify ready_to_pay or created orders (and not payed or canceled orders)
if (
($order->getState() == OrderHistory::STATE_READY_TO_PAY) ||
Expand Down

0 comments on commit 868cef9

Please sign in to comment.