Install
Works with Drupal: ^9.4 || ^10.2 || ^11Using Composer to manage Drupal site dependencies
Alternative installation files
Release notes
Summary
-------
This release adds a manual "Import now" button and a price-trend chart to
the Special Nights alterator, refactors the JSON import logic into a
shared service, and simplifies the configuration form by removing the
channel discount fields. Special nights are now treated as absolute
prices; any further adjustment (percentage, discount) is handled by other
Price Alterators in the chain, such as the Global Slider.
New features
------------
- Manual "Import now" button in the Special Nights form.
Inside the "Import from JSON" fieldset, a new button lets the site
builder run the JSON import directly from the admin UI, without
needing shell access or Drush. The current form values are saved
before the import runs, and the result is displayed at the top of
the page with per-file details.
The button works regardless of the "Enable JSON import (cron)"
setting: the automatic import (cron) remains gated by that switch,
while the manual button is always available to administrators.
- Price-trend chart in the Special Nights form.
A Google Charts Material Line chart renders one line per room,
plotting the imported absolute price (field_alteration) against
the check-in date (field_nights.value). The legend uses the room
node title (e.g. "Magnolia Room") instead of the numeric node ID,
making the chart readable at a glance. The chart updates when the
form is reloaded and automatically resizes with the window.
- ImportService.
The JSON import logic now lives in a dedicated service
(Drupal\beehotel_pricealterators\ImportService) shared between the
Drush commands and the new admin button, so both paths stay in sync.
Bug fixes
---------
- Fixed: Drush commands (bhpas:check, bhpas:import) were not registered
when the module's import service was private. The service is now
public and exposes an FQCN alias so AutowireTrait can resolve it.
- Fixed: the SpecialNights plugin did not match nodes whose check-in
was stored at 23:00 and check-out at 22:59. The query now compares
field_nights.value <= T23:59:59 and field_nights.end_value > T23:00:00,
so special prices are correctly applied to the nights they cover and
excluded from the checkout day.
Breaking changes
----------------
The Special Nights configuration no longer exposes the following fields:
- Nights
- Adults
- Primary channel discount
- Secondary channel discount
- Apply channel discount
These fields were informational only and have been removed to keep the
form minimal. Special nights are absolute prices: the value written in
field_alteration replaces the base room price for that night. If you
need to apply a percentage discount on top of the imported price, use
the Global Slider alterator (or any other percentage alterator) in the
price alterator chain.
Existing configuration keys (import_nights, import_adults,
import_discount_primary, import_discount_secondary,
import_discount_channel) become orphan and can be safely ignored or
removed with:
drush config:delete beehotel_pricealterator.pricealterator.SpecialNights.settings import_nights
drush config:delete beehotel_pricealterator.pricealterator.SpecialNights.settings import_adults
drush config:delete beehotel_pricealterator.pricealterator.SpecialNights.settings import_discount_primary
drush config:delete beehotel_pricealterator.pricealterator.SpecialNights.settings import_discount_secondary
drush config:delete beehotel_pricealterator.pricealterator.SpecialNights.settings import_discount_channel
Upgrade notes
-------------
No database updates are required. After updating the codebase:
drush cr
drush bhpas:check
Open the Special Nights configuration form once and click "Save" to
persist the simplified configuration. The next time you need to import
new prices, either wait for the next cron run or click "Import now"
directly from the form.
Full changelog
--------------
- Added: "Import now" submit button in the Special Nights form.
- Added: Google Charts price-trend chart, one line per room, using
the room node title as legend label.
- Added: ImportService shared between Drush commands and the form.
- Added: beehotel_pricealterators.services.yml with public service
and FQCN alias for AutowireTrait.
- Changed: Special Nights form now exposes only Enable, JSON directory
and Imported node status.
- Changed: Special Nights plugin treats field_alteration as an absolute
price (no channel discount applied at runtime).
- Removed: Nights, Adults, Primary channel discount, Secondary channel
discount and Apply channel discount fields.
- Fixed: Drush commands were not registered when the import service
was private.
- Fixed: SpecialNights plugin date range matching (T23:59:59 / T23:00:00).