|
|
|
|
|
|
|
|
*/ |
|
|
*/ |
|
|
public function actionCredit(int $id) |
|
|
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()) { |
|
|
if (($userProducer) || $this->isUserCurrentAdmin()) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$creditForm->save(); |
|
|
$creditForm->save(); |
|
|
|
|
|
|
|
|
$creditForm = new CreditForm; |
|
|
$creditForm = new CreditForm; |
|
|
|
|
|
$user = $userManager->findOneUserById($id); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$history = Payment::find() |
|
|
$history = Payment::find() |
|
|
->with(['order', 'userAction']) |
|
|
->with(['order', 'userAction']) |
|
|
->where([ |
|
|
->where([ |
|
|
'id_user' => $user->id, |
|
|
'id_user' => $user->id, |
|
|
'id_producer' => GlobalParam::getCurrentProducerId(), |
|
|
|
|
|
'mean_payment' => MeanPayment::CREDIT |
|
|
|
|
|
|
|
|
'id_producer' => $this->getProducerCurrent()->id, |
|
|
]) |
|
|
]) |
|
|
->orderBy('date DESC') |
|
|
->orderBy('date DESC') |
|
|
->all(); |
|
|
->all(); |