Преглед изворни кода

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

feature/souke
Guillaume Bourgeois пре 1 година
родитељ
комит
86d61ad6e9
3 измењених фајлова са 10 додато и 3 уклоњено
  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 Прегледај датотеку

@@ -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 Прегледај датотеку

@@ -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 Прегледај датотеку

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

return $subscription;
}

Loading…
Откажи
Сачувај