Browse Source

Processus de commande

feature/export_comptable
Fab 4 years ago
parent
commit
3ff8e51f79
2 changed files with 12 additions and 4 deletions
  1. +3
    -0
      ShopBundle/Resources/translations/lcshop.fr.yaml
  2. +9
    -4
      ShopBundle/Services/OrderUtils.php

+ 3
- 0
ShopBundle/Resources/translations/lcshop.fr.yaml View File

form.label.delete: Supprimer l'image form.label.delete: Supprimer l'image
field: field:
error: error:
orderStatus:
nextStatusAllowed: La commande ne peut passer à ce statut
noPayment: Le montant de la commande n'a pas été règlé dans sa totalité
reductionCart: reductionCart:
date: La réduction n'est plus active date: La réduction n'est plus active
pointSale: L'ambassade ne correspond pas pointSale: L'ambassade ne correspond pas

+ 9
- 4
ShopBundle/Services/OrderUtils.php View File

$this->em->flush(); $this->em->flush();
} }


public function isOrderPaid($orderShop)
public function isOrderPaid($order)
{ {
if ($this->getTotalOrderPayments($orderShop) >= $this->priceUtils->getTotalWithTaxAndReduction($orderShop)) {
if ($this->getTotalOrderPayments($order) >= $this->priceUtils->getTotalWithTaxAndReduction($order)) {
return true; return true;
} else { } else {
$order->changeStatusError[] = 'field.error.orderStatus.noPayment';
return false; return false;
} }
} }


public function getTotalOrderPayments($orderShop): float
public function getTotalOrderPayments($order): float
{ {
$totalAmount = floatval(0); $totalAmount = floatval(0);
foreach ($orderShop->getOrderPayments() as $orderPayment) {
foreach ($order->getOrderPayments() as $orderPayment) {
$totalAmount = $orderPayment->getAmount() + $totalAmount; $totalAmount = $orderPayment->getAmount() + $totalAmount;
} }
return $totalAmount; return $totalAmount;
} }


} }

public function isCartAllowToBeOrder($order){
return true;
}
} }

Loading…
Cancel
Save