Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.2.0] - 2026-11-08

### Added

- **Tick "Send satisfaction question"** in the agent panel's reply form, note form and status dialog, shown when a closing status is chosen and the ticket would be asked. Removing it means: never ask this ticket (row state `declined`, internal note).
- **"No satisfaction question" / "Allow satisfaction question again"** in the ticket's More menu, before closing. POST to `scp/ajax.php/feedback/ticket/<id>/decline|allow` with osTicket's CSRF token and the agent's ticket permission.
- **Setting "Closing without an agent form"** for API, cron and mass status changes in the ticket list: ask (default, as in 0.1), only when the request asks for it, or never. Requests pass `feedback_ask=1|0`; API Endpoints 2.9.0 forwards its `feedback` field.
- **Setting "Agents can switch the question off"** (default on).
- The note after a sent question names what triggered it (agent panel, ticket list, API or cron).

## [0.1.1] - 2026-11-08

### Added
Expand Down Expand Up @@ -35,6 +45,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Retention: rows are deleted after 24 months; the IP is stored only as a keyed hash.
- Mail in the style of a brand line over an accent rule, buttons as table cells, a grey footer with an AI notice; texts editable, German (informal) and English built in.

[Unreleased]: https://github.com/studio-prisma/osticket-plugin-feedback/compare/v0.1.1...HEAD
[Unreleased]: https://github.com/studio-prisma/osticket-plugin-feedback/compare/v0.2.0...HEAD
[0.2.0]: https://github.com/studio-prisma/osticket-plugin-feedback/compare/v0.1.1...v0.2.0
[0.1.1]: https://github.com/studio-prisma/osticket-plugin-feedback/compare/v0.1.0...v0.1.1
[0.1.0]: https://github.com/studio-prisma/osticket-plugin-feedback/releases/tag/v0.1.0
13 changes: 13 additions & 0 deletions README.de.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ Die Bewertungen bleiben in der Datenbank des Helpdesks. Kein Umfragedienst, kein
- Abteilungen, Hilfethemen und Absender-Domains aus den Einstellungen; standardmäßig die eigenen Domains des Helpdesks
- Schließen mit einem Status wie „Dublette“ oder „Spam“ (Einstellung, nach Namen vorausgewählt)
- Tickets, zu denen schon gefragt wurde
- Tickets, bei denen ein Agent die Frage abgeschaltet hat: Häkchen „Send satisfaction question“ beim Schließen entfernt oder „Keine Zufriedenheitsfrage“ im Menü „Weitere“
- je nach Einstellung: Schließen ohne Agentenformular (API, Cron, Massen-Statuswechsel in der Ticketliste)

## Wer entscheidet

| Schließen | Standard | Einstellung |
|---|---|---|
| Agent schließt ein Ticket (Antwort, Notiz, Statusdialog) | fragt; der Agent kann das Häkchen entfernen, dann nie für dieses Ticket | „Agents can switch the question off“ |
| API, Cron, Massen-Statuswechsel in der Liste | fragt, wie in 0.1 | „Closing without an agent form“: fragen / nur wenn angefordert / nie |

