FIX_DEPENDENT_DELETION

This commit is contained in:
VENKATESHWARAN 2025-12-08 11:23:03 +05:30
parent 76cc67a417
commit f39dbe7d20

View File

@ -526,16 +526,22 @@ class EmployeeRestController extends AdminController
try { try {
if($this->request->getGet('id')) if($this->request->getGet('id'))
{ {
$this->employeeModel->where('id', $this->request->getGet('id') ) $is_from_copy = $this->request->getGet('is_from_copy') ?? null;
->where('is_active', 1 )
->set(array('is_active'=> 0 )) if($is_from_copy == false && $is_from_copy == null){
->update();
$this->employeeModel->where('id', $this->request->getGet('id') )
->where('is_active', 1 )
->set(array('is_active'=> 0 ))
->update();
}
$this->employeePolicyModel->where('employee_id',$this->request->getGet('id') ) $this->employeePolicyModel->where('employee_id',$this->request->getGet('id') )
->where('is_active', 1 ) ->where('is_active', 1 )
->set(array('is_active'=> 0 )) ->set(array('is_active'=> 0 ))
->update(); ->update();
return $this->respond(['status' => 'success','code' => 200,'data' =>[] ], 200); return $this->respond(['status' => 'success','code' => 200,'data' =>[] ], 200);
}else{ }else{