last changes since 6-2023

This commit is contained in:
Kevin Adametz 2023-07-03 10:07:08 +02:00
parent da10f19fcb
commit 3a81b8a0f5
139 changed files with 5377 additions and 1511 deletions

View file

@ -47,17 +47,20 @@ class BusinessUsersStore
}
foreach($this->user_business_structure->users as $user_id=>$completed){
if($completed === 0){
$user = User::findOrFail($user_id);
$TreeCalcBot = new TreeCalcBot($this->month, $this->year, 'admin');
$TreeCalcBot->initBusinesslUserDetail($user);
if(!$TreeCalcBot->business_user){
abort(403, 'not found TreeCalcBot->business_user');
$user = User::find($user_id);
if($user){
$TreeCalcBot = new TreeCalcBot($this->month, $this->year, 'admin');
$TreeCalcBot->initBusinesslUserDetail($user);
if(!$TreeCalcBot->business_user){
abort(403, 'not found TreeCalcBot->business_user');
}
$this->storeBusinesslUser($TreeCalcBot->business_user);
$users = $this->user_business_structure->users;
$users[$user_id] = 1;
$this->user_business_structure->users = $users;
$this->user_business_structure->save();
}
$this->storeBusinesslUser($TreeCalcBot->business_user);
$users = $this->user_business_structure->users;
$users[$user_id] = 1;
$this->user_business_structure->users = $users;
$this->user_business_structure->save();
}
}
}

View file

@ -41,7 +41,7 @@ class UserLevelUpdate
$userBusiness->save();
$ret = $nextQualUserLevel['id'].' '.$nextQualUserLevel['name'];
if($send_update_mail){
self::sendUpdateMail($userBusiness->user, $userBusiness->total_qual_tp, $nextQualUserLevel['name']);
self::sendUpdateMail($userBusiness->user, $userBusiness->total_qual_pp, $nextQualUserLevel['name']);
}
}

View file

@ -25,7 +25,7 @@ class UserPaymentCredits
->where('user_businesses.month', '=', $this->month)
->where('user_businesses.year', '=', $this->year)
->where(function($q) {
return $q->where('user_businesses.commission_team_total', '>', 0)
return $q->where('user_businesses.commission_pp_total', '>', 0)
->orWhere('user_businesses.commission_shop_sales', '>', 0);
})
->get();
@ -46,17 +46,28 @@ class UserPaymentCredits
]);
}
}
if($userBusiness->commission_team_total > 0){
if($userBusiness->commission_pp_total > 0){
if($this->hasNotUserCreditItem($userBusiness, 2)){
UserCreditItem::create([
'user_id' => $userBusiness->user_id,
'user_business_id' => $userBusiness->id,
'credit' => $userBusiness->commission_team_total,
'message' => 'Provision Team '.$date,
'credit' => $userBusiness->commission_pp_total,
'message' => 'Provision Payline '.$date,
'status' => 2,
]);
}
}
if($userBusiness->commission_growth_total > 0){
if($this->hasNotUserCreditItem($userBusiness, 5)){
UserCreditItem::create([
'user_id' => $userBusiness->user_id,
'user_business_id' => $userBusiness->id,
'credit' => $userBusiness->commission_growth_total,
'message' => 'Provision Wachstumsbonus '.$date,
'status' => 5,
]);
}
}
return $userBusiness;
}
@ -74,7 +85,7 @@ class UserPaymentCredits
$user = User::findOrFail($user_id);
$data = [];
if($credit_send_mail){
$data['credit_send_mail'] = true;
$data['credit_send_mail'] = false;
}
$credit_repo = new CreditRepository($user);
return $credit_repo->create($data);