Ver código fonte

Modifications fonction changement de TVA #165

dev
Guillaume Bourgeois 4 anos atrás
pai
commit
8e208dc1f8
1 arquivos alterados com 5 adições e 8 exclusões
  1. +5
    -8
      backend/controllers/ProducerAdminController.php

+ 5
- 8
backend/controllers/ProducerAdminController.php Ver arquivo

@@ -180,19 +180,16 @@ class ProducerAdminController extends BackendController
]);
}
public function actionProducerInstallTaxUpdatePrices($idProducer, $idTaxRate)
public function actionProducerInstallTaxUpdatePrices($idProducer)
{
$taxRate = TaxRate::searchOne([
'id' => $idTaxRate
]) ;
// product
$productsArray = Product::searchAll([
'id_producer' => $idProducer
]) ;
foreach($productsArray as $product) {
$product->price = $product->price / (1 + $taxRate->value) ;
$product->price = $product->price / (1 + $product->taxRate->value) ;
$product->save() ;
}
// product_order
@@ -201,7 +198,7 @@ class ProducerAdminController extends BackendController
]) ;
foreach($ordersArray as $order) {
foreach($order->productOrder as $productOrder) {
$productOrder->price = $productOrder->price / (1 + $taxRate->value) ;
$productOrder->price = $productOrder->price / (1 + $productOrder->taxRate->value) ;
$productOrder->save() ;
}
}
@@ -212,7 +209,7 @@ class ProducerAdminController extends BackendController
]) ;
foreach($subscriptionsArray as $subscription) {
foreach($subscription->productSubscription as $productSubscription) {
$productSubscription->price = $productSubscription->price / (1 + $taxRate->value) ;
$productSubscription->price = $productSubscription->price / (1 + $productSubscription->taxRate->value) ;
$productSubscription->save() ;
}
}

Carregando…
Cancelar
Salvar