Bläddra i källkod

Modifications fonction changement de TVA #165

refactoring
Guillaume Bourgeois 4 år sedan
förälder
incheckning
8e208dc1f8
1 ändrade filer med 5 tillägg och 8 borttagningar
  1. +5
    -8
      backend/controllers/ProducerAdminController.php

+ 5
- 8
backend/controllers/ProducerAdminController.php Visa fil

@@ -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() ;
}
}

Laddar…
Avbryt
Spara