|
|
|
|
|
|
|
|
->where(['id' => $id]) |
|
|
->where(['id' => $id]) |
|
|
->one(); |
|
|
->one(); |
|
|
|
|
|
|
|
|
|
|
|
if(!$commande) |
|
|
|
|
|
throw new \yii\web\NotFoundHttpException('Commande introuvable'); |
|
|
|
|
|
|
|
|
if ($commande->getEtat() != Commande::ETAT_MODIFIABLE) { |
|
|
if ($commande->getEtat() != Commande::ETAT_MODIFIABLE) { |
|
|
throw new UserException('Vous ne pouvez plus annuler cette commande.'); |
|
|
throw new UserException('Vous ne pouvez plus annuler cette commande.'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// delete |
|
|
// delete |
|
|
$commande->delete(); |
|
|
$commande->delete(); |
|
|
CommandeProduit::deleteAll(['id_commande' => $commande->id]); |
|
|
CommandeProduit::deleteAll(['id_commande' => $commande->id]); |
|
|
|
|
|
|
|
|
|
|
|
Yii::$app->session->setFlash('success','Votre commande a bien été annulée.') ; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$this->redirect(Yii::$app->urlManager->createUrl(['commande/index', 'annule_ok' => true])); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->redirect(Yii::$app->urlManager->createUrl(['commande/historique'])); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function actionVerifCodePointVente($id_point_vente, $code) { |
|
|
public function actionVerifCodePointVente($id_point_vente, $code) { |