Code Duplication    Length = 24-26 lines in 2 locations

src/Intraface/modules/accounting/YearEnd.php 2 locations

@@ 280-305 (lines=26) @@
277
                    return 0;
278
                }
279
280
                foreach ($actions as $a) {
281
                    $save_array = array();
282
                    // der er byttet om på debet og credit med vilje, fordi
283
                    // det skal reverses
284
                    $debet_account = new Account($this->year, $a['credit_account_id']);
285
                    $credit_account = new Account($this->year, $a['debet_account_id']);
286
287
                    $save_array = array(
288
                        'date' => $this->year->get('to_date_dk'),
289
                        'debet_account_number' => $debet_account->get('number'),
290
                        'credit_account_number' => $credit_account->get('number'),
291
                        'amount' => amountToForm($a['amount']),
292
                        'text' => 'Modpostering: ' . $debet_account->get('name') . ' og ' . $credit_account->get('name'),
293
                        'vat_off' => 1
294
295
                    );
296
297
                    if (!empty($save_array)) {
298
                        if ($voucher->saveInDayBook($save_array, true)) {
299
                            $this->deleteStatedAction($a['id']);
300
                        } else {
301
                            $voucher->error->view();
302
                        }
303
                    }
304
                }
305
                break;
306
            default:
307
                $voucher = new Voucher($this->year, $this->get('operating_reset_voucher_id'));
308
                $voucher->save(array(
@@ 411-434 (lines=24) @@
408
                    return false;
409
                }
410
411
                foreach ($actions as $a) {
412
                    $save_array = array();
413
                    // der er byttet om på debet og credit med vilje, fordi
414
                    // det skal reverses
415
                    $debet_account = new Account($this->year, $a['credit_account_id']);
416
                    $credit_account = new Account($this->year, $a['debet_account_id']);
417
418
                    $save_array = array(
419
                        'date' => $this->year->get('to_date_dk'),
420
                        'debet_account_number' => $debet_account->get('number'),
421
                        'credit_account_number' => $credit_account->get('number'),
422
                        'amount' => amountToForm($a['amount']),
423
                        'text' => 'Modpostering: ' . $debet_account->get('name') . ' og ' . $credit_account->get('name'),
424
                        'vat_off' => 1
425
426
                    );
427
428
                    if (!empty($save_array)) {
429
                        if ($voucher->saveInDayBook($save_array, true)) {
430
                            $this->deleteStatedAction($a['id']);
431
                        }
432
                    }
433
                }
434
                return true;
435
            break;
436
            default:
437
                if (!$this->get('result_account_reset_voucher_id')) {