Ein Request fordert die Frage mit `feedback_ask=1` in den POST-Daten an und lehnt sie mit `feedback_ask=0` ab. Das Plugin [API Endpoints](https://github.com/studio-prisma/osticket-api-endpoints) (ab 2.9.0) reicht sein Feld `feedback` so weiter. Der Schalter kann eine Frage nur bestätigen oder unterdrücken, die die Regeln erlauben; er erweitert sie nie.

## Voraussetzungen

Expand All @@ -49,6 +60,8 @@ Schritt für Schritt mit Prüfpunkten: **[docs/INSTALL.de.md](docs/INSTALL.de.md
| Link valid for | Tage (1–90) | 14 |
| Comment field after the click | an / aus | an |
| Note at the ticket when asked | keine / kurz / mit der gesendeten Mail | kurz; ein gescheiterter Versand bekommt immer eine Notiz |
| Agents can switch the question off | an / aus | an |
| Closing without an agent form | fragen / nur wenn angefordert / nie | fragen |
| Never ask for | Abteilungen, Hilfethemen, Status beim Schließen, Absender-Domains, eigene Domains | Abteilungen mit „Alert“/„Protokoll“ im Namen, Status mit „Duplicate“/„Spam“/„Hinfällig“ im Namen, eigene Domains |
| Texte | Betreff, Mailtext, Frage, Zeile, KI-Hinweis; leer = eingebauter Text | eingebaut, Deutsch (du) oder Englisch |
| Accent colour | `#rrggbb` | `#330066` |
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ Ratings stay in the help desk's own database. No survey service, no tracking pix
- departments, help topics and sender domains from the settings; the help desk's own domains by default
- closes with a status like "Duplicate" or "Spam" (setting, preselected by name)
- tickets that were already asked
- tickets an agent switched off: the tick "Send satisfaction question" removed when closing, or "No satisfaction question" in the ticket's More menu
- depending on the setting, closes without an agent form (API, cron, mass status change in the ticket list)

## Who decides

| Close | Default | Setting |
|---|---|---|
| Agent closes one ticket (reply, note, status dialog) | asks; the agent can remove the tick, which means never for this ticket | "Agents can switch the question off" |
| API, cron, mass status change in the list | asks, as in 0.1 | "Closing without an agent form": ask / only when the request asks for it / never |

A request asks for it with `feedback_ask=1` in the POST data and declines with `feedback_ask=0`. The [API Endpoints](https://github.com/studio-prisma/osticket-api-endpoints) plugin (2.9.0 or later) passes its `feedback` field this way. The flag can only confirm or suppress a question the rules allow; it never widens them.

## Requirements

Expand All @@ -49,6 +60,8 @@ Step by step with checkpoints: **[docs/INSTALL.md](docs/INSTALL.md)**. Short ver
| Link valid for | days (1–90) | 14 |
| Comment field after the click | on / off | on |
| Note at the ticket when asked | none / short / with the mail as sent | short; a failed send always gets a note |
| Agents can switch the question off | on / off | on |
| Closing without an agent form | ask / only when requested / never | ask |
| Never ask for | departments, help topics, closing statuses, sender domains, own domains | departments named like "Alert"/"Protokoll", statuses named like "Duplicate"/"Spam"/"Hinfällig", own domains |
| Texts | subject, mail text, question, line, AI notice; empty = built-in text | built-in, German (informal) or English |
| Accent colour | `#rrggbb` | `#330066` |
Expand Down
2 changes: 2 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Expected response: an acknowledgement within 7 days, an assessment within 30. Th
- **Markup from a comment rendered** on the click page, in a thread note, in the agent mail, in the assignment alert or on the evaluation page.
- **The token key or `SECRET_SALT`** in a response, a log line, an error message or the release package; a link that works while `SECRET_SALT` is the sample value.
- **The IP address stored in clear text.**
- **Switching the question off or on for a ticket** (`scp/ajax.php/feedback/ticket/<id>/decline|allow`) without an agent session, without osTicket's CSRF token, or for a ticket the agent can't access.
- **`feedback_ask` widening the rules**: a request that makes the plugin ask a ticket the rules exclude (AI agent, department, status, domain, already asked).
- **A redirect to an address outside the help desk** or a link built from the request's Host header.
- **Bypassing the rate limit** with the same IP, or growing the plugin's tables without bound from outside.
- **Asking twice for one ticket**, asking for a ticket an AI agent closed, a sub-ticket or an excluded department, help topic or domain.
Expand Down
9 changes: 7 additions & 2 deletions class.FeedbackPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@
require_once __DIR__ . '/src/FeedbackActions.php';
require_once __DIR__ . '/src/FeedbackPage.php';
require_once __DIR__ . '/src/FeedbackAdmin.php';
require_once __DIR__ . '/src/FeedbackUi.php';

class FeedbackPlugin extends Plugin
{
/** Mirrors plugin.php. */
public const VERSION = '0.1.1';
public const VERSION = '0.2.0';

/** Route bases, relative to the help desk root. */
public const CLIENT_BASE = 'ajax.php/feedback';
Expand Down Expand Up @@ -75,7 +76,7 @@ public function bootstrap(): void
$raw = array();
foreach (array('enabled', 'mode', 'scale', 'on_bad', 'bad_stars', 'bad_nps', 'valid_days', 'exclude_depts',
'exclude_topics', 'exclude_statuses', 'exclude_domains', 'exclude_own', 'comment_on', 'note_sent',
'language', 'subject', 'text',
'agent_decline', 'no_session', 'language', 'subject', 'text',
'question', 'line', 'foot_on', 'foot', 'accent') as $k) {
$raw[$k] = $config->get($k);
}
Expand Down Expand Up @@ -109,6 +110,7 @@ public function bootstrap(): void
}
Signal::connect('threadentry.created', array('FeedbackTrigger', 'onEntry'));
Signal::connect('model.updated', array('FeedbackTrigger', 'onUpdated'));
FeedbackUi::maybeStart(FeedbackSettings::get());
}

// Handlers are closures on purpose: given array('Class', 'method'), the
Expand All @@ -131,6 +133,9 @@ public static function staffRoutes($dispatcher): void
$dispatcher->append(url_get('^/feedback/admin$', static function () {
return FeedbackAdmin::page();
}));
$dispatcher->append(url_post('^/feedback/ticket/(?P<id>\d+)/(?P<what>decline|allow)$', static function ($id, $what) {
return FeedbackUi::toggle((int) $id, (string) $what);
}));
}

/** Key material from SECRET_SALT, or null: then nobody is asked and no link is valid. */
Expand Down
25 changes: 25 additions & 0 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,31 @@ public function getOptions()
. 'opens the ticket sees the customer\'s rating links.',
)),

