@@ -48,14 +48,17 @@ discard block |
||
48 | 48 | |
49 | 49 | public function printOrder(Order $order, ?array $devices = []) |
50 | 50 | { |
51 | - if (empty($devices)) |
|
52 | - $devices = $this->configService->getConfig($order->getProvider(), 'order-print-devices', true); |
|
51 | + if (empty($devices)) { |
|
52 | + $devices = $this->configService->getConfig($order->getProvider(), 'order-print-devices', true); |
|
53 | + } |
|
53 | 54 | |
54 | - if ($devices) |
|
55 | - $devices = $this->deviceService->findDevices($devices); |
|
55 | + if ($devices) { |
|
56 | + $devices = $this->deviceService->findDevices($devices); |
|
57 | + } |
|
56 | 58 | |
57 | - foreach ($devices as $device) |
|
58 | - $this->generatePrintData($order, $device); |
|
59 | + foreach ($devices as $device) { |
|
60 | + $this->generatePrintData($order, $device); |
|
61 | + } |
|
59 | 62 | } |
60 | 63 | |
61 | 64 | private function printProduct($orderProduct, $indent = "- ", $printForm = false) |
@@ -64,7 +67,9 @@ discard block |
||
64 | 67 | $quantity = $printForm ? 1 : $orderProduct->getQuantity(); |
65 | 68 | $total = $printForm ? $orderProduct->getPrice() : $orderProduct->getTotal(); |
66 | 69 | |
67 | - if ($printForm) $this->printService->addLine('', '', ' '); |
|
70 | + if ($printForm) { |
|
71 | + $this->printService->addLine('', '', ' '); |
|
72 | + } |
|
68 | 73 | |
69 | 74 | $this->printService->addLine( |
70 | 75 | $indent . $quantity . ' X ' . $product->getProduct(), |
@@ -72,7 +77,9 @@ discard block |
||
72 | 77 | '.' |
73 | 78 | ); |
74 | 79 | |
75 | - if ($printForm) $this->printService->addLine('', '', ' '); |
|
80 | + if ($printForm) { |
|
81 | + $this->printService->addLine('', '', ' '); |
|
82 | + } |
|
76 | 83 | } |
77 | 84 | |
78 | 85 | private function printChildren($orderProducts) |
@@ -107,8 +114,9 @@ discard block |
||
107 | 114 | $this->printProduct($parentOrderProduct, "- ", $printForm); |
108 | 115 | |
109 | 116 | $childs = $parentOrderProduct->getOrderProductComponents(); |
110 | - if (!empty($childs)) |
|
111 | - $this->printChildren($childs); |
|
117 | + if (!empty($childs)) { |
|
118 | + $this->printChildren($childs); |
|
119 | + } |
|
112 | 120 | |
113 | 121 | $this->printService->addLine('', '', '-'); |
114 | 122 | } |
@@ -120,9 +128,13 @@ discard block |
||
120 | 128 | foreach ($queues as $queueName => $orderProducts) { |
121 | 129 | $parentOrderProducts = array_filter($orderProducts, fn($orderProduct) => $orderProduct->getOrderProduct() === null); |
122 | 130 | if (!empty($parentOrderProducts)) { |
123 | - if (!$printForm) $this->printService->addLine(strtoupper($queueName) . ":"); |
|
131 | + if (!$printForm) { |
|
132 | + $this->printService->addLine(strtoupper($queueName) . ":"); |
|
133 | + } |
|
124 | 134 | $this->printQueueProducts($orderProducts, $printForm); |
125 | - if ($printForm) $this->printService->addLine('', '', ' '); |
|
135 | + if ($printForm) { |
|
136 | + $this->printService->addLine('', '', ' '); |
|
137 | + } |
|
126 | 138 | $this->printService->addLine('', '', ' '); |
127 | 139 | } |
128 | 140 | } |
@@ -28,8 +28,9 @@ |
||
28 | 28 | { |
29 | 29 | try { |
30 | 30 | $order = $this->entityManager->getRepository(Order::class)->find($id); |
31 | - if (!$order) |
|
32 | - return new JsonResponse(['error' => 'Order not found'], 404); |
|
31 | + if (!$order) { |
|
32 | + return new JsonResponse(['error' => 'Order not found'], 404); |
|
33 | + } |
|
33 | 34 | |
34 | 35 | $data = json_decode($request->getContent(), true); |
35 | 36 |
@@ -80,11 +80,13 @@ discard block |
||
80 | 80 | $order = $orderProduct->getOrder(); |
81 | 81 | $product = $orderProduct->getProduct(); |
82 | 82 | |
83 | - if ($order->getOrderType() == 'sale' && !$orderProduct->getOutInventory()) |
|
84 | - $orderProduct->setOutInventory($product->getDefaultOutInventory()); |
|
83 | + if ($order->getOrderType() == 'sale' && !$orderProduct->getOutInventory()) { |
|
84 | + $orderProduct->setOutInventory($product->getDefaultOutInventory()); |
|
85 | + } |
|
85 | 86 | |
86 | - if ($order->getOrderType() == 'purchase' && !$orderProduct->getInInventory()) |
|
87 | - $orderProduct->setInInventory($product->getDefaultInInventory()); |
|
87 | + if ($order->getOrderType() == 'purchase' && !$orderProduct->getInInventory()) { |
|
88 | + $orderProduct->setInInventory($product->getDefaultInInventory()); |
|
89 | + } |
|
88 | 90 | } |
89 | 91 | |
90 | 92 | private function checkSubproducts(OrderProduct $orderProduct) |
@@ -108,7 +110,9 @@ discard block |
||
108 | 110 | |
109 | 111 | public function postPersist(OrderProduct $orderProduct) |
110 | 112 | { |
111 | - if (!self::$mainProduct || !$this->request) return; |
|
113 | + if (!self::$mainProduct || !$this->request) { |
|
114 | + return; |
|
115 | + } |
|
112 | 116 | self::$mainProduct = false; |
113 | 117 | |
114 | 118 | $this->checkSubproducts($orderProduct); |
@@ -120,7 +124,9 @@ discard block |
||
120 | 124 | public function preRemove(OrderProduct $orderProduct) |
121 | 125 | { |
122 | 126 | |
123 | - if (!self::$mainProduct) return; |
|
127 | + if (!self::$mainProduct) { |
|
128 | + return; |
|
129 | + } |
|
124 | 130 | self::$mainProduct = false; |
125 | 131 | $order = $orderProduct->getOrder(); |
126 | 132 | $this->manager->persist($order->setPrice(0)); |
@@ -129,8 +135,9 @@ discard block |
||
129 | 135 | 'parentProduct' => $orderProduct->getProduct(), |
130 | 136 | ]); |
131 | 137 | |
132 | - foreach ($parentProducts as $parentProduct) |
|
133 | - $this->manager->remove($parentProduct); |
|
138 | + foreach ($parentProducts as $parentProduct) { |
|
139 | + $this->manager->remove($parentProduct); |
|
140 | + } |
|
134 | 141 | $this->manager->flush(); |
135 | 142 | |
136 | 143 | self::$calculateBefore[] = $order; |