|
- <?php
-
-
-
- namespace backend\controllers;
-
- use common\forms\SubscriptionForm;
- use common\helpers\CSV;
- use common\helpers\GlobalParam;
- use common\helpers\Price;
- use domain\Distribution\Distribution\Distribution;
- use domain\Distribution\PointSaleDistribution\PointSaleDistribution;
- use domain\Distribution\ProductDistribution\ProductDistribution;
- use domain\Order\Order\Order;
- use domain\Order\OrderStatus\OrderStatus;
- use domain\Order\ProductOrder\ProductOrder;
- use domain\Payment\Payment;
- use domain\PointSale\PointSale\PointSale;
- use domain\Product\Product\Product;
- use domain\User\User\User;
- use domain\User\UserProducer\UserProducer;
- use yii\filters\AccessControl;
- use yii\helpers\Html;
-
- class OrderController extends BackendController
- {
- var $enableCsrfValidation = false;
-
- public function behaviors()
- {
- return [
- 'access' => [
- 'class' => AccessControl::class,
- 'rules' => [
- [
- 'allow' => true,
- 'roles' => ['@'],
- 'matchCallback' => function ($rule, $action) {
- return $this->getUserModule()
- ->getAuthorizationChecker()
- ->isGrantedAsProducer($this->getUserCurrent());
- }
- ]
- ],
- ],
- ];
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
- public function actionDownload($date = '', $idPointSale = 0, $global = 0)
- {
- $orderModule = $this->getOrderModule();
- $distributionModule = $this-> getDistributionModule();
- $pointSaleModule = $this->getPointSaleModule();
- $productModule = $this->getProductModule();
- $productDistributionModule = $this->getProductDistributionModule();
-
- $distribution = $distributionModule->findOneDistribution($date);
- $selectedProductsArray = $productDistributionModule->findProductDistributionsByDistribution($distribution);
- $productsArray = $productModule->findProducts();
- $ordersArray = $orderModule->findOrdersByDistributionDate($date);
-
- $pointsSaleArray = $pointSaleModule->findPointSales();
- foreach ($pointsSaleArray as $pointSale) {
- $pointSaleModule->initOrders($pointSale, $ordersArray);
- }
-
-
-
- if ($global) {
-
- $data = [];
- $filename = 'export_' . $date . '_global';
-
- $dayWeek = date('w', strtotime($date));
- $dayWeekArray = [0 => 'sunday', 1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saturday'];
- $fieldsHoursPointSale = 'infos_' . $dayWeekArray[$dayWeek];
-
-
- foreach ($pointsSaleArray as $pointSale) {
- if (count($pointSale->orders) && strlen($pointSale->$fieldsHoursPointSale)) {
-
- $line = [$pointSale->name, 'Produits', 'Montant', 'Commentaire'];
-
- $data[] = $line;
-
- $res = $this->contentPointSaleCSV($date, $productsArray, $pointsSaleArray, $pointSale->id);
- foreach ($res['data'] as $line) {
- $data[] = $line;
- }
- }
-
- if (count($pointSale->orders) && strlen($pointSale->$fieldsHoursPointSale)) {
-
- $line = ['Total'];
- $strProducts = '';
- foreach ($productsArray as $product) {
- if (isset($selectedProductsArray[$product->id]['active']) && $selectedProductsArray[$product->id]['active']) {
- $quantity = $orderModule->getProductQuantity($product, $pointSale->orders);
- $strQuantity = '';
- if ($quantity) {
- $strQuantity = $quantity;
- $strProducts .= $strQuantity . ', ';
- }
- }
- }
- $line[] = substr($strProducts, 0, strlen($strProducts) - 2);
- $line[] = number_format($pointSale->revenues, 2) . ' €';
- $data[] = $line;
-
- $data[] = [];
- }
- }
-
- $line = ['Total'];
- $strProducts = '';
- foreach ($productsArray as $product) {
- if (isset($selectedProductsArray[$product->id]['active']) && $selectedProductsArray[$product->id]['active']) {
- $quantity = $orderModule->getProductQuantity($product, $ordersArray);
- $strQuantity = '';
- if ($quantity) {
- $strQuantity = $quantity;
- $strQuantity .= $strQuantity . ', ';
- }
- }
- }
- $line[] = substr($strProducts, 0, strlen($strProducts) - 2);
-
- $data[] = $line;
-
-
- $infos = $this->actionIndex($date, true);
-
- CSV::downloadSendHeaders($filename . '.csv');
- echo CSV::array2csv($data);
- die();
- }
-
- else {
- if ($ordersArray && count($ordersArray)) {
-
- $data = [];
-
-
- if ($idPointSale) {
- $res = $this->contentPointSaleCSV($date, $productsArray, $pointsSaleArray, $idPointSale);
- $data = $res['data'];
- $filename = $res['filename'];
- }
- else {
- $res = $this->contentRecapCSV($date, $productsArray, $pointsSaleArray, $ordersArray);
- $filename = 'summary_' . $date;
- $data = $res['data'];
- }
-
- CSV::downloadSendHeaders($filename . '.csv');
- echo CSV::array2csv($data);
- die();
- }
- }
- }
-
-
-
- public function contentRecapCSV(string $date, array $products, array $pointsSale, array $orders)
- {
- $orderModule = $this->getOrderModule();
- $distributionModule = $this-> getDistributionModule();
- $productDistributionModule = $this->getProductDistributionModule();
-
- $data = [];
- $filename = 'summary_' . $date;
-
- $distribution = $distributionModule->findOneDistribution($date);
- $selectedProductsArray = $productDistributionModule->findProductDistributionsByDistribution($distribution);
-
-
- $data[0] = ['Lieu'];
- foreach ($products as $product) {
- if (isset($selectedProductsArray[$product->id]['active']) && $selectedProductsArray[$product->id]['active']) {
- $data[0][] = $product->description;
- }
- }
-
- $dayWeek = date('w', strtotime($date));
- $dayWeekArray = [0 => 'sunday', 1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saturday'];
- $fieldHoursPointSale = 'infos_' . $dayWeekArray[$dayWeek];
-
-
-
- foreach ($pointsSale as $pointSale) {
- if (count($pointSale->orders) && strlen($pointSale->$fieldHoursPointSale)) {
- $dataAdd = [$pointSale->name];
- foreach ($products as $product) {
- if (isset($selectedProductsArray[$product->id]['active']) && $selectedProductsArray[$product->id]['active']) {
- $dataAdd[] = $orderModule->getProductQuantity($product, $pointSale->orders);
- }
- }
- $data[] = $dataAdd;
- }
- }
-
- $dataAdd = ['Total'];
- foreach ($products as $product) {
- if (isset($selectedProductsArray[$product->id]['active']) && $selectedProductsArray[$product->id]['active']) {
- $dataAdd[] = $orderModule->getProductQuantity($product, $orders);
- }
- }
- $data[] = $dataAdd;
-
- return [
- 'data' => $data,
- 'filename' => $filename
- ];
- }
-
-
-
- public function contentPointSaleCSV($date, $products, $pointsSale, $idPointSale)
- {
- $distributionModule = $this-> getDistributionModule();
- $productDistributionModule = $this->getProductDistributionModule();
-
- $data = [];
- $distribution = $distributionModule->findOneDistribution($date);
- $selectedProductsArray = $productDistributionModule->findProductDistributionsByDistribution($distribution);
-
-
- foreach ($pointsSale as $pointSale) {
- if ($pointSale->id == $idPointSale) {
-
- $filename = 'export_' . $date . '_' . strtolower(str_replace(' ', '-', $pointSale->name));
-
- foreach ($pointSale->orders as $order) {
- $strUser = '';
-
- if ($order->user) {
- $strUser = $order->user->name . " " . $order->user->lastname;
- } else {
- $strUser = $order->username;
- }
-
-
- if (isset($order->user) && strlen($order->user->phone)) {
- $strUser .= ' (' . $order->user->phone . ')';
- }
-
- $dataAdd = [$strUser];
-
-
- $strProducts = '';
- foreach ($products as $product) {
- if (isset($selectedProductsArray[$product->id]['active']) && $selectedProductsArray[$product->id]['active']) {
- $add = false;
- foreach ($product->productOrder as $productOrder) {
- if ($product->id == $productOrder->id_product) {
- $strProducts .= $productOrder->quantity;
- $add = true;
- }
- }
- }
- }
-
- $dataAdd[] = substr($strProducts, 0, strlen($strProducts) - 2);
- $dataAdd[] = number_format($order->amount, 2) . ' €';
- $dataAdd[] = $order->comment;
-
- $data[] = $dataAdd;
- }
- }
- }
-
- return [
- 'data' => $data,
- 'filename' => $filename
- ];
- }
-
-
-
- public function actionChangeState(string $date, bool $active, bool $redirect = true)
- {
- $distributionModule = $this-> getDistributionModule();
- $distribution = $distributionModule->createDistributionIfNotExist($date);
- $distributionModule->activeDistribution($distribution, $active);
-
- if ($redirect) {
- $this->redirect(['index', 'date' => $date]);
- }
- }
-
-
-
- public function actionChangeStateWeek(string $date, bool $active)
- {
- $pointSaleModule = $this->getPointSaleModule();
-
- $pointsSaleArray = $pointSaleModule->findPointSales();
-
- $week = sprintf('%02d', date('W', strtotime($date)));
- $start = strtotime(date('Y', strtotime($date)) . 'W' . $week);
- $dateMonday = date('Y-m-d', strtotime('Monday', $start));
- $dateTuesday = date('Y-m-d', strtotime('Tuesday', $start));
- $dateWednesday = date('Y-m-d', strtotime('Wednesday', $start));
- $dateThursday = date('Y-m-d', strtotime('Thursday', $start));
- $dateFriday = date('Y-m-d', strtotime('Friday', $start));
- $dateSaturday = date('Y-m-d', strtotime('Saturday', $start));
- $dateSunday = date('Y-m-d', strtotime('Sunday', $start));
-
- $activeMonday = false;
- $activeTuesday = false;
- $activeWednesday = false;
- $activeThursday = false;
- $activeFriday = false;
- $activeSaturday = false;
- $activeSunday = false;
-
- foreach ($pointsSaleArray as $pointSale) {
- if ($pointSale->delivery_monday) $activeMonday = true;
- if ($pointSale->delivery_tuesday) $activeTuesday = true;
- if ($pointSale->delivery_wednesday) $activeWednesday = true;
- if ($pointSale->delivery_thursday) $activeThursday = true;
- if ($pointSale->delivery_friday) $activeFriday = true;
- if ($pointSale->delivery_saturday) $activeSaturday = true;
- if ($pointSale->delivery_sunday) $activeSunday = true;
- }
-
- if ($activeMonday || !$active) $this->actionChangeState($dateMonday, $active, false);
- if ($activeTuesday || !$active) $this->actionChangeState($activeTuesday, $active, false);
- if ($activeWednesday || !$active) $this->actionChangeState($activeWednesday, $active, false);
- if ($activeThursday || !$active) $this->actionChangeState($activeThursday, $active, false);
- if ($activeFriday || !$active) $this->actionChangeState($activeFriday, $active, false);
- if ($activeSaturday || !$active) $this->actionChangeState($activeSaturday, $active, false);
- if ($activeSunday || !$active) $this->actionChangeState($activeSunday, $active, false);
-
- $this->redirect(['index', 'date' => $date]);
- }
-
-
-
- public function actionAjaxDelete(int $idOrder)
- {
- \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
-
- $orderModule = $this->getOrderModule();
-
- $order = $orderModule->findOneOrderById($idOrder);
- if ($order) {
- $orderModule->getManager()->deleteOrder($order, $this->getUserCurrent());
- }
-
- return ['success'];
- }
-
-
-
-
- public function actionDelete(string $date, int $idOrder)
- {
- $orderModule = $this->getOrderModule();
- $order = $orderModule->findOneOrderById($idOrder);
- if ($order) {
- $orderModule->getManager()->deleteOrder($order, $this->getUserCurrent());
- }
-
- $this->redirect(['index', 'date' => $date]);
- }
-
-
-
- public function actionAjaxCreate(
- $date, $idPointSale, $idUser, $username, $meanPayment = '', $products, $comment, $debitCredit = false)
- {
- \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
-
- $distributionModule = $this-> getDistributionModule();
- $pointSaleModule = $this->getPointSaleModule();
- $userPointSaleModule = $this->getUserPointSaleModule();
- $userModule = $this->getUserModule();
- $userProducerModule = $this->getUserProducerModule();
- $producerModule = $this->getProducerModule();
- $productModule = $this->getProductModule();
- $orderModule = $this->getOrderModule();
-
- $products = json_decode($products);
- $pointSale = $pointSaleModule->findOnePointSaleById($idPointSale);
- $distribution = $distributionModule->findOneDistribution($date);
- $producerCurrent = $this->getProducerCurrent();
- $userCurrent = $this->getUserCurrent();
-
- if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $date)
- && ($idUser || strlen($username))
- && $pointSale
- && count(get_object_vars($products))
- && $distribution) {
-
- $order = new Order;
- $order->date = date('Y-m-d H:i:s');
- $order->id_point_sale = $idPointSale;
- $order->mean_payment = $meanPayment;
- $order->id_distribution = $distribution->id;
- $order->origin = Order::ORIGIN_ADMIN;
- $order->comment = $comment;
-
- if ($idUser) {
- $order->id_user = $idUser;
-
-
- $userPointSale = $userPointSaleModule->findOneUserPointSale($userModule->findOneUserById($idUser), $pointSale);
-
- if ($userPointSale && strlen($userPointSale->comment)) {
- $order->comment_point_sale = $userPointSale->comment;
- }
- } else {
- $order->username = $username;
- $order->id_user = 0;
- }
-
- $order->save();
-
- $orderModule->getManager()->changeOrderStatus($order, OrderStatus::ALIAS_ORDERED, $userCurrent);
-
- $user = false;
- $userProducer = false;
- if (isset($order->user) && $order->user) {
- $user = $order->user;
-
- $userProducer = $userProducerModule->findOneUserProducer($user);
- }
-
- foreach ($products as $key => $dataProductOrder) {
- $product = $productModule->findOneProductById($key);
- if(isset(Product::$unitsArray[$dataProductOrder->unit]) && Product::$unitsArray[$dataProductOrder->unit]['coefficient']) {
- $quantity = $dataProductOrder->quantity / Product::$unitsArray[$dataProductOrder->unit]['coefficient'];
- if ($product && $quantity) {
- $productOrder = new ProductOrder;
- $productOrder->id_order = $order->id;
- $productOrder->id_product = $key;
- $productOrder->quantity = $quantity;
- $productOrder->unit = $product->unit;
- $productOrder->step = $product->step;
- if ($dataProductOrder->price) {
- $productOrder->price = $dataProductOrder->price;
- } else {
- $productOrder->price = $productModule->getPrice($product, [
- 'user' => $user,
- 'user_producer' => $userProducer,
- 'point_sale' => $order->pointSale,
- 'quantity' => $productOrder->quantity
- ]);
- }
- $productOrder->id_tax_rate = $product->taxRate->id;
- $productOrder->save();
- }
- }
- }
-
- $order = $orderModule->findOneOrderById($order->id);
- $orderModule->initOrder($order);
- if ($order && $orderModule->isCreditAutoPayment($order, $debitCredit)) {
- $orderModule->processCredit($order);
- }
-
- $order = $orderModule->findOneOrderById($order->id);
- $orderModule->initOrder($order);
- if ($order) {
- $orderModule->generateOrderReference($order);
- $orderModule->updateOrderTillerSynchronization($order);
- }
-
-
- if ($idUser && $pointSale) {
- $pointSaleModule->addUser($user, $pointSale);
- }
- }
-
- return ['success'];
- }
-
-
-
- public function actionAjaxUpdate()
- {
- \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
-
- $orderModule = $this->getOrderModule();
- $userModule = $this->getUserModule();
- $pointSaleModule = $this->getPointSaleModule();
- $userPointSaleModule = $this->getUserPointSaleModule();
- $paymentManager = $this->getPaymentModule();
- $productModule = $this->getProductModule();
-
- $request = \Yii::$app->request;
- $date = $request->post('date');
- $idOrder = $request->post('idOrder');
- $idPointSale = $request->post('idPointSale');
- $idUser = $request->post('idUser');
- $username = $request->post('username');
- $meanPayment = $request->post('meanPayment');
- $products = $request->post('products');
- $comment = $request->post('comment');
- $debitCredit = $request->post('debitCredit');
-
- $order = $orderModule->findOneOrderById($idOrder);
- $orderModule->initOrder($order);
-
- $user = $userModule->findOneUserById($idUser);
- $pointSale = $pointSaleModule->findOnePointSaleById($idPointSale);
-
- if ($order
- && $order->distribution->id_producer == GlobalParam::getCurrentProducerId()) {
-
-
- $oldIdUser = $order->id_user;
- $amountPaid = $orderModule->getOrderAmountWithTax($order, Order::AMOUNT_PAID);
- if ($oldIdUser != $idUser && $amountPaid > 0) {
- $paymentManager->refundOrderCredit($order, $this->getUserCurrent());
- $order = $orderModule->findOneOrderById($idOrder);
- $orderModule->initOrder($order);
- }
-
- if ($idUser) {
- $order->username = '';
- $order->id_user = $idUser;
-
-
- $userPointSale = $userPointSaleModule->findOneUserPointSale($user, $pointSale);
- if ($userPointSale && strlen($userPointSale->comment)) {
- $order->comment_point_sale = $userPointSale->comment;
- }
- } else {
- $order->username = $username;
- $order->id_user = 0;
- }
-
- $user = User::searchOne(['id' => $order->id_user]);
- $userProducer = false;
- if ($user) {
- $userProducer = UserProducer::searchOne([
- 'id_user' => $user->id,
- 'id_producer' => $order->distribution->id_producer
- ]);
- }
-
- $products = json_decode($products);
- foreach ($products as $key => $dataProductOrder) {
- $productOrder = ProductOrder::findOne([
- 'id_order' => $idOrder,
- 'id_product' => $key
- ]);
-
- $quantity = $dataProductOrder->quantity
- / Product::$unitsArray[$dataProductOrder->unit]['coefficient'];
-
- if ($quantity) {
- if ($productOrder) {
- $productOrder->quantity = $quantity;
- $productOrder->price = $dataProductOrder->price;
-
- if(isset($dataProductOrder->invoice_price) && $dataProductOrder->invoice_price) {
- $productOrder->invoice_price = $dataProductOrder->invoice_price;
- }
- } else {
- $product = Product::findOne($key);
-
- if ($product) {
- $productOrder = new ProductOrder;
- $productOrder->id_order = $idOrder;
- $productOrder->id_product = $key;
- $productOrder->quantity = $quantity;
- $productOrder->unit = $product->unit;
- $productOrder->step = $product->step;
- $productOrder->id_tax_rate = $product->taxRate->id;
-
- if ($dataProductOrder->price) {
- $productOrder->price = $dataProductOrder->price;
- } else {
- $productOrder->price = $productModule->getPrice($product, [
- 'user' => $user,
- 'user_producer' => $userProducer,
- 'point_sale' => $order->pointSale,
- 'quantity' => $productOrder->quantity
- ]);
- }
- }
- }
-
- $productOrder->save();
- } else {
- if ($productOrder) {
- $productOrder->delete();
- }
- }
- }
-
- $order->id_point_sale = $idPointSale;
- $order->mean_payment = $meanPayment;
- $order->comment = $comment;
-
- $order->save();
-
- $orderModule->getManager()->changeOrderStatus($order, OrderStatus::ALIAS_UPDATED, $this->getUserCurrent());
-
- $order = Order::searchOne(['id' => $order->id]);
- $orderModule->initOrder($order);
- if ($order && $orderModule->isCreditAutoPayment($order, $debitCredit)) {
- $orderModule->processCredit($order);
- }
- }
- }
-
-
-
- public function actionPaymentStatus(int $idOrder)
- {
- $orderModule = $this->getOrderModule();
- $paymentManager = $this->getPaymentModule();
-
- $order = $orderModule->findOneOrderById($idOrder);
-
- if ($order) {
- $html = '';
-
- if ($order->id_user) {
- $userProducer = UserProducer::find()
- ->where([
- 'id_user' => $order->id_user,
- 'id_producer' => $order->distribution->id_producer
- ])
- ->one();
-
- $amountPaid = $orderModule->getOrderAmount($order, Order::AMOUNT_PAID);
-
- if (abs($order->amount - $amountPaid) < 0.0001) {
- $html .= '<span class="label label-success">Payé</span>';
- $buttonsCredit = Html::a('Rembourser ' . $orderModule->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL, true), 'javascript:void(0);', ['class' => 'btn btn-default btn-xs rembourser', 'data-montant' => $order->amount, 'data-type' => 'refund']);
- } elseif ($order->amount > $amountPaid) {
- $amountToPay = $order->amount - $amountPaid;
- $html .= '<span class="label label-danger">Non payé</span> reste <strong>' . number_format($amountToPay, 2) . ' €</strong> à débiter';
- $buttonsCredit = Html::a('Débiter ' . number_format($amountToPay, 2) . ' €', 'javascript:void(0);', ['class' => 'btn btn-default btn-xs payer', 'data-montant' => $amountToPay, 'data-type' => 'payment']);
- } elseif ($order->amount < $amountPaid) {
- $amountToRefund = $amountPaid - $order->amount;
- $html .= ' <span class="label label-success">Payé</span> <strong>' . number_format($amountToRefund, 2) . ' €</strong> à rembourser';
- $buttonsCredit = Html::a('Rembourser ' . number_format($amountToRefund, 2) . ' €', 'javascript:void(0);', ['class' => 'btn btn-default btn-xs rembourser', 'data-montant' => $amountToRefund, 'data-type' => 'refund']);
- }
-
- $html .= '<span class="buttons-credit">'
- . 'Cagnotte : <strong>' . number_format($userProducer->credit, 2) . ' €</strong><br />'
- . $buttonsCredit
- . '</span>';
-
-
- $history = Payment::find()
- ->with('userAction')
- ->where(['id_order' => $idOrder])
- ->all();
-
- $html .= '<br /><br /><strong>Historique</strong><br /><table class="table table-condensed table-bordered">'
- . '<thead><tr><th>Date</th><th>Utilisateur</th><th>Action</th><th>- Débit</th><th>+ Crédit</th></tr></thead>'
- . '<tbody>';
-
- if ($history && is_array($history) && count($history)) {
- foreach ($history as $creditHistory) {
- $html .= '<tr>'
- . '<td>' . date('d/m/Y H:i:s', strtotime($paymentManager->getDate($creditHistory))) . '</td>'
- . '<td>' . Html::encode($paymentManager->getStrUserAction($creditHistory)) . '</td>'
- . '<td>' . $paymentManager->getStrWording($creditHistory) . '</td>'
- . '<td>' . ($paymentManager->isTypeDebit($creditHistory) ? '- ' . Price::getPriceWithTax($creditHistory->amount) : '') . '</td>'
- . '<td>' . ($paymentManager->isTypeCredit($creditHistory) ? '+ ' . Price::getPriceWithTax($creditHistory->amount) : '') . '</td>'
- . '</tr>';
- }
- } else {
- $html .= '<tr><td colspan="4">Aucun résultat</td></tr>';
- }
-
- $html .= '</tbody></table>';
- } else {
- $html .= '<div class="alert alert-warning">Pas de gestion de crédit pain pour cette commande car elle n\'est pas liée à un compte utilisateur.</div>';
- }
-
- echo json_encode([
- 'html_payment_status' => $html,
- 'json_order' => $order->getDataJson()
- ]);
- }
-
- die();
- }
-
-
-
- public function actionAjaxPayment(int $idOrder, string $type, string $meanPayment): array
- {
- \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
-
- $orderModule = $this->getOrderModule();
- $paymentManager = $this->getPaymentModule();
- $order = $orderModule->findOneOrderById($idOrder);
- $orderModule->initOrder($order);
-
- if ($order) {
- $paymentManager->payOrRefundOrder($type, $order, $meanPayment, $this->getUserCurrent());
- }
-
- return ['success'];
- }
-
-
-
- public function actionAjaxChangeSynchroTiller(int $idOrder, bool $boolSynchroTiller): array
- {
- \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
-
- $orderModule = $this->getOrderModule();
-
- $order = $orderModule->findOneOrderById($idOrder);
- if ($order) {
- $orderModule->updateOrderTillerSynchronization($order, (int) $boolSynchroTiller);
- return ['success'];
- }
-
- return ['error'];
- }
-
- }
-
|