浏览代码

Système compte prépayés

feature/export_comptable
Fab 4 年前
父节点
当前提交
0bd1b6c734
共有 3 个文件被更改,包括 9 次插入7 次删除
  1. +3
    -2
      ShopBundle/Controller/Backend/UserMerchantController.php
  2. +2
    -2
      ShopBundle/Model/CreditHistory.php
  3. +4
    -3
      ShopBundle/Services/CreditUtils.php

+ 3
- 2
ShopBundle/Controller/Backend/UserMerchantController.php 查看文件

@@ -38,8 +38,9 @@ class UserMerchantController extends AdminController
$addCreditHistoryForm = $this->createForm(CreditHistoryType::class, $creditHistory);
$addCreditHistoryForm->handleRequest($this->request);
if ($addCreditHistoryForm->isSubmitted() && $addCreditHistoryForm->isValid()) {

if($this->creditUtils->saveCreditHistory()){
$creditHistory->setUserMerchant($userMerchant);
dump($creditHistory);
if($this->creditUtils->saveCreditHistory($creditHistory)){
$this->utils->addFlash('warning', 'success.credit.added');
}else{
$this->utils->addFlash('warning', 'error.credit.notAdded');

+ 2
- 2
ShopBundle/Model/CreditHistory.php 查看文件

@@ -87,9 +87,9 @@ abstract class CreditHistory extends AbstractEntity implements PayoffInterface
return $this->type;
}

public function setType(string $meanPayment): self
public function setType(string $type): self
{
$this->meanPayment = $meanPayment;
$this->type = $type;

return $this;
}

+ 4
- 3
ShopBundle/Services/CreditUtils.php 查看文件

@@ -8,6 +8,7 @@ use Lc\ShopBundle\Context\MerchantInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\UserInterface;
use Lc\ShopBundle\Context\UserMerchantInterface;
use Lc\ShopBundle\Model\CreditHistory;

class CreditUtils
{
@@ -126,7 +127,7 @@ class CreditUtils
{
if($creditHistory) {
$userMerchant = $creditHistory->getUserMerchant() ;
$checkCreditActive = $this->checkCreditActive() ;
$checkCreditActive = $this->checkCreditActive($userMerchant) ;

if($checkCreditActive) {
$this->em->persist($creditHistory) ;
@@ -149,9 +150,9 @@ class CreditUtils
return false ;
}

public function updateCredit($userMerchant, $amount, $merchant = null)
public function updateCredit($userMerchant, $amount)
{
$userMerchant->setAmount($amount) ;
$userMerchant->setCredit($amount) ;
$this->em->persist($userMerchant) ;
$this->em->flush() ;
}

正在加载...
取消
保存