Просмотр исходного кода

Merge branch 'develop'

master^2
Fab 3 лет назад
Родитель
Сommit
f04d20608c
9 измененных файлов: 277 добавлений и 253 удалений
  1. +1
    -0
      ShopBundle/Controller/Backend/OrderController.php
  2. +2
    -1
      ShopBundle/Controller/Backend/ProductFamilyController.php
  3. +1
    -0
      ShopBundle/Model/ProductFamily.php
  4. +266
    -248
      ShopBundle/Repository/OrderShopRepository.php
  5. +1
    -1
      ShopBundle/Resources/public/js/backend/script/order/vuejs-order.js
  6. +3
    -1
      ShopBundle/Resources/translations/lcshop.fr.yaml
  7. +1
    -1
      ShopBundle/Resources/views/backend/user/macros.html.twig
  8. +1
    -1
      ShopBundle/Services/Price/OrderProductPriceUtils.php
  9. +1
    -0
      ShopBundle/Services/Utils.php

+ 1
- 0
ShopBundle/Controller/Backend/OrderController.php Просмотреть файл

@@ -459,6 +459,7 @@ class OrderController extends AdminController
$parameters['form_order_send_payment_link'] = $this->createCustomForm(OrderSendPaymentLink::class, 'orderSendPaymentLink', $parameters)->createView();
break;
case OrderStatus::ALIAS_ERROR_PAYMENT_ONLINE :
case OrderStatus::ALIAS_PARTIAL_PAYMENT :
case OrderStatus::ALIAS_WAITING_PAYMENT_ONLINE :
$parameters['form_order_send_payment_link'] = $this->createCustomForm(OrderSendPaymentLink::class, 'orderSendPaymentLink', $parameters)->createView();
$parameters['form_order_payment'] = $this->createCustomForm(OrderPaymentType::class, 'orderPayment', $parameters, false)->createView();

+ 2
- 1
ShopBundle/Controller/Backend/ProductFamilyController.php Просмотреть файл

@@ -139,7 +139,8 @@ class ProductFamilyController extends AdminController
'choices' => array(
'field.ProductFamily.organicLabelOptions.' . ProductFamily::PROPERTY_ORGANIC_LABEL_AB => ProductFamily::PROPERTY_ORGANIC_LABEL_AB,
'field.ProductFamily.organicLabelOptions.' . ProductFamily::PROPERTY_ORGANIC_LABEL_NP => ProductFamily::PROPERTY_ORGANIC_LABEL_NP,
'field.ProductFamily.organicLabelOptions.' . ProductFamily::PROPERTY_ORGANIC_LABEL_HVE => ProductFamily::PROPERTY_ORGANIC_LABEL_HVE
'field.ProductFamily.organicLabelOptions.' . ProductFamily::PROPERTY_ORGANIC_LABEL_HVE => ProductFamily::PROPERTY_ORGANIC_LABEL_HVE,
'field.ProductFamily.organicLabelOptions.' . ProductFamily::PROPERTY_ORGANIC_LABEL_TVVR => ProductFamily::PROPERTY_ORGANIC_LABEL_TVVR
),
'translation_domain' => 'lcshop',
'multiple' => false,

+ 1
- 0
ShopBundle/Model/ProductFamily.php Просмотреть файл

@@ -47,6 +47,7 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr
const PROPERTY_ORGANIC_LABEL_AB = 'ab';
const PROPERTY_ORGANIC_LABEL_NP = 'nature-progres';
const PROPERTY_ORGANIC_LABEL_HVE = 'hve';
const PROPERTY_ORGANIC_LABEL_TVVR = 'tvvr';

const TYPE_EXPIRATION_DATE_DLC = 'dlc';
const TYPE_EXPIRATION_DATE_DDM = 'ddm';

+ 266
- 248
ShopBundle/Repository/OrderShopRepository.php Просмотреть файл

