|
|
@@ -39,14 +39,14 @@ |
|
|
|
namespace common\models; |
|
|
|
|
|
|
|
use common\helpers\GlobalParam; |
|
|
|
use common\models\PointSale; |
|
|
|
use common\models\User; |
|
|
|
use Yii; |
|
|
|
use common\components\ActiveRecordCommon; |
|
|
|
use common\models\Producer; |
|
|
|
use common\models\PointSale; |
|
|
|
use common\models\UserPointSale; |
|
|
|
use common\models\Order; |
|
|
|
use common\models\ProductOrder; |
|
|
|
use common\models\User; |
|
|
|
|
|
|
|
/** |
|
|
|
* This is the model class for table "commande_auto". |
|
|
@@ -187,6 +187,12 @@ class Subscription extends ActiveRecordCommon |
|
|
|
} else { |
|
|
|
$order->id_user = $this->id_user; |
|
|
|
} |
|
|
|
|
|
|
|
$user = false; |
|
|
|
if($this->id_user) { |
|
|
|
$user = User::findOne($this->id_user); |
|
|
|
} |
|
|
|
|
|
|
|
$order->date = date('Y-m-d H:i:s'); |
|
|
|
$order->origin = Order::ORIGIN_AUTO; |
|
|
|
$order->id_point_sale = $this->id_point_sale; |
|
|
@@ -248,8 +254,8 @@ class Subscription extends ActiveRecordCommon |
|
|
|
$productOrder->id_product = $productSubscription->product->id; |
|
|
|
$productOrder->quantity = $productSubscription->quantity; |
|
|
|
$productOrder->price = $productSubscription->product->getPrice([ |
|
|
|
'id_user' => $this->id_user, |
|
|
|
'id_point_sale' => $this->id_point_sale |
|
|
|
'user' => $user, |
|
|
|
'point_sale' => $pointSale |
|
|
|
]); |
|
|
|
$productOrder->unit = $productSubscription->product->unit; |
|
|
|
$productOrder->step = $productSubscription->product->step; |