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

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