|
|
@@ -202,9 +202,9 @@ class OrderController extends ProducerBaseController |
|
|
|
$user->phone = $posts['user']['phone']; |
|
|
|
$user->save(); |
|
|
|
// liaison producer / user |
|
|
|
$producer->addUser($user->id, $idProducer); |
|
|
|
$producerManager->addUser($user, $producer); |
|
|
|
} else { |
|
|
|
$producer->addUser($user->id, $idProducer); |
|
|
|
$producerManager->addUser($user, $producer); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -612,6 +612,7 @@ class OrderController extends ProducerBaseController |
|
|
|
Order $order = null |
|
|
|
) |
|
|
|
{ |
|
|
|
$orderManager = $this->getOrderManager(); |
|
|
|
$json = []; |
|
|
|
$format = 'Y-m-d'; |
|
|
|
$dateObject = DateTime::createFromFormat($format, $date); |
|
|
@@ -628,6 +629,13 @@ class OrderController extends ProducerBaseController |
|
|
|
$json['points_sale'] = $this->ajaxInfosPointsSale($producer, $distribution); |
|
|
|
$json['categories'] = $this->ajaxInfosProductCategories($producer); |
|
|
|
$json['products'] = $this->ajaxInfosProducts($producer, $distribution, $pointSale, $user, $order); |
|
|
|
|
|
|
|
if ($order) { |
|
|
|
$json['order'] = array_merge($order->getAttributes(), [ |
|
|
|
'amount_total' => $orderManager->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL), |
|
|
|
'amount_paid' => $orderManager->getOrderAmount($order, Order::AMOUNT_PAID), |
|
|
|
]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return $json; |
|
|
@@ -961,7 +969,7 @@ class OrderController extends ProducerBaseController |
|
|
|
{ |
|
|
|
$orderManager = $this->getOrderManager(); |
|
|
|
|
|
|
|
$orderUser = false; |
|
|
|
$orderUser = null; |
|
|
|
if (GlobalParam::getCurrentUserId()) { |
|
|
|
$conditionOrderUser = [ |
|
|
|
'distribution.date' => $date, |
|
|
@@ -975,17 +983,10 @@ class OrderController extends ProducerBaseController |
|
|
|
$orderUser = Order::searchOne($conditionOrderUser); |
|
|
|
|
|
|
|
if ($orderUser && $orderUser->online_payment_url) { |
|
|
|
$orderUser = false; |
|
|
|
$orderUser = null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ($orderUser) { |
|
|
|
$json['order'] = array_merge($orderUser->getAttributes(), [ |
|
|
|
'amount_total' => $orderManager->getOrderAmountWithTax($orderUser, Order::AMOUNT_TOTAL), |
|
|
|
'amount_paid' => $orderManager->getOrderAmount($orderUser, Order::AMOUNT_PAID), |
|
|
|
]); |
|
|
|
} |
|
|
|
|
|
|
|
return $orderUser; |
|
|
|
} |
|
|
|
} |