toga-ai 1.0.472 → 1.0.473
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/knowledge/1.0/apps/library/features/startech-pcmaticb2b-sync.md +23 -1
- package/knowledge/2.0/apps/worker2/features/startech-webhook-handler.md +22 -1
- package/knowledge/clients/pcmaticb2b/INDEX.md +1 -0
- package/knowledge/clients/pcmaticb2b/features/startech-per-ticket-type-stages.md +186 -0
- package/knowledge/clients/pcmaticb2b/features/startech-ticket-sync.md +12 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ project: Library
|
|
|
6
6
|
client: pcmaticb2b
|
|
7
7
|
type: client-feature
|
|
8
8
|
status: active
|
|
9
|
-
updated: 2026-07-
|
|
9
|
+
updated: 2026-07-29
|
|
10
10
|
owners: [snaredla]
|
|
11
11
|
files:
|
|
12
12
|
- library/app/api/toga2.php
|
|
@@ -84,3 +84,25 @@ Imports Startech (Easeedesk V3) config into TOGA 2.0 — users, groups, devices,
|
|
|
84
84
|
- 2026-06-23: Initial doc — ticket type maps (both directions), NULL sync behavior, TOGADESK_PCS type added
|
|
85
85
|
- 2026-07-06: Added syncWithToga V1 leg (cross-ref gating, cron-abort ordering, debugging findings) and supporting-records import notes (groups via groups_dispatching, getCategories ticket-type filter)
|
|
86
86
|
- 2026-07-09: Corrected the groups note — groups come from `dynamic_field_options->data->groups` (16 groups); the empty result was a credentials bug (`agilant.api`), not the endpoint. Confirmed `getCategories` `ticket_type` filter works (`50,54` → 15 categories).
|
|
87
|
+
- 2026-07-29: Added two per-ticket-type stage helpers to `App_Api_Toga2` (see
|
|
88
|
+
`clients/pcmaticb2b/features/startech-per-ticket-type-stages.md`):
|
|
89
|
+
`getStartechSelectableTicketStageNames($togadeskClientId, $togadeskDepartmentId)` resolves the
|
|
90
|
+
agent-selectable stage names for TOGaDesk's status dropdown (department → ticket type via
|
|
91
|
+
`TicketTypes.c_togadeskTicketDepartmentId`, filtered by `c_isSelectable = 1`), and
|
|
92
|
+
`getStartechTicketStageUuid($ticketTypeName, $ticketStageName)` resolves a stage within a type for
|
|
93
|
+
the 1.0 → 2.0 payload. Both reference the client's 2.0 schema **by name** (from
|
|
94
|
+
`App_Model_Client::getClientDatabaseNames()`) so the JOIN stays inside one client schema — do not use
|
|
95
|
+
`qqJoinClientsTable(…, true)` here, its UNION-across-all-clients form would cross-match ids between
|
|
96
|
+
clients. StarTech clients are identified by `App_Api_Toga2::STARTECH_TOGADESK_CLIENTS`
|
|
97
|
+
(TOGaDesk client id => TOGA 2.0 client id); non-StarTech clients short-circuit with no DB hit.
|
|
98
|
+
- 2026-07-29: Added two per-ticket-type stage helpers to `App_Api_Toga2` (see
|
|
99
|
+
`clients/pcmaticb2b/features/startech-per-ticket-type-stages.md`):
|
|
100
|
+
`getStartechSelectableTicketStageNames($togadeskClientId, $togadeskDepartmentId)` resolves the
|
|
101
|
+
agent-selectable stage names for TOGaDesk's status dropdown (department → ticket type via
|
|
102
|
+
`TicketTypes.c_togadeskTicketDepartmentId`, filtered by `c_isSelectable = 1`), and
|
|
103
|
+
`getStartechTicketStageUuid($ticketTypeName, $ticketStageName)` resolves a stage within a type for
|
|
104
|
+
the 1.0 → 2.0 payload. Both reference the client's 2.0 schema **by name** (from
|
|
105
|
+
`App_Model_Client::getClientDatabaseNames()`) so the JOIN stays inside one client schema — do not use
|
|
106
|
+
`qqJoinClientsTable(…, true)` here, its UNION-across-all-clients form would cross-match ids between
|
|
107
|
+
clients. StarTech clients are identified by `App_Api_Toga2::STARTECH_TOGADESK_CLIENTS`
|
|
108
|
+
(TOGaDesk client id => TOGA 2.0 client id); non-StarTech clients short-circuit with no DB hit.
|
|
@@ -6,12 +6,13 @@ project: Worker
|
|
|
6
6
|
client: pcmaticb2b
|
|
7
7
|
type: feature
|
|
8
8
|
status: active
|
|
9
|
-
updated: 2026-
|
|
9
|
+
updated: 2026-07-29
|
|
10
10
|
owners: [snaredla]
|
|
11
11
|
files:
|
|
12
12
|
- worker2/Worker/Startech.php
|
|
13
13
|
related:
|
|
14
14
|
- clients/pcmaticb2b/features/startech-ticket-sync.md
|
|
15
|
+
- clients/pcmaticb2b/features/startech-per-ticket-type-stages.md
|
|
15
16
|
- clients/pcmaticb2b/profile.md
|
|
16
17
|
---
|
|
17
18
|
|
|
@@ -53,6 +54,26 @@ Conditional additions: `ticketStage` (from `ticket_status`), `contact` (from `cr
|
|
|
53
54
|
- `c_escalateToStartech: 0` must be in the payload. If omitted, the interceptor still skips Startech (null is also falsy), but the field stays NULL in TOGA 2.0 — making webhook tickets indistinguishable from TOGaDesk-created ones.
|
|
54
55
|
- `ticketType` is resolved via `c_startechTicketTypeId` on `TicketTypes` — not a hardcoded string. Startech type IDs: SR=6, PCS=54, API=201.
|
|
55
56
|
|
|
57
|
+
## Ticket type and stage lookups (per-ticket-type stages)
|
|
58
|
+
|
|
59
|
+
Since ticket stages became scoped to a ticket type, matching a nested child by a single Startech id is
|
|
60
|
+
ambiguous, so `Webhook()` resolves both explicitly and sends `['uuid' => …]`:
|
|
61
|
+
|
|
62
|
+
- **Ticket type** — `GET /ticket-types` filtered on `c_startechTicketTypeId` **plus** `code`, mapped by
|
|
63
|
+
`_Worker_Startech::TOGA_TICKET_TYPE_CODE_BY_STARTECH_TICKET_TYPE_ID` (`50 => 'SUPPORT REQUEST'`,
|
|
64
|
+
`54 => 'PCS'`). **Startech type 54 maps to three TOGA types** for PC Matic B2B — 1 PCS, 3 API and
|
|
65
|
+
4 Togadesk PCS — so `c_startechTicketTypeId` alone cannot identify a type. API and Togadesk PCS are
|
|
66
|
+
TOGA-side origins (tickets created via the API or in TOGaDesk), never what Startech sends inbound.
|
|
67
|
+
- **Ticket stage** — `GET /ticket-stages` filtered on `c_startechStageId` **plus** the resolved
|
|
68
|
+
`ticketTypeId`. Startech status ids repeat across types (New = `1` for every type), so a stage is only
|
|
69
|
+
unique per type. If the type cannot be resolved, the stage is **omitted** rather than risking a stage
|
|
70
|
+
from another type; the type itself falls back to the old `c_startechTicketTypeId` match.
|
|
71
|
+
|
|
72
|
+
Both filters use `fields` to request only `id`/`uuid`. Filtering on `ticketTypeId` requires the
|
|
73
|
+
`Core.RecordFields` registration (id 2479) — see the per-ticket-type-stages doc for deploy order.
|
|
74
|
+
|
|
56
75
|
## Change history
|
|
57
76
|
|
|
77
|
+
- 2026-07-29: Explicit ticket-type (id + code) and ticket-stage (id + ticketTypeId) lookups for
|
|
78
|
+
per-ticket-type stages; documented the Startech type 54 → three TOGA types ambiguity
|
|
58
79
|
- 2026-06-23: Initial doc — webhook handler, c_escalateToStartech=0 payload field, POST vs PUT logic
|
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
| Doc | Framework | Summary | Files |
|
|
4
4
|
|-----|-----------|---------|-------|
|
|
5
5
|
| [PC Matic B2B — Startech Entitlement Provisioning (customer + SKU)](features/startech-entitlement-provisioning.md) | 2.0 | When a PC Matic B2B entitlement is created in TOGA 2.0 (`POST /entitlements`), the client registers the customer on StarTech's OptimumDesk platform and assigns | _underscore/Trait/Startech/Entitlement.php, _underscore/Model/Pcmaticb2b/Entitlement.php, _underscore/Config.php, api2/Config/production.ini, api2/Config/beta.ini, api2/Config/sandbox-client.ini, test/@srija/Startech Testing/PC Matic B2B/test_e2e_pcmaticb2b.sh |
|
|
6
|
+
| [PC Matic B2B — Startech Per-Ticket-Type Ticket Stages](features/startech-per-ticket-type-stages.md) | 2.0 | Startech (OptimumDesk) exposes a **different status set per ticket type** — Support Request (workflow 56) has 15 statuses, Phone Call Support (workflow 59) has | dbchanges2/Client/2026-07-22a - TicketStageTicketTypeId.sql, dbchanges2/Core/2026-07-28 - TicketStageTicketTypeIdRecordField.sql, dbchanges2/_modules/startech/2026-07-28 - TicketStageIsSelectable.sql, dbchanges2/Client_Pcmaticb2b/2026-07-28 - pcmaticb2b ticketstages.sql, _underscore/Model/Client/TicketStage.php, _underscore/Trait/Startech/TicketStage.php, _underscore/Model/Pcmaticb2b/TicketStage.php, _underscore/Trait/Startech/Ticket.php, worker2/Worker/Startech.php, library/app/api/toga2.php, library/app/model/togadesk/ticket.php, togadesk/desk/includes/functions.php, togadesk/desk/includes/controllers/data/tickets/manage.php, togadesk/desk/template/pages/tickets/manage.php |
|
|
6
7
|
| [PC Matic B2B — Startech Ticket Sync](features/startech-ticket-sync.md) | 1.0 | Bidirectional ticket sync between TOGaDesk 1.0 (client 177), TOGA 2.0 (client 21), and Startech (Easeedesk). | worker/crons/toga2/startech/sync_togadesk_startech_pcmaticb2b.php, worker/crons/toga2/startech/common_import_supporting_records.php, library/app/api/toga2.php, library/app/api/startechticket.php, togadesk/desk/includes/controllers/quickactions.php, togadesk/desk/template/pages/tickets/manage.php, togadesk/desk/includes/functions.php, worker2/Worker/Startech.php, _underscore/Trait/Startech/Ticket.php, dbchanges2/Client_Pcmaticb2b/2026-06-22-pcmaticb2b-enhancements.sql |
|
|
7
8
|
| [PC Matic B2B Client Profile](profile.md) | 1.0 | PC Matic B2B is a client using TOGaDesk 1.0 for ticket management, with TOGA 2.0 as the data layer and Startech (Easeedesk) as an external ticketing system for | worker/crons/toga2/startech/sync_togadesk_startech_pcmaticb2b.php, togadesk/desk/includes/functions.php |
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: PC Matic B2B — Startech Per-Ticket-Type Ticket Stages
|
|
3
|
+
framework: "2.0"
|
|
4
|
+
project: TOGa
|
|
5
|
+
client: pcmaticb2b
|
|
6
|
+
type: client-feature
|
|
7
|
+
status: active
|
|
8
|
+
updated: 2026-07-29
|
|
9
|
+
owners: [snaredla]
|
|
10
|
+
files:
|
|
11
|
+
- dbchanges2/Client/2026-07-22a - TicketStageTicketTypeId.sql
|
|
12
|
+
- dbchanges2/Core/2026-07-28 - TicketStageTicketTypeIdRecordField.sql
|
|
13
|
+
- dbchanges2/_modules/startech/2026-07-28 - TicketStageIsSelectable.sql
|
|
14
|
+
- dbchanges2/Client_Pcmaticb2b/2026-07-28 - pcmaticb2b ticketstages.sql
|
|
15
|
+
- _underscore/Model/Client/TicketStage.php
|
|
16
|
+
- _underscore/Trait/Startech/TicketStage.php
|
|
17
|
+
- _underscore/Model/Pcmaticb2b/TicketStage.php
|
|
18
|
+
- _underscore/Trait/Startech/Ticket.php
|
|
19
|
+
- worker2/Worker/Startech.php
|
|
20
|
+
- library/app/api/toga2.php
|
|
21
|
+
- library/app/model/togadesk/ticket.php
|
|
22
|
+
- togadesk/desk/includes/functions.php
|
|
23
|
+
- togadesk/desk/includes/controllers/data/tickets/manage.php
|
|
24
|
+
- togadesk/desk/template/pages/tickets/manage.php
|
|
25
|
+
related:
|
|
26
|
+
- clients/pcmaticb2b/features/startech-ticket-sync.md
|
|
27
|
+
- 2.0/apps/worker2/features/startech-webhook-handler.md
|
|
28
|
+
- 1.0/apps/library/features/startech-pcmaticb2b-sync.md
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Summary
|
|
32
|
+
|
|
33
|
+
Startech (OptimumDesk) exposes a **different status set per ticket type** — Support Request
|
|
34
|
+
(workflow 56) has 15 statuses, Phone Call Support (workflow 59) has 10. Previously TOGA stored a
|
|
35
|
+
single flat set of 8 generic stages, so Startech statuses like Connected or Dispatched could not be
|
|
36
|
+
represented and agents could pick statuses Startech would reject.
|
|
37
|
+
|
|
38
|
+
This feature scopes ticket stages to a ticket type via a nullable `TicketStages.ticketTypeId`, and
|
|
39
|
+
marks which stages an agent may actually select via a `c_isSelectable` custom field. TOGaDesk shows
|
|
40
|
+
**every** synced status (full visibility for reporting) but only offers the selectable subset in the
|
|
41
|
+
status dropdown.
|
|
42
|
+
|
|
43
|
+
A bridge table was deliberately rejected in favour of the nullable FK to avoid duplicating stage rows.
|
|
44
|
+
|
|
45
|
+
## Key files / entry points
|
|
46
|
+
|
|
47
|
+
| Concern | File |
|
|
48
|
+
|---|---|
|
|
49
|
+
| `ticketTypeId` column (all client DBs) | `dbchanges2/Client/2026-07-22a - TicketStageTicketTypeId.sql` |
|
|
50
|
+
| `ticketTypeId` API registration + ACL | `dbchanges2/Core/2026-07-28 - TicketStageTicketTypeIdRecordField.sql` |
|
|
51
|
+
| `c_isSelectable` column + registration | `dbchanges2/_modules/startech/2026-07-28 - TicketStageIsSelectable.sql` |
|
|
52
|
+
| Per-type stage seed | `dbchanges2/Client_Pcmaticb2b/2026-07-28 - pcmaticb2b ticketstages.sql` |
|
|
53
|
+
| Model fields | `_underscore/Model/Client/TicketStage.php`, `_underscore/Trait/Startech/TicketStage.php` |
|
|
54
|
+
| Inbound webhook lookups | `worker2/Worker/Startech.php` (`_Worker_Startech::Webhook`) |
|
|
55
|
+
| Outbound to Startech | `_underscore/Trait/Startech/Ticket.php` (`postPost` / `postPut`) |
|
|
56
|
+
| 1.0 ↔ 2.0 sync mapping | `library/app/api/toga2.php` |
|
|
57
|
+
| Desk dropdown + badges | `togadesk/desk/includes/controllers/data/tickets/manage.php`, `.../includes/functions.php` |
|
|
58
|
+
|
|
59
|
+
## Data model
|
|
60
|
+
|
|
61
|
+
`TicketStages` gained two fields:
|
|
62
|
+
|
|
63
|
+
- **`ticketTypeId`** — nullable `INT UNSIGNED` FK to `Client.TicketTypes`, `AFTER ticketStatusId`.
|
|
64
|
+
NULL = applies to all types. Registered as `Core.RecordFields` **id 2479**
|
|
65
|
+
(`type = 'NUMBER'`, `precision = 0`, **`isIdentifier = 1`**) so it can be filtered over the V2 API
|
|
66
|
+
and participate in MATCH keys. Record 88 (`Ticket stages`) is `aclDatabase = CLIENT`, so its native
|
|
67
|
+
fields need a grant in **both** `Core.AclFieldPermissions` (roleId 3) **and** each client's
|
|
68
|
+
`AclFieldPermissions` (roleId 1) — mirroring the sibling `ticketStatusId`.
|
|
69
|
+
- **`c_isSelectable`** — nullable `TINYINT UNSIGNED` custom field (`1` = agent-selectable,
|
|
70
|
+
`0` = display-only). Registered in the client's `CustomRecordFields` (recordId 88, `BOOLEAN`) with
|
|
71
|
+
`AclCustomFieldPermissions` for roles 1 and 3. Declared on `_Trait_Startech_TicketStage` alongside
|
|
72
|
+
`c_startechStageId`, so every Startech client's TicketStage model gets both by `use`-ing the trait.
|
|
73
|
+
|
|
74
|
+
### Seeded stages (PC Matic B2B) — 35 rows across 4 types
|
|
75
|
+
|
|
76
|
+
| Dept | TicketTypes.id | Type | Startech type / workflow | Stage ids | Count |
|
|
77
|
+
|---|---|---|---|---|---|
|
|
78
|
+
| 336 | 2 | Support Request | 50 / 56 | 1-15 | 15 |
|
|
79
|
+
| 337 | 1 | Phone Call Support | 54 / 59 | 16-25 | 10 |
|
|
80
|
+
| 338 | 3 | API | 54 | 26-30 | 5 |
|
|
81
|
+
| 338 | 4 | Togadesk PCS | 54 | 31-35 | 5 |
|
|
82
|
+
|
|
83
|
+
Selectable in **every** set: New Ticket, In Progress, Resolved, Reopened, Closed. Everything else
|
|
84
|
+
(Connected 76, Transferred 141, User Offline 155, Cancelled 177, Remote Control 178, Customer
|
|
85
|
+
Confirmation 179, Lost 180, Dispatched 181, Automate Check 183, Live 186, Rework 74) is display-only.
|
|
86
|
+
|
|
87
|
+
API and Togadesk PCS get **only the 5 mutual TOGaDesk/Startech statuses** — those tickets originate on
|
|
88
|
+
the TOGA/Desk side, so Startech automation statuses would never legitimately apply. Awaiting User
|
|
89
|
+
(210), Open (72) and On Hold (209) were dropped: they appear in neither workflow.
|
|
90
|
+
|
|
91
|
+
## How it works
|
|
92
|
+
|
|
93
|
+
### Desk visibility + selectability (1.0)
|
|
94
|
+
|
|
95
|
+
1. `manage.php` calls `App_Api_Toga2::getStartechSelectableTicketStageNames($clientId, $departmentId)`.
|
|
96
|
+
2. The resolver maps the TOGaDesk client id to a TOGA 2.0 client id via
|
|
97
|
+
`App_Api_Toga2::STARTECH_TOGADESK_CLIENTS` (also the "is this a Startech client?" test), resolves
|
|
98
|
+
the 2.0 schema **by name** from `App_Model_Client::getClientDatabaseNames()`, and queries
|
|
99
|
+
`TicketStages ⋈ TicketTypes WHERE c_togadeskTicketDepartmentId = ? AND c_isSelectable = 1`.
|
|
100
|
+
3. Non-Startech clients get `[]` back with **no DB hit** and fall through to the default dropdown.
|
|
101
|
+
4. Display is unrestricted: `ticketStatusBadge()` renders any status. Its third parameter
|
|
102
|
+
(`$showStartechStatusColors`) enables dark inline hex + white text, passed only from the pcmatic
|
|
103
|
+
ticket-details templates — so lists/dashboard/search show the same statuses in neutral gray.
|
|
104
|
+
|
|
105
|
+
### Inbound Startech webhook (2.0)
|
|
106
|
+
|
|
107
|
+
`_Worker_Startech::Webhook` resolves type and stage **explicitly** instead of relying on child MATCH:
|
|
108
|
+
|
|
109
|
+
1. `GET /ticket-types` filtered on `c_startechTicketTypeId` **+** `code` (via
|
|
110
|
+
`TOGA_TICKET_TYPE_CODE_BY_STARTECH_TICKET_TYPE_ID`: `50 => SUPPORT REQUEST`, `54 => PCS`).
|
|
111
|
+
2. `GET /ticket-stages` filtered on `c_startechStageId` **+** the resolved `ticketTypeId`.
|
|
112
|
+
3. Both passed as `['uuid' => …]`. If the type cannot be resolved the stage is **omitted** rather than
|
|
113
|
+
risking another type's stage; the type itself falls back to the old `c_startechTicketTypeId` match.
|
|
114
|
+
|
|
115
|
+
### 1.0 ↔ 2.0 sync (`library/app/api/toga2.php`)
|
|
116
|
+
|
|
117
|
+
- **2.0 → 1.0:** use `ticketStage->name` directly. 2.0 stage names match TOGaDesk status strings for
|
|
118
|
+
every type, and the name is inherently type-correct because the stage belongs to the ticket's type.
|
|
119
|
+
- **1.0 → 2.0:** `getStartechTicketStageUuid($ticketTypeName, $ticketStageName)` resolves the type by
|
|
120
|
+
name then the stage by name within that type, and the payload sends `ticketStage.uuid`. Results are
|
|
121
|
+
cached per run in `$_startechTicketStageUuids`. Applied at both write sites (ticket create and
|
|
122
|
+
note/reply status change). Non-pcmatic clients keep the existing `status → code` map untouched.
|
|
123
|
+
|
|
124
|
+
### Outbound to OptimumDesk (interceptor)
|
|
125
|
+
|
|
126
|
+
`_Trait_Startech_Ticket::getStartechTicketStatusForTicketType($payload)` compares
|
|
127
|
+
`ticketStage->ticketTypeId` with `ticketType->id` and returns `0` on mismatch, so the status is omitted
|
|
128
|
+
instead of sent. Startech validates a status against the type's workflow and returns **400** for a
|
|
129
|
+
status that workflow lacks (e.g. Transferred on a Phone Call Support ticket). Used by both `postPost`
|
|
130
|
+
(create) and `postPut` (update).
|
|
131
|
+
|
|
132
|
+
## Client variations
|
|
133
|
+
|
|
134
|
+
Only PC Matic B2B is seeded today. Selectability generalises to any Startech client by adding one row
|
|
135
|
+
to `STARTECH_TOGADESK_CLIENTS`; the **coloured** badges are pcmatic-only by product decision
|
|
136
|
+
(`TOGADESK_CLIENT_ID__PCMATICB2B`).
|
|
137
|
+
|
|
138
|
+
## Gotchas / known issues
|
|
139
|
+
|
|
140
|
+
- **Deploy order matters.** Migrations must run before the library/worker2/_underscore deploy:
|
|
141
|
+
`Client/2026-07-22a` → `Core/2026-07-28` → `_modules/startech/2026-07-28` → pcmatic seed. Until
|
|
142
|
+
`ticketTypeId` is registered and stages are seeded, the new lookups resolve nothing and the code
|
|
143
|
+
falls back to the old paths.
|
|
144
|
+
- **The old `ticketStage->code` switch was a live mis-mapping.** Codes used to mean statuses (1-8);
|
|
145
|
+
after the seed they are row ids (1-35), so code 4 (`Reopened`) would have set the ticket to
|
|
146
|
+
`Closed`. Never map a pcmatic stage by code — use the name or the uuid.
|
|
147
|
+
- **`c_startechStageId` is no longer unique.** New = `1` for all four types. Always scope a stage
|
|
148
|
+
lookup by `ticketTypeId`.
|
|
149
|
+
- **Startech type `54` maps to three TOGA types** (1 PCS, 3 API, 4 Togadesk PCS), so
|
|
150
|
+
`c_startechTicketTypeId` alone cannot identify a type — pair it with `code`.
|
|
151
|
+
- **Interceptors receive `$outData`**, the resolved response record with expanded relations (depth
|
|
152
|
+
bumped to the interceptor's `minDepth`) — not the raw request. That is why sending
|
|
153
|
+
`ticketStage.uuid` still yields a populated `c_startechStageId` / `ticketTypeId` downstream.
|
|
154
|
+
- **`c_isSelectable` is registered with `isIdentifier = 0` — deliberately.** `isIdentifier = 1` would
|
|
155
|
+
put a mutable flag in the child-match lookup key (`api2/Component/Api/V2/V2.php:7053-7128` searches
|
|
156
|
+
only on identifier fields), so flipping a stage's selectability would stop a MATCH payload finding the
|
|
157
|
+
row and the API would insert a **duplicate stage** instead of updating. `ticketTypeId` by contrast
|
|
158
|
+
*must* be `isIdentifier = 1` — it is what makes `{c_startechStageId, ticketTypeId}` resolve to the one
|
|
159
|
+
correct per-type stage. Note: when a record has **no** identifier fields at all, the API falls back to
|
|
160
|
+
treating every field as an identifier.
|
|
161
|
+
- **The seed opens with `DELETE FROM TicketStages` / `TicketStatuses`.** Clean for a fresh onboard, but
|
|
162
|
+
it will fail or orphan rows if live tickets already reference the old stage ids — a migrate-in-place
|
|
163
|
+
is needed for an already-populated schema.
|
|
164
|
+
- **`c_isSelectable` exists only in 2.0.** TOGaDesk 1.0 has no statuses table (`tickets.status` is a
|
|
165
|
+
free string), so 1.0 reads the flag live from the client's 2.0 schema on each ticket-details render.
|
|
166
|
+
Flipping it in 2.0 changes the dropdown immediately, with no sync step.
|
|
167
|
+
- **Dept 338 maps to two types** (3 and 4) with identical status names; the resolver's
|
|
168
|
+
`GROUP BY ticketStages.name` collapses them to one clean list. That ambiguity still matters for any
|
|
169
|
+
department → type lookup elsewhere.
|
|
170
|
+
|
|
171
|
+
## Related docs
|
|
172
|
+
|
|
173
|
+
- `clients/pcmaticb2b/features/startech-ticket-sync.md`
|
|
174
|
+
- `2.0/apps/worker2/features/startech-webhook-handler.md`
|
|
175
|
+
- `1.0/apps/library/features/startech-pcmaticb2b-sync.md`
|
|
176
|
+
|
|
177
|
+
## Change history
|
|
178
|
+
|
|
179
|
+
- 2026-07-29: Initial doc — delivers the per-ticket-type statuses enhancement flagged as pending on
|
|
180
|
+
2026-07-10 in `startech-ticket-sync.md`. Covers `TicketStages.ticketTypeId` (Core.RecordFields 2479,
|
|
181
|
+
`isIdentifier = 1`) and the `c_isSelectable` custom field, the 35-stage seed across 4 ticket types,
|
|
182
|
+
TOGaDesk visibility vs selectability (`getStartechSelectableTicketStageNames()`, badge colour scoping),
|
|
183
|
+
explicit type + stage lookups in the worker2 webhook, per-type stage mapping in both sync directions,
|
|
184
|
+
and the outbound interceptor's ticket-type/stage consistency guard. Records two bugs fixed (the
|
|
185
|
+
2.0 → 1.0 `ticketStage->code` mis-mapping; non-unique `c_startechStageId` and Startech type 54) and
|
|
186
|
+
the migration-before-deploy ordering.
|
|
@@ -5,7 +5,7 @@ project: TOGa
|
|
|
5
5
|
client: pcmaticb2b
|
|
6
6
|
type: client-feature
|
|
7
7
|
status: active
|
|
8
|
-
updated: 2026-07-
|
|
8
|
+
updated: 2026-07-29
|
|
9
9
|
owners: [snaredla]
|
|
10
10
|
files:
|
|
11
11
|
- worker/crons/toga2/startech/sync_togadesk_startech_pcmaticb2b.php
|
|
@@ -19,6 +19,7 @@ files:
|
|
|
19
19
|
- _underscore/Trait/Startech/Ticket.php
|
|
20
20
|
- dbchanges2/Client_Pcmaticb2b/2026-06-22-pcmaticb2b-enhancements.sql
|
|
21
21
|
related:
|
|
22
|
+
- clients/pcmaticb2b/features/startech-per-ticket-type-stages.md
|
|
22
23
|
- clients/pcmaticb2b/profile.md
|
|
23
24
|
- 2.0/apps/worker2/features/startech-webhook-handler.md
|
|
24
25
|
- 1.0/apps/library/features/startech-pcmaticb2b-sync.md
|
|
@@ -228,3 +229,13 @@ not yet resolved:
|
|
|
228
229
|
- 2026-07-06: Added sync prerequisites/gotchas (entitlement gate, staff-email collision) and clarified the escalate button's actual behavior (desk changes always; 2.0 PUT only when linked)
|
|
229
230
|
- 2026-07-09: Corrected Startech ticket-type IDs (50 Support Request, 54 Phone Call Support for company 24412); added Sync Risks (escalate flag never reset, webhook 1→0 silencing, interceptor DB-gating) and Verification (OUT-log + E2E test); cross-linked entitlement provisioning.
|
|
230
231
|
- 2026-07-10: Added Ticket Statuses & Workflows section — workflow IDs 56 (Support Request) / 59 (Phone Call Support), statuses queried by workflow_id (not type id); TicketStages.c_startechStageId check (Awaiting User 210 / On Hold 209 disabled, Open 72 absent → invalid); flagged per-ticket-type statuses as a pending enhancement (sync + TOGaDesk).
|
|
232
|
+
- 2026-07-29: Per-ticket-type stages delivered (the 2026-07-10 pending enhancement) — see
|
|
233
|
+
`clients/pcmaticb2b/features/startech-per-ticket-type-stages.md`. Sync-relevant changes:
|
|
234
|
+
**2.0 → 1.0** no longer switches on `ticketStage->code` (codes became per-type row ids 1-35, so the
|
|
235
|
+
old 1-8 switch mis-mapped — code 4 `Reopened` set the ticket to `Closed`); it now uses
|
|
236
|
+
`ticketStage->name`, which is type-correct by construction. **1.0 → 2.0** no longer uses the shared
|
|
237
|
+
`status → code` map for pcmatic (it would attach another type's stage); `App_Api_Toga2::getStartechTicketStageUuid($ticketTypeName, $ticketStageName)`
|
|
238
|
+
resolves the stage within the ticket's type and the payload sends `ticketStage.uuid` (applied to both
|
|
239
|
+
ticket create and note/reply status changes, cached per run). The outbound interceptor now drops a
|
|
240
|
+
status whose stage belongs to a different ticket type, since Startech 400s on a status outside the
|
|
241
|
+
type's workflow.
|
package/package.json
CHANGED