EditNCFRango::execAfterAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * Copyright (C) 2019 joenilson.
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Lesser General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 3 of the License, or (at your option) any later version.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Lesser General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Lesser General Public
16
 * License along with this library; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA 02110-1301  USA
19
 */
20
21
namespace FacturaScripts\Plugins\fsRepublicaDominicana\Controller;
22
23
use FacturaScripts\Core\Lib\ExtendedController\EditController;
24
use FacturaScripts\Core\Tools;
25
26
27
/**
28
 * Description of EditNCFRango
29
 *
30
 * @author "Joe Nilson <joenilson at gmail dot com>"
31
 */
32
class EditNCFRango extends EditController
33
{
34
    public function getModelClassName(): string
35
    {
36
        return 'NCFRango';
37
    }
38
39
    public function getPageData(): array
40
    {
41
        $pagedata = parent::getPageData();
42
        $pagedata['menu'] = 'RepublicaDominicana';
43
        $pagedata['title'] = 'edit-ncf-master';
44
        $pagedata['icon'] = 'fa-solid fa-tasks';
45
46
        return $pagedata;
47
    }
48
49
    protected function createViews()
50
    {
51
        parent::createViews();
52
        $this->setCustomWidgetValues('EditNCFRango');
53
        $this->views['EditNCFRango']->disableColumn('usuariocreacion', false, 'true');
54
        $this->views['EditNCFRango']->disableColumn('fechacreacion', false, 'true');
55
        $this->views['EditNCFRango']->disableColumn('usuariomodificacion', false, 'true');
56
        $this->views['EditNCFRango']->disableColumn('fechamodificacion', false, 'true');
57
    }
58
59
    public function setCustomWidgetValues($viewName)
60
    {
61
        $customValues = [];
62
        $customValues[] = ['value' => '', 'title' => '-----------'];
63
        foreach (\range('A', 'Z') as $i) {
64
            $customValues[] = ['value' => $i, 'title' => $i];
65
        }
66
        $columnToModify = $this->views[$viewName]->columnForName('serie');
67
        if ($columnToModify) {
68
            $columnToModify->widget->setValuesFromArray($customValues);
69
        }
70
    }
71
72
    public function execPreviousAction($action)
73
    {
74
        switch ($action) {
75
            default:
76
                $this->views['EditNCFRango']->model->usuariomodificacion_view = $this->user->nick;
77
                break;
78
        }
79
        parent::execPreviousAction($action);
80
    }
81
82
    public function execAfterAction($action)
83
    {
84
        parent::execAfterAction($action);
85
    }
86
}
87