protected $orderPayments; | protected $orderPayments; | ||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderProductInterface", mappedBy="orderShop", cascade={"persist", "remove"}, orphanRemoval=true) | |||||
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderProductInterface", mappedBy="orderShop", cascade={"persist", "remove"}, orphanRemoval=true, fetch="EAGER") | |||||
*/ | */ | ||||
protected $orderProducts; | protected $orderProducts; | ||||
} | } | ||||
public function countValidOrderProductsOfWeekByProduct($weekNumber, $productId) | |||||
{ | |||||
$query = $this->findByMerchantQuery(); | |||||
$query = $this->filterOrderValid($query); | |||||
$query->andWhere('e.weekNumber = :weekNumber'); | |||||
$query->setParameter('weekNumber', $weekNumber); | |||||
$query->leftJoin('e.orderProducts', 'orderProduct'); | |||||
$query->andWhere('orderProduct.product = :product'); | |||||
$query->setParameter('product', $productId); | |||||
$query->select('SUM(orderProduct.quantityOrder) as quantity'); | |||||
$result = $query->getQuery()->getOneOrNullResult(); | |||||
return $result['quantity']; | |||||
} | |||||
} | } |
} | } | ||||
}, | }, | ||||
preventFormSubmit: function (){ | preventFormSubmit: function (){ | ||||
$(document).keypress(function(e) { | |||||
$('#lc-order-edit').keypress(function(e) { | |||||
if (e.which == 13) { | if (e.which == 13) { | ||||
e.preventDefault(); | e.preventDefault(); | ||||
} | } |