Code Duplication    Length = 18-19 lines in 2 locations

src/Eccube/Controller/Admin/Product/ProductClassController.php 1 location

@@ 665-683 (lines=19) @@
662
        
663
        // 個別消費税
664
        $BaseInfo = $app['eccube.repository.base_info']->get();
665
        if ($BaseInfo->getOptionProductTaxRule() == Constant::ENABLED) {
666
            if($productClassOrig->getTaxRate()) {
667
                $productClassDest->setTaxRate($productClassOrig->getTaxRate());
668
                if ($productClassDest->getTaxRule() && !$productClassDest->getTaxRule()->getDelFlg()) {
669
                    $productClassDest->getTaxRule()->setTaxRate($productClassOrig->getTaxRate());
670
                } else {
671
                    $taxrule = $app['eccube.repository.tax_rule']->newTaxRule();
672
                    $taxrule->setTaxRate($productClassOrig->getTaxRate());
673
                    $taxrule->setApplyDate(new \DateTime());
674
                    $taxrule->setProduct($productClassDest->getProduct());
675
                    $taxrule->setProductClass($productClassDest);
676
                    $productClassDest->setTaxRule($taxrule);
677
                }
678
            } else {
679
                if ($productClassDest->getTaxRule()) {
680
                    $productClassDest->getTaxRule()->setDelFlg(Constant::ENABLED);
681
                }
682
            }
683
        }
684
    }
685
686

src/Eccube/Controller/Admin/Product/ProductController.php 1 location

@@ 320-337 (lines=18) @@
317
318
                    // 個別消費税
319
                    $BaseInfo = $app['eccube.repository.base_info']->get();
320
                    if ($BaseInfo->getOptionProductTaxRule() == Constant::ENABLED) {
321
                        if ($ProductClass->getTaxRate()) {
322
                            if ($ProductClass->getTaxRule() && !$ProductClass->getTaxRule()->getDelFlg()) {
323
                                $ProductClass->getTaxRule()->setTaxRate($ProductClass->getTaxRate());
324
                            } else {
325
                                $taxrule = $app['eccube.repository.tax_rule']->newTaxRule();
326
                                $taxrule->setTaxRate($ProductClass->getTaxRate());
327
                                $taxrule->setApplyDate(new \DateTime());
328
                                $taxrule->setProduct($Product);
329
                                $taxrule->setProductClass($ProductClass);
330
                                $ProductClass->setTaxRule($taxrule);
331
                            }
332
                        } else {
333
                            if ($ProductClass->getTaxRule()) {
334
                                $ProductClass->getTaxRule()->setDelFlg(Constant::ENABLED);
335
                            }
336
                        }
337
                    }
338
                    $app['orm.em']->persist($ProductClass);
339
340
                    // 在庫情報を作成