FIX_DEP_ADD_ERR_SRI

This commit is contained in:
Srinivas-Saravanan 2025-05-07 18:01:34 +05:30
parent c74c858f4b
commit ce1b88dd44
2 changed files with 31 additions and 3 deletions

View File

@ -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";
}
}

View File

@ -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]);
}
}