feat: Kalender-Code replaces the product's calendar hotel

Every hotel field now has one job. The hotel's code and aliases are
import codes only (dates, lookups); a new Kalender-Code (calendar_code)
decides the availability a record shows and may be shared by a house's
summer and winter records. The product's "Unterkunft für
Belegungskalender" is replaced by the checkbox "Kalender anzeigen"
(show_calendar): a product page shows the calendar of the hotel it
displays, the season still decides which one.

- Price calendar, price tables, Belegungskalender, iCal feeds and
  /api/calendar-hotels read the Kalender-Code. A feed without one answers
  404 instead of an empty calendar.
- The upgrade wizard epProductsCalendarCode fills both fields from
  calendar_hotel, preserving today's calendars; the deploy runs it between
  the schema update and the switch. calendar_hotel stays in the database,
  so the previous release keeps working. ep:calendar-codes lists the
  product pages whose calendar differs from it.
- HotelCodeResolver is the one lookup of import codes (date import,
  /api/hotel, Travelinfo); a code on several records resolves to the
  record whose own code it is, then the lowest uid, with a warning.
  Saving a code that is already another visible record's import code is
  refused with a message naming that record.
- /api/product without hotel attaches the product's only visible
  Unterkunft (422 otherwise) and adds board_description,
  additional_services and calendar_hotel_code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
frommeandClaude Opus 5.5 committed 2026-11-16 17:18:00 +01:00
1 parent 659e72fc8c
commit 5455973dba
25 files changed
+880 -127

No files matched your search

