Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0bf7f19ac5 | |||
| 7c0016c244 | |||
| 997541ab48 | |||
| 36a69b0de4 | |||
| 5d24cfa6f9 |
23
CHANGELOG.md
23
CHANGELOG.md
@@ -5,6 +5,29 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [0.11.2] - 2026-02-03
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Calendar page room column now wider (200px) with proper left alignment
|
||||||
|
- Room column displays building name on second row for better identification
|
||||||
|
- Changed calendar table layout from fixed to auto for flexible column widths
|
||||||
|
|
||||||
|
## [0.11.1] - 2026-02-03
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Internationalization (i18n) support:
|
||||||
|
- Translation template file `languages/wp-bnb.pot` with 1,140 translatable strings
|
||||||
|
- German (Switzerland) translation `languages/wp-bnb-de_CH.po` with 77% coverage (875 strings)
|
||||||
|
- Compiled binary `languages/wp-bnb-de_CH.mo` for WordPress use
|
||||||
|
- Coverage includes: admin UI, post types, taxonomies, settings, dashboard, reports, REST API, WooCommerce, CF7, widgets, blocks, shortcodes
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- README.md updated with comprehensive WooCommerce integration documentation
|
||||||
|
- Added REST API to key features list in README
|
||||||
|
|
||||||
## [0.11.0] - 2026-02-03
|
## [0.11.0] - 2026-02-03
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
106
CLAUDE.md
106
CLAUDE.md
@@ -1128,3 +1128,109 @@ Admin features always work; frontend requires valid license.
|
|||||||
- v0.10.1: Committed `3f5adfb` - Configurable rate limiting with settings subtabs
|
- v0.10.1: Committed `3f5adfb` - Configurable rate limiting with settings subtabs
|
||||||
- Tags: `v0.10.0`, `v0.10.1`
|
- Tags: `v0.10.0`, `v0.10.1`
|
||||||
- Pushed to origin: dev, main, both tags
|
- Pushed to origin: dev, main, both tags
|
||||||
|
|
||||||
|
### 2026-02-03 - Version 0.11.0 (WooCommerce Integration)
|
||||||
|
|
||||||
|
**Completed:**
|
||||||
|
|
||||||
|
- Created `src/Integration/WooCommerce/Manager.php` (~435 lines)
|
||||||
|
- Core integration manager with option constants
|
||||||
|
- HPOS (High-Performance Order Storage) compatibility declaration
|
||||||
|
- `is_wc_active()`, `is_enabled()` checks
|
||||||
|
- `map_wc_status_to_booking()` for status synchronization
|
||||||
|
- `get_order_for_booking()`, `get_booking_for_order()` bidirectional lookups
|
||||||
|
- `link_booking_to_order()` for creating relationships
|
||||||
|
- Created `src/Integration/WooCommerce/ProductSync.php` (~515 lines)
|
||||||
|
- Virtual WooCommerce products for rooms (SKU: `bnb-room-{id}`)
|
||||||
|
- Auto-sync on `save_post_bnb_room` hook
|
||||||
|
- Product deletion on room deletion
|
||||||
|
- `sync_all_rooms()` for bulk synchronization
|
||||||
|
- Bidirectional meta linking (room ↔ product)
|
||||||
|
- Created `src/Integration/WooCommerce/CartHandler.php` (~545 lines)
|
||||||
|
- Cart item data structure with booking details
|
||||||
|
- Availability validation on add-to-cart
|
||||||
|
- Dynamic price calculation using `Calculator` class
|
||||||
|
- Cart item display with dates, guests, nights
|
||||||
|
- Services support in cart items
|
||||||
|
- Created `src/Integration/WooCommerce/CheckoutHandler.php` (~347 lines)
|
||||||
|
- Special requests textarea field
|
||||||
|
- Arrival time dropdown field
|
||||||
|
- Guest data pre-fill from user profile
|
||||||
|
- Final availability validation before payment
|
||||||
|
- Booking summary display
|
||||||
|
- Created `src/Integration/WooCommerce/OrderHandler.php` (~584 lines)
|
||||||
|
- Booking creation on `woocommerce_payment_complete`
|
||||||
|
- Guest record creation from billing info
|
||||||
|
- Booking reference generation (BNB-YYYY-NNNNN)
|
||||||
|
- Status synchronization on order status changes
|
||||||
|
- Order-booking bidirectional linking
|
||||||
|
- Created `src/Integration/WooCommerce/InvoiceGenerator.php` (~633 lines)
|
||||||
|
- PDF generation using existing mPDF dependency
|
||||||
|
- Configurable invoice numbering (prefix + start number)
|
||||||
|
- Auto-attach to WooCommerce order emails
|
||||||
|
- Secure storage in `wp-content/uploads/wp-bnb-invoices/`
|
||||||
|
- .htaccess protection for invoice directory
|
||||||
|
- Created `src/Integration/WooCommerce/RefundHandler.php` (~394 lines)
|
||||||
|
- Full refund triggers booking cancellation
|
||||||
|
- Partial refund records amount without cancellation
|
||||||
|
- Refund meta storage on booking
|
||||||
|
- `wp_bnb_wc_should_cancel_on_refund` filter for customization
|
||||||
|
- Created `src/Integration/WooCommerce/AdminColumns.php` (~282 lines)
|
||||||
|
- "WC Order" column in bookings list
|
||||||
|
- "Booking" column in WC orders list (supports HPOS)
|
||||||
|
- Row actions for cross-navigation
|
||||||
|
- Created `assets/css/wc-integration.css` (~443 lines)
|
||||||
|
- Cart booking display styles
|
||||||
|
- Checkout summary styles
|
||||||
|
- Booking form styles
|
||||||
|
- Status badge colors
|
||||||
|
- Created `assets/js/wc-integration.js` (~358 lines)
|
||||||
|
- `BookingForm` class for frontend forms
|
||||||
|
- AJAX sync rooms handler
|
||||||
|
- AJAX generate invoice handler
|
||||||
|
- Availability checking with debounce
|
||||||
|
- Updated `src/Plugin.php`
|
||||||
|
- WooCommerce initialization when WC is active
|
||||||
|
- WooCommerce settings tab with 4 subtabs (General, Products, Orders, Invoices)
|
||||||
|
- Asset enqueuing for WooCommerce integration
|
||||||
|
|
||||||
|
**Files Created:**
|
||||||
|
|
||||||
|
- `src/Integration/WooCommerce/Manager.php`
|
||||||
|
- `src/Integration/WooCommerce/ProductSync.php`
|
||||||
|
- `src/Integration/WooCommerce/CartHandler.php`
|
||||||
|
- `src/Integration/WooCommerce/CheckoutHandler.php`
|
||||||
|
- `src/Integration/WooCommerce/OrderHandler.php`
|
||||||
|
- `src/Integration/WooCommerce/InvoiceGenerator.php`
|
||||||
|
- `src/Integration/WooCommerce/RefundHandler.php`
|
||||||
|
- `src/Integration/WooCommerce/AdminColumns.php`
|
||||||
|
- `assets/css/wc-integration.css`
|
||||||
|
- `assets/js/wc-integration.js`
|
||||||
|
|
||||||
|
**Files Changed:**
|
||||||
|
|
||||||
|
- `src/Plugin.php` - WooCommerce initialization and settings tab
|
||||||
|
- `assets/css/admin.css` - Status badge colors for booking statuses
|
||||||
|
- `wp-bnb.php` - Version bump to 0.11.0
|
||||||
|
- `CHANGELOG.md` - Added v0.11.0 release notes
|
||||||
|
- `PLAN.md` - Marked Phase 11 as complete
|
||||||
|
|
||||||
|
**Learnings:**
|
||||||
|
|
||||||
|
- WooCommerce HPOS compatibility requires `FeaturesUtil::declare_compatibility()` in `before_woocommerce_init` hook
|
||||||
|
- Use `$order->get_meta()` / `$order->update_meta_data()` instead of `get_post_meta()` for HPOS compatibility
|
||||||
|
- Virtual products (`virtual => true`, `downloadable => false`) don't require shipping
|
||||||
|
- Cart item data stored via `woocommerce_add_cart_item_data` filter persists through session
|
||||||
|
- Dynamic pricing via `woocommerce_before_calculate_totals` hook with priority 20
|
||||||
|
- `woocommerce_payment_complete` fires after successful payment, ideal for booking creation
|
||||||
|
- Invoice attachment via `woocommerce_email_attachments` filter with order and email type detection
|
||||||
|
- Refund detection: `woocommerce_refund_created` for partial, `woocommerce_order_fully_refunded` for full
|
||||||
|
- Status badge CSS must be in admin.css for settings page (wc-integration.css is frontend only)
|
||||||
|
- HPOS orders list uses `manage_woocommerce_page_wc-orders_columns` filter (different from legacy)
|
||||||
|
|
||||||
|
**Released:**
|
||||||
|
|
||||||
|
- Committed: `2865956` on dev branch
|
||||||
|
- Merged to main (fast-forward)
|
||||||
|
- Tagged: `v0.11.0`
|
||||||
|
- Pushed to origin: dev, main, v0.11.0
|
||||||
|
|||||||
94
README.md
94
README.md
@@ -19,9 +19,11 @@ WP BnB Management enables WordPress to act as a full management system for B&B h
|
|||||||
- **Auto-Updates**: Automatic update checks and installation from license server
|
- **Auto-Updates**: Automatic update checks and installation from license server
|
||||||
- **Development Mode**: License bypass for local development environments
|
- **Development Mode**: License bypass for local development environments
|
||||||
- **Contact Form 7 Integration**: Accept booking requests and inquiries through CF7 forms
|
- **Contact Form 7 Integration**: Accept booking requests and inquiries through CF7 forms
|
||||||
|
- **WooCommerce Integration**: Accept payments, auto-sync rooms as products, generate invoices
|
||||||
- **Dashboard**: Comprehensive admin dashboard with statistics and charts
|
- **Dashboard**: Comprehensive admin dashboard with statistics and charts
|
||||||
- **Reports**: Detailed reports with CSV and PDF export
|
- **Reports**: Detailed reports with CSV and PDF export
|
||||||
- **Prometheus Metrics**: Expose operational metrics for monitoring with Grafana
|
- **Prometheus Metrics**: Expose operational metrics for monitoring with Grafana
|
||||||
|
- **REST API**: Comprehensive API for external integrations
|
||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|
||||||
@@ -29,6 +31,7 @@ WP BnB Management enables WordPress to act as a full management system for B&B h
|
|||||||
- PHP 8.3 or higher
|
- PHP 8.3 or higher
|
||||||
- Valid license key
|
- Valid license key
|
||||||
- Contact Form 7 (optional, for booking forms)
|
- Contact Form 7 (optional, for booking forms)
|
||||||
|
- WooCommerce 8.0+ (optional, for payments and invoicing)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@@ -444,6 +447,95 @@ The dashboard includes:
|
|||||||
- Today's check-ins/check-outs
|
- Today's check-ins/check-outs
|
||||||
- Trend indicators
|
- Trend indicators
|
||||||
|
|
||||||
|
## WooCommerce Integration
|
||||||
|
|
||||||
|
The plugin integrates with WooCommerce to enable payment processing, automatic invoicing, and seamless order management.
|
||||||
|
|
||||||
|
### Enabling WooCommerce Integration
|
||||||
|
|
||||||
|
1. Install and activate WooCommerce 8.0 or higher
|
||||||
|
2. Navigate to **WP BnB → Settings → WooCommerce**
|
||||||
|
3. Enable "Enable WooCommerce Integration"
|
||||||
|
4. Configure product sync and invoice settings
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
**Product Synchronization:**
|
||||||
|
|
||||||
|
- Rooms are automatically synced as virtual WooCommerce products
|
||||||
|
- Products use SKU format `bnb-room-{id}` for tracking
|
||||||
|
- Price, description, and images are kept in sync
|
||||||
|
- Products created/updated on room save, deleted on room deletion
|
||||||
|
- Manual "Sync All Rooms" button in settings
|
||||||
|
|
||||||
|
**Cart & Checkout:**
|
||||||
|
|
||||||
|
- Add room bookings to WooCommerce cart with dates and guest count
|
||||||
|
- Real-time availability validation prevents double-booking
|
||||||
|
- Dynamic pricing calculated from room rates and services
|
||||||
|
- Special checkout fields for arrival time and special requests
|
||||||
|
- Guest information pre-filled from user profile
|
||||||
|
|
||||||
|
**Booking Creation:**
|
||||||
|
|
||||||
|
- Bookings automatically created on successful payment
|
||||||
|
- Guest records created from billing information
|
||||||
|
- Booking linked to WooCommerce order for reference
|
||||||
|
- Booking reference displayed on order confirmation
|
||||||
|
|
||||||
|
**Order-Booking Synchronization:**
|
||||||
|
|
||||||
|
- Order status changes sync to booking status:
|
||||||
|
- Order completed → Booking confirmed
|
||||||
|
- Order cancelled → Booking cancelled
|
||||||
|
- Order refunded → Booking cancelled (full refund)
|
||||||
|
- Partial refunds recorded without cancellation
|
||||||
|
- Bidirectional linking between orders and bookings
|
||||||
|
|
||||||
|
**PDF Invoices:**
|
||||||
|
|
||||||
|
- Automatic PDF invoice generation
|
||||||
|
- Configurable invoice number prefix (default: `INV-`)
|
||||||
|
- Sequential invoice numbering with configurable start number
|
||||||
|
- Auto-attach to WooCommerce order emails
|
||||||
|
- Secure storage in `wp-content/uploads/wp-bnb-invoices/`
|
||||||
|
- Manual generation from order admin
|
||||||
|
|
||||||
|
### WooCommerce Settings
|
||||||
|
|
||||||
|
**General Subtab:**
|
||||||
|
|
||||||
|
- Enable/disable WooCommerce integration
|
||||||
|
- Enable automatic product sync
|
||||||
|
- Enable auto-attach invoices to emails
|
||||||
|
|
||||||
|
**Products Subtab:**
|
||||||
|
|
||||||
|
- View sync status and product count
|
||||||
|
- Manual "Sync All Rooms Now" button
|
||||||
|
- Product category assignment
|
||||||
|
|
||||||
|
**Orders Subtab:**
|
||||||
|
|
||||||
|
- Order-booking status mapping
|
||||||
|
- View linked orders and bookings
|
||||||
|
|
||||||
|
**Invoices Subtab:**
|
||||||
|
|
||||||
|
- Invoice number prefix
|
||||||
|
- Starting invoice number
|
||||||
|
- Company details for invoice header
|
||||||
|
- PDF styling options
|
||||||
|
|
||||||
|
### HPOS Compatibility
|
||||||
|
|
||||||
|
The integration is fully compatible with WooCommerce High-Performance Order Storage (HPOS). Order meta is accessed using the modern `$order->get_meta()` and `$order->update_meta_data()` methods.
|
||||||
|
|
||||||
|
### Admin Columns
|
||||||
|
|
||||||
|
- **Bookings list**: "WC Order" column with link to order
|
||||||
|
- **WooCommerce Orders list**: "Booking" column with link to booking
|
||||||
|
|
||||||
## REST API
|
## REST API
|
||||||
|
|
||||||
The plugin provides a comprehensive REST API for integration with external applications, mobile apps, and third-party services.
|
The plugin provides a comprehensive REST API for integration with external applications, mobile apps, and third-party services.
|
||||||
@@ -668,7 +760,7 @@ Yes, guest data can be exported and deleted on request, and consent is tracked a
|
|||||||
|
|
||||||
### Does it integrate with WooCommerce?
|
### Does it integrate with WooCommerce?
|
||||||
|
|
||||||
WooCommerce integration for payments is planned for a future release.
|
Yes! WooCommerce integration is available for payment processing and invoicing. Rooms are synced as virtual products, bookings are created on successful payment, and PDF invoices are auto-generated and attached to order emails. Navigate to **WP BnB → Settings → WooCommerce** to enable and configure the integration.
|
||||||
|
|
||||||
### How is guest data secured?
|
### How is guest data secured?
|
||||||
|
|
||||||
|
|||||||
@@ -976,7 +976,7 @@
|
|||||||
.bnb-calendar-table {
|
.bnb-calendar-table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
table-layout: fixed;
|
table-layout: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bnb-calendar-table th,
|
.bnb-calendar-table th,
|
||||||
@@ -997,7 +997,8 @@
|
|||||||
.bnb-calendar-table th.room-header {
|
.bnb-calendar-table th.room-header {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
min-width: 150px;
|
width: 200px;
|
||||||
|
min-width: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calendar Day Cell */
|
/* Calendar Day Cell */
|
||||||
@@ -1068,16 +1069,31 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Room Row in Multi-Room Calendar */
|
/* Room Row in Multi-Room Calendar */
|
||||||
.bnb-calendar-room {
|
.bnb-calendar-table .bnb-calendar-room {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
padding: 8px 10px;
|
padding: 8px 10px;
|
||||||
background: #f6f7f7;
|
background: #f6f7f7;
|
||||||
|
min-width: 200px;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bnb-calendar-room small {
|
.bnb-calendar-room a {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bnb-calendar-room .room-number {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
color: #646970;
|
color: #646970;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bnb-calendar-room .building-name {
|
||||||
|
display: block;
|
||||||
|
font-weight: normal;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #646970;
|
||||||
|
margin-top: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calendar Legend */
|
/* Calendar Legend */
|
||||||
|
|||||||
BIN
languages/wp-bnb-de_CH.mo
Normal file
BIN
languages/wp-bnb-de_CH.mo
Normal file
Binary file not shown.
5162
languages/wp-bnb-de_CH.po
Normal file
5162
languages/wp-bnb-de_CH.po
Normal file
File diff suppressed because it is too large
Load Diff
5163
languages/wp-bnb.pot
Normal file
5163
languages/wp-bnb.pot
Normal file
File diff suppressed because it is too large
Load Diff
@@ -256,16 +256,20 @@ final class Calendar {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ( $rooms as $room ) : ?>
|
<?php foreach ( $rooms as $room ) : ?>
|
||||||
<?php
|
<?php
|
||||||
$room_number = get_post_meta( $room->ID, '_bnb_room_room_number', true );
|
$room_number = get_post_meta( $room->ID, '_bnb_room_room_number', true );
|
||||||
$booked_dates = Availability::get_booked_dates( $room->ID, $year, $month );
|
$room_building = Room::get_building( $room->ID );
|
||||||
|
$booked_dates = Availability::get_booked_dates( $room->ID, $year, $month );
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="bnb-calendar-room">
|
<td class="bnb-calendar-room">
|
||||||
<a href="<?php echo esc_url( get_edit_post_link( $room->ID ) ); ?>">
|
<a href="<?php echo esc_url( get_edit_post_link( $room->ID ) ); ?>">
|
||||||
<?php echo esc_html( $room->post_title ); ?>
|
<?php echo esc_html( $room->post_title ); ?>
|
||||||
|
<?php if ( $room_number ) : ?>
|
||||||
|
<span class="room-number">#<?php echo esc_html( $room_number ); ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
</a>
|
</a>
|
||||||
<?php if ( $room_number ) : ?>
|
<?php if ( $room_building ) : ?>
|
||||||
<br><small>#<?php echo esc_html( $room_number ); ?></small>
|
<span class="building-name"><?php echo esc_html( $room_building->post_title ); ?></span>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
<?php for ( $day = 1; $day <= $days_in_month; $day++ ) : ?>
|
<?php for ( $day = 1; $day <= $days_in_month; $day++ ) : ?>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Plugin Name: WP BnB Management
|
* Plugin Name: WP BnB Management
|
||||||
* Plugin URI: https://src.bundespruefstelle.ch/magdev/wp-bnb
|
* Plugin URI: https://src.bundespruefstelle.ch/magdev/wp-bnb
|
||||||
* Description: A comprehensive Bed & Breakfast management system for WordPress. Manage buildings, rooms, bookings, and guests.
|
* Description: A comprehensive Bed & Breakfast management system for WordPress. Manage buildings, rooms, bookings, and guests.
|
||||||
* Version: 0.11.0
|
* Version: 0.11.2
|
||||||
* Requires at least: 6.0
|
* Requires at least: 6.0
|
||||||
* Requires PHP: 8.3
|
* Requires PHP: 8.3
|
||||||
* Author: Marco Graetsch
|
* Author: Marco Graetsch
|
||||||
@@ -24,7 +24,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Plugin version constant - MUST match Version in header above.
|
// Plugin version constant - MUST match Version in header above.
|
||||||
define( 'WP_BNB_VERSION', '0.11.0' );
|
define( 'WP_BNB_VERSION', '0.11.2' );
|
||||||
|
|
||||||
// Plugin path constants.
|
// Plugin path constants.
|
||||||
define( 'WP_BNB_PATH', plugin_dir_path( __FILE__ ) );
|
define( 'WP_BNB_PATH', plugin_dir_path( __FILE__ ) );
|
||||||
|
|||||||
Reference in New Issue
Block a user