'sec_decide' => new SectionBreakField(array(
'label' => 'Who decides',
)),

'agent_decline' => new BooleanField(array(
'label' => 'Agents can switch the question off',
'default' => true,
'configuration' => array(
'desc' => 'A tick "Send satisfaction question" when closing in the agent panel, and '
. '"No satisfaction question" in the ticket\'s More menu. Off for a ticket means never.',
),
)),

'no_session' => new ChoiceField(array(
'label' => 'Closing without an agent form',
'default' => 'ask',
'choices' => array(
'ask' => 'Ask (as in 0.1)',
'requested' => 'Ask only when the request asks for it (feedback_ask=1)',
'never' => 'Never ask',
),
'hint' => 'API, cron and mass status changes in the ticket list. The API Endpoints plugin passes '
. '"feedback": true/false as feedback_ask.',
)),

'sec_except' => new SectionBreakField(array(
'label' => 'Never ask for',
)),
Expand Down
5 changes: 4 additions & 1 deletion docs/INSTALL.de.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Abbruch, wenn: `SECRET_SALT` fehlt oder der Beispielwert ist, oder kein Cron lä
1. Das Paket `feedback-<version>.zip` nach `include/plugins/` entpacken. Danach gibt es `include/plugins/feedback/plugin.php`.
2. Rechte wie bei den anderen Plugins: lesbar für den Webserver, nicht schreibbar.

Prüfung: `include/plugins/feedback/` enthält `plugin.php`, `config.php`, `class.FeedbackPlugin.php`, `LICENSE` und `src/` mit 12 Dateien.
Prüfung: `include/plugins/feedback/` enthält `plugin.php`, `config.php`, `class.FeedbackPlugin.php`, `LICENSE` und `src/` mit 13 Dateien.

---

Expand All @@ -51,6 +51,7 @@ Prüfung: `include/plugins/feedback/` enthält `plugin.php`, `config.php`, `clas
- „Closing statuses“: Schließen mit einem dieser Status fragt nie, z. B. „Dublette“ oder „Spam“. Vorausgewählt sind geschlossene Status mit „Duplicate“, „Spam“, „Rejected“ oder „Hinfällig“ im Namen.
- „Help topics“ und „Sender domains“ nach Bedarf, z. B. Domains von Partnern, die nicht gefragt werden sollen.
- „Note at the ticket when asked“: kurz (Standard), mit der gesendeten Mail oder keine. Mit der Mail sieht jeder Agent, der das Ticket öffnet, die Bewertungslinks des Kunden.
- „Who decides“: „Agents can switch the question off“ (Häkchen beim Schließen, Menü „Weitere“) und „Closing without an agent form“ für API, Cron und Massen-Statuswechsel in der Ticketliste. Schließen Werkzeuge wie ein MCP-Server Tickets über die API, macht „only when requested“ jedes solche Schließen zu einer ausdrücklichen Entscheidung (Feld `feedback` von API Endpoints 2.9.0).
- Texte leer lassen für den eingebauten Text (Du-Form). „Language of the built-in texts“ auf „Deutsch (du)“, wenn das Helpdesk nicht auf Deutsch steht.
5. Speichern.
6. **Instanz noch einmal öffnen und die Häkchen prüfen.** osTicket 1.18 speichert beim Anlegen einer Instanz die Standardwerte von Häkchen nicht: Nach dem ersten Speichern können „Comment field after the click“, „Own domains“ und „Footer with AI notice“ aus sein, obwohl sie standardmäßig an sind. Gewünschte Häkchen wieder setzen, Speichern, erneut öffnen und prüfen, dass sie bleiben.
Expand Down Expand Up @@ -96,6 +97,8 @@ Abbruch, wenn: bei Schritt 3 keine Mail kommt. Dann zuerst prüfen: Steht am Tic
| Kommentar mit HTML | `<script>alert(1)</script>` als Kommentar | Notiz zeigt ‹script›…‹/script› als Text, nichts wird ausgeführt |
| Viele Aufrufe | über 60 Aufrufe in 10 Minuten von einer IP | „Zu viele Anfragen“ (HTTP 429) |
| Zweites Schließen | Ticket wieder öffnen, erneut schließen | keine zweite Frage |
| Abschalten ohne Token | `curl -X POST …/scp/ajax.php/feedback/ticket/<id>/decline` mit gültigem Agenten-Cookie, ohne CSRF-Header | HTTP 400, nichts ändert sich |
| Fremdes Ticket abschalten | derselbe POST als Agent ohne Zugriff auf das Ticket | HTTP 403, nichts ändert sich |

---

Expand Down
5 changes: 4 additions & 1 deletion docs/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Stop if: `SECRET_SALT` is missing or the sample value, or no cron runs.
1. Unzip `feedback-<version>.zip` into `include/plugins/`. Afterwards `include/plugins/feedback/plugin.php` exists.
2. Permissions as for the other plugins: readable by the web server, not writable.

Check: `include/plugins/feedback/` holds `plugin.php`, `config.php`, `class.FeedbackPlugin.php`, `LICENSE` and `src/` with 12 files.
Check: `include/plugins/feedback/` holds `plugin.php`, `config.php`, `class.FeedbackPlugin.php`, `LICENSE` and `src/` with 13 files.

---

Expand All @@ -51,6 +51,7 @@ Check: `include/plugins/feedback/` holds `plugin.php`, `config.php`, `class.Feed
- "Closing statuses": closing with one of these never asks, e.g. "Duplicate" or "Spam". Preselected are closed statuses with "Duplicate", "Spam", "Rejected" or "Hinfällig" in their name.
- "Help topics" and "Sender domains" as needed, e.g. partner domains that shouldn't be asked.
- "Note at the ticket when asked": short (default), with the mail as sent, or none. With the mail, every agent who opens the ticket sees the customer's rating links.
- "Who decides": "Agents can switch the question off" (tick when closing, More menu) and "Closing without an agent form" for API, cron and mass changes in the ticket list. If tools such as an MCP server close tickets through the API, "only when requested" makes every such close an explicit decision (`feedback` field of API Endpoints 2.9.0).
- Leave the texts empty for the built-in text. "Language of the built-in texts" decides between German (informal "du") and English; "Help desk language" follows the system language.
5. Save.
6. **Open the instance again and check the checkboxes.** osTicket 1.18 doesn't store checkbox defaults when an instance is created: after the first save "Comment field after the click", "Own domains" and "Footer with AI notice" can be off although they are on by default. Tick them again where wanted, Save, open once more and check they stay ticked.
Expand Down Expand Up @@ -96,6 +97,8 @@ Stop if: no mail arrives in step 3. Check first: is there a note "Satisfaction q
| HTML in the comment | `<script>alert(1)</script>` as comment | the note shows ‹script›…‹/script› as text, nothing runs |
| Many requests | more than 60 requests in 10 minutes from one IP | "Too many requests" (HTTP 429) |
| Second close | reopen the ticket, close it again | no second question |
| Switch off without token | `curl -X POST …/scp/ajax.php/feedback/ticket/<id>/decline` with a valid agent session cookie but no CSRF header | HTTP 400, nothing changes |
| Switch off a foreign ticket | the same POST as an agent without access to the ticket | HTTP 403, nothing changes |