@@ -20,298 +20,316 @@ use Lc\ShopBundle\Model\OrderStatus;
class OrderShopRepository extends BaseRepository implements DefaultRepositoryInterface
{

public function getInterfaceClass()
{
return OrderShopInterface::class;
public function getInterfaceClass()
{
return OrderShopInterface::class;
}

public function countValidOrderWithReductionCredit($reductionCredit, $user = null)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
if ($user) {
$query->andWhere('e.user = :user');
$query->setParameter('user', $user);
}
$query->innerJoin('e.orderReductionCredits', 'orc');
$query->andWhere('orc.reductionCredit = :reductionCredit');
$query->setParameter('reductionCredit', $reductionCredit);

public function countValidOrderWithReductionCredit($reductionCredit, $user=null)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
if($user) {
$query->andWhere('e.user = :user');
$query->setParameter('user', $user);
}
$query->innerJoin('e.orderReductionCredits', 'orc');
$query->andWhere('orc.reductionCredit = :reductionCredit');
$query->setParameter('reductionCredit', $reductionCredit);
return $query->getQuery()->getSingleScalarResult();
}

return $query->getQuery()->getSingleScalarResult();

public function countValidOrderWithReductionCart($reductionCart)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
$query->join('e.orderReductionCarts', 'orc');
$query->andWhere('orc.reductionCart = :reductionCart');
$query->setParameter('reductionCart', $reductionCart);

return $query->getQuery()->getSingleScalarResult();
}


public function countValidOrderWithReductionCartPerUser($reductionCart, $user)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
$query->andWhere('e.user = :user');
$query->join('e.orderReductionCarts', 'orc');
$query->andWhere('orc.reductionCart = :reductionCart');
$query->setParameter('reductionCart', $reductionCart);
$query->setParameter('user', $user);

return $query->getQuery()->getSingleScalarResult();
}


public function filterOrderWaitingDelivery($query)
{
return $this->_filterOrderStatus($query, OrderStatus::$statusAliasWaitingDelivery);
}

public function filterOrderCart($query)
{
return $this->_filterOrderStatus($query, OrderStatus::$statusAliasAsCart);
}

public function filterOrderValid(?QueryBuilder $query): QueryBuilder
{
return $this->_filterOrderStatus($query, OrderStatus::$statusAliasAsValid);
}

private function _filterOrderStatus($query, $statusArray)
{
$query->leftJoin('e.orderStatus', 'os');
$query->andWhere('os.alias IN (:alias)');
$query->setParameter('alias', $statusArray);

return $query;
}

public function findCartCurrent($params)
{
$query = $this->findByMerchantQuery();


if (isset($params['user'])) {
$query->andWhere('e.user = :user')->setParameter('user', $params['user']);
}

if (isset($params['visitor'])) {
$query->andWhere('e.visitor = :visitor')->setParameter('visitor', $params['visitor']);
}

$query = $this->filterOrderCart($query);

$query->leftJoin('e.orderReductionCarts', 'orderReductionCarts')
->addSelect('orderReductionCarts');

public function countValidOrderWithReductionCart($reductionCart)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
$query->join('e.orderReductionCarts', 'orc');
$query->andWhere('orc.reductionCart = :reductionCart');
$query->setParameter('reductionCart', $reductionCart);
return $query->getQuery()->getSingleScalarResult();
$results = $query->getQuery()->getResult();

if ($results) {
return $results[0];
}

return null;
}

