From ce1b88dd44018f47c00913812699240022ccb254 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Wed, 7 May 2025 18:01:34 +0530 Subject: [PATCH] FIX_DEP_ADD_ERR_SRI --- app/Controllers/EmployeeServiceController.php | 11 +++++++-- app/Helpers/excel_util_helper.php | 23 ++++++++++++++++++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index a6c146f..b76510b 100755 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -1035,7 +1035,14 @@ class EmployeeServiceController extends AdminController $family = data_group_by_family($family)[ $emp_id ];// reason to call this again bring self to first index of the array } // kint::dump($family);//die(); - + $firstNonTemp = null; + + foreach ($family as $fam) { + if (!isset($fam['temp'])) { + $firstNonTemp = $fam; + break; + } + } //check name dup within a family if($file['action'] == 'inception' || $file['action'] == 'missed_inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition' || $file['action'] == 'enrollment') { @@ -1069,7 +1076,7 @@ class EmployeeServiceController extends AdminController if(!count($self_details)) { array_push($result['error_summary'],14); // Self not found - $result['error_data'][ $family[0][0] ]['sno']['error'][] = "Self not found in Database"; + $result['error_data'][ $firstNonTemp[0] ]['sno']['error'][] = "Self not found in Database"; } } diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index 92b55c9..7a59f25 100755 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -444,6 +444,18 @@ if (!function_exists('name_dup_check_within_family')) if(in_array($row[2],$temp)) { array_push($result,$row[0]); + $emp_code = $row[1]; + $tempFam = null; + foreach ($family_data as $family) { + if ($family[1] == $emp_code &&!isset($family['temp'])) { + $tempFam = $family; + break; // Stop at the first match + } + } + // Kint::dump($tempFam); + // die(); + + array_push($result,$tempFam[0]); } else { @@ -521,7 +533,16 @@ if (!function_exists('name_and_empid_check_in_db')) } if(($current_action == 'inception' || $current_action == 'dependent_addition' || $current_action == 'addition' || $current_action == 'enrollment') && count($res)) { - array_push($result['i'],$row[0]); + $emp_code = $row[1]; + $tempFam = null; + foreach ($family_data as $family) { + if ($family[1] == $emp_code &&!isset($family['temp'])) { + $tempFam = $family; + break; // Stop at the first match + } + } + array_push($result['i'],$tempFam[0]); + // array_push($result['i'],$row[0]); } }