CHANGE_CLIENT_FILE_UPLOAD_PAN_DUP_CHECK : AADHAVAN

This commit is contained in:
aadhavan valli 2024-07-05 14:15:56 +05:30
parent a41a3f5c11
commit 1797349ebb

View File

@ -435,28 +435,40 @@ class ClientController extends BaseController
"created_by" => $created_by, "created_by" => $created_by,
"business_id" => $business_id, "business_id" => $business_id,
]; ];
$client_pan_find = $this->ClientModel->where('pan_no', $value['pan_no'])->first();
$client = $this->ClientModel->insert($insertData); if($client_pan_find){
if($client){
if($value['branches']){ }else{
foreach ($value['branches'] as $key => $branch) { $client = $this->ClientModel->insert($insertData);
$insertBranchData = [ if($client){
"name" => $branch['b_name'], if($value['branches']){
"gst_no" => $branch['gst_no'], foreach ($value['branches'] as $key => $branch) {
"email" => $branch['b_email'], $insertBranchData = [
"mobile_no" => $branch['b_mobile_no'], "name" => $branch['b_name'],
"created_by" => $created_by, "gst_no" => $branch['gst_no'],
"client_id" => $client, "email" => $branch['b_email'],
"country" => $branch['country'], "mobile_no" => $branch['b_mobile_no'],
"state" => $branch['state'], "created_by" => $created_by,
"city" => $branch['city'], "client_id" => $client,
"pin_code" => $branch['pin_code'], "country" => $branch['country'],
"address" => $branch['address'], "state" => $branch['state'],
]; "city" => $branch['city'],
$clientBranch = $this->ClientBranchModel->insert($insertBranchData); "pin_code" => $branch['pin_code'],
"address" => $branch['address'],
];
if($this->ClientBranchModel->where('gst_no', $branch['gst_no'])->first()){
}else{
$clientBranch = $this->ClientBranchModel->insert($insertBranchData);
}
}
} }
} }
} }
} }
return json_encode(true); return json_encode(true);
} else { } else {