Code Duplication    Length = 28-32 lines in 2 locations

code/control/cms/CountryPrice_DistributorManagementTool.php 2 locations

@@ 549-580 (lines=32) @@
546
                    }
547
                }
548
                $addText = 'Add price to start selling';
549
                foreach ($outstandingCountries as $countryCode) {
550
                    if ($countryCode != EcommerceConfig::get('EcommerceCountry', 'default_country_code')) {
551
                        $countryObject = EcommerceCountry::get()->filter(array("Code" => $countryCode))->first();
552
                        if (!$countryObject) {
553
                            user_error("country not found");
554
                        }
555
                        $currencyObject = $countryObject->EcommerceCurrency();
556
                        $data = array(
557
                            "T" => "CountryPrice",
558
                            "I" => array(
559
                                'Country' => $countryCode,
560
                                'Currency' => $currencyObject->Code,
561
                                'ObjectClass' => $product->ClassName,
562
                                'ObjectID' => $product->ID
563
                            ),
564
                            'F' => 'Price'
565
                        );
566
                        $countryName = EcommerceCountry::find_title($countryCode);
567
                        if ($withDefaultPrices) {
568
                            $html .= $this->createEditNode(
569
                                $countryCode . ' - '. $countryName,
570
                                $currencyObject->Code,
571
                                $addText,
572
                                $data,
573
                                "input",
574
                                array($countryObject),
575
                                '[x]',
576
                                'add-node'
577
                            );
578
                        }
579
                    }
580
                }
581
                if ($withDefaultPrices) {
582
                    $html .= $this->closeTreeNode();
583
                }
@@ 650-677 (lines=28) @@
647
                                        }
648
                                    }
649
                                }
650
                                foreach ($outstandingCountries as $countryCode) {
651
                                    if ($countryCode != EcommerceConfig::get('EcommerceCountry', 'default_country_code')) {
652
                                        $countryObject = EcommerceCountry::get()->filter(array("Code" =>$countryCode))->first();
653
                                        if (!$countryObject) {
654
                                            user_error("country not found");
655
                                        }
656
                                        $currency = $countryObject->EcommerceCurrency();
657
                                        $data = array(
658
                                            "T" => "CountryPrice",
659
                                            "I" => array(
660
                                                'Country' => $countryCode,
661
                                                'Currency' => $currency->Code,
662
                                                'ObjectClass' => $variation->ClassName,
663
                                                'ObjectID' => $variation->ID
664
                                            ),
665
                                            'F' => 'Price'
666
                                        );
667
                                        $countryName = EcommerceCountry::find_title($countryCode);
668
                                        $html .= $this->createEditNode(
669
                                            $countryCode . ' - '. $countryName,
670
                                            $currency->Code,
671
                                            $addText,
672
                                            $data,
673
                                            "input",
674
                                            array($countryObject)
675
                                        );
676
                                    }
677
                                }
678
                                $html .= $this->closeTreeNode();
679
                                $html .= $this->closeTreeNode();
680
                            }