---

Expand Down
2 changes: 1 addition & 1 deletion plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

return array(
'id' => 'studio-prisma:feedback',
'version' => '0.1.1',
'version' => '0.2.0',
'ost_version' => '1.18',
'name' => 'Feedback',
'author' => 'Studio Prisma',
Expand Down
25 changes: 23 additions & 2 deletions src/FeedbackActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,34 @@ private static function mailAgent(Ticket $ticket, array $s, array $t, string $la
}

/** After the question went out: a note, unless switched off. Mail mode only. */
public static function sentNote(Ticket $ticket, array $s, string $to, int $expires, string $subject, string $body): void
public static function sentNote(Ticket $ticket, array $s, string $to, int $expires, string $subject, string $body,
string $source = ''): void
{
if ($s['note_sent'] === FeedbackSettings::NOTE_OFF) {
return;
}
$t = self::strings();
self::note($ticket, $t['note_sent_title'], FeedbackMail::sentNote($s, $t, $to, $expires, $subject, $body));
self::note($ticket, $t['note_sent_title'], FeedbackMail::sentNote($s, $t, $to, $expires, $subject, $body, $source));
}

/** $how: "close" (tick removed at closing, or the API said no), "menu" (switched off in advance). */
public static function declinedNote(Ticket $ticket, string $how, int $staffId): void
{
$t = self::strings();
$key = $how === 'menu' ? 'note_declined_menu' : 'note_declined_close';
self::note($ticket, $t['note_sent_title'], FeedbackMail::e(sprintf($t[$key], self::who($staffId, $t))));
}

public static function allowedNote(Ticket $ticket, int $staffId): void
{
$t = self::strings();
self::note($ticket, $t['note_sent_title'], FeedbackMail::e(sprintf($t['note_allowed'], self::who($staffId, $t))));
}

private static function who(int $staffId, array $t): string
{
$staff = $staffId > 0 ? Staff::lookup($staffId) : null;
return $staff instanceof Staff ? (string) $staff->getName() : $t['by_system'];
}

/** A question that couldn't be sent: always a note, so nobody believes the customer was asked. */
Expand Down
Loading
Loading