Browse Source

[Administration] Problème crédit #1250

master
Guillaume Bourgeois 1 year ago
parent
commit
e3bd78a380
3 changed files with 7 additions and 6 deletions
  1. +5
    -4
      backend/controllers/UserController.php
  2. +1
    -1
      common/logic/Payment/Model/CreditHistorySearch.php
  3. +1
    -1
      common/logic/User/UserProducer/Service/UserProducerBuilder.php

+ 5
- 4
backend/controllers/UserController.php View File

@@ -390,8 +390,9 @@ class UserController extends BackendController
*/
public function actionCredit(int $id)
{
$user = User::find()->with('userProducer')->where(['id' => $id])->one();
$userProducer = UserProducer::findOne(['id_user' => $id, 'id_producer' => GlobalParam::getCurrentProducerId()]);
$userManager = $this->getUserManager();
$user = $userManager->findOneUserById($id);
$userProducer = UserProducer::findOne(['id_user' => $id, 'id_producer' => $this->getProducerCurrent()->id]);

if (($userProducer) || $this->isUserCurrentAdmin()) {

@@ -401,14 +402,14 @@ class UserController extends BackendController
$creditForm->save();

$creditForm = new CreditForm;
$user = $userManager->findOneUserById($id);
}

$history = Payment::find()
->with(['order', 'userAction'])
->where([
'id_user' => $user->id,
'id_producer' => GlobalParam::getCurrentProducerId(),
'mean_payment' => MeanPayment::CREDIT
'id_producer' => $this->getProducerCurrent()->id,
])
->orderBy('date DESC')
->all();

+ 1
- 1
common/logic/Payment/Model/CreditHistorySearch.php View File

@@ -66,7 +66,7 @@ class CreditHistorySearch extends Payment
->innerJoinWith($optionsSearch['join_with'], true)
->where([
'payment.id_producer' => GlobalParam::getCurrentProducerId(),
'payment.mean_payment' => MeanPayment::CREDIT
//'payment.mean_payment' => MeanPayment::CREDIT
])
->orderBy('id DESC')
;

+ 1
- 1
common/logic/User/UserProducer/Service/UserProducerBuilder.php View File

@@ -64,7 +64,7 @@ class UserProducerBuilder extends AbstractBuilder

public function updateCredit(Payment $payment): void
{
if($this->paymentSolver->isMeanPaymentCredit($payment) && $payment->user) {
if($payment->user) {
$userProducer = $this->userProducerRepository->findOneUserProducer($payment->user);

if ($userProducer) {

Loading…
Cancel
Save