浏览代码

[backend] Distributions : optimisation chargement ajax des distributions (commandes, produits)

refactoring
父节点
当前提交
265106496c
共有 2 个文件被更改,包括 14 次插入7 次删除
  1. +2
    -2
      backend/controllers/DistributionController.php
  2. +12
    -5
      common/models/Order.php

+ 2
- 2
backend/controllers/DistributionController.php 查看文件

@@ -156,8 +156,8 @@ class DistributionController extends BackendController
}])
->orderBy('product_distribution.active DESC, order ASC')
->asArray()
->all();
->all();
$potentialRevenues = 0;
$potentialWeight = 0;

+ 12
- 5
common/models/Order.php 查看文件

@@ -206,10 +206,15 @@ class Order extends ActiveRecordCommon
*/
public function initPaidAmount()
{
$history = CreditHistory::find()
->where(['id_order' => $this->id])
->all();

if(isset($this->creditHistory)) {
$history = $this->creditHistory ;
}
else {
$history = CreditHistory::find()
->where(['id_order' => $this->id])
->all();
}
$this->paid_amount = 0 ;

if(count($history)) {
@@ -665,7 +670,9 @@ class Order extends ActiveRecordCommon
if(is_array($orders)) {
if(count($orders)) {
foreach($orders as $order) {
$order->init() ;
if(is_a($order, 'common\models\Order')) {
$order->init() ;
}
}
return $orders ;
}

正在加载...
取消
保存