public function findAllBy($params = [])
{
if (isset($params['merchant'])) {
$query = $this->findByMerchantQuery($params['merchant']);
} else {
$query = $this->findByMerchantQuery();
}

if (isset($params['count']) && $params['count']) {
$query->select('count(e.id)');
}

public function countValidOrderWithReductionCartPerUser($reductionCart, $user)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
$query->andWhere('e.user = :user');
$query->join('e.orderReductionCarts', 'orc');
$query->andWhere('orc.reductionCart = :reductionCart');
$query->setParameter('reductionCart', $reductionCart);
$query->setParameter('user', $user);
return $query->getQuery()->getSingleScalarResult();
if (isset($params['select'])) {
$query->select($params['select']);
}

if (isset($params['section'])) {
$query = $query->andWhere('e.section = :section')->setParameter('section', $params['section']);
}

if (isset($params['dateStart']) || isset($params['dateEnd'])) {
$params['dateField'] = isset($params['dateField']) ? $params['dateField'] : 'validationDate';
}

public function filterOrderWaitingDelivery($query)
{
return $this->_filterOrderStatus($query, OrderStatus::$statusAliasWaitingDelivery) ;
if (isset($params['dateStart'])) {
$query->andWhere('e.'.$params['dateField'].' >= :dateStart')->setParameter(
'dateStart',
$params['dateStart']
);
}
if (isset($params['dateEnd'])) {
$query->andWhere('e.'.$params['dateField'].' <= :dateEnd')->setParameter('dateEnd', $params['dateEnd']);
}

public function filterOrderCart($query)
{
return $this->_filterOrderStatus($query, OrderStatus::$statusAliasAsCart) ;
if (isset($params['weekNumber'])) {
$query->andWhere('e.weekNumber = :weekNumber')->setParameter('weekNumber', $params['weekNumber']);
$currentYear = new \DateTime();
$currentYear->setDate($currentYear->format('Y'), 1, 1);
$query->andWhere('e.validationDate >= :now')->setParameter('now', $currentYear);
}
public function filterOrderValid(?QueryBuilder $query): QueryBuilder
{
return $this->_filterOrderStatus($query, OrderStatus::$statusAliasAsValid) ;
if (isset($params['isCart'])) {
$query = $this->filterOrderCart($query);
}

private function _filterOrderStatus($query, $statusArray) {
$query->leftJoin('e.orderStatus', 'os');
$query->andWhere('os.alias IN (:alias)');
$query->setParameter('alias',$statusArray);
return $query ;
if (isset($params['isValid'])) {
$query = $this->filterOrderValid($query);
}

public function findCartCurrent($params)
{
$query = $this->findByMerchantQuery();
if (isset($params['isWaitingDelivery'])) {
$query = $this->filterOrderWaitingDelivery($query);
}

if (isset($params['orderStatus'])) {
$query->leftJoin('e.orderStatus', 'os');
$query->andWhere('os.alias LIKE :alias');
$query->setParameter('alias', $params['orderStatus']);
}

if (isset($params['user'])) {
$query->andWhere('e.user = :user')->setParameter('user', $params['user']);
}
if (isset($params['user'])) {
$query->andWhere('e.user = :user')->setParameter('user', $params['user']);
}

if (isset($params['visitor'])) {
$query->andWhere('e.visitor = :visitor')->setParameter('visitor', $params['visitor']);
}
if (isset($params['address'])) {
$query->andWhere('e.deliveryAddress = :address OR e.invoiceAddress = :address')->setParameter(
'address',
$params['address']
);
}

$query = $this->filterOrderCart($query);
if (isset($params['weekDeliveryTrucks'])) {
$query->andWhere('e.weekDeliveryTruck IN (:weekDeliveryTrucks)')->setParameter(
'weekDeliveryTrucks',
$params['weekDeliveryTrucks']
);
}

$query->leftJoin('e.orderReductionCarts', 'orderReductionCarts')
->addSelect('orderReductionCarts');
if (isset($params['estimatedDeliveryDateTime'])) {
$query->andWhere('e.estimatedDeliveryDateTime >= :deliveryDateStart');
$query->andWhere('e.estimatedDeliveryDateTime < :deliveryDateEnd');
$date = clone $params['estimatedDeliveryDateTime'];
$query->setParameter('deliveryDateStart', $date->format('Y-m-d 00:00:00'));
$query->setParameter('deliveryDateEnd', $date->modify('+1 day')->format('Y-m-d 00:00:00'));
}

$results = $query->getQuery()->getResult();
if (isset($params['deliveryDate'])) {
$query->andWhere('e.deliveryDate >= :deliveryDateStart');
$query->andWhere('e.deliveryDate < :deliveryDateEnd');
$date = clone $params['deliveryDate'];
$query->setParameter('deliveryDateStart', $date->format('Y-m-d 00:00:00'));
$query->setParameter('deliveryDateEnd', $date->modify('+1 day')->format('Y-m-d 00:00:00'));
}

if ($results) {
return $results[0];
}
if (isset($params['mergeComplementaryOrderShops'])) {
$query->andWhere('e.mainOrderShop IS NULL');
$query->leftJoin('e.complementaryOrderShops', 'complementaryOrderShops');
}

return null;
if (isset($params['excludeComplementaryOrderShops'])) {
$query->andWhere('e.mainOrderShop IS NULL');
}

public function findAllBy($params = [])
{
$setParameterHorsTournee = false;
$setParameterGiftVoucher = false;

if(isset($params['merchant'])){
$query = $this->findByMerchantQuery($params['merchant']);
}else{
$query = $this->findByMerchantQuery();
}
if (isset($params['isCircuit'])) {
$query->leftJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere(
'e.deliveryPointSale IS NULL OR (pointSale.isDepository = 0 AND (pointSale.devAlias IS NULL OR (pointSale.devAlias != :devAliasHorsTournee AND pointSale.devAlias != :devAliasGiftVoucher)))'
);
$setParameterHorsTournee = true;
$setParameterGiftVoucher = true;
}

if (isset($params['count']) && $params['count']) {
$query->select('count(e.id)');
}
if (isset($params['isDepository'])) {
$query->innerJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere(
'pointSale IS NOT NULL AND pointSale.isDepository = 1 AND (pointSale.devAlias IS NULL OR (pointSale.devAlias != :devAliasHorsTournee AND pointSale.devAlias != :devAliasGiftVoucher))'
);
$setParameterHorsTournee = true;
$setParameterGiftVoucher = true;
}

if (isset($params['select'])) {
$query->select( $params['select']);
}
if (isset($params['isOffCircuit'])) {
$query->innerJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere('pointSale IS NOT NULL AND pointSale.devAlias = :devAliasHorsTournee');
$setParameterHorsTournee = true;
}

if (isset($params['section'])) {
$query = $query->andWhere('e.section = :section')->setParameter('section', $params['section']);
}
if (isset($params['isGiftVoucher'])) {
$query->innerJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere('pointSale IS NOT NULL AND pointSale.devAlias = :devAliasGiftVoucher');
$setParameterGiftVoucher = true;
}

if (isset($params['dateStart']) || isset($params['dateEnd'])) {
$params['dateField'] = isset($params['dateField']) ? $params['dateField'] : 'validationDate';
}
if ($setParameterHorsTournee) {
$query->setParameter('devAliasHorsTournee', PointSale::DEV_ALIAS_OFF_CIRCUIT);
}

if (isset($params['dateStart'])) {
$query->andWhere('e.' . $params['dateField'] . ' >= :dateStart')->setParameter('dateStart', $params['dateStart']);
}
if (isset($params['dateEnd'])) {
$query->andWhere('e.' . $params['dateField'] . ' <= :dateEnd')->setParameter('dateEnd', $params['dateEnd']);
}
if ($setParameterGiftVoucher) {
$query->setParameter('devAliasGiftVoucher', PointSale::DEV_ALIAS_GIFT_VOUCHER);
}

if (isset($params['weekNumber'])) {
$query->andWhere('e.weekNumber = :weekNumber')->setParameter('weekNumber', $params['weekNumber']);
}
if (isset($params['deliveryAvailability'])) {
$deliveryAvailability = $params['deliveryAvailability'];

if (isset($params['isCart'])) {
$query = $this->filterOrderCart($query);
}
$deliveryAvailabilityZone = ($deliveryAvailability instanceof DeliveryAvailabilityZone) ? $deliveryAvailability : false;
$deliveryAvailabilityPointSale = ($deliveryAvailability instanceof DeliveryAvailabilityPointSale) ? $deliveryAvailability : false;

if (isset($params['isValid'])) {
$query = $this->filterOrderValid($query);
}
if ($deliveryAvailabilityZone) {
$query->andWhere('e.deliveryAvailabilityZone = :deliveryAvailabilityZone');
$query->setParameter('deliveryAvailabilityZone', $deliveryAvailabilityZone);
}

if (isset($params['isWaitingDelivery'])) {
$query = $this->filterOrderWaitingDelivery($query);
}
if ($deliveryAvailabilityPointSale) {
$query->andWhere('e.deliveryAvailabilityPointSale = :deliveryAvailabilityPointSale');
$query->setParameter('deliveryAvailabilityPointSale', $deliveryAvailabilityPointSale);
}
} else {
$query->leftJoin('e.deliveryAvailabilityZone', 'deliveryAvailabilityZone');
$query->leftJoin('deliveryAvailabilityZone.deliverySlot', 'deliverySlotZone');

if (isset($params['orderStatus'])) {
$query->leftJoin('e.orderStatus', 'os');
$query->andWhere('os.alias LIKE :alias');
$query->setParameter('alias', $params['orderStatus']);
}

if (isset($params['user'])) {
$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['weekDeliveryTrucks'])) {
$query->andWhere('e.weekDeliveryTruck IN (:weekDeliveryTrucks)')->setParameter('weekDeliveryTrucks', $params['weekDeliveryTrucks']);
}

if(isset($params['estimatedDeliveryDateTime'])) {
$query->andWhere('e.estimatedDeliveryDateTime >= :deliveryDateStart');
$query->andWhere('e.estimatedDeliveryDateTime < :deliveryDateEnd');
$date = clone $params['estimatedDeliveryDateTime'];
$query->setParameter('deliveryDateStart', $date->format('Y-m-d 00:00:00'));
$query->setParameter('deliveryDateEnd', $date->modify('+1 day')->format('Y-m-d 00:00:00'));
}

if(isset($params['deliveryDate'])) {
$query->andWhere('e.deliveryDate >= :deliveryDateStart');
$query->andWhere('e.deliveryDate < :deliveryDateEnd');
$date = clone $params['deliveryDate'];
$query->setParameter('deliveryDateStart', $date->format('Y-m-d 00:00:00'));
$query->setParameter('deliveryDateEnd', $date->modify('+1 day')->format('Y-m-d 00:00:00'));
}

if (isset($params['mergeComplementaryOrderShops'])) {
$query->andWhere('e.mainOrderShop IS NULL');
$query->leftJoin('e.complementaryOrderShops', 'complementaryOrderShops');
}

if (isset($params['excludeComplementaryOrderShops'])) {
$query->andWhere('e.mainOrderShop IS NULL');
}

$setParameterHorsTournee = false ;
$setParameterGiftVoucher = false ;

if(isset($params['isCircuit'])) {
$query->leftJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere('e.deliveryPointSale IS NULL OR (pointSale.isDepository = 0 AND (pointSale.devAlias IS NULL OR (pointSale.devAlias != :devAliasHorsTournee AND pointSale.devAlias != :devAliasGiftVoucher)))');
$setParameterHorsTournee = true ;
$setParameterGiftVoucher = true ;
}

if(isset($params['isDepository'])) {
$query->innerJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere('pointSale IS NOT NULL AND pointSale.isDepository = 1 AND (pointSale.devAlias IS NULL OR (pointSale.devAlias != :devAliasHorsTournee AND pointSale.devAlias != :devAliasGiftVoucher))');
$setParameterHorsTournee = true ;
$setParameterGiftVoucher = true ;
}

if(isset($params['isOffCircuit'])) {
$query->innerJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere('pointSale IS NOT NULL AND pointSale.devAlias = :devAliasHorsTournee');
$setParameterHorsTournee = true ;
}

if(isset($params['isGiftVoucher'])) {
$query->innerJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere('pointSale IS NOT NULL AND pointSale.devAlias = :devAliasGiftVoucher');
$setParameterGiftVoucher = true ;
}

if($setParameterHorsTournee) {
$query->setParameter('devAliasHorsTournee', PointSale::DEV_ALIAS_OFF_CIRCUIT) ;
}

if($setParameterGiftVoucher) {
$query->setParameter('devAliasGiftVoucher', PointSale::DEV_ALIAS_GIFT_VOUCHER) ;
}

if (isset($params['deliveryAvailability'])) {
$deliveryAvailability = $params['deliveryAvailability'] ;

$deliveryAvailabilityZone = ($deliveryAvailability instanceof DeliveryAvailabilityZone) ? $deliveryAvailability : false;
$deliveryAvailabilityPointSale = ($deliveryAvailability instanceof DeliveryAvailabilityPointSale) ? $deliveryAvailability : false;

if($deliveryAvailabilityZone){
$query->andWhere('e.deliveryAvailabilityZone = :deliveryAvailabilityZone');
$query->setParameter('deliveryAvailabilityZone', $deliveryAvailabilityZone);
}

if($deliveryAvailabilityPointSale) {
$query->andWhere('e.deliveryAvailabilityPointSale = :deliveryAvailabilityPointSale');
$query->setParameter('deliveryAvailabilityPointSale', $deliveryAvailabilityPointSale);
}
}
else{
$query->leftJoin('e.deliveryAvailabilityZone', 'deliveryAvailabilityZone');
$query->leftJoin('deliveryAvailabilityZone.deliverySlot', 'deliverySlotZone');

$query->leftJoin('e.deliveryAvailabilityPointSale', 'deliveryAvailabilityPointSale');
$query->leftJoin('deliveryAvailabilityPointSale.deliverySlot', 'deliverySlotPointSale');
}

if (isset($params['orderBy'])) {
$query->orderBy('e.' . $params['orderBy'], isset($params['orderByDirection']) ? $params['orderByDirection'] : 'DESC');
} else {
$query->orderBy('e.id', 'DESC');
}

if (isset($params['groupBy'])) {
$query->groupBy( $params['groupBy']);
}

if (isset($params['count']) && $params['count']) {
return $query->getQuery()->getSingleScalarResult();
} else {
return $query->getQuery()->getResult();
}
}

public function findLastOrderValidOfWeek($weekNumber)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->andWhere('e.weekNumber = :weekNumber');
$query->andWhere('e.mainOrderShop = false OR e.mainOrderShop IS NULL');
$query->setParameter('weekNumber', $weekNumber);
$query->orderBy('e.weekId', 'DESC');
$query->setMaxResults(1);

return $query->getQuery()->getOneOrNullResult();

}

public function findLastOrderValid()
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->andWhere('e.mainOrderShop = false OR e.mainOrderShop IS NULL');
$query->orderBy('e.idValidOrder', 'DESC');
$query->setMaxResults(1);

return $query->getQuery()->getOneOrNullResult();
$query->leftJoin('e.deliveryAvailabilityPointSale', 'deliveryAvailabilityPointSale');
$query->leftJoin('deliveryAvailabilityPointSale.deliverySlot', 'deliverySlotPointSale');
}

if (isset($params['orderBy'])) {
$query->orderBy(
'e.'.$params['orderBy'],
isset($params['orderByDirection']) ? $params['orderByDirection'] : 'DESC'
);
} else {
$query->orderBy('e.id', 'DESC');
}

if (isset($params['groupBy'])) {
$query->groupBy($params['groupBy']);
}

if (isset($params['count']) && $params['count']) {
return $query->getQuery()->getSingleScalarResult();
} else {
return $query->getQuery()->getResult();
}
}

public function findLastOrderValidOfWeek($weekNumber)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->andWhere('e.weekNumber = :weekNumber');
$query->andWhere('e.mainOrderShop = false OR e.mainOrderShop IS NULL');
$query->setParameter('weekNumber', $weekNumber);
$query->orderBy('e.weekId', 'DESC');
$query->setMaxResults(1);

return $query->getQuery()->getOneOrNullResult();
}

public function findLastOrderValid()
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->andWhere('e.mainOrderShop = false OR e.mainOrderShop IS NULL');
$query->orderBy('e.idValidOrder', 'DESC');
$query->setMaxResults(1);

return $query->getQuery()->getOneOrNullResult();
}


}

