getDepositSummary function error fix : GWM
This commit is contained in:
parent
542a03e7f1
commit
0589f98891
@ -368,10 +368,11 @@ class ClientPolicyModel extends Model
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client condition (raw vs MD5)
|
// Build SAFE client condition (NO BINDS!)
|
||||||
$clientWhere = 'client_id = :clientId:';
|
|
||||||
if (is_string($clientId) && preg_match('/^[a-f0-9]{32}$/i', $clientId)) {
|
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')
|
$subQuery = $this->db->table('cash_deposit')
|
||||||
->select('balance')
|
->select('balance')
|
||||||
->where($clientWhere, ['clientId' => $clientId])
|
->where($clientCondition, null, false)
|
||||||
->where('insurer_id', $insurerId)
|
->where('insurer_id', $insurerId)
|
||||||
->where('cd_ac_pk', $cd_ac_pk)
|
->where('cd_ac_pk', $cd_ac_pk)
|
||||||
->where('is_active', 1)
|
->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 = "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 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')
|
->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('insurer_id', $insurerId)
|
||||||
->where('cd_ac_pk', $cd_ac_pk)
|
->where('cd_ac_pk', $cd_ac_pk)
|
||||||
->where('cash_deposit.is_active', 1)
|
->where('cash_deposit.is_active', 1)
|
||||||
@ -406,6 +407,7 @@ class ClientPolicyModel extends Model
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Inside your clientPolicyModel
|
// Inside your clientPolicyModel
|
||||||
// Inside your clientPolicyModel
|
// Inside your clientPolicyModel
|
||||||
// public function getDepositDataWithBalance($clientId, $insurerId)
|
// public function getDepositDataWithBalance($clientId, $insurerId)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user