getDepositSummary function error fix : GWM
This commit is contained in:
parent
542a03e7f1
commit
0589f98891
@ -368,10 +368,11 @@ class ClientPolicyModel extends Model
|
||||
return null;
|
||||
}
|
||||
|
||||
// Client condition (raw vs MD5)
|
||||
$clientWhere = 'client_id = :clientId:';
|
||||
// Build SAFE client condition (NO BINDS!)
|
||||
if (is_string($clientId) && preg_match('/^[a-f0-9]{32}$/i', $clientId)) {
|
||||
$clientWhere = 'MD5(client_id) = :clientId:';
|
||||
$clientCondition = 'MD5(client_id) = ' . $this->db->escape($clientId);
|
||||
} else {
|
||||
$clientCondition = 'client_id = ' . $this->db->escape($clientId);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------
|
||||
@ -379,7 +380,7 @@ class ClientPolicyModel extends Model
|
||||
------------------------------------------------- */
|
||||
$subQuery = $this->db->table('cash_deposit')
|
||||
->select('balance')
|
||||
->where($clientWhere, ['clientId' => $clientId])
|
||||
->where($clientCondition, null, false)
|
||||
->where('insurer_id', $insurerId)
|
||||
->where('cd_ac_pk', $cd_ac_pk)
|
||||
->where('is_active', 1)
|
||||
@ -395,7 +396,7 @@ class ClientPolicyModel extends Model
|
||||
->select('SUM(CASE WHEN transaction_type = "Credit" THEN amount ELSE 0 END) AS total_credit')
|
||||
->select('SUM(CASE WHEN transaction_type = "Debit" THEN amount ELSE 0 END) AS total_withdraw')
|
||||
->select('SUM(CASE WHEN sub_type = 3 THEN amount ELSE 0 END) AS total_refund')
|
||||
->where($clientWhere, ['clientId' => $clientId])
|
||||
->where($clientCondition, null, false)
|
||||
->where('insurer_id', $insurerId)
|
||||
->where('cd_ac_pk', $cd_ac_pk)
|
||||
->where('cash_deposit.is_active', 1)
|
||||
@ -406,6 +407,7 @@ class ClientPolicyModel extends Model
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
// Inside your clientPolicyModel
|
||||
// Inside your clientPolicyModel
|
||||
// public function getDepositDataWithBalance($clientId, $insurerId)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user