Kaynağa Gözat

Fix : annulation commande

Correction de la redirection après la suppression d'une commande.
Ajout d'une exception si la commande est introuvable.
Ajout d'un message flash en cas de suppression effective de la commande.
dev
keun 6 yıl önce
ebeveyn
işleme
21be766151
1 değiştirilmiş dosya ile 7 ekleme ve 2 silme
  1. +7
    -2
      producer/controllers/CommandeController.php

+ 7
- 2
producer/controllers/CommandeController.php Dosyayı Görüntüle

@@ -446,6 +446,9 @@ class CommandeController extends ProducerBaseController {
->where(['id' => $id])
->one();

if(!$commande)
throw new \yii\web\NotFoundHttpException('Commande introuvable');
if ($commande->getEtat() != Commande::ETAT_MODIFIABLE) {
throw new UserException('Vous ne pouvez plus annuler cette commande.');
}
@@ -465,9 +468,11 @@ class CommandeController extends ProducerBaseController {
// delete
$commande->delete();
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) {

Yükleniyor…
İptal
Kaydet