@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | /** |
253 | 253 | * 複数配送オプション有効時の画面制御を行う. |
254 | 254 | */ |
255 | - $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) { |
|
255 | + $builder->addEventListener(FormEvents::PRE_SUBMIT, function(FormEvent $event) { |
|
256 | 256 | |
257 | 257 | if ($this->BaseInfo->getOptionMultipleShipping() != Constant::ENABLED) { |
258 | 258 | return; |
@@ -262,17 +262,16 @@ discard block |
||
262 | 262 | $orderDetails = &$data['OrderDetails']; |
263 | 263 | |
264 | 264 | // 数量0フィルター |
265 | - $quantityFilter = function ($v) { |
|
265 | + $quantityFilter = function($v) { |
|
266 | 266 | return !(isset($v['quantity']) && preg_match('/^0+$/', trim($v['quantity']))); |
267 | 267 | }; |
268 | 268 | |
269 | 269 | // $shippings = &$data['Shippings']; |
270 | 270 | |
271 | 271 | // 数量を抽出 |
272 | - $getQuantity = function ($v) { |
|
272 | + $getQuantity = function($v) { |
|
273 | 273 | return (isset($v['quantity']) && preg_match('/^\d+$/', trim($v['quantity']))) ? |
274 | - trim($v['quantity']) : |
|
275 | - 0; |
|
274 | + trim($v['quantity']) : 0; |
|
276 | 275 | }; |
277 | 276 | |
278 | 277 | // foreach ($shippings as &$shipping) { |
@@ -289,7 +288,7 @@ discard block |
||
289 | 288 | $orderDetail['quantity'] = 0; |
290 | 289 | |
291 | 290 | // 受注詳細と同じ商品規格のみ抽出 |
292 | - $productClassFilter = function ($v) use ($orderDetail) { |
|
291 | + $productClassFilter = function($v) use ($orderDetail) { |
|
293 | 292 | return $orderDetail['ProductClass'] === $v['ProductClass']; |
294 | 293 | }; |
295 | 294 | |
@@ -298,10 +297,9 @@ discard block |
||
298 | 297 | if (!empty($shipping['ShipmentItems'])) { |
299 | 298 | |
300 | 299 | // 同じ商品規格の受注詳細の価格を適用 |
301 | - $applyPrice = function (&$v) use ($orderDetail) { |
|
300 | + $applyPrice = function(&$v) use ($orderDetail) { |
|
302 | 301 | $v['price'] = ($v['ProductClass'] === $orderDetail['ProductClass']) ? |
303 | - $orderDetail['price'] : |
|
304 | - $v['price']; |
|
302 | + $orderDetail['price'] : $v['price']; |
|
305 | 303 | }; |
306 | 304 | array_walk($shipping['ShipmentItems'], $applyPrice); |
307 | 305 | |
@@ -330,7 +328,7 @@ discard block |
||
330 | 328 | // } |
331 | 329 | // }); |
332 | 330 | // 選択された支払い方法の名称をエンティティにコピーする |
333 | - $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { |
|
331 | + $builder->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) { |
|
334 | 332 | $Order = $event->getData(); |
335 | 333 | $Payment = $Order->getPayment(); |
336 | 334 | if (!is_null($Payment)) { |
@@ -338,7 +336,7 @@ discard block |
||
338 | 336 | } |
339 | 337 | }); |
340 | 338 | // 会員受注の場合、会員の性別/職業/誕生日をエンティティにコピーする |
341 | - $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { |
|
339 | + $builder->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) { |
|
342 | 340 | $Order = $event->getData(); |
343 | 341 | $Customer = $Order->getCustomer(); |
344 | 342 | if (!is_null($Customer)) { |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | 'prototype' => true, |
200 | 200 | )) |
201 | 201 | |
202 | - ->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { |
|
202 | + ->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) { |
|
203 | 203 | if ($this->BaseInfo->getOptionMultipleShipping() == Constant::ENABLED) { |
204 | 204 | $form = $event->getForm(); |
205 | 205 | $form->add('ShipmentItems', CollectionType::class, array( |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | )); |
211 | 211 | } |
212 | 212 | }) |
213 | - ->addEventListener(FormEvents::POST_SET_DATA, function (FormEvent $event) { |
|
213 | + ->addEventListener(FormEvents::POST_SET_DATA, function(FormEvent $event) { |
|
214 | 214 | /** @var \Eccube\Entity\Shipping $data */ |
215 | 215 | $data = $event->getData(); |
216 | 216 | /** @var \Symfony\Component\Form\Form $form */ |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | 'choice_label' => 'delivery_time', |
230 | 230 | 'placeholder' => '指定なし', |
231 | 231 | 'required' => false, |
232 | - 'query_builder' => function (EntityRepository $er) use($Delivery) { |
|
232 | + 'query_builder' => function(EntityRepository $er) use($Delivery) { |
|
233 | 233 | return $er->createQueryBuilder('dt') |
234 | 234 | ->where('dt.Delivery = :Delivery') |
235 | 235 | ->setParameter('Delivery', $Delivery); |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | )); |
238 | 238 | |
239 | 239 | }) |
240 | - ->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) { |
|
240 | + ->addEventListener(FormEvents::PRE_SUBMIT, function(FormEvent $event) { |
|
241 | 241 | $data = $event->getData(); |
242 | 242 | $form = $event->getForm(); |
243 | 243 | if (!$data) { |
@@ -257,14 +257,14 @@ discard block |
||
257 | 257 | 'choice_label' => 'delivery_time', |
258 | 258 | 'placeholder' => '指定なし', |
259 | 259 | 'required' => false, |
260 | - 'query_builder' => function (EntityRepository $er) use($Delivery) { |
|
260 | + 'query_builder' => function(EntityRepository $er) use($Delivery) { |
|
261 | 261 | return $er->createQueryBuilder('dt') |
262 | 262 | ->where('dt.Delivery = :Delivery') |
263 | 263 | ->setParameter('Delivery', $Delivery); |
264 | 264 | }, |
265 | 265 | )); |
266 | 266 | }) |
267 | - ->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { |
|
267 | + ->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) { |
|
268 | 268 | if ($this->BaseInfo->getOptionMultipleShipping() == Constant::ENABLED) { |
269 | 269 | $form = $event->getForm(); |
270 | 270 | $shipmentItems = $form['ShipmentItems']->getData(); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | } |
276 | 276 | } |
277 | 277 | }) |
278 | - ->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { |
|
278 | + ->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) { |
|
279 | 279 | $Shipping = $event->getData(); |
280 | 280 | $Delivery = $Shipping->getDelivery(); |
281 | 281 | $Shipping->setShippingDeliveryName($Delivery ? $Delivery : null); |