Code Duplication    Length = 17-18 lines in 2 locations

src/Intraface/modules/invoice/CreditNote.php 1 location

@@ 75-92 (lines=18) @@
72
73
        $return = true;
74
75
        if ($check_products == 'check_products') {
76
            $this->loadItem();
77
            $items = $this->item->getList();
78
            for ($i = 0, $max = count($items); $i < $max; $i++) {
79
                $product = new Product($this->kernel, $items[$i]['product_id']);
80
                if ($product->get('state_account_id') == 0) {
81
                    $this->error->set('Produktet ' . $product->get('name') . ' ved ikke hvor den skal bogf�res');
82
                } else {
83
                    require_once 'Intraface/modules/accounting/Account.php';
84
                    $account = Account::factory($year, $product->get('state_account_id'));
85
                    if ($account->get('id') == 0 || $account->get('type') != 'operating') {
86
                        $this->error->set('Ugyldig konto for bogf�ring af produktet ' . $product->get('name'));
87
                        $return = false;
88
                    }
89
                }
90
            }
91
        }
92
93
        return $return;
94
    }
95

src/Intraface/modules/invoice/Invoice.php 1 location

@@ 126-142 (lines=17) @@
123
124
        $return = true;
125
126
        if ($check_products == 'check_products') {
127
            $this->loadItem();
128
            $items = $this->item->getList();
129
            for ($i = 0, $max = count($items); $i < $max; $i++) {
130
                $product = new Product($this->kernel, $items[$i]['product_id']);
131
                if ($product->get('state_account_id') == 0) {
132
                    $this->error->set('Produktet ' . $product->get('name') . ' ved ikke hvor den skal bogf�res');
133
                } else {
134
                    require_once 'Intraface/modules/accounting/Account.php';
135
                    $account = Account::factory($year, $product->get('state_account_id'));
136
                    if ($account->get('id') == 0 || $account->get('type') != 'operating') {
137
                        $this->error->set('Ugyldig konto for bogføring af produktet ' . $product->get('name'));
138
                        $return = false;
139
                    }
140
                }
141
            }
142
        }
143
144
        return $return;
145
    }