@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | const PRODUCT_SEARCH = 'Product.getQueryBuilderBySearchData'; |
30 | 30 | const PRODUCT_SEARCH_ADMIN = 'Product.getQueryBuilderBySearchDataForAdmin'; |
31 | - const PRODUCT_GET_FAVORITE = 'Product.getFavoriteProductQueryBuilderByCustomer'; |
|
31 | + const PRODUCT_GET_FAVORITE = 'Product.getFavoriteProductQueryBuilderByCustomer'; |
|
32 | 32 | |
33 | 33 | const CUSTOMER_SEARCH = 'Customer.getQueryBuilderBySearchData'; |
34 | 34 |
@@ -4,25 +4,17 @@ |
||
4 | 4 | |
5 | 5 | use Doctrine\Common\Collections\ArrayCollection; |
6 | 6 | use Eccube\Application; |
7 | -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; |
|
8 | 7 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
9 | 8 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; |
10 | 9 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; |
11 | 10 | use Symfony\Component\HttpFoundation\Request; |
12 | - |
|
13 | -use Eccube\Common\Constant; |
|
14 | -use Eccube\Controller\AbstractController; |
|
15 | 11 | use Eccube\Entity\Shipping; |
16 | -use Eccube\Entity\Master\CsvType; |
|
17 | 12 | use Eccube\Event\EccubeEvents; |
18 | 13 | use Eccube\Event\EventArgs; |
19 | -use Eccube\Form\Type\AddCartType; |
|
20 | -use Eccube\Form\Type\Admin\SearchOrderType; |
|
21 | 14 | use Eccube\Form\Type\Admin\ShippingType; |
22 | 15 | use Eccube\Form\Type\Admin\SearchCustomerType; |
23 | 16 | use Eccube\Form\Type\Admin\SearchProductType; |
24 | 17 | use Eccube\Form\Type\Admin\ShipmentItemType; |
25 | -use Symfony\Component\HttpFoundation\StreamedResponse; |
|
26 | 18 | |
27 | 19 | /** |
28 | 20 | * // FIXME UrlGenerator で {_admin} を認識しない問題あり |
@@ -446,7 +446,7 @@ |
||
446 | 446 | $session->set('eccube.admin.order.product.search', $searchData); |
447 | 447 | $session->set('eccube.admin.order.product.search.page_no', $page_no); |
448 | 448 | } else { |
449 | - $searchData = (array)$session->get('eccube.admin.order.product.search'); |
|
449 | + $searchData = (array) $session->get('eccube.admin.order.product.search'); |
|
450 | 450 | if (is_null($page_no)) { |
451 | 451 | $page_no = intval($session->get('eccube.admin.order.product.search.page_no')); |
452 | 452 | } else { |
@@ -53,6 +53,9 @@ |
||
53 | 53 | |
54 | 54 | protected $app; |
55 | 55 | |
56 | + /** |
|
57 | + * @param \Pimple\Container $app |
|
58 | + */ |
|
56 | 59 | public function __construct($app) |
57 | 60 | { |
58 | 61 | $this->app = $app; |
@@ -35,7 +35,6 @@ |
||
35 | 35 | use Symfony\Component\Form\AbstractType; |
36 | 36 | use Symfony\Component\Form\Extension\Core\Type\CollectionType; |
37 | 37 | use Symfony\Component\Form\Extension\Core\Type\EmailType; |
38 | -use Symfony\Component\Form\Extension\Core\Type\FormType; |
|
39 | 38 | use Symfony\Component\Form\Extension\Core\Type\HiddenType; |
40 | 39 | use Symfony\Component\Form\Extension\Core\Type\MoneyType; |
41 | 40 | use Symfony\Component\Form\Extension\Core\Type\TextareaType; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | /** |
257 | 257 | * 複数配送オプション有効時の画面制御を行う. |
258 | 258 | */ |
259 | - $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use ($BaseInfo) { |
|
259 | + $builder->addEventListener(FormEvents::PRE_SUBMIT, function(FormEvent $event) use ($BaseInfo) { |
|
260 | 260 | |
261 | 261 | if ($BaseInfo->getOptionMultipleShipping() != Constant::ENABLED) { |
262 | 262 | return; |
@@ -266,17 +266,16 @@ discard block |
||
266 | 266 | $orderDetails = &$data['OrderDetails']; |
267 | 267 | |
268 | 268 | // 数量0フィルター |
269 | - $quantityFilter = function ($v) { |
|
269 | + $quantityFilter = function($v) { |
|
270 | 270 | return !(isset($v['quantity']) && preg_match('/^0+$/', trim($v['quantity']))); |
271 | 271 | }; |
272 | 272 | |
273 | 273 | // $shippings = &$data['Shippings']; |
274 | 274 | |
275 | 275 | // 数量を抽出 |
276 | - $getQuantity = function ($v) { |
|
276 | + $getQuantity = function($v) { |
|
277 | 277 | return (isset($v['quantity']) && preg_match('/^\d+$/', trim($v['quantity']))) ? |
278 | - trim($v['quantity']) : |
|
279 | - 0; |
|
278 | + trim($v['quantity']) : 0; |
|
280 | 279 | }; |
281 | 280 | |
282 | 281 | // foreach ($shippings as &$shipping) { |
@@ -293,7 +292,7 @@ discard block |
||
293 | 292 | $orderDetail['quantity'] = 0; |
294 | 293 | |
295 | 294 | // 受注詳細と同じ商品規格のみ抽出 |
296 | - $productClassFilter = function ($v) use ($orderDetail) { |
|
295 | + $productClassFilter = function($v) use ($orderDetail) { |
|
297 | 296 | return $orderDetail['ProductClass'] === $v['ProductClass']; |
298 | 297 | }; |
299 | 298 | |
@@ -302,10 +301,9 @@ discard block |
||
302 | 301 | if (!empty($shipping['ShipmentItems'])) { |
303 | 302 | |
304 | 303 | // 同じ商品規格の受注詳細の価格を適用 |
305 | - $applyPrice = function (&$v) use ($orderDetail) { |
|
304 | + $applyPrice = function(&$v) use ($orderDetail) { |
|
306 | 305 | $v['price'] = ($v['ProductClass'] === $orderDetail['ProductClass']) ? |
307 | - $orderDetail['price'] : |
|
308 | - $v['price']; |
|
306 | + $orderDetail['price'] : $v['price']; |
|
309 | 307 | }; |
310 | 308 | array_walk($shipping['ShipmentItems'], $applyPrice); |
311 | 309 | |
@@ -334,7 +332,7 @@ discard block |
||
334 | 332 | // } |
335 | 333 | // }); |
336 | 334 | // 選択された支払い方法の名称をエンティティにコピーする |
337 | - $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { |
|
335 | + $builder->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) { |
|
338 | 336 | $Order = $event->getData(); |
339 | 337 | $Payment = $Order->getPayment(); |
340 | 338 | if (!is_null($Payment)) { |
@@ -342,7 +340,7 @@ discard block |
||
342 | 340 | } |
343 | 341 | }); |
344 | 342 | // 会員受注の場合、会員の性別/職業/誕生日をエンティティにコピーする |
345 | - $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { |
|
343 | + $builder->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) { |
|
346 | 344 | $Order = $event->getData(); |
347 | 345 | $Customer = $Order->getCustomer(); |
348 | 346 | if (!is_null($Customer)) { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | // 配送業者のプルダウンを生成 |
60 | 60 | $builder->addEventListener( |
61 | 61 | FormEvents::PRE_SET_DATA, |
62 | - function (FormEvent $event) { |
|
62 | + function(FormEvent $event) { |
|
63 | 63 | /* @var Shipping $Shipping */ |
64 | 64 | $Shipping = $event->getData(); |
65 | 65 | if (is_null($Shipping) || !$Shipping->getId()) { |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | // お届け日のプルダウンを生成 |
102 | 102 | $builder->addEventListener( |
103 | 103 | FormEvents::PRE_SET_DATA, |
104 | - function (FormEvent $event) { |
|
104 | + function(FormEvent $event) { |
|
105 | 105 | $Shipping = $event->getData(); |
106 | 106 | if (is_null($Shipping) || !$Shipping->getId()) { |
107 | 107 | return; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | // 配送日数が設定されている |
141 | 141 | if ($deliveryDateFlag) { |
142 | - $period = new \DatePeriod ( |
|
142 | + $period = new \DatePeriod( |
|
143 | 143 | new \DateTime($minDate.' day'), |
144 | 144 | new \DateInterval('P1D'), |
145 | 145 | new \DateTime($minDate + $this->config['deliv_date_end_max'].' day') |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | // お届け時間のプルダウンを生成 |
168 | 168 | $builder->addEventListener( |
169 | 169 | FormEvents::PRE_SET_DATA, |
170 | - function (FormEvent $event) { |
|
170 | + function(FormEvent $event) { |
|
171 | 171 | $Shipping = $event->getData(); |
172 | 172 | if (is_null($Shipping) || !$Shipping->getId()) { |
173 | 173 | return; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | // 支払い方法のプルダウンを生成 |
86 | 86 | $builder->addEventListener( |
87 | 87 | FormEvents::PRE_SET_DATA, |
88 | - function (FormEvent $event) { |
|
88 | + function(FormEvent $event) { |
|
89 | 89 | /** @var Order $Order */ |
90 | 90 | $Order = $event->getData(); |
91 | 91 | if (is_null($Order) || !$Order->getId()) { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | // TODO Calculatorで行うのが適切. |
134 | 134 | $builder->addEventListener( |
135 | 135 | FormEvents::POST_SUBMIT, |
136 | - function (FormEvent $event) { |
|
136 | + function(FormEvent $event) { |
|
137 | 137 | /** @var Order $Order */ |
138 | 138 | $Order = $event->getData(); |
139 | 139 | $Payment = $Order->getPayment(); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | ))); |
144 | 144 | |
145 | 145 | $app = $this->app; |
146 | - $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use ($app) { |
|
146 | + $builder->addEventListener(FormEvents::PRE_SUBMIT, function(FormEvent $event) use ($app) { |
|
147 | 147 | // モーダルからのPOST時に、金額等をセットする. |
148 | 148 | if ('modal' === $app['request_stack']->getCurrentRequest()->get('modal')) { |
149 | 149 | $data = $event->getData(); |
@@ -213,17 +213,13 @@ discard block |
||
213 | 213 | $data['product_name'] = $Product->getName(); |
214 | 214 | $data['product_code'] = $ProductClass->getCode(); |
215 | 215 | $data['class_name1'] = $ProductClass->hasClassCategory1() ? |
216 | - $ProductClass->getClassCategory1()->getClassName() : |
|
217 | - null; |
|
216 | + $ProductClass->getClassCategory1()->getClassName() : null; |
|
218 | 217 | $data['class_name2'] = $ProductClass->hasClassCategory2() ? |
219 | - $ProductClass->getClassCategory2()->getClassName() : |
|
220 | - null; |
|
218 | + $ProductClass->getClassCategory2()->getClassName() : null; |
|
221 | 219 | $data['class_category_name1'] = $ProductClass->hasClassCategory1() ? |
222 | - $ProductClass->getClassCategory1()->getName() : |
|
223 | - null; |
|
220 | + $ProductClass->getClassCategory1()->getName() : null; |
|
224 | 221 | $data['class_category_name2'] = $ProductClass->hasClassCategory2() ? |
225 | - $ProductClass->getClassCategory2()->getName() : |
|
226 | - null; |
|
222 | + $ProductClass->getClassCategory2()->getName() : null; |
|
227 | 223 | $data['price'] = $ProductClass->getPrice02(); |
228 | 224 | $data['quantity'] = empty($data['quantity']) ? 1 : $data['quantity']; |
229 | 225 | $data['tax_type'] = TaxType::TAXATION; |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | 'prototype' => true, |
176 | 176 | )) |
177 | 177 | |
178 | - ->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($BaseInfo) { |
|
178 | + ->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) use ($BaseInfo) { |
|
179 | 179 | if ($BaseInfo->getOptionMultipleShipping() == Constant::ENABLED) { |
180 | 180 | $form = $event->getForm(); |
181 | 181 | $form->add('ShipmentItems', CollectionType::class, array( |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | )); |
187 | 187 | } |
188 | 188 | }) |
189 | - ->addEventListener(FormEvents::POST_SET_DATA, function (FormEvent $event) { |
|
189 | + ->addEventListener(FormEvents::POST_SET_DATA, function(FormEvent $event) { |
|
190 | 190 | /** @var \Eccube\Entity\Shipping $data */ |
191 | 191 | $data = $event->getData(); |
192 | 192 | /** @var \Symfony\Component\Form\Form $form */ |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | 'choice_label' => 'delivery_time', |
206 | 206 | 'placeholder' => '指定なし', |
207 | 207 | 'required' => false, |
208 | - 'query_builder' => function (EntityRepository $er) use($Delivery) { |
|
208 | + 'query_builder' => function(EntityRepository $er) use($Delivery) { |
|
209 | 209 | return $er->createQueryBuilder('dt') |
210 | 210 | ->where('dt.Delivery = :Delivery') |
211 | 211 | ->setParameter('Delivery', $Delivery); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | )); |
214 | 214 | |
215 | 215 | }) |
216 | - ->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use ($app) { |
|
216 | + ->addEventListener(FormEvents::PRE_SUBMIT, function(FormEvent $event) use ($app) { |
|
217 | 217 | $data = $event->getData(); |
218 | 218 | $form = $event->getForm(); |
219 | 219 | if (!$data) { |
@@ -233,14 +233,14 @@ discard block |
||
233 | 233 | 'choice_label' => 'delivery_time', |
234 | 234 | 'placeholder' => '指定なし', |
235 | 235 | 'required' => false, |
236 | - 'query_builder' => function (EntityRepository $er) use($Delivery) { |
|
236 | + 'query_builder' => function(EntityRepository $er) use($Delivery) { |
|
237 | 237 | return $er->createQueryBuilder('dt') |
238 | 238 | ->where('dt.Delivery = :Delivery') |
239 | 239 | ->setParameter('Delivery', $Delivery); |
240 | 240 | }, |
241 | 241 | )); |
242 | 242 | }) |
243 | - ->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use ($BaseInfo) { |
|
243 | + ->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) use ($BaseInfo) { |
|
244 | 244 | if ($BaseInfo->getOptionMultipleShipping() == Constant::ENABLED) { |
245 | 245 | $form = $event->getForm(); |
246 | 246 | $shipmentItems = $form['ShipmentItems']->getData(); |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | } |
252 | 252 | } |
253 | 253 | }) |
254 | - ->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use ($BaseInfo) { |
|
254 | + ->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) use ($BaseInfo) { |
|
255 | 255 | $Shipping = $event->getData(); |
256 | 256 | $Delivery = $Shipping->getDelivery(); |
257 | 257 | $Shipping->setShippingDeliveryName($Delivery ? $Delivery : null); |
@@ -45,10 +45,10 @@ |
||
45 | 45 | public function hasProductByName($productName) |
46 | 46 | { |
47 | 47 | $ShipmentItems = array_filter($this->getArrayCopy(), |
48 | - function ($ShipmentItem) use ($productName) { |
|
49 | - /* @var ShipmentItem $ShipmentItem */ |
|
50 | - return $ShipmentItem->getProductName() == $productName; |
|
51 | - }); |
|
48 | + function ($ShipmentItem) use ($productName) { |
|
49 | + /* @var ShipmentItem $ShipmentItem */ |
|
50 | + return $ShipmentItem->getProductName() == $productName; |
|
51 | + }); |
|
52 | 52 | return !empty($ShipmentItems); |
53 | 53 | } |
54 | 54 | // map, filter, reduce も実装したい |
@@ -45,7 +45,7 @@ |
||
45 | 45 | public function hasProductByName($productName) |
46 | 46 | { |
47 | 47 | $ShipmentItems = array_filter($this->getArrayCopy(), |
48 | - function ($ShipmentItem) use ($productName) { |
|
48 | + function($ShipmentItem) use ($productName) { |
|
49 | 49 | /* @var ShipmentItem $ShipmentItem */ |
50 | 50 | return $ShipmentItem->getProductName() == $productName; |
51 | 51 | }); |
@@ -24,7 +24,7 @@ |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | /** @var ShipmentItem $ShipmentItem */ |
27 | - foreach($this->ShipmentItems as $ShipmentItem) { |
|
27 | + foreach ($this->ShipmentItems as $ShipmentItem) { |
|
28 | 28 | if (!$this->Order->getShipmentItems()->contains($ShipmentItem)) { |
29 | 29 | $ShipmentItem->setOrder($this->Order); |
30 | 30 | $this->Order->addShipmentItem($ShipmentItem); |