@@ -558,12 +558,13 @@ class OrderController extends ProducerBaseController | |||
{ | |||
$orderManager = $this->getOrderManager(); | |||
$order = $this->getOrderManager()->findOneOrderById($id); | |||
$orderManager->initOrder($order); | |||
if (!$order) { | |||
throw new \yii\web\NotFoundHttpException('Commande introuvable'); | |||
} | |||
$orderManager->initOrder($order); | |||
if (!$orderManager->isOrderStateOpen($order)) { | |||
throw new UserException('Vous ne pouvez plus annuler cette commande.'); | |||
} |