Problem/Motivation
A booking left in the "confirmed" state once its event has ended is unsettled: nobody recorded whether it was honored. Such lines accumulate, and an order mixing attended and still-confirmed lines never reaches a settled outcome (completed, unused, or partial) on its own. There is no automatic settlement once the event has passed.
Proposed resolution
Add a post-event settlement policy, configured on the resource type and overridable per resource (the same cascade as booking mode and cancellation). It has two parts, a settlement mode and a grace period.
Settlement mode:
- Auto-complete (default): mark bookings still confirmed after the event completed.
- Auto-mark unused: mark them unused (a no-show).
- Manual: never touch them; attendance is recorded out of band.
The grace period is how long after the event ends the sweep waits, as a number of seconds or an ISO 8601 duration (default PT1H).
A cron sweep (the SettleBookings queue worker, following the ExpireHolds pattern) settles the remaining confirmed bookings after the grace period. It resolves the swept resources first, grouped by grace window, so each booking query stays a simple "resource IN"; resources set to (or inheriting) manual settlement are skipped.
The sweep only ever acts on lines still confirmed, so it composes with check-in (yoyaku_checkin): a scan or presence-list check settles attendees during the grace window, and the sweep settles whatever is left. For a presence-list check done long after the event, set the resource to manual and settle by hand.
This also tightens the order aggregate state: an order stays "confirmed" while any line is still confirmed, so "partial" now means only the terminal mix of completed and unused.
Remaining tasks
- Review the merge request.
- On deploy (pre-1.0, hand-patched, no update hooks): install the new settlement and settlement_grace base fields on yoyaku_resource.
Issue fork yoyaku-3612964
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mably commentedComment #4
mably commentedComment #6
mably commented