|
|
|
|
|
|
|
|
$user->phone = $posts['user']['phone']; |
|
|
$user->phone = $posts['user']['phone']; |
|
|
$user->save(); |
|
|
$user->save(); |
|
|
// liaison producer / user |
|
|
// liaison producer / user |
|
|
$producer->addUser($user->id, $idProducer); |
|
|
|
|
|
|
|
|
$producerManager->addUser($user, $producer); |
|
|
} else { |
|
|
} else { |
|
|
$producer->addUser($user->id, $idProducer); |
|
|
|
|
|
|
|
|
$producerManager->addUser($user, $producer); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Order $order = null |
|
|
Order $order = null |
|
|
) |
|
|
) |
|
|
{ |
|
|
{ |
|
|
|
|
|
$orderManager = $this->getOrderManager(); |
|
|
$json = []; |
|
|
$json = []; |
|
|
$format = 'Y-m-d'; |
|
|
$format = 'Y-m-d'; |
|
|
$dateObject = DateTime::createFromFormat($format, $date); |
|
|
$dateObject = DateTime::createFromFormat($format, $date); |
|
|
|
|
|
|
|
|
$json['points_sale'] = $this->ajaxInfosPointsSale($producer, $distribution); |
|
|
$json['points_sale'] = $this->ajaxInfosPointsSale($producer, $distribution); |
|
|
$json['categories'] = $this->ajaxInfosProductCategories($producer); |
|
|
$json['categories'] = $this->ajaxInfosProductCategories($producer); |
|
|
$json['products'] = $this->ajaxInfosProducts($producer, $distribution, $pointSale, $user, $order); |
|
|
$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; |
|
|
return $json; |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
$orderManager = $this->getOrderManager(); |
|
|
$orderManager = $this->getOrderManager(); |
|
|
|
|
|
|
|
|
$orderUser = false; |
|
|
|
|
|
|
|
|
$orderUser = null; |
|
|
if (GlobalParam::getCurrentUserId()) { |
|
|
if (GlobalParam::getCurrentUserId()) { |
|
|
$conditionOrderUser = [ |
|
|
$conditionOrderUser = [ |
|
|
'distribution.date' => $date, |
|
|
'distribution.date' => $date, |
|
|
|
|
|
|
|
|
$orderUser = Order::searchOne($conditionOrderUser); |
|
|
$orderUser = Order::searchOne($conditionOrderUser); |
|
|
|
|
|
|
|
|
if ($orderUser && $orderUser->online_payment_url) { |
|
|
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; |
|
|
return $orderUser; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |