Code Duplication    Length = 10-10 lines in 2 locations

src/Intraface/modules/debtor/Controller/Create.php 1 location

@@ 46-55 (lines=10) @@
43
            $_POST["contact_person_id"] = $contact_person->get("id");
44
        }
45
46
        if ($this->getKernel()->intranet->hasModuleAccess('currency') && $this->body('currency_id')) {
47
            $currency_module = $this->getKernel()->useModule('currency', false); // false = ignore user access
48
            $gateway = new Intraface_modules_currency_Currency_Gateway($this->doctrine);
49
            $currency = $gateway->findById($this->body('currency_id'));
50
            if ($currency == false) {
51
                throw new Exception('Invalid currency');
52
            }
53
54
            $_POST['currency'] = $currency;
55
        }
56
57
        if ($debtor->update($_POST)) {
58
            return new k_SeeOther($this->url('../' . $debtor->get('id')));

src/Intraface/modules/debtor/Controller/Show.php 1 location

@@ 436-445 (lines=10) @@
433
                $_POST["contact_person_id"] = $contact_person->get("id");
434
            }
435
436
            if ($this->getKernel()->intranet->hasModuleAccess('currency') && $this->body('currency_id')) {
437
                $currency_module = $this->getKernel()->useModule('currency', false); // false = ignore user access
438
                $gateway = new Intraface_modules_currency_Currency_Gateway($this->doctrine);
439
                $currency = $gateway->findById($_POST['currency_id']);
440
                if ($currency == false) {
441
                    throw new Exception('Invalid currency');
442
                }
443
444
                $_POST['currency'] = $currency;
445
            }
446
447
            if ($debtor->update($_POST)) {
448
                return new k_SeeOther($this->url(null));