Code Duplication    Length = 18-19 lines in 2 locations

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

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

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
                    // 在庫情報を作成