=== Do It Simply Booking Notifications ===
Contributors: baperrou
Tags: woocommerce, bookings, email, notifications, woocommerce-bookings
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 3.1.3
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.txt

Send scheduled email lists of upcoming WooCommerce Bookings to staff — fully configurable, no code editing required.

== Description ==

Do It Simply Booking Notifications for WooCommerce Bookings sends scheduled email lists of upcoming bookings to whoever needs to see them — guides, coaches, or office staff — without anyone needing to log in and check WooCommerce manually.

**Requires WooCommerce and WooCommerce Bookings to be active.** The plugin has no function without both.

Each notification ("send") is configured from a settings screen and can have its own:

* Internal name (for your own reference — not shown to recipients)
* Timing offset (e.g. tomorrow, in 2 days, in 10 days)
* Optional day-of-week restriction (e.g. only run this one on Fridays)
* Weekend mode — a single Friday schedule that automatically covers both Saturday and Sunday bookings in one run
* Scope — either a set of WooCommerce product categories, or an explicit list of individual products (useful on smaller sites with few bookable products)
* Recipient list

Sends run automatically once daily via WP-Cron. For sites where WP-Cron's page-visit-dependent timing isn't reliable enough (low traffic, full-page caching), the settings screen documents a real server-cron fallback using WP-CLI.

== Changelog ==
= 3.1.3 =
* Initial public release
* Fixed: booking query used LIKE comparison for product ID matching, causing bookings 
  from products whose IDs contain the target ID as a substring to be incorrectly 
  included in results (e.g. product ID 20 matching IDs 200, 1120 etc).
  Changed to exact numeric match (=) for single product queries.
= 3.1.2 =
* Fixed: inline JavaScript moved to an enqueued external file (assets/admin.js) per WP plugin review requirements.
= 3.1.1 =
* Fixed: removed unnecessary direct inclusion of wp-admin/includes/plugin.php flagged by WP plugin review.
* Fixed: recipients field now sanitized per-address using sanitize_email() rather than as a plain text string.
= 3.1.0 =
* Added "Weekend" day restriction option — a single Friday schedule now covers both Saturday (+1 day) and Sunday (+2 days) bookings in one cron run, removing the need for two separate weekend schedules.
* Fixed: product category scope now correctly includes child categories (e.g. selecting a parent coaching category finds products in all sub-categories).
* Fixed: product type filter removed from category scope query — previously caused bookable products to be silently missed if their product type slug was registered differently by WooCommerce Bookings.
* Added: error logging throughout dis_be_run_sends() for easier diagnosis of missed or unexpected sends.

= 3.0.0 =
* Major rework: replaced hardcoded per-site cron scripts and code-level email timing with a settings screen inside wp-admin.
* Added repeating "sends" — add, edit, or remove any number of scheduled notifications without editing code.
* Added support for scoping a send by WooCommerce product category or by an explicit product list.
* Added optional day-of-week restriction per send.
* Added WP-Cron based daily scheduling, registered on plugin activation and cleared on deactivation.
* Added an in-admin reliability note documenting the real-cron/WP-CLI fallback for low-traffic or heavily cached sites.
* Renamed internal functions to remove site-specific naming (e.g. `create_wye_booking_email()` → `dis_be_build_and_send_email()`), in preparation for reuse across sites.
* Fixed: email subject lines showing raw HTML entities (e.g. `&#8217;`) instead of decoded characters.
* Removed dependency on external, per-site cron script files (`all-bookings-list-email.php` and variants) — these are retired in favour of the built-in scheduler.

= 2.0.0 =
* Previous version. Email timing, recipients, and product/category scope were hardcoded in per-site cron script files, requiring a code change for any new send, schedule, or scope adjustment.

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/do-it-simply-booking-notifications` directory, or install the plugin through the WordPress Plugins screen directly.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Ensure WooCommerce and WooCommerce Bookings are both installed and active — this plugin has no function without them.
4. Go to the "Booking Notifications" menu item in wp-admin to configure your first send: give it an internal name, choose a timing offset, select the product categories or products it should cover, and enter recipient email addresses.
5. Save. Sends run automatically once daily via WP-Cron. For sites with low traffic or aggressive page caching, see the reliability note on the settings screen for a server-cron alternative.

== Screenshots ==

1. Configuring a send scoped by WooCommerce product category.
2. Configuring a send scoped by individual product, for smaller catalogues.
3. An example booking notification email as received by staff.
4. The booking notification email, showing the WooCommerce-styled header and full booking details table.

== Frequently Asked Questions ==

= Does this work without WooCommerce Bookings? =

No. This plugin only sends notifications about WooCommerce Bookings — it has no function on a site without WooCommerce and WooCommerce Bookings both active.

= Will my scheduled emails go out at exactly the time I set? =

By default, sends run once daily via WP-Cron, which fires on the next site visit after the scheduled time — usually within minutes on an active site, but potentially later on very low-traffic sites or ones behind aggressive page caching. See the reliability note on the settings screen for a server-cron alternative that guarantees exact timing.

= Can I send weekend booking lists without setting up two separate schedules? =

Yes — select "Weekend — fires Friday, sends Sat + Sun" as the day restriction. A single schedule will automatically send Saturday's bookings and Sunday's bookings in one Friday cron run.