ventas_clientes_opciones   A
last analyzed

Complexity

Total Complexity 22

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 59
c 1
b 0
f 0
dl 0
loc 79
rs 10
wmc 22

3 Methods

Rating   Name   Duplication   Size   Complexity  
F private_core() 0 55 20
A __construct() 0 3 1
A share_extension() 0 10 1
1
<?php
2
/*
3
 * This file is part of facturacion_base
4
 * Copyright (C) 2015-2016    Carlos Garcia Gomez        [email protected]
5
 * Copyright (C) 2015         Luis Miguel Pérez Romero   [email protected]
6
 *
7
 * This program is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU Lesser General Public License as
9
 * published by the Free Software Foundation, either version 3 of the
10
 * License, or (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public License
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
/**
22
 * Description of opciones_servicios
23
 *
24
 * @author Carlos Garcia Gomez
25
 */
26
class ventas_clientes_opciones extends fs_controller
0 ignored issues
show
Bug introduced by
The type fs_controller was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
27
{
28
29
    public $nuevocli_setup;
30
    public $grupo;
31
32
    public function __construct()
33
    {
34
        parent::__construct(__CLASS__, 'Opciones', 'clientes', FALSE, FALSE);
35
    }
36
37
    protected function private_core()
38
    {
39
        $this->share_extension();
40
41
        $this->grupo = new grupo_clientes();
0 ignored issues
show
Bug introduced by
The type grupo_clientes was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
42
43
        /// cargamos la configuración
44
        $fsvar = new fs_var();
0 ignored issues
show
Bug introduced by
The type fs_var was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
45
        $this->nuevocli_setup = $fsvar->array_get(
46
                array(
47
            'nuevocli_cifnif_req' => 0,
48
            'nuevocli_direccion' => 1,
49
            'nuevocli_direccion_req' => 0,
50
            'nuevocli_codpostal' => 1,
51
            'nuevocli_codpostal_req' => 0,
52
            'nuevocli_pais' => 0,
53
            'nuevocli_pais_req' => 0,
54
            'nuevocli_provincia' => 1,
55
            'nuevocli_provincia_req' => 0,
56
            'nuevocli_ciudad' => 1,
57
            'nuevocli_ciudad_req' => 0,
58
            'nuevocli_telefono1' => 0,
59
            'nuevocli_telefono1_req' => 0,
60
            'nuevocli_telefono2' => 0,
61
            'nuevocli_telefono2_req' => 0,
62
            'nuevocli_email' => 0,
63
            'nuevocli_email_req' => 0,
64
            'nuevocli_codgrupo' => '',
65
            ), FALSE
66
        );
67
68
        if (isset($_POST['setup'])) {
69
            $this->nuevocli_setup['nuevocli_cifnif_req'] = ( isset($_POST['nuevocli_cifnif_req']) ? 1 : 0 );
70
            $this->nuevocli_setup['nuevocli_direccion'] = ( isset($_POST['nuevocli_direccion']) ? 1 : 0 );
71
            $this->nuevocli_setup['nuevocli_direccion_req'] = ( isset($_POST['nuevocli_direccion_req']) ? 1 : 0 );
72
            $this->nuevocli_setup['nuevocli_codpostal'] = ( isset($_POST['nuevocli_codpostal']) ? 1 : 0 );
73
            $this->nuevocli_setup['nuevocli_codpostal_req'] = ( isset($_POST['nuevocli_codpostal_req']) ? 1 : 0 );
74
            $this->nuevocli_setup['nuevocli_pais'] = ( isset($_POST['nuevocli_pais']) ? 1 : 0 );
75
            $this->nuevocli_setup['nuevocli_pais_req'] = ( isset($_POST['nuevocli_pais_req']) ? 1 : 0 );
76
            $this->nuevocli_setup['nuevocli_provincia'] = ( isset($_POST['nuevocli_provincia']) ? 1 : 0 );
77
            $this->nuevocli_setup['nuevocli_provincia_req'] = ( isset($_POST['nuevocli_provincia_req']) ? 1 : 0 );
78
            $this->nuevocli_setup['nuevocli_ciudad'] = ( isset($_POST['nuevocli_ciudad']) ? 1 : 0 );
79
            $this->nuevocli_setup['nuevocli_ciudad_req'] = ( isset($_POST['nuevocli_ciudad_req']) ? 1 : 0 );
80
            $this->nuevocli_setup['nuevocli_telefono1'] = ( isset($_POST['nuevocli_telefono1']) ? 1 : 0 );
81
            $this->nuevocli_setup['nuevocli_telefono1_req'] = ( isset($_POST['nuevocli_telefono1_req']) ? 1 : 0 );
82
            $this->nuevocli_setup['nuevocli_telefono2'] = ( isset($_POST['nuevocli_telefono2']) ? 1 : 0 );
83
            $this->nuevocli_setup['nuevocli_telefono2_req'] = ( isset($_POST['nuevocli_telefono2_req']) ? 1 : 0 );
84
            $this->nuevocli_setup['nuevocli_email'] = ( isset($_POST['nuevocli_email']) ? 1 : 0 );
85
            $this->nuevocli_setup['nuevocli_email_req'] = ( isset($_POST['nuevocli_email_req']) ? 1 : 0 );
86
            $this->nuevocli_setup['nuevocli_codgrupo'] = $_POST['nuevocli_codgrupo'];
87
88
            if ($fsvar->array_save($this->nuevocli_setup)) {
89
                $this->new_message('Datos guardados correctamente.');
90
            } else
91
                $this->new_error_msg('Error al guardar los datos.');
92
        }
93
    }
94
95
    private function share_extension()
96
    {
97
        $fsext = new fs_extension();
0 ignored issues
show
Bug introduced by
The type fs_extension was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
98
        $fsext->name = 'opciones_clientes';
99
        $fsext->from = __CLASS__;
100
        $fsext->to = 'ventas_clientes';
101
        $fsext->type = 'button';
102
        $fsext->text = '<span class="glyphicon glyphicon-wrench" aria-hidden="true" title="Opciones para nuevos clientes"></span>'
103
                . '<span class="hidden-xs">&nbsp; Opciones</span>';
104
        $fsext->save();
105
    }
106
}
107