FIX_Sales Tracker only
This commit is contained in:
parent
8406598b07
commit
1d561d63b6
@ -537,13 +537,21 @@ class SalesController extends BaseController
|
|||||||
$value = trim($this->request->getGet('value') ?? '');
|
$value = trim($this->request->getGet('value') ?? '');
|
||||||
$exclude_id = $this->request->getGet('exclude_id');
|
$exclude_id = $this->request->getGet('exclude_id');
|
||||||
|
|
||||||
// ── Whitelist ─────────────────────────────────────────────
|
// ── Whitelist (table → model, pk, allowed fields) ─────────
|
||||||
$allowed = [
|
$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 (! isset($allowed[$table]) || ! in_array($field, $allowed[$table]['fields'], true)) {
|
||||||
if (!array_key_exists($table, $allowed) || !in_array($field, ['short_name', 'client_name'])) {
|
|
||||||
return $this->response
|
return $this->response
|
||||||
->setStatusCode(400)
|
->setStatusCode(400)
|
||||||
->setContentType('application/json')
|
->setContentType('application/json')
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class SalesActualLeadModel extends Model
|
|||||||
'company_name' => [
|
'company_name' => [
|
||||||
'required' => 'Company Name is Missing',
|
'required' => 'Company Name is Missing',
|
||||||
// 'alpha_space' => 'Company Name must contain only letters and spaces',
|
// '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',
|
'min_length' => 'Company Name must be at least 2 characters long',
|
||||||
'max_length' => 'Company Name must be at most 255 characters long'
|
'max_length' => 'Company Name must be at most 255 characters long'
|
||||||
],
|
],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user