Code Duplication    Length = 18-19 lines in 2 locations

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

@@ 584-602 (lines=19) @@
581
        
582
        // 個別消費税
583
        $BaseInfo = $app['eccube.repository.base_info']->get();
584
        if ($BaseInfo->getOptionProductTaxRule() == Constant::ENABLED) {
585
            if($productClassOrig->getTaxRate()) {
586
                $productClassDest->setTaxRate($productClassOrig->getTaxRate());
587
                if ($productClassDest->getTaxRule() && !$productClassDest->getTaxRule()->getDelFlg()) {
588
                    $productClassDest->getTaxRule()->setTaxRate($productClassOrig->getTaxRate());
589
                } else {
590
                    $taxrule = $app['eccube.repository.tax_rule']->newTaxRule();
591
                    $taxrule->setTaxRate($productClassOrig->getTaxRate());
592
                    $taxrule->setApplyDate(new \DateTime());
593
                    $taxrule->setProduct($productClassDest->getProduct());
594
                    $taxrule->setProductClass($productClassDest);
595
                    $productClassDest->setTaxRule($taxrule);
596
                }
597
            } else {
598
                if ($productClassDest->getTaxRule()) {
599
                    $productClassDest->getTaxRule()->setDelFlg(Constant::ENABLED);
600
                }
601
            }
602
        }
603
    }
604
605

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

@@ 240-257 (lines=18) @@
237
238
                    // 個別消費税
239
                    $BaseInfo = $app['eccube.repository.base_info']->get();
240
                    if ($BaseInfo->getOptionProductTaxRule() == Constant::ENABLED) {
241
                        if ($ProductClass->getTaxRate()) {
242
                            if ($ProductClass->getTaxRule() && !$ProductClass->getTaxRule()->getDelFlg()) {
243
                                $ProductClass->getTaxRule()->setTaxRate($ProductClass->getTaxRate());
244
                            } else {
245
                                $taxrule = $app['eccube.repository.tax_rule']->newTaxRule();
246
                                $taxrule->setTaxRate($ProductClass->getTaxRate());
247
                                $taxrule->setApplyDate(new \DateTime());
248
                                $taxrule->setProduct($Product);
249
                                $taxrule->setProductClass($ProductClass);
250
                                $ProductClass->setTaxRule($taxrule);
251
                            }
252
                        } else {
253
                            if ($ProductClass->getTaxRule()) {
254
                                $ProductClass->getTaxRule()->setDelFlg(Constant::ENABLED);
255
                            }
256
                        }
257
                    }
258
                    $app['orm.em']->persist($ProductClass);
259
260
                    // 在庫情報を作成