fix bug, add type hints, fix annotations
This commit is contained in:
parent
6f76bb4a97
commit
a06bca38d4
|
|
@ -9,7 +9,7 @@ class AppointmentSlot extends Booking
|
||||||
* @param \Webkul\BookingProduct\Contracts\BookingProduct $bookingProduct
|
* @param \Webkul\BookingProduct\Contracts\BookingProduct $bookingProduct
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function haveSufficientQuantity($qty, $bookingProduct)
|
public function haveSufficientQuantity(int $qty, $bookingProduct): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ class Booking extends Virtual
|
||||||
* @param int $qty
|
* @param int $qty
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function haveSufficientQuantity($qty)
|
public function haveSufficientQuantity(int $qty): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -795,7 +795,13 @@ class Cart
|
||||||
*/
|
*/
|
||||||
public function isItemsHaveSufficientQuantity(): bool
|
public function isItemsHaveSufficientQuantity(): bool
|
||||||
{
|
{
|
||||||
foreach ($this->getCart()->items as $item) {
|
$cart = cart()->getCart();
|
||||||
|
|
||||||
|
if (! $cart) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($cart->items as $item) {
|
||||||
if (! $this->isItemHaveQuantity($item)) {
|
if (! $this->isItemHaveQuantity($item)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -261,11 +261,11 @@ class Product extends Model implements ProductContract
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param integer $qty
|
* @param int $qty
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function haveSufficientQuantity($qty)
|
public function haveSufficientQuantity(int $qty): bool
|
||||||
{
|
{
|
||||||
return $this->getTypeInstance()->haveSufficientQuantity($qty);
|
return $this->getTypeInstance()->haveSufficientQuantity($qty);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,11 +99,11 @@ class ProductFlat extends Model implements ProductFlatContract
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param integer $qty
|
* @param int $qty
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function haveSufficientQuantity($qty)
|
public function haveSufficientQuantity(int $qty): bool
|
||||||
{
|
{
|
||||||
return $this->product->haveSufficientQuantity($qty);
|
return $this->product->haveSufficientQuantity($qty);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -350,7 +350,7 @@ abstract class AbstractType
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function haveSufficientQuantity($qty)
|
public function haveSufficientQuantity(int $qty): bool
|
||||||
{
|
{
|
||||||
return $this->haveSufficientQuantity;
|
return $this->haveSufficientQuantity;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -685,7 +685,15 @@ class Bundle extends AbstractType
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($item->children as $childItem) {
|
foreach ($item->children as $childItem) {
|
||||||
$childItem->product->getTypeInstance()->validateCartItem($childItem);
|
$childResult = $childItem->product->getTypeInstance()->validateCartItem($childItem);
|
||||||
|
|
||||||
|
if ($childResult->isItemInactive()) {
|
||||||
|
$result->itemIsInactive();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($childResult->isCartDirty()) {
|
||||||
|
$result->cartIsDirty();
|
||||||
|
}
|
||||||
|
|
||||||
$price += $childItem->base_price * $childItem->quantity;
|
$price += $childItem->base_price * $childItem->quantity;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -592,7 +592,7 @@ class Configurable extends AbstractType
|
||||||
* @param int $qty
|
* @param int $qty
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function haveSufficientQuantity($qty)
|
public function haveSufficientQuantity(int $qty): bool
|
||||||
{
|
{
|
||||||
$backorders = core()->getConfigData('catalog.inventory.stock_options.backorders');
|
$backorders = core()->getConfigData('catalog.inventory.stock_options.backorders');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ class Simple extends AbstractType
|
||||||
* @param int $qty
|
* @param int $qty
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function haveSufficientQuantity($qty)
|
public function haveSufficientQuantity(int $qty): bool
|
||||||
{
|
{
|
||||||
$backorders = core()->getConfigData('catalog.inventory.stock_options.backorders');
|
$backorders = core()->getConfigData('catalog.inventory.stock_options.backorders');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ class Virtual extends AbstractType
|
||||||
* @param int $qty
|
* @param int $qty
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function haveSufficientQuantity($qty)
|
public function haveSufficientQuantity(int $qty): bool
|
||||||
{
|
{
|
||||||
return $qty <= $this->totalQuantity() ? true : false;
|
return $qty <= $this->totalQuantity() ? true : false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue