|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
$orderManager = $this->getOrderManager(); |
|
|
$orderManager = $this->getOrderManager(); |
|
|
$order = $this->getOrderManager()->findOneOrderById($id); |
|
|
$order = $this->getOrderManager()->findOneOrderById($id); |
|
|
$orderManager->initOrder($order); |
|
|
|
|
|
|
|
|
|
|
|
if (!$order) { |
|
|
if (!$order) { |
|
|
throw new \yii\web\NotFoundHttpException('Commande introuvable'); |
|
|
throw new \yii\web\NotFoundHttpException('Commande introuvable'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$orderManager->initOrder($order); |
|
|
|
|
|
|
|
|
if (!$orderManager->isOrderStateOpen($order)) { |
|
|
if (!$orderManager->isOrderStateOpen($order)) { |
|
|
throw new UserException('Vous ne pouvez plus annuler cette commande.'); |
|
|
throw new UserException('Vous ne pouvez plus annuler cette commande.'); |
|
|
} |
|
|
} |