Selaa lähdekoodia

Modifications fonction changement de TVA #165

dev
Guillaume Bourgeois 4 vuotta sitten
vanhempi
commit
8e208dc1f8
1 muutettua tiedostoa jossa 5 lisäystä ja 8 poistoa
  1. +5
    -8
      backend/controllers/ProducerAdminController.php

+ 5
- 8
backend/controllers/ProducerAdminController.php Näytä tiedosto

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

Loading…
Peruuta
Tallenna