Sfoglia il codice sorgente

Processus de commande

feature/export_comptable
Fab 4 anni fa
parent
commit
69d9940546
4 ha cambiato i file con 22 aggiunte e 10 eliminazioni
  1. +2
    -1
      ShopBundle/Controller/Backend/ProductFamilyController.php
  2. +11
    -5
      ShopBundle/Model/Product.php
  3. +8
    -3
      ShopBundle/Model/ProductFamily.php
  4. +1
    -1
      ShopBundle/Services/OrderUtils.php

+ 2
- 1
ShopBundle/Controller/Backend/ProductFamilyController.php Vedi File

@@ -63,7 +63,8 @@ class ProductFamilyController extends AdminController
'choices' => array(
'field.ProductFamily.behaviorCountStockOptions.' . ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE => ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE,
'field.ProductFamily.behaviorCountStockOptions.' . ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY => ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY,
'field.ProductFamily.behaviorCountStockOptions.' . ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT => ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT
'field.ProductFamily.behaviorCountStockOptions.' . ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT => ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT,
'field.ProductFamily.behaviorCountStockOptions.' . ProductFamily::BEHAVIOR_COUNT_STOCK_UNLIMITED => ProductFamily::BEHAVIOR_COUNT_STOCK_UNLIMITED
),
'translation_domain' => 'lcshop',
'multiple' => false,

+ 11
- 5
ShopBundle/Model/Product.php Vedi File

@@ -128,11 +128,17 @@ abstract class Product extends AbstractEntity implements SortableInterface, Prod

public function getAvailableQuantityInherited()
{
if ($this->getProductFamily()->getBehaviorCountStock() == ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY ||
$this->getProductFamily()->getBehaviorCountStock() == ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE) {
return $this->getProductFamily()->getAvailableQuantity();
} else if ($this->getProductFamily()->getBehaviorCountStock() == ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT) {
return $this->getAvailableQuantity();
switch ($this->getProductFamily()->getBehaviorCountStock()) {
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY :
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE :
return $this->getProductFamily()->getAvailableQuantity();
break;
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT :
return $this->getAvailableQuantity();
break;
case ProductFamily::BEHAVIOR_COUNT_STOCK_UNLIMITED :
return false;
break;
}
}


+ 8
- 3
ShopBundle/Model/ProductFamily.php Vedi File

@@ -17,6 +17,7 @@ use Lc\ShopBundle\Context\ProductPropertyInterface;

abstract class ProductFamily extends AbstractDocumentEntity implements ProductPropertyInterface, PriceInterface, FilterMerchantInterface
{
const BEHAVIOR_COUNT_STOCK_UNLIMITED = 'unlimited' ;
const BEHAVIOR_COUNT_STOCK_BY_MEASURE = 'by-measure' ;
const BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY = 'by-product-family' ;
const BEHAVIOR_COUNT_STOCK_BY_PRODUCT = 'by-product' ;
@@ -188,18 +189,22 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr

switch ($this->getBehaviorCountStock()) {

case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE :
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY :
case self::BEHAVIOR_COUNT_STOCK_BY_MEASURE :
case self::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY :

$availableQuantity = $this->getAvailableQuantity() ;
break;

case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT :
case self::BEHAVIOR_COUNT_STOCK_BY_PRODUCT :

foreach($this->getProducts() as $product) {
$availableQuantity += $product->getAvailableQuantityInherited() ;
}
break ;

case self::BEHAVIOR_COUNT_STOCK_UNLIMITED :
$availableQuantity = false;
break;
}

return $availableQuantity ;

+ 1
- 1
ShopBundle/Services/OrderUtils.php Vedi File

@@ -444,7 +444,7 @@ class OrderUtils
$quanityAsked = ($product->getQuantityInherited() / $product->getUnitInherited()->getCoefficient()) * $quanityOrder;
}

if ($product->getAvailableQuantityInherited() >= $quanityAsked) {
if ($product->getAvailableQuantityInherited() >= $quanityAsked || $product->getProductFamily()->getBehaviorCountStock() == ProductFamily::BEHAVIOR_COUNT_STOCK_UNLIMITED) {
return true;
} else {
return false;

Loading…
Annulla
Salva