Code Duplication    Length = 26-26 lines in 2 locations

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

@@ 324-349 (lines=26) @@
321
                    $account = new Account($this->year, $a['id']);
322
                    $account->getSaldo();
323
324
                    if ($account->get('saldo') > 0) {
325
                        $save_array = array(
326
                            'date' => $this->year->get('to_date_dk'),
327
                            'debet_account_number' => $result_account->get('number'),
328
                            'credit_account_number' => $account->get('number'),
329
                            'amount' => amountToForm(abs($account->get('saldo'))), // amountToFrom necessary to get the correct format for daybook
330
                            'text' => $account->get('name') . ' til resultatkontoen',
331
                            'vat_off' => 1
332
333
                        );
334
                        $debet_account = $result_account;
335
                        $credit_account = $account;
336
                    } elseif ($account->get('saldo') <= 0) {
337
                        $save_array = array(
338
                            'date' => $this->year->get('to_date_dk'),
339
                            'debet_account_number' => $account->get('number'),
340
                            'credit_account_number' => $result_account->get('number'),
341
                            'amount' => amountToForm(abs($account->get('saldo'))), // amountToFrom necessary to get the correct format for daybook
342
                            'text' => $account->get('name') . ' til resultatkontoen',
343
                            'vat_off' => 1
344
                        );
345
                        $debet_account = $account;
346
                        $credit_account = $result_account;
347
                    }
348
349
                    if (!empty($save_array)) {
350
                        if ($voucher->saveInDayBook($save_array, true)) {
351
                            $this->saveStatedAction('operating_reset', $voucher->get('id'), $debet_account->get('id'), $credit_account->get('id'), abs(amountToForm($account->get('saldo'))));
352
                        }
@@ 452-477 (lines=26) @@
449
                $capital_account = new Account($this->year, $this->year->getSetting('capital_account_id'));
450
451
                $save_array = array();
452
                if ($result_account->get('saldo') < 0) {
453
                    $save_array = array(
454
                        'date' => $this->year->get('to_date_dk'),
455
                        'debet_account_number' => $result_account->get('number'),
456
                        'credit_account_number' => $capital_account->get('number'),
457
                        'amount' => abs(amountToForm($result_account->get('saldo'))), // amountToFrom necessary to get the correct format for daybook
458
                        'text' => $result_account->get('name') . ' nulstilles',
459
                        'vat_off' => 1
460
461
                    );
462
                    $debet_account = $result_account;
463
                    $credit_account = $capital_account;
464
                } elseif ($result_account->get('saldo') >= 0) {
465
                    $save_array = array(
466
                        'date' => $this->year->get('to_date_dk'),
467
                        'debet_account_number' => $capital_account->get('number'),
468
                        'credit_account_number' => $result_account->get('number'),
469
                        'amount' => abs(amountToForm($result_account->get('saldo'))), // amountToFrom necessary to get the correct format for daybook
470
                        'text' => $result_account->get('name') . ' nulstilles',
471
                        'vat_off' => 1
472
                    );
473
                    $debet_account = $capital_account;
474
                    $credit_account = $result_account;
475
                }
476
477
                if (!empty($save_array)) {
478
                    if ($voucher->saveInDayBook($save_array, true)) {
479
                        $this->saveStatedAction('result_account_reset', $voucher->get('id'), $debet_account->get('id'), $credit_account->get('id'), abs(amountToForm($result_account->get('saldo'))));
480
                    } else {