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

@@ 293-310 (lines=18) @@
290
291
                    // 個別消費税
292
                    $BaseInfo = $app['eccube.repository.base_info']->get();
293
                    if ($BaseInfo->getOptionProductTaxRule() == Constant::ENABLED) {
294
                        if ($ProductClass->getTaxRate()) {
295
                            if ($ProductClass->getTaxRule() && !$ProductClass->getTaxRule()->getDelFlg()) {
296
                                $ProductClass->getTaxRule()->setTaxRate($ProductClass->getTaxRate());
297
                            } else {
298
                                $taxrule = $app['eccube.repository.tax_rule']->newTaxRule();
299
                                $taxrule->setTaxRate($ProductClass->getTaxRate());
300
                                $taxrule->setApplyDate(new \DateTime());
301
                                $taxrule->setProduct($Product);
302
                                $taxrule->setProductClass($ProductClass);
303
                                $ProductClass->setTaxRule($taxrule);
304
                            }
305
                        } else {
306
                            if ($ProductClass->getTaxRule()) {
307
                                $ProductClass->getTaxRule()->setDelFlg(Constant::ENABLED);
308
                            }
309
                        }
310
                    }
311
                    $app['orm.em']->persist($ProductClass);
312
313
                    // 在庫情報を作成