FIX_BDS_PT_CO_RMV_ISSUE : RV
This commit is contained in:
parent
f4e2fa3a21
commit
a744b8e105
@ -418,7 +418,7 @@ class PolicyTransactionController extends BaseController
|
||||
// die;
|
||||
|
||||
if(isset($data['co_share_id']) && !empty($data['co_share_id'])){
|
||||
$this->removePtCoShareRecords($data['co_share_id']);
|
||||
$this->removePtCoShareRecords($data['co_share_id'], $pt_id);
|
||||
}
|
||||
|
||||
if(isset($data['follow_insurer_id'])){
|
||||
@ -967,21 +967,26 @@ class PolicyTransactionController extends BaseController
|
||||
}
|
||||
|
||||
//function for soft delete for pt_co_share_details records
|
||||
public function removePtCoShareRecords($primaryKeys)
|
||||
public function removePtCoShareRecords($primaryKeys, $pt_id)
|
||||
{
|
||||
// print_r($primaryKeys); die;
|
||||
if (empty($primaryKeys)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Convert array to a comma-separated string for query binding
|
||||
// Convert array to a comma-separated string of placeholders for query binding
|
||||
$placeholders = implode(',', array_fill(0, count($primaryKeys), '?'));
|
||||
|
||||
$sql = "UPDATE pt_co_share_details SET is_active = 0 WHERE id NOT IN ($placeholders)";
|
||||
|
||||
return db_connect()->query($sql, $primaryKeys);
|
||||
// Prepare the query with proper binding
|
||||
$sql = "UPDATE pt_co_share_details SET is_active = 0 WHERE pt_id = ? AND id NOT IN ($placeholders)";
|
||||
|
||||
// Merge pt_id with primary keys for binding
|
||||
$params = array_merge([$pt_id], $primaryKeys);
|
||||
|
||||
// Execute the query with bound parameters
|
||||
return db_connect()->query($sql, $params);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -319,9 +319,11 @@ class EmployeePolicyModel extends Model
|
||||
}
|
||||
|
||||
// Always check these conditions
|
||||
$result->where('employee_polices.is_active', 1)
|
||||
->where('emp.is_active', 1);
|
||||
|
||||
$result
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('emp.is_active', 1)
|
||||
->where('employee_polices.status !=', 'inactive');
|
||||
|
||||
$res = $result->findAll();
|
||||
|
||||
// dd($this->db->getLastQuery());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user