Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
6a0c584e1c
@ -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')
|
||||
|
||||
@ -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'
|
||||
],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user