Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
velz 2026-04-08 12:58:28 +05:30
commit 6a0c584e1c
2 changed files with 13 additions and 5 deletions

View File

@ -537,13 +537,21 @@ class SalesController extends BaseController
$value = trim($this->request->getGet('value') ?? '');
$exclude_id = $this->request->getGet('exclude_id');
// ── Whitelist ─────────────────────────────────────────────
// ── Whitelist (table → model, pk, allowed fields) ─────────
$allowed = [
'clients' => ['model' => $this->clientModel, 'pk' => 'id'],
'clients' => [
'model' => $this->clientModel,
'pk' => 'id',
'fields' => ['short_name', 'client_name'],
],
'sales_actual_leads' => [
'model' => $this->leadModel,
'pk' => 'lead_id',
'fields' => ['company_name'],
],
];
// ── Allowed fields per table ──────────────────────────────
if (!array_key_exists($table, $allowed) || !in_array($field, ['short_name', 'client_name'])) {
if (! isset($allowed[$table]) || ! in_array($field, $allowed[$table]['fields'], true)) {
return $this->response
->setStatusCode(400)
->setContentType('application/json')

View File

@ -50,7 +50,7 @@ class SalesActualLeadModel extends Model
'company_name' => [
'required' => 'Company Name is Missing',
// 'alpha_space' => 'Company Name must contain only letters and spaces',
'regex_match' => 'Company Name can only contain letters, numbers, spaces, hyphens and underscores.',
'regex_match' => 'Company Name can only contain letters, numbers.',
'min_length' => 'Company Name must be at least 2 characters long',
'max_length' => 'Company Name must be at most 255 characters long'
],