Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Email notifications for locations, on bookings, cancellations, deletions, and when the location changes #172

Merged
merged 28 commits into from
Sep 12, 2018

Conversation

sgrubsmyon
Copy link
Collaborator

Locations can receive BCCs of confirmation emails sent to users when they book an item at the location. That way, locations can stay informed about who is coming on what day to fetch items.

Emails are sent to all email addresses found (by regex) in the contact details text field. The BCC sending is enabled by a checkbox below the contact details field in the location settings (below the "hide contact details" checkbox).

This fixes #143, #165 and a part of #77.

@sgrubsmyon
Copy link
Collaborator Author

New update: Notification emails will also be sent when an admin deletes a booking from the booking table (only if the booking was not already canceled by the user and lies in the future).

@sgrubsmyon sgrubsmyon closed this Aug 12, 2018
@sgrubsmyon sgrubsmyon reopened this Aug 12, 2018
@sgrubsmyon
Copy link
Collaborator Author

The email sending from the admin interface (bookings table) is done via the action API (see https://developer.wordpress.org/reference/functions/add_action/), so that the class in the 'admin' directory can access the existing email sending code in 'public/cb-bookings/class-cb-booking.php' in the 'public' directory. This avoids code duplication inside 'admin/cb-bookings/class-cb-bookings-table.php'.

@sgrubsmyon
Copy link
Collaborator Author

Another change (mainly commit 21dc7c8): When a timeframe is edited (or a new one is created and there are already overlapping bookings), it is checked if the location of existing bookings has changed. If so, the bookings' location_id is updated in the DB, so that the data stay intact (e.g. in the bookings table in the admin area). Notification emails about the change of their booking's location are sent to all users that have already booked (only if the booking's start date is today or lies in the future). Old and new location receive copies of the notification emails as well if they have the check box checked that they want to receive notification emails.

@sgrubsmyon
Copy link
Collaborator Author

This change makes it possible to offer bookings at a placeholder "fake" location. As soon as the actual location is known, an admin can change the timeframe's location to the real one (or delete the timeframe with the fake location and create a new one with the real location). All users that have already booked will be notified of the actual location. The location can receive copies and is therefore notified as well of who has already booked on which days. A problem might be existing bookings on days when the new location is closed. In this case, users should contact the item's location.

@sgrubsmyon
Copy link
Collaborator Author

Another use case is that a location cannot offer its services, e.g. due to illness, and the item must be relocated. With these changes, the plugin takes care of notifying all users of the change of the location.

@sgrubsmyon sgrubsmyon changed the title Email notifications for locations, on bookings and cancellations Email notifications for locations, on bookings, cancellations, deletions, and when the location changes Aug 27, 2018
@sgrubsmyon sgrubsmyon merged commit e5a35ce into wielebenwir:master Sep 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

E-Mail Notification for locations
2 participants