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

@@ -47,6 +47,9 @@ label.form.empty_value: Choisissez une option
form.label.delete: Supprimer l'image
field:
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:
date: La réduction n'est plus active
pointSale: L'ambassade ne correspond pas

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

@@ -381,19 +381,20 @@ class OrderUtils
$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;
} else {
$order->changeStatusError[] = 'field.error.orderStatus.noPayment';
return false;
}
}

public function getTotalOrderPayments($orderShop): float
public function getTotalOrderPayments($order): float
{
$totalAmount = floatval(0);
foreach ($orderShop->getOrderPayments() as $orderPayment) {
foreach ($order->getOrderPayments() as $orderPayment) {
$totalAmount = $orderPayment->getAmount() + $totalAmount;
}
return $totalAmount;
@@ -451,4 +452,8 @@ class OrderUtils
}

}

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

Loading…
Cancel
Save