fix add customer

main
nocode 1 year ago
parent d775363751
commit 653167d918
  1. 12
      Modules/Agents/Services/AgentService.php

@ -263,6 +263,14 @@ class AgentService
} }
//execute query get list //execute query get list
$listAgentGet = $myAgentDown->get(); $listAgentGet = $myAgentDown->get();
$allAgentInGeneral = $this->modelAgentUser->byParentPath($agentId)->joinAgent()->get();
$AgentById = [];
if(!empty($allAgentInGeneral)){
foreach($allAgentInGeneral as $vAgent){
$AgentById[$vAgent->agent_id] = $vAgent;
}
}
$finalData = []; $finalData = [];
if (!empty($listAgentGet)) { if (!empty($listAgentGet)) {
$listAgentById = []; $listAgentById = [];
@ -273,8 +281,8 @@ class AgentService
$listAgentById[$kAgent->agent_id] = $kAgent; $listAgentById[$kAgent->agent_id] = $kAgent;
} }
foreach ($listAgentGet as $vAgent) { foreach ($listAgentGet as $vAgent) {
if (!empty($listAgentById[$vAgent->grant_parent_id])) { if (!empty($AgentById[$vAgent->grant_parent_id])) {
$agentParent = $listAgentById[$vAgent->grant_parent_id]; $agentParent = $AgentById[$vAgent->grant_parent_id];
$upGrant = $agentParent->code ?? null; $upGrant = $agentParent->code ?? null;
} }
if (!empty($input['up_grant'])) { // if existing up_geant if (!empty($input['up_grant'])) { // if existing up_geant

Loading…
Cancel
Save