Merge pull request #2751 from jitendra-webkul/1.0

Issue #2717 fixed
This commit is contained in:
Jitendra Singh 2020-03-24 14:01:00 +05:30 committed by GitHub
commit e6e84dfdf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 12 deletions

View File

@ -182,6 +182,8 @@
* #2716 [fixed] - After saving the default booking time product selected time for date range changes to 00:00:00 ,because of which not able to book appointment on frontend.
* #2717 [fixed] - Getting error message on adding rental product in cart if rental booking is not available for that day.
* #2722 [fixed] - warning showing when update event booking cart quantity from the product page
* #2723 [fixed] - Compare product icon on header showing counts of compare product but there are no product in compare list.

View File

@ -140,24 +140,46 @@ class RentalSlot extends Booking
public function isSlotExpired($cartItem)
{
$bookingProduct = $this->bookingProductRepository->findOneByField('product_id', $cartItem['product_id']);
$typeHelper = app($this->typeHelpers[$bookingProduct->type]);
$timeIntervals = $typeHelper->getSlotsByDate($bookingProduct, $cartItem['additional']['booking']['date']);
if (isset($cartItem['additional']['booking']['date'])) {
$timeIntervals = $this->getSlotsByDate($bookingProduct, $cartItem['additional']['booking']['date']);
$isExpired = true;
$isExpired = true;
foreach ($timeIntervals as $timeInterval) {
foreach ($timeInterval['slots'] as $slot) {
if ($slot['from_timestamp'] == $cartItem['additional']['booking']['slot']['from']
&& $slot['to_timestamp'] == $cartItem['additional']['booking']['slot']['to']
) {
$isExpired = false;
foreach ($timeIntervals as $timeInterval) {
foreach ($timeInterval['slots'] as $slot) {
if ($slot['from_timestamp'] == $cartItem['additional']['booking']['slot']['from']
&& $slot['to_timestamp'] == $cartItem['additional']['booking']['slot']['to']
) {
$isExpired = false;
}
}
}
}
return $isExpired;
return $isExpired;
} else {
$requestedFromDate = Carbon::createFromTimeString($cartItem['additional']['booking']['date_from'] . " 00:00:00");
$requestedToDate = Carbon::createFromTimeString($cartItem['additional']['booking']['date_to'] . " 23:59:59");
$availableFrom = ! $bookingProduct->available_every_week && $bookingProduct->available_from
? Carbon::createFromTimeString($bookingProduct->available_from)
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
$availableTo = ! $bookingProduct->available_every_week && $bookingProduct->available_from
? Carbon::createFromTimeString($bookingProduct->available_to)
: Carbon::createFromTimeString('2080-01-01 00:00:00');
if ($requestedFromDate < $availableFrom
|| $requestedFromDate > $availableTo
|| $requestedToDate < $availableFrom
|| $requestedToDate > $availableTo
) {
return true;
}
return false;
}
}
/**