fix(helpdesk): consolidation fixes from drift/performance/security review

- Fix docblock: getTicketsForTeam() uses PBI_FP_Tickets, not LV
- Process_Stage check now uses isset() guard — FP entity does not
  expose this field, prevents false positives from default 0
- Remove exception message from JSON error response (security)
- Remove dead JS functions: formatAge(), formatDate()
- Remove debug console.error and verbose error display from JS

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-05 20:25:51 +02:00
parent b82cef31a6
commit fc98f2684a
4 changed files with 9 additions and 27 deletions

View File

@@ -590,7 +590,8 @@ class BcODataGateway
/**
* Get ticket rows across all customers for team workload aggregation.
*
* Uses PBI_LV_Tickets without Customer_No filter to return a global snapshot.
* Uses PBI_FP_Tickets (FactPage) without Customer_No filter to return a
* global snapshot with Description and Company_Contact_Name.
* Support_User_Name is used for per-agent grouping.
*
* @return array<int, array<string, mixed>>

View File

@@ -1603,8 +1603,10 @@ class DebitorDetailService
foreach ($tickets as $ticket) {
$state = trim((string) ($ticket['Ticket_State'] ?? ''));
// Team query uses PBI_FP_Tickets which has no Process_Stage;
// fall back to Process_Stage only when present (LV entity).
$isClosed = self::isClosedTicketState($state)
|| (int) ($ticket['Process_Stage'] ?? 0) === 40;
|| (isset($ticket['Process_Stage']) && (int) $ticket['Process_Stage'] === 40);
$rawUser = trim((string) ($ticket['Support_User_Name'] ?? ''));
$normalizedUser = $rawUser === '' ? '' : strtolower($rawUser);