Code Duplication    Length = 4-4 lines in 3 locations

system/modules/Ecommerce/appControllers/EcommerceController.php 1 location

@@ 73-76 (lines=4) @@
70
71
            $fields = \Ecommerce\UserAdds\Field::getList();
72
            foreach ($fields as $field) {
73
                if (empty($_POST['userAdds']['fields'][$field->id]) && $field->required) {
74
                    $error = 1;
75
                    Msg::add('Вы не указали: ' . $field->name);
76
                }
77
            }
78
            if (!$error) {
79
                $cardItem = new \Ecommerce\Card\Item();

system/modules/Ecommerce/appControllers/CartController.php 2 locations

@@ 79-82 (lines=4) @@
76
            }
77
            if ($cart->delivery_id) {
78
                foreach ($deliverys[$cart->delivery_id]->fields as $field) {
79
                    if (empty($_POST['deliveryFields'][$field->id]) && $field->required) {
80
                        $error = 1;
81
                        Msg::add('Вы не указали: ' . $field->name, 'danger');
82
                    }
83
                }
84
            }
85
            $payType = false;
@@ 94-97 (lines=4) @@
91
                $cart->paytype_id = $payType->id;
92
            }
93
            foreach (\Ecommerce\UserAdds\Field::getList() as $field) {
94
                if (empty($_POST['userAdds']['fields'][$field->id]) && $field->required) {
95
                    $error = 1;
96
                    Msg::add('Вы не указали: ' . $field->name, 'danger');
97
                }
98
            }
99
            if (!empty($_POST['discounts']['card_item_id'])) {
100
                $userCard = \Ecommerce\Card\Item::get((int) $_POST['discounts']['card_item_id']);