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) {
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
                $this->module->parseDeliveryFields($_POST['deliveryFields'], $cart, $cart->delivery->fields);
85
            }
@@ 97-100 (lines=4) @@
94
                $cart->paytype_id = $payType->id;
95
            }
96
            foreach (\Ecommerce\UserAdds\Field::getList() as $field) {
97
                if (empty($_POST['userAdds']['fields'][$field->id]) && $field->required) {
98
                    $error = 1;
99
                    Msg::add('Вы не указали: ' . $field->name, 'danger');
100
                }
101
            }
102
            if (!empty($_POST['discounts']['card_item_id'])) {
103
                $userCard = \Ecommerce\Card\Item::get((int) $_POST['discounts']['card_item_id']);