Files
servicedesk/scripts/hesk-import/README.md
Kacper 03c6ec7cae v1.4.0
Co nowego:
- Wsparcie Active Directory dla LDAP (obok LLDAP/OpenLDAP), przełącznik typu
  katalogu w Admin > Integracje.
- Wyszukiwarka klientów dla operatora (Operator > Klienci).
- Stronicowanie kolejki operatora (50/stronę) i dashboardu klienta (20/stronę).
- Globalna wyszukiwarka zgłoszeń (Ctrl+K/Cmd+K) z operatorami w stylu Gmaila
  (od:, temat:, treść:, numer:), plus przycisk "Szukaj" w panelu bocznym.
- Ostatnio przeglądane zgłoszenia w panelu bocznym operatora.
- Przeprojektowany pasek nawigacji: suwak Klient/Operator/Administrator
  zamiast rozwijanego menu, bogatsze menu profilu (nazwa/e-mail/role),
  dynamiczne tytuły kart przeglądarki na każdej podstronie.
- Narzędzie do jednorazowego importu historii zgłoszeń z Heska 3.x
  (scripts/hesk-import/).
- Poprawka: paginacja pokazywała surowe klucze tłumaczeń zamiast tekstu
  (brakujący lang/pl/pagination.php).

Zaktualizowana dokumentacja: README, CLAUDE.md, install.md, ARCHITECTURE.md,
CHANGELOG.md, wiki/*.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-05 00:58:35 +02:00

3.1 KiB

Hesk 3.x import

One-time historical migration of tickets (with full reply/note history) from a Hesk 3.x helpdesk database into this app, restricted to a single e-mail domain. Read-only against the Hesk database — never writes there.

This is not an ongoing sync. Run it once to backfill history from an old Hesk install; it doesn't pick up edits made in Hesk afterward.

What it does

  • Matches Hesk tickets by requester e-mail domain (--domain=firma.pl).
  • Imports each ticket's subject/body, status, priority, and full reply + internal-note history, converting Hesk's <br />-laden "plain" text into real line breaks.
  • Maps Hesk categories to this app's categories by exact (case/whitespace- insensitive) name match. A Hesk category with no match is skipped by default — pass --include-unmapped-categories to import those tickets anyway, uncategorized.
  • Auto-assigns a team when every subcategory under the matched category routes to the same single team (same rule TicketService::autoAssignTeam() uses for normal ticket creation); ambiguous categories are left unrouted.
  • Finds or creates a client account per requester e-mail, reusing an existing account (adding the client role if it doesn't have it yet) rather than duplicating.
  • Hesk staff replies are not linked to a real operator account (this script never creates operator accounts) — the reply still shows the correct staff name and "operator" badge via author_name, just without a clickable user behind it.

Setup

cp scripts/hesk-import/.env.example scripts/hesk-import/.env

Fill in scripts/hesk-import/.env with the Hesk database's host/port/database/username/password. That file is gitignored — it holds real credentials for a database this app otherwise has no access to.

Usage

Always dry-run first — it reports what would happen without writing anything:

scripts/hesk-import/hesk-import.sh --domain=firma.pl

Try a small batch for real before committing to the whole thing:

scripts/hesk-import/hesk-import.sh --domain=firma.pl --limit=10 --commit

Then the full import:

scripts/hesk-import/hesk-import.sh --domain=firma.pl --commit

Safe to re-run (including after an interrupted/crashed run): already-imported Hesk ticket ids are tracked in storage/app/hesk-import-state.json inside the app container and skipped on subsequent runs.

Backfilling team assignment

If tickets were already imported before team-by-category mapping existed (or teams/subcategories changed since), backfill team_id on existing imported tickets without importing anything new:

scripts/hesk-import/hesk-import.sh --assign-teams --commit

How it's wired up

hesk-import.sh is a thin wrapper: it loads .env in this folder, then runs php artisan hesk:import inside the app container via docker compose exec, passing the Hesk DB credentials as one-off environment variables (they never touch the app's own .env or get persisted anywhere but the state file). The actual import logic lives in ../../src/app/Console/Commands/ImportHeskTickets.php.