瀏覽代碼

Correctifs refactoring Unit

feature/souke
Guillaume Bourgeois 1 年之前
父節點
當前提交
3171129bb2
共有 3 個文件被更改,包括 4 次插入4 次删除
  1. +1
    -1
      backend/controllers/DocumentController.php
  2. +1
    -1
      common/forms/SubscriptionForm.php
  3. +2
    -2
      producer/controllers/SubscriptionController.php

+ 1
- 1
backend/controllers/DocumentController.php 查看文件

@@ -618,7 +618,7 @@ class DocumentController extends BackendController
'order',
function ($product) use ($document, $userProducer, $pointSale, $productModule) {
return array_merge($product->getAttributes(), [
'unit_coefficient' => $productModule->getSolver()->getUnitCoefficient($product->unit),
'unit_coefficient' => $productModule->getSolver()->getUnitCoefficient($product),
'prices' => $productModule->getPriceArray($product, $userProducer->user, $pointSale),
'wording_unit' => $product->wording_unit,
'tax_rate' => $product->taxRate->value

+ 1
- 1
common/forms/SubscriptionForm.php 查看文件

@@ -177,7 +177,7 @@ class SubscriptionForm extends Model
$newProductSubscription = new ProductSubscription;
$newProductSubscription->id_subscription = $subscription->id;
$newProductSubscription->id_product = $idProduct;
$newProductSubscription->quantity = $quantity / $productModule->getSolver()->getUnitCoefficient($product->unit);
$newProductSubscription->quantity = $quantity / $productModule->getSolver()->getUnitCoefficient($product);

$newProductSubscription->save();
}

+ 2
- 2
producer/controllers/SubscriptionController.php 查看文件

@@ -265,11 +265,11 @@ class SubscriptionController extends ProducerBaseController
$indexProduct = 0;
foreach ($productsArray as &$product) {
$quantity = 0;
$coefficientUnit = $productModule->getSolver()->getUnitCoefficient($product->unit);
$coefficientUnit = $productModule->getSolver()->getUnitCoefficient($product);
if (isset($arrayProductsSubscription) && count($arrayProductsSubscription)) {
foreach ($arrayProductsSubscription as $productSubscription) {
if ($product->id == $productSubscription->id_product) {
$coefficientUnit = $productModule->getSolver()->getUnitCoefficient($productSubscription->product->unit);
$coefficientUnit = $productModule->getSolver()->getUnitCoefficient($productSubscription->product);
$quantity = $productSubscription->quantity * $coefficientUnit;
}
}

Loading…
取消
儲存