task: #3612364 Match order summary lines to the order state so a cancellation email shows the cancelled lines

Follows up #3612196.

Problem

TransactionSummary::build() filtered a transaction's lines to a fixed set of consuming states (held, confirmed, completed, unused). A cancelled order has no consuming lines left, so:

  • the order summary rendered empty and the cancellation email showed a blank booking list;
  • the [yoyaku-order:count] token and the Orders overview "Lines" column counted every line row, so abandoned basket holds (released / expired) inflated the count.

Fix

The order now reads the same way on every surface, keyed on one predicate (was the line ever a booking) rather than a per-state table.

  • Summary (TransactionSummary::currentLines(), new): the consuming lines while the order is active; once none consume (a settled order), its cancelled lines. build()'s NULL default routes through it; an explicit $states list still filters exactly (e.g. the cart's [STATE_HELD]).
  • Cancellation email: [yoyaku-order:bookings] / -plain now list what was cancelled instead of rendering blank.
  • Counts: [yoyaku-order:count] and TransactionManager::lineCounts() (the Orders overview and list-builder "Lines" column) count the same representing set, lineCounts() in a single aggregate query grouped by state.

A line only reaches cancelled from confirmed, so the cancelled lines are exactly the bookings that were withdrawn and cannot be inflated by churn. Released and expired holds never became bookings, so they are never shown or counted.

The now-unused OrderManagerInterface dependency is dropped from OrderTokens.

Tests

Kernel coverage added: a cancelled order lists its cancelled lines; released churn is excluded from a cancelled order; an active order shows only its consuming lines; an all-released basket stays empty; lineCounts() matches currentLines() cardinality across the held / churn / cancelled cases; and the [yoyaku-order:count] / [yoyaku-order:bookings] tokens exclude churn on a cancelled order.

Edited by Frank Mably

Merge request reports

Loading