+29 -24
View File
@@ -6,32 +6,35 @@ group house prices.
| What | Where | Shown for | MyE&P endpoint |
|---|---|---|---|
| **Price calendar** + price tables | product detail, tab "Termine/Preise" | products with a calendar hotel and season **summer** (`s`) | `contingents/calendar`, `contingents/prices` |
| **Belegungskalender** (availability calendar) | product detail, sidebar | products with a calendar hotel and season **not summer** | `contingents/availability` (+ `contingents/calendar` for the months to leave out) |
| **iCal feed** for booking portals | `https://www.ep-reisen.de/contingents/<hotel>.ical` | every hotel | `contingents/availability` |
| **Price calendar** + price tables | product detail, tab "Termine/Preise" | products with a calendar and season **summer** (`s`) | `contingents/calendar`, `contingents/prices` |
| **Belegungskalender** (availability calendar) | product detail, sidebar | products with a calendar and season **not summer** | `contingents/availability` (+ `contingents/calendar` for the months to leave out) |
| **iCal feed** for booking portals | `https://www.ep-reisen.de/contingents/<hotel>.ical` | every hotel with a Kalender-Code | `contingents/availability` |
So every product with a calendar hotel shows exactly one calendar. The MyE&P side is documented in
So every product with a calendar shows exactly one. The MyE&P side is documented in
its `docs/api-consumer-guide.md` (`EP/myep`).
## The calendar hotel field
## Hotel codes
A product's **calendar hotel** (`calendar_hotel`) decides whose availability and prices it shows.
TYPO3 sends that hotel's **code** to MyE&P, which only understands **BusPro calendar codes** (the
codes bpn-connect knows, e.g. `DGS`, `LPJ`, `DKS`).
Every field has one job:
Most hotel records carry the BusPro code. Group houses also have **content records** of their own
(`DKSGRP`, `LPJGRP`, `SERASCSO`, …) whose code is the **CMS code** MyE&P uses to fetch content via
`/api/hotel`. These must **not** be used as calendar hotel: MyE&P and bpn-connect do not know
them, and the calendar shows its error message. This broke three example trips until 2026-10-29.
| Use as calendar hotel | Not |
| Field | Job |
|---|---|
| `DKS` Sportclub Schweizerhaus (uid 193) | `DKSGRP` Davos Klosters - Gruppenhaus Schweizerhaus |
| `LPJ` Sportclub Jenatsch (uid 37) | `LPJGRP` Lenzerheide - Gruppenhaus Jenatsch |
| Hotel › **Import-Code** (`code`) and **Weitere Import-Codes** (matchcode aliases) | The BusPro codes whose imported dates land on this record, and by which `/api/hotel`, `/api/product?hotel=` and the Travelinfo page find it (`HotelCodeResolver`). A code belongs to one visible record; saving it on a second one is refused. Nothing to do with the calendars. |
| Hotel › **Kalender-Code** (`calendar_code`) | The BusPro code whose contingent this record shows: calendars, price tables, iCal feed. Empty = no calendar, the feed answers `404`. Records may share it: a house's summer record (`…GRP`) and its winter record both carry the house's code. |
| Product › **Kalender anzeigen** (`show_calendar`) | Whether the product page shows a calendar at all. |
| Product › **Saison** (`season`) | Which one: `s` the price calendar, anything else the Belegungskalender. |
`/api/calendar-hotels` lists all calendar hotels in use; every code in it should be a BusPro code.
A hidden hotel record counts as no calendar hotel: the product shows no calendar and the code is
not in the list (e.g. `ASB` Sportclub Bader).
**The calendar on a product page is the Kalender-Code of the hotel that page shows**: the hotel
pinned in the Produktdetail element, else the product's only Unterkunft, else the one picked in
its hotel list (`Product::getCalendarHotelFor()`).
MyE&P only understands **BusPro codes** that it syncs (e.g. `DGS`, `LPJ`, `DKS`). When BusPro has
several entries for a house (Mitterlengau: nine), only one carries the house's contingent; the
office says which one, and that is the Kalender-Code.
The product's old "Unterkunft für Belegungskalender" (`calendar_hotel`) is no longer read. The
upgrade wizard `epProductsCalendarCode` filled the new fields from it; `vendor/bin/typo3
ep:calendar-codes` lists the product pages whose calendar differs from it, until it is removed.
## Price calendar (summer)
@@ -62,7 +65,7 @@ not in the list (e.g. `ASB` Sportclub Bader).
- `IcalController::contingentsAction`, `IcalService`; route `/contingents/{hotel}.ical` on the
`ep-reisen` site (`config/sites/ep-reisen/config.yaml`, page 9, type 1710), `{hotel}` is the
hotel's path segment.
hotel's path segment. The feed shows the record's Kalender-Code; without one it answers `404`.
- One `Unavailable` event per run of `BLOCKED` or `ON_REQUEST` days with the same status, as on
TYPO3 10.
- Never cached. When MyE&P has no availability it answers `503` with `Retry-After: 900` instead of
@@ -72,8 +75,9 @@ not in the list (e.g. `ASB` Sportclub Bader).
MyE&P syncs its snapshot from bpn-connect every 15 minutes during the day and hourly at night, for
the calendar codes of its accommodations **plus** every code in TYPO3's `/api/calendar-hotels`
(see [cms-api.md](cms-api.md)). So a hotel offered only in winter needs nothing in MyE&P: setting
it as calendar hotel of a visible product is enough; it is synced with the next run.
(see [cms-api.md](cms-api.md)), which lists the Kalender-Code of every visible hotel record. So a
hotel offered only in winter needs nothing in MyE&P: giving the record a Kalender-Code is enough;
it is synced with the next run.
`contingents/availability` answers:
- `400` for a code that is not synced (not an accommodation, not in TYPO3's list),
@@ -106,8 +110,9 @@ The message is "Der Kalender konnte aktuell nicht geladen werden."; the iCal fee
| Cause | How to tell | Fix |
|---|---|---|
| Calendar hotel has a CMS code (`…GRP`, `…SO`) | code not BusPro; MyE&P `400`, bpn-connect `404` | set the hotel record with the BusPro code as calendar hotel |
| Code not synced by MyE&P | not in `contingents/status`; MyE&P `400` | check that the product and its calendar hotel are visible (then it is in `/api/calendar-hotels`) |
| No calendar at all | product's "Kalender anzeigen" off, or the shown hotel has no Kalender-Code | tick it / set the Kalender-Code of the hotel the page shows |
| Kalender-Code is not a BusPro code (`…GRP`, `…SO`) | MyE&P `400`, bpn-connect `404` | set the house's BusPro code as Kalender-Code |
| Code not synced by MyE&P | not in `contingents/status`; MyE&P `400` | check that the hotel record is visible (then its code is in `/api/calendar-hotels`) |
| Sync failing for the hotel | `contingents/status`: `available: false`, `lastError` | MyE&P / bpn-connect |
| MyE&P unreachable or its OAuth failing | all hotels fail; TYPO3 log `EP.EpProducts.MyEP.ApiClient` | MyE&P |
| Price calendar only: no accommodation or no prices | MyE&P `400` / empty | prices are maintained in MyE&P's Groups admin |
+25 -15
View File
@@ -23,8 +23,9 @@ changed together.
Content of one hotel, for MyE&P's group house pages and booking flow.
- `hotel`: the TYPO3 hotel code or one of its matchcode aliases. In MyE&P this is the
accommodation's **CMS code** (e.g. `DGSGRP`), which can differ from its calendar code.
- `hotel`: an import code of the record: its "Import-Code" or one of its "Weitere Import-Codes"
(matchcode aliases), resolved by `HotelCodeResolver`. In MyE&P this is the accommodation's
**CMS code** (e.g. `DGSGRP`), which can differ from its calendar code.
- `400` without `hotel`, `404 {"message": "Hotel not found"}` for an unknown code.
```json
@@ -42,15 +43,23 @@ Content of one hotel, for MyE&P's group house pages and booking flow.
## `GET /api/product?product=<code>[&hotel=<code>]`
Content of one product, optionally with a hotel.
Content of one product with a hotel.
- `product`: the product code. `400` without it, `404 {"message": "Product not found"}` for an
unknown code.
- `hotel` (optional): adds `hotel` with the same content as `/api/hotel`.
- `product`: the product code (default language). `400` without it, `404 {"message": "Product
not found"}` for an unknown code.
- Without `hotel` (MyE&P's group houses, linked by product code): the product's only visible
Unterkunft. Any other number of visible Unterkünfte answers `422 {"message": "Product <code>
links <n> hotels, expected exactly 1", "hotel_count": <n>}`.
- With `hotel` (MyE&P's booking flow): the record of that import code, as in `/api/hotel`; an
unknown code gives `"hotel": []`.
- `board_description`, `additional_services`: raw RTE values, `""` when empty.
- `calendar_hotel_code`: the Kalender-Code of the hotel when "Kalender anzeigen" is on, else
`null`. MyE&P compares it with its accommodation's calendar code.
```json
{
"product": {"name": "…", "code": "…", "images": {…}},
"product": {"name": "…", "code": "…", "images": {…}, "board_description": "…",
"additional_services": "…", "calendar_hotel_code": "SST"},
"country": {"name": "…"},
"region": {…},
"city": {"name": "…"},
@@ -60,12 +69,14 @@ Content of one product, optionally with a hotel.
## `GET /api/calendar-hotels`
The calendar hotel of every visible product: the hotel codes whose availability TYPO3 shows
(iCal feed, availability calendar, price calendar). MyE&P syncs its contingent snapshot for
these codes in addition to its accommodations, so hotels offered only in winter, which have no
accommodation in MyE&P, have availability too. See [calendars.md](calendars.md).
The Kalender-Codes of all visible hotel records: the codes whose availability TYPO3 shows (iCal
feeds, availability calendar, price calendar). MyE&P syncs its contingent snapshot for these codes
in addition to its accommodations, so hotels offered only in winter, which have no accommodation in
MyE&P, have availability too. See [calendars.md](calendars.md).
- Only products and hotels that are not hidden or deleted; hotels without a code are left out.
- One entry per code; `name` of the record whose import code it is, else of the first record.
- `products`: visible products with "Kalender anzeigen" that link a record with the code under
Unterkünfte.
- Sorted by code; products by uid. Names have line breaks collapsed.
- `season`: `"s"` (summer), `"w"` (winter) or `null`.
@@ -78,9 +89,8 @@ accommodation in MyE&P, have availability too. See [calendars.md](calendars.md).
]
```
Every code in this list should be a **BusPro calendar code**. A group house's content record
(`…GRP`, `…SO`) set as a product's calendar hotel puts its CMS code in here, which bpn-connect does
not know (see [calendars.md](calendars.md#the-calendar-hotel-field)).
Every code in this list should be a **BusPro code** with a contingent (see
[calendars.md](calendars.md#hotel-codes)).
## `GET /api/content/manifest` and `GET /api/content/records?type=<type>&uids=<uids>`