|
|
@@ -140,6 +140,8 @@ class OrderController extends ProducerBaseController |
|
|
|
|
|
|
|
$orderManager = $this->getOrderManager(); |
|
|
|
$producerManager = $this->getProducerManager(); |
|
|
|
$userManager = $this->getUserManager(); |
|
|
|
|
|
|
|
$producer = $this->getProducerCurrent(); |
|
|
|
$redirect = null; |
|
|
|
$idProducer = $producer->id; |
|
|
@@ -192,9 +194,8 @@ class OrderController extends ProducerBaseController |
|
|
|
$user = new User; |
|
|
|
$user->id_producer = 0; |
|
|
|
$user->type = User::TYPE_GUEST; |
|
|
|
$password = Password::generate(); |
|
|
|
$user->setPassword($password); |
|
|
|
$user->generateAuthKey(); |
|
|
|
$userManager->setPassword($user, Password::generate()); |
|
|
|
$userManager->generateAuthKey($user); |
|
|
|
$user->username = $posts['user']['email']; |
|
|
|
$user->email = $posts['user']['email']; |
|
|
|
$user->name = $posts['user']['firstname']; |
|
|
@@ -564,10 +565,11 @@ class OrderController extends ProducerBaseController |
|
|
|
public function actionConfirm(int $idOrder, string $returnPayment = '') |
|
|
|
{ |
|
|
|
$orderManager = $this->getOrderManager(); |
|
|
|
|
|
|
|
$order = $orderManager->findOneOrderById($idOrder); |
|
|
|
$producer = $this->getProducerCurrent(); |
|
|
|
|
|
|
|
if (!$order || (!$orderManager->isOrderBelongsToUser($order, GlobalParam::getCurrentUser()) && !$producer->option_allow_order_guest)) { |
|
|
|
if (!$order || (!$producer->option_allow_order_guest && !$orderManager->isOrderBelongsToUser($order, GlobalParam::getCurrentUser()))) { |
|
|
|
throw new \yii\base\UserException('Commande introuvable.'); |
|
|
|
} |
|
|
|
|
|
|
@@ -936,7 +938,7 @@ class OrderController extends ProducerBaseController |
|
|
|
$product['photo'] = ''; |
|
|
|
} |
|
|
|
|
|
|
|
$product['quantity_max'] = $product['productDistribution'][0]['quantity_max']; |
|
|
|
$product['quantity_max'] = (isset($product['productDistribution']) && isset($product['productDistribution'][0])) ? $product['productDistribution'][0]['quantity_max'] : null; |
|
|
|
$quantityOrder = $orderManager->getProductQuantity($productObject, $ordersArray); |
|
|
|
$product['quantity_ordered'] = $quantityOrder; |
|
|
|
$product['quantity_remaining'] = $product['quantity_max'] - $quantityOrder; |