|
|
@@ -183,7 +183,13 @@ class OrderController extends ProducerBaseController |
|
|
|
]) |
|
|
|
->one(); |
|
|
|
|
|
|
|
if (!$order) { |
|
|
|
if($order) { |
|
|
|
if($order->id_point_sale != $posts['Order']['id_point_sale']) { |
|
|
|
$order->id_point_sale = $posts['Order']['id_point_sale'] ; |
|
|
|
$order->date_update = date('Y-m-d H:i:s') ; |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
$order = new Order; |
|
|
|
$order->load(Yii::$app->request->post()); |
|
|
|
$order->id_user = User::getCurrentId(); |
|
|
@@ -335,7 +341,11 @@ class OrderController extends ProducerBaseController |
|
|
|
$productOrder->id_order = $order->id; |
|
|
|
$productOrder->id_product = $product->id; |
|
|
|
|
|
|
|
$productOrder->price = $product->price; |
|
|
|
$productOrder->price = $product->getPrice([ |
|
|
|
'user' => User::getCurrent(), |
|
|
|
'user_producer' => $userProducer, |
|
|
|
'point_sale' => $pointSale |
|
|
|
]); |
|
|
|
$productOrder->id_tax_rate = $product->taxRate->id; |
|
|
|
|
|
|
|
$unit = (!is_null($order) && isset($unitsArray[$product->id])) ? $unitsArray[$product->id] : $product->unit; |