Code Duplication    Length = 31-31 lines in 3 locations

src/Eccube/Controller/ShoppingController.php 3 locations

@@ 388-418 (lines=31) @@
385
    /**
386
     * お届け先変更がクリックされた場合の処理
387
     */
388
    public function shippingChange(Application $app, Request $request, $id)
389
    {
390
        $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
391
        if (!$Order) {
392
            $app->addError('front.shopping.order.error');
393
            return $app->redirect($app->url('shopping_error'));
394
        }
395
396
        $form = $app['eccube.service.shopping']->getShippingForm($Order);
397
        $form->handleRequest($request);
398
399
        if ($form->isSubmitted()) {
400
            if ($form->isValid()) {
401
                $data = $form->getData();
402
                $message = $data['message'];
403
                $Order->setMessage($message);
404
                // 受注情報を更新
405
                $app['orm.em']->flush();
406
407
                // お届け先設定一覧へリダイレクト
408
                return $app->redirect($app->url('shopping_shipping', array('id' => $id)));
409
            } else {
410
                return $app->render('Shopping/index.twig', array(
411
                    'form' => $form->createView(),
412
                    'Order' => $Order,
413
                ));
414
            }
415
        }
416
417
        return $app->redirect($app->url('shopping'));
418
    }
419
420
    /**
421
     * お届け先の設定一覧からの選択
@@ 493-523 (lines=31) @@
490
    /**
491
     * お届け先の設定(非会員)がクリックされた場合の処理
492
     */
493
    public function shippingEditChange(Application $app, Request $request, $id)
494
    {
495
        $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
496
        if (!$Order) {
497
            $app->addError('front.shopping.order.error');
498
            return $app->redirect($app->url('shopping_error'));
499
        }
500
501
        $form = $app['eccube.service.shopping']->getShippingForm($Order);
502
        $form->handleRequest($request);
503
504
        if ($form->isSubmitted()) {
505
            if ($form->isValid()) {
506
                $data = $form->getData();
507
                $message = $data['message'];
508
                $Order->setMessage($message);
509
                // 受注情報を更新
510
                $app['orm.em']->flush();
511
512
                // お届け先設定一覧へリダイレクト
513
                return $app->redirect($app->url('shopping_shipping_edit', array('id' => $id)));
514
            } else {
515
                return $app->render('Shopping/index.twig', array(
516
                    'form' => $form->createView(),
517
                    'Order' => $Order,
518
                ));
519
            }
520
        }
521
522
        return $app->redirect($app->url('shopping'));
523
    }
524
525
    /**
526
     * お届け先の設定(非会員でも使用する)
@@ 760-790 (lines=31) @@
757
    /**
758
     * 複数配送処理がクリックされた場合の処理
759
     */
760
    public function shippingMultipleChange(Application $app, Request $request)
761
    {
762
        $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
763
        if (!$Order) {
764
            $app->addError('front.shopping.order.error');
765
            return $app->redirect($app->url('shopping_error'));
766
        }
767
768
        $form = $app['eccube.service.shopping']->getShippingForm($Order);
769
        $form->handleRequest($request);
770
771
        if ($form->isSubmitted()) {
772
            if ($form->isValid()) {
773
                $data = $form->getData();
774
                $message = $data['message'];
775
                $Order->setMessage($message);
776
                // 受注情報を更新
777
                $app['orm.em']->flush();
778
779
                // 複数配送設定へリダイレクト
780
                return $app->redirect($app->url('shopping_shipping_multiple'));
781
            } else {
782
                return $app->render('Shopping/index.twig', array(
783
                    'form' => $form->createView(),
784
                    'Order' => $Order,
785
                ));
786
            }
787
        }
788
789
        return $app->redirect($app->url('shopping'));
790
    }
791
792
793
    /**