Bug: Appointment booked for day where staff is unavailable

Issue #72 resolved
johannesmutter created an issue

This bug is really a rare but serious one:

  1. An appointment was booked by “B” for September 16th with staff “A”.

  2. A few days after this appointment was made the availability for staff “A” was changed due to holidays.

  3. Staff “A” is now unavailable on the 16th September where the appointment with “B” will take place.

  4. FIRST (UX) PROBLEM: There should be an alert if staff availability is changed and there are appointments booked for the time the staff is unavailable, e.g. cause of holidays. So all appointments assigned to the staff in the date/ time range that was set to unavailable should be processed: A modal with a list of them should be displayed so staff is able to edit/ assign other staff or reschedule these appointments.

  5. SECOND PROBLEM (BUG): This problem is “a bit” more serious than the above one. The day where the above conflict takes place becomes unavailable for ALL APPOINTMENTS and for ALL STAFF. So no customer or staff is able to book an appointment for this day, even if there is only one appointment (the one with staff assigned who’s unavailable that day).

I made a screen recording for better understanding (In this case “Dounia is unavailable on 16th September and the appointment was originally booked with her).

Comments (5)

  1. Janez Svetin
    • changed status to open

    Taking over this issue. Will prepare a fix for this issue and paste a pull request for it here.

  2. Janez Svetin

    Plan for solving this:

    • on edit user (staff member) screen in administration after the user gets updated (profile_update hook) and
    • on edit/insert appointment screen in administration after the appointment gets updated/inserted (save_post hook),

    .. check the availability of the staff members for expected appointments. If any of the staff is unavailable for already assigned expected appointments, display a global woocommerce notice "Some of the staff members are unavailable for expected appointments".

    Additional change:

    • if staff member gets deleted (delete_user hook), display an option to reassign appointments to another user.
  3. Log in to comment