Browse Source

Système compte prépayés

feature/export_comptable
Fab 4 years ago
parent
commit
0bd1b6c734
3 changed files with 9 additions and 7 deletions
  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 View File

@@ -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 View File

@@ -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 View File

@@ -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() ;
}

Loading…
Cancel
Save