Code Duplication    Length = 31-31 lines in 3 locations

src/Eccube/Controller/ShoppingController.php 3 locations

@@ 486-516 (lines=31) @@
483
    /**
484
     * お届け先変更がクリックされた場合の処理
485
     */
486
    public function shippingChange(Application $app, Request $request, $id)
487
    {
488
        $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
489
        if (!$Order) {
490
            $app->addError('front.shopping.order.error');
491
            return $app->redirect($app->url('shopping_error'));
492
        }
493
494
        if ('POST' !== $request->getMethod()) {
495
            return $app->redirect($app->url('shopping'));
496
        }
497
498
        $form = $app['eccube.service.shopping']->getShippingForm($Order);
499
        $form->handleRequest($request);
500
501
        if ($form->isSubmitted() && $form->isValid()) {
502
            $data = $form->getData();
503
            $message = $data['message'];
504
            $Order->setMessage($message);
505
            // 受注情報を更新
506
            $app['orm.em']->flush();
507
508
            // お届け先設定一覧へリダイレクト
509
            return $app->redirect($app->url('shopping_shipping', array('id' => $id)));
510
        }
511
512
        return $app->render('Shopping/index.twig', array(
513
            'form' => $form->createView(),
514
            'Order' => $Order,
515
        ));
516
    }
517
518
    /**
519
     * お届け先の設定一覧からの選択
@@ 600-630 (lines=31) @@
597
    /**
598
     * お届け先の設定(非会員)がクリックされた場合の処理
599
     */
600
    public function shippingEditChange(Application $app, Request $request, $id)
601
    {
602
        $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
603
        if (!$Order) {
604
            $app->addError('front.shopping.order.error');
605
            return $app->redirect($app->url('shopping_error'));
606
        }
607
608
        if ('POST' !== $request->getMethod()) {
609
            return $app->redirect($app->url('shopping'));
610
        }
611
612
        $form = $app['eccube.service.shopping']->getShippingForm($Order);
613
        $form->handleRequest($request);
614
615
        if ($form->isSubmitted() && $form->isValid()) {
616
            $data = $form->getData();
617
            $message = $data['message'];
618
            $Order->setMessage($message);
619
            // 受注情報を更新
620
            $app['orm.em']->flush();
621
622
            // お届け先設定一覧へリダイレクト
623
            return $app->redirect($app->url('shopping_shipping_edit', array('id' => $id)));
624
        }
625
626
        return $app->render('Shopping/index.twig', array(
627
            'form' => $form->createView(),
628
            'Order' => $Order,
629
        ));
630
    }
631
632
    /**
633
     * お届け先の設定(非会員でも使用する)
@@ 964-994 (lines=31) @@
961
    /**
962
     * 複数配送処理がクリックされた場合の処理
963
     */
964
    public function shippingMultipleChange(Application $app, Request $request)
965
    {
966
        $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
967
        if (!$Order) {
968
            $app->addError('front.shopping.order.error');
969
            return $app->redirect($app->url('shopping_error'));
970
        }
971
972
        if ('POST' !== $request->getMethod()) {
973
            return $app->redirect($app->url('shopping'));
974
        }
975
976
        $form = $app['eccube.service.shopping']->getShippingForm($Order);
977
        $form->handleRequest($request);
978
979
        if ($form->isSubmitted() && $form->isValid()) {
980
            $data = $form->getData();
981
            $message = $data['message'];
982
            $Order->setMessage($message);
983
            // 受注情報を更新
984
            $app['orm.em']->flush();
985
986
            // 複数配送設定へリダイレクト
987
            return $app->redirect($app->url('shopping_shipping_multiple'));
988
        }
989
990
        return $app->render('Shopping/index.twig', array(
991
            'form' => $form->createView(),
992
            'Order' => $Order,
993
        ));
994
    }
995
996
997
    /**