mithrildesign
Forum Replies Created
Viewing 1 replies (of 1 total)
-
My client also had this problem, and I changed a few lines of code to make it work.
Example of problem:
——————————
– 2 assistants, each available for multiple different services.
– Assistant #1 has booking for “hair cut” at 1:00pm on Sept 24 2022
– Assistant #2 is not available for any service in the 1:00pm time slot on Sept 24 2022
– ‘customers per session’ makes no difference to this exampleHere is my fix, one line is specific to our usage with the time offset. Adjust as needed.
--- wp-content/plugins/salon-booking-plugin/src/SLN/Action/Ajax/CheckDateAlt.php Tue Sep 6 02:32:28 2022 +++ wp-content/plugins/salon-booking-plugin/src/SLN/Action/Ajax/CheckDateAlt.php Fri Sep 16 22:42:04 2022 @@ -238,9 +238,8 @@ $attendantErrors = array(); if ($bookingServices->isLast($bookingService) && $bookingOffsetEnabled) { - $offsetStart = $bookingService->getEndsAt(); - $offsetEnd = $bookingService->getEndsAt()->modify('+'.$bookingOffset.' minutes'); - $serviceErrors = $ah->validateTimePeriod($offsetStart, $offsetEnd); + $offsetEnd = $bookingService->getEndsAt()->modify('+' . ($bookingOffset - 15) . ' minutes'); + $serviceErrors = $ah->validateAttendant($bookingService->getAttendant(), $offsetEnd, null, $bookingService->getBreakStartsAt(), $bookingService->getBreakEndsAt()); } if (empty($serviceErrors)) { $serviceErrors = $ah->validateBookingService($bookingService, $bookingServices->isLast($bookingService)); --- wp-content/plugins/salon-booking-plugin/src/SLN/Helper/Availability.php Tue Sep 6 02:32:28 2022 +++ wp-content/plugins/salon-booking-plugin/src/SLN/Helper/Availability.php Fri Sep 16 22:32:53 2022 @@ -936,12 +936,7 @@ public function isValidOnlyTime($date) { - $countHour = $this->settings->get('parallels_hour'); - - return ($date >= $this->initialDate) && !($countHour && $this->getBookingsHourCount( - $date->format('H'), - $date->format('i') - ) >= $countHour); + return ($date >= $this->initialDate); } public function getFreeMinutes($date) --- wp-content/plugins/salon-booking-plugin/src/SLN/Helper/Availability/Advanced/DayBookings.php Tue Sep 6 02:32:28 2022 +++ wp-content/plugins/salon-booking-plugin/src/SLN/Helper/Availability/Advanced/DayBookings.php Fri Sep 16 22:38:57 2022 @@ -39,10 +39,17 @@ foreach ($bookings as $booking) { $bookingServices = $booking->getBookingServices(); foreach ($bookingServices->getItems() as $bookingService) { + + $offsetEnd = clone $booking->getEndsAt(); + + if ($bookingServices->isLast($bookingService) && $bookingOffsetEnabled) { + $offsetEnd->modify('+'.$bookingOffset.' minutes'); + } + $times = SLN_Func::filterTimes( $this->minutesIntervals, - $bookingService->getStartsAt(), - $bookingService->getEndsAt() + $booking->getStartsAt(), + $offsetEnd ); foreach ($times as $time) { $time = $time->format('H:i');
Viewing 1 replies (of 1 total)