+ 1
- 1
ShopBundle/Resources/public/js/backend/script/order/vuejs-order.js Просмотреть файл

@@ -49,7 +49,7 @@ Vue.component('order-product', {
},
modalAddReductionCredit:function () {
$(this.$parent.$refs['addReductionCreditFormTitle']).val(this.orderProduct.title);
$(this.$parent.$refs['addReductionCreditFormValue']).val(this.orderProduct.price);
$(this.$parent.$refs['addReductionCreditFormValue']).val(this.orderProduct.priceWithTaxAndReduction);
$(this.$parent.$refs['addReductionCreditFormBehaviorTaxRate']).val('tax-included').trigger('change');
$('#modal-add-reduction-credit').modal('show');
}

+ 3
- 1
ShopBundle/Resources/translations/lcshop.fr.yaml Просмотреть файл

@@ -154,7 +154,7 @@ error:
reductionCart:
conditionsError: Cette réduction ne peut pas être appliqué sur cette commande
date: La réduction n'est plus active
pointSale: L'ambassade ne correspond pas
pointSale: Cette réduction étant liée à une ambassade, le code sera à rentrer à l'étape « Paiement » (après avoir choisi la livraison dans l’ambassade correspondante).
deliveryZone: La zone de livraison ne correspond pas
deliverySlot: La créneau de livraison ne correspond pas
groupUser: Le(s) groupe(s) utilisateurs ne correspondent pas
@@ -292,6 +292,7 @@ field:
cash: Espèce
transfer: Virement
credit: Compte prépayé
transfer-gift: Transfert de bon cadeau
minimumAmountCb: "Paiement par carte bancaire : montant minimum"
emailFrom: "Email (From) : email"
emailFromName: "Email (From) : nom"
@@ -384,6 +385,7 @@ field:
ab: Agriculture biologique
hve: Haute valeur environnementale
nature-progres: Nature & progrès
tvvr: "Terra Vitis : Viticulture Responsable"
behaviorExpirationDate: Gèrer
behaviorExpirationDateOptions:
by-product-family: Par produit

+ 1
- 1
ShopBundle/Resources/views/backend/user/macros.html.twig Просмотреть файл

@@ -95,7 +95,7 @@

{% macro box_prepaid_account(user) %}
{% embed '@LcShop/backend/default/block/embed_figure_box.twig' %}
{% set userMerchant = creditUtils.getUserMerchant() %}
{% set userMerchant = creditUtils.getUserMerchant(user) %}
{% trans_default_domain 'lcshop' %}
{% block class %}bg-blue{% endblock %}
{% block icon %}cash-register{% endblock %}

+ 1
- 1
ShopBundle/Services/Price/OrderProductPriceUtils.php Просмотреть файл

@@ -89,7 +89,7 @@ class OrderProductPriceUtils

public function getMarginPercent(OrderProductInterface $orderProduct)
{
if ($this->getBuyingPrice($orderProduct)) {
if ($this->getBuyingPrice($orderProduct) && $this->getPriceWithReduction($orderProduct)) {
return $this->round(($this->getMargin($orderProduct) / $this->getPriceWithReduction($orderProduct)) * 100);
} else {
return 0;

+ 1
- 0
ShopBundle/Services/Utils.php Просмотреть файл

@@ -47,6 +47,7 @@ class Utils
const MEAN_PAYMENT_CREDIT = 'credit';
const MEAN_PAYMENT_TRANSFER = 'transfer';
const MEAN_PAYMENT_CASH = 'cash';
const MEAN_PAYMENT_GIFT = 'transfer-gift';

public function __construct(EntityManagerInterface $em, ParameterBagInterface $parameterBag, SessionInterface $session, TranslatorInterface $translator, ConfigManager $configManager, CacheManager $liipCacheHelper)
{

Загрузка…
Отмена
Сохранить