Browse Source

[Boutique] Abonnements : correctif

feature/souke
Guillaume Bourgeois 10 months ago
parent
commit
4b0d5b3816
2 changed files with 11 additions and 2 deletions
  1. +10
    -1
      producer/controllers/SubscriptionController.php
  2. +1
    -1
      producer/views/subscription/_form.php

+ 10
- 1
producer/controllers/SubscriptionController.php View File

@@ -122,7 +122,7 @@ class SubscriptionController extends ProducerBaseController
}

/**
* Crée une commande récurrente.
* Crée un abonnement
*/
public function actionForm(int $id = 0)
{
@@ -131,6 +131,15 @@ class SubscriptionController extends ProducerBaseController
return $this->redirect($this->getUrlManagerFrontend()->createAbsoluteUrl(['site/producer', 'id' => $producer->id]));
}

$subscriptionModule = $this->getSubscriptionModule();
if($id) {
$subscription = $subscriptionModule->getRepository()->findOneSubscriptionById($id);
if(!$subscription) {
$this->setFlash('error', 'Abonnement introuvable');
return $this->redirect(['subscription/index']);
}
}

return $this->render('form', [
'idSubscription' => $id
]);

+ 1
- 1
producer/views/subscription/_form.php View File

@@ -261,7 +261,7 @@ $orderModule = OrderModule::getInstance();
<?php if($idSubscription): ?>
<?php
$subscription = $subscriptionModule->findOneSubscriptionById($idSubscription);
$ordersIncomingSubscriptionArray = $orderModule->findOrdersIncomingBySubscription($subscription);
$ordersIncomingSubscriptionArray = $subscription ? $orderModule->findOrdersIncomingBySubscription($subscription) : null;
?>
<?php if($subscription && $ordersIncomingSubscriptionArray): ?>
<div class="alert alert-warning">

Loading…
Cancel
Save