@@ -10,6 +10,7 @@ use Lc\ShopBundle\Context\OrderPaymentInterface; | |||
use Lc\ShopBundle\Context\OrderRefundInterface; | |||
use Lc\ShopBundle\Context\PayoffInterface; | |||
use Lc\ShopBundle\Context\UserMerchantInterface; | |||
use Gedmo\Mapping\Annotation as Gedmo; | |||
/** | |||
* @ORM\MappedSuperclass() | |||
@@ -47,6 +48,19 @@ abstract class CreditHistory extends AbstractEntity implements PayoffInterface | |||
*/ | |||
protected $orderRefund; | |||
/** | |||
* @Gedmo\Blameable(on="create") | |||
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface") | |||
* @ORM\JoinColumn(nullable=true) | |||
*/ | |||
protected $createdBy; | |||
/** | |||
* @Gedmo\Blameable(on="update") | |||
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface") | |||
* @ORM\JoinColumn(nullable=true) | |||
*/ | |||
protected $updatedBy; | |||
public function getAmount(): ?float | |||
{ |
@@ -47,7 +47,7 @@ abstract class Document extends AbstractDocumentEntity implements FilterMerchant | |||
/** | |||
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\AddressInterface") | |||
* @ORM\JoinColumn(nullable=false) | |||
* @ORM\JoinColumn(nullable=true) | |||
*/ | |||
protected $buyerAddress; | |||
@@ -97,6 +97,7 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr | |||
/** | |||
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\ProductInterface", mappedBy="productFamily", orphanRemoval=true, cascade={"persist"}) | |||
* @ORM\OrderBy({"position" = "ASC"}) | |||
*/ | |||
protected $products; | |||
@@ -154,6 +154,10 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt | |||
$query->andWhere('e.user = :user')->setParameter('user', $params['user']); | |||
} | |||
if(isset($params['address'])) { | |||
$query->andWhere('e.deliveryAddress = :address OR e.invoiceAddress = :address')->setParameter('address', $params['address']); | |||
} | |||
if (isset($params['mergeComplementaryOrderShops'])) { | |||
$query->andWhere('e.mainOrderShop IS NULL'); | |||
$query->leftJoin('e.complementaryOrderShops', 'complementaryOrderShops'); |
@@ -28,6 +28,13 @@ class ProductCategoryRepository extends BaseRepository implements DefaultReposit | |||
->orderBy('e.position', 'ASC'); | |||
} | |||
public function findOneBySlug($slug) | |||
{ | |||
$query = $this->findByMerchantQuery() ; | |||
$query->andWhere('e.slug = :slug')->setParameter('slug',$slug) ; | |||
return $query->getQuery()->getOneOrNullResult() ; | |||
} | |||
public function findAllParents($withOffline = false) | |||
{ | |||
$query = $this->findByMerchantQuery() |
@@ -36,6 +36,13 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor | |||
return $query->getQuery()->getResult() ; | |||
} | |||
public function findOneBySlug($slug) | |||
{ | |||
$query = $this->findByMerchantQuery() ; | |||
$query->andWhere('e.slug = :slug')->setParameter('slug',$slug) ; | |||
return $query->getQuery()->getOneOrNullResult() ; | |||
} | |||
public function getProductFamiliesByCategory($category){ | |||
$query = $this->findByMerchantQuery() ; | |||
$query = $this->joinRelations($query) ; |
@@ -134,7 +134,7 @@ trait OrderUtilsStockTrait | |||
&& $orderProduct->getProduct()->getProductFamily()->getId() == $productFamily->getId())) { | |||
if($byWeight) { | |||
$quantity += $orderProduct->getQuantityOrder() * ($orderProduct->getQuantityProduct() / $product->getUnitInherited()->getCoefficient()) ; | |||
$quantity += $orderProduct->getQuantityOrder() * ($orderProduct->getQuantityProduct() / $orderProduct->getProduct()->getUnitInherited()->getCoefficient()) ; | |||
} | |||
else { | |||
$quantity += $orderProduct->getQuantityOrder() ; |