Explorar el Código

[Administration] Abonnements : champs débit automatique non modifé #1281

feature/souke
Guillaume Bourgeois hace 1 año
padre
commit
86d61ad6e9
Se han modificado 3 ficheros con 10 adiciones y 3 borrados
  1. +1
    -1
      backend/controllers/SubscriptionController.php
  2. +8
    -2
      common/forms/SubscriptionForm.php
  3. +1
    -0
      common/logic/Subscription/Subscription/Service/SubscriptionBuilder.php

+ 1
- 1
backend/controllers/SubscriptionController.php Ver fichero

@@ -152,8 +152,8 @@ class SubscriptionController extends BackendController
$subscriptionManager = $this->getSubscriptionManager();
$productSubscriptionManager = $this->getProductSubscriptionManager();
$productManager = $this->getProductManager();
$orderManager = $this->getOrderManager();
$distributionManager = $this->getDistributionManager();
$orderManager = $this->getOrderManager();

$model = new SubscriptionForm;
$model->isAdmin = true;

+ 8
- 2
common/forms/SubscriptionForm.php Ver fichero

@@ -41,6 +41,7 @@ namespace common\forms;
use common\logic\Product\Product\Model\Product;
use common\logic\Subscription\ProductSubscription\Model\ProductSubscription;
use common\logic\Subscription\Subscription\Model\Subscription;
use common\logic\Subscription\Subscription\Wrapper\SubscriptionManager;
use Yii;
use yii\base\Model;

@@ -115,11 +116,13 @@ class SubscriptionForm extends Model
*/
public function save()
{
$subscriptionManager = SubscriptionManager::getInstance();

if ($this->id) {
$subscription = Subscription::searchOne(['id' => $this->id]) ;
}
else {
$subscription = new Subscription ;
$subscription = $subscriptionManager->instanciateSubscription() ;
}

if ($subscription) {
@@ -147,7 +150,10 @@ class SubscriptionForm extends Model
$subscription->saturday = $this->saturday;
$subscription->sunday = $this->sunday;
$subscription->week_frequency = $this->week_frequency;
$subscription->auto_payment = Subscription::AUTO_PAYMENT_DEDUCTED;
$subscription->auto_payment = $this->auto_payment;
if(is_null($subscription->auto_payment)) {
$subscription->auto_payment = Subscription::AUTO_PAYMENT_DEDUCTED;
}
$subscription->comment = $this->comment;

$subscription->save();

+ 1
- 0
common/logic/Subscription/Subscription/Service/SubscriptionBuilder.php Ver fichero

@@ -19,6 +19,7 @@ class SubscriptionBuilder extends AbstractBuilder
public function instanciateSubscription(): Subscription
{
$subscription = new Subscription();
$subscription->auto_payment = Subscription::AUTO_PAYMENT_DEDUCTED;

return $subscription;
}

Cargando…
Cancelar
Guardar