Passed
Push — master ( 49d752...4c7773 )
by Joe Nilson
03:19
created
model/core/residentes_facturacion_programada_edificaciones.php 3 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             $this->codcliente = $t['codcliente'];
45 45
             $this->idfactura = $t['idfactura'];
46 46
             $this->procesado = $this->str2bool($t['procesado']);
47
-        }else{
47
+        } else{
48 48
             $this->id = null;
49 49
             $this->idprogramacion = null;
50 50
             $this->id_edificacion = null;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
             $this->var2str($this->procesado).");";
88 88
             if($this->db->exec($sql)){
89 89
                 return true;
90
-            }else{
90
+            } else{
91 91
                 return false;
92 92
             }
93 93
         }
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -141,9 +141,9 @@
 block discarded – undo
141 141
         $lista = array();
142 142
         if ($data) {
143 143
             foreach ($data as $d) {
144
-                 $item = new residentes_facturacion_programada_edificaciones($d);
145
-                 $this->infoAdicional($item);
146
-                 $lista[] = $item;
144
+                    $item = new residentes_facturacion_programada_edificaciones($d);
145
+                    $this->infoAdicional($item);
146
+                    $lista[] = $item;
147 147
             }
148 148
             return $lista;
149 149
         }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
     public $procesado;
37 37
     
38 38
     public function __construct($t = FALSE) {
39
-        parent::__construct('residentes_fact_prog_edificaciones','plugins/residentes');
40
-        if($t){
39
+        parent::__construct('residentes_fact_prog_edificaciones', 'plugins/residentes');
40
+        if ($t) {
41 41
             $this->id = $t['id'];
42 42
             $this->idprogramacion = $t['idprogramacion'];
43 43
             $this->id_edificacion = $t['id_edificacion'];
44 44
             $this->codcliente = $t['codcliente'];
45 45
             $this->idfactura = $t['idfactura'];
46 46
             $this->procesado = $this->str2bool($t['procesado']);
47
-        }else{
47
+        }else {
48 48
             $this->id = null;
49 49
             $this->idprogramacion = null;
50 50
             $this->id_edificacion = null;
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
         }
55 55
     }
56 56
 
57
-    public function install(){
57
+    public function install() {
58 58
         return "";
59 59
     }
60 60
     
61 61
     public function exists()
62 62
     {
63
-        if(is_null($this->id)) {
63
+        if (is_null($this->id)) {
64 64
             return false;
65 65
         }
66 66
         return true;
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     
69 69
     public function save()
70 70
     {
71
-        if($this->exists()){
71
+        if ($this->exists()) {
72 72
             $sql = "UPDATE ".$this->table_name." SET ".
73 73
             "idfactura = ".$this->intval($this->idfactura).", ".
74 74
             "codcliente = ".$this->var2str($this->codcliente).", ".
@@ -78,16 +78,16 @@  discard block
 block discarded – undo
78 78
             "WHERE id = ".$this->intval($this->id).";";
79 79
             $data = $this->db->exec($sql);
80 80
             return $data;
81
-        } else {
81
+        }else {
82 82
             $sql = "INSERT INTO ".$this->table_name.
83 83
             " (idprogramacion, id_edificacion, codcliente, procesado) VALUES (".
84 84
             $this->intval($this->idprogramacion).", ".
85 85
             $this->intval($this->id_edificacion).", ".
86 86
             $this->var2str($this->codcliente).", ".
87 87
             $this->var2str($this->procesado).");";
88
-            if($this->db->exec($sql)){
88
+            if ($this->db->exec($sql)) {
89 89
                 return true;
90
-            }else{
90
+            }else {
91 91
                 return false;
92 92
             }
93 93
         }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         $sql = "select * from ".$this->table_name." WHERE id = ".$this->intval($id);
100 100
         $this->new_advice($sql);
101 101
         $data = $this->db->select($sql);
102
-        if($data) {
102
+        if ($data) {
103 103
             return new residentes_facturacion_programada_edificaciones($data[0]);
104 104
         }
105 105
         return false;
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
         $sql = "select * from ".$this->table_name." WHERE idprogramacion = ".$this->intval($idProg)." ORDER BY id";
111 111
         $data = $this->db->select($sql);
112 112
         $lista = array();
113
-        if($data) {
114
-            foreach($data as $d) {
113
+        if ($data) {
114
+            foreach ($data as $d) {
115 115
                 $lista[] = new residentes_facturacion_programada_edificaciones($d);
116 116
             }
117 117
             return $lista;
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
                 " AND procesado = FALSE ORDER BY id";
126 126
         $data = $this->db->select($sql);
127 127
         $lista = array();
128
-        if($data) {
129
-            foreach($data as $d) {
128
+        if ($data) {
129
+            foreach ($data as $d) {
130 130
                 $lista[] = new residentes_facturacion_programada_edificaciones($d);
131 131
             }
132 132
             return $lista;
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
     public function getFacturasPorEnviar(int $idProgramacion, int $limit = 0)
204 204
     {
205 205
         $sql = "SELECT t1.*, t2.femail FROM ".$this->table_name." as t1, facturascli as t2 ".
206
-            "WHERE idprogramacion = ".$this->intval($idProgramacion) .
207
-            " AND t2.femail = ".$this->str2bool("FALSE") .
206
+            "WHERE idprogramacion = ".$this->intval($idProgramacion).
207
+            " AND t2.femail = ".$this->str2bool("FALSE").
208 208
             " AND t1.idfactura = t2.idfactura "
209
-            ." AND "."estado = ".$this->var2str($status)." ORDER BY id, idfactura" .
210
-            " LIMIT " . $limit;
209
+            ." AND "."estado = ".$this->var2str($status)." ORDER BY id, idfactura".
210
+            " LIMIT ".$limit;
211 211
         $data = $this->db->select($sql);
212 212
         $lista = array();
213 213
         if ($data) {
Please login to merge, or discard this patch.
model/core/residentes_ayudas.php 2 patches
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             $this->codigo = $t['codigo'];
45 45
             $this->tipo = $t['tipo'];
46 46
             $this->descripcion = $t['descripcion'];
47
-        }else{
47
+        } else{
48 48
             $this->codigo = null;
49 49
             $this->tipo = null;
50 50
             $this->descripcion = null;
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
                 $lista[] = new residentes_ayudas($d);
75 75
             }
76 76
             return $lista;
77
-        }else{
77
+        } else{
78 78
             return false;
79 79
         }
80 80
     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                 $lista[] = new residentes_ayudas($d);
89 89
             }
90 90
             return $lista;
91
-        }else{
91
+        } else{
92 92
             return false;
93 93
         }
94 94
     }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $data = $this->db->select($sql);
99 99
         if($data){
100 100
             return new residentes_ayudas($data[0]);
101
-        }else{
101
+        } else{
102 102
             return false;
103 103
         }
104 104
     }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     public function exists() {
107 107
         if(is_null($this->codigo)){
108 108
             return false;
109
-        }else{
109
+        } else{
110 110
             return $this->get($this->codigo,$this->tipo);
111 111
         }
112 112
     }
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
                     "descripcion = ".$this->var2str($this->descripcion)." ".
118 118
                     "WHERE codigo = ".$this->var2str($this->codigo)." AND tipo = ".$this->var2str($this->tipo).";";
119 119
             return $this->db->exec($sql);
120
-        }else{
120
+        } else{
121 121
             $sql = "INSERT INTO ".$this->table_name." (codigo, tipo, descripcion) VALUES (".
122 122
                     $this->var2str($this->codigo).", ".
123 123
                     $this->var2str($this->tipo).", ".
124 124
                     $this->var2str($this->descripcion).");";
125 125
             if($this->db->exec($sql)){
126 126
                 return $this->db->lastval();
127
-            }else{
127
+            } else{
128 128
                 return false;
129 129
             }
130 130
         }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  *
23 23
  * @author Joe Nilson <joenilson at gmail.com>
24 24
  */
25
-class residentes_ayudas extends \fs_model{
25
+class residentes_ayudas extends \fs_model {
26 26
     /**
27 27
      * El codigo de la ayuda ya sea para parentesco u ocupacion
28 28
      * @var string
@@ -39,19 +39,19 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public $descripcion;
41 41
     public function __construct($t = FALSE) {
42
-        parent::__construct('residentes_ayudas','plugins/residentes');
43
-        if($t){
42
+        parent::__construct('residentes_ayudas', 'plugins/residentes');
43
+        if ($t) {
44 44
             $this->codigo = $t['codigo'];
45 45
             $this->tipo = $t['tipo'];
46 46
             $this->descripcion = $t['descripcion'];
47
-        }else{
47
+        }else {
48 48
             $this->codigo = null;
49 49
             $this->tipo = null;
50 50
             $this->descripcion = null;
51 51
         }
52 52
     }
53 53
 
54
-    public function install(){
54
+    public function install() {
55 55
         return "insert into residentes_ayudas (codigo,tipo, descripcion) VALUES ".
56 56
             "('EMPPUB','OCUPACION','Empleado Publico'),".
57 57
             "('EMPRI','OCUPACION','Empleado Privado'),".
@@ -65,66 +65,66 @@  discard block
 block discarded – undo
65 65
             "('HIJO','PARENTESCO','HermanHijo (a)');";
66 66
     }
67 67
 
68
-    public function all(){
68
+    public function all() {
69 69
         $sql = "SELECT * FROM ".$this->table_name." ORDER BY tipo,codigo";
70 70
         $data = $this->db->select($sql);
71
-        if($data){
71
+        if ($data) {
72 72
             $lista = array();
73
-            foreach($data as $d){
73
+            foreach ($data as $d) {
74 74
                 $lista[] = new residentes_ayudas($d);
75 75
             }
76 76
             return $lista;
77
-        }else{
77
+        }else {
78 78
             return false;
79 79
         }
80 80
     }
81 81
 
82
-    public function all_tipo($tipo){
82
+    public function all_tipo($tipo) {
83 83
         $sql = "SELECT * FROM ".$this->table_name." WHERE tipo = ".$this->var2str($tipo)." ORDER BY codigo";
84 84
         $data = $this->db->select($sql);
85
-        if($data){
85
+        if ($data) {
86 86
             $lista = array();
87
-            foreach($data as $d){
87
+            foreach ($data as $d) {
88 88
                 $lista[] = new residentes_ayudas($d);
89 89
             }
90 90
             return $lista;
91
-        }else{
91
+        }else {
92 92
             return false;
93 93
         }
94 94
     }
95 95
 
96
-    public function get($codigo,$tipo){
96
+    public function get($codigo, $tipo) {
97 97
         $sql = "SELECT * FROM ".$this->table_name." WHERE codigo = ".$this->var2str($codigo)." AND tipo = ".$this->var2str($tipo).";";
98 98
         $data = $this->db->select($sql);
99
-        if($data){
99
+        if ($data) {
100 100
             return new residentes_ayudas($data[0]);
101
-        }else{
101
+        }else {
102 102
             return false;
103 103
         }
104 104
     }
105 105
 
106 106
     public function exists() {
107
-        if(is_null($this->codigo)){
107
+        if (is_null($this->codigo)) {
108 108
             return false;
109
-        }else{
110
-            return $this->get($this->codigo,$this->tipo);
109
+        }else {
110
+            return $this->get($this->codigo, $this->tipo);
111 111
         }
112 112
     }
113 113
 
114 114
     public function save() {
115
-        if($this->exists()){
115
+        if ($this->exists()) {
116 116
             $sql = "UPDATE ".$this->table_name." SET ".
117 117
                     "descripcion = ".$this->var2str($this->descripcion)." ".
118 118
                     "WHERE codigo = ".$this->var2str($this->codigo)." AND tipo = ".$this->var2str($this->tipo).";";
119 119
             return $this->db->exec($sql);
120
-        }else{
120
+        }else {
121 121
             $sql = "INSERT INTO ".$this->table_name." (codigo, tipo, descripcion) VALUES (".
122 122
                     $this->var2str($this->codigo).", ".
123 123
                     $this->var2str($this->tipo).", ".
124 124
                     $this->var2str($this->descripcion).");";
125
-            if($this->db->exec($sql)){
125
+            if ($this->db->exec($sql)) {
126 126
                 return $this->db->lastval();
127
-            }else{
127
+            }else {
128 128
                 return false;
129 129
             }
130 130
         }
Please login to merge, or discard this patch.
model/residentes_edificaciones.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
  *
23 23
  * @author Joe Nilson <joenilson at gmail.com>
24 24
  */
25
-class residentes_edificaciones extends FacturaScripts\model\residentes_edificaciones{
25
+class residentes_edificaciones extends FacturaScripts\model\residentes_edificaciones {
26 26
     /**
27 27
      * @todo Clases específicas para este plugin
28 28
      */
Please login to merge, or discard this patch.
controller/imprimir_factura_residentes.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@
 block discarded – undo
126 126
                 'page_to' => __CLASS__,
127 127
                 'type' => 'head',
128 128
                 'text' => '<script src="' .
129
-                             FS_PATH .
129
+                                FS_PATH .
130 130
                             'plugins/residentes/view/js/jsPDF/plugins/split_text_to_size.min.js" ' .
131 131
                             'type="text/javascript"></script>',
132 132
                 'params' => ''
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         if ($logo) {
59 59
             $type = pathinfo($logo, PATHINFO_EXTENSION);
60 60
             $data = file_get_contents($logo);
61
-            $this->factura_logo_uri = 'data:image/' . $type . ';base64,' . base64_encode($data);
61
+            $this->factura_logo_uri = 'data:image/'.$type.';base64,'.base64_encode($data);
62 62
         }
63 63
 
64 64
         if ($this->id) {
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
         $fac = new factura_cliente();
72 72
         $this->factura = $fac->get($this->id);
73 73
         //Agregamos la cantidad de lineas multiplicadas por 4
74
-        $this->sizeFactura+= count($this->factura->get_lineas())*8;
74
+        $this->sizeFactura += count($this->factura->get_lineas()) * 8;
75 75
         //Agregamos la linea de separación del total
76
-        $this->sizeFactura+=4;
76
+        $this->sizeFactura += 4;
77 77
         //Agregamos las 3 lineas de Neto, FS_IVA y Total
78
-        $this->sizeFactura+=12;
78
+        $this->sizeFactura += 12;
79 79
         //Agregamos un espacio de 4 lineas aprox
80
-        $this->sizeFactura+=20;
80
+        $this->sizeFactura += 20;
81 81
         $cli = new cliente();
82 82
         $this->cliente = $cli->get($this->factura->codcliente);
83 83
         $facturas = $fac->all_from_cliente($this->factura->codcliente);
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
                         'fecha'=>$f->fecha,
90 90
                         'monto'=>$f->total
91 91
                     );
92
-                    $this->sizeFactura+=4;
92
+                    $this->sizeFactura += 4;
93 93
                     $this->total_facturas_pendientes += $f->total;
94 94
                 }
95 95
             }
96 96
         }
97
-        $this->sizeFactura+=20;
97
+        $this->sizeFactura += 20;
98 98
     }
99 99
 
100 100
     public function url()
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
                 'page_from' => __CLASS__,
121 121
                 'page_to' => __CLASS__,
122 122
                 'type' => 'head',
123
-                'text' => '<script src="' .
124
-                            FS_PATH .
123
+                'text' => '<script src="'.
124
+                            FS_PATH.
125 125
                             'plugins/residentes/view/js/jspdf.min.js" type="text/javascript"></script>',
126 126
                 'params' => ''
127 127
             ),
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
                 'page_from' => __CLASS__,
131 131
                 'page_to' => __CLASS__,
132 132
                 'type' => 'head',
133
-                'text' => '<script src="' .
134
-                             FS_PATH .
135
-                            'plugins/residentes/view/js/jsPDF/plugins/split_text_to_size.min.js" ' .
133
+                'text' => '<script src="'.
134
+                             FS_PATH.
135
+                            'plugins/residentes/view/js/jsPDF/plugins/split_text_to_size.min.js" '.
136 136
                             'type="text/javascript"></script>',
137 137
                 'params' => ''
138 138
             ),
Please login to merge, or discard this patch.
controller/facturacion_residentes.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -311,7 +311,7 @@
 block discarded – undo
311 311
         $listaReferencias = $this->filter_request_array('referencia');
312 312
         foreach ($listaReferencias as $referencia) {
313 313
             $sql = "SELECT count(referencia) as facturado from lineasfacturascli where referencia = '".$referencia."' ".
314
-               " AND idfactura IN (select idfactura from facturascli WHERE codcliente = '".$codcliente."');";
314
+                " AND idfactura IN (select idfactura from facturascli WHERE codcliente = '".$codcliente."');";
315 315
             $data = $this->db->select($sql);
316 316
             if (!$data[0]['facturado']) {
317 317
                 $listaResidentes[$codcliente][] = $referencia;
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
                 'page_from' => __CLASS__,
100 100
                 'page_to' => __CLASS__,
101 101
                 'type' => 'head',
102
-                'text' => '<link rel="stylesheet" type="text/css" media="screen" href="' . FS_PATH .
102
+                'text' => '<link rel="stylesheet" type="text/css" media="screen" href="'.FS_PATH.
103 103
                             'plugins/residentes/view/css/bootstrap-select.min.css"/>',
104 104
                 'params' => ''
105 105
             ),
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
                 'page_from' => __CLASS__,
145 145
                 'page_to' => __CLASS__,
146 146
                 'type' => 'head',
147
-                'text' => '<link rel="stylesheet" type="text/css" media="screen" href="' . FS_PATH .
147
+                'text' => '<link rel="stylesheet" type="text/css" media="screen" href="'.FS_PATH.
148 148
                     'plugins/residentes/view/js/bootstrap-wysihtml5/bootstrap3-wysihtml5.css"/>',
149 149
                 'params' => ''
150 150
             ),
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         foreach ($extensiones as $ext) {
155 155
             $fsext0 = new fs_extension($ext);
156 156
             if (!$fsext0->save()) {
157
-                $this->new_error_msg('Imposible guardar los datos de la extensión ' . $ext['name'] . '.');
157
+                $this->new_error_msg('Imposible guardar los datos de la extensión '.$ext['name'].'.');
158 158
             }
159 159
         }
160 160
     }
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         }
215 215
         if ($estado === true) {
216 216
             $this->new_message('Programaci&oacute;n eliminada correctamente.');
217
-        } else {
217
+        }else {
218 218
             $this->new_error_msg('La Programaci&oacute;n no pudo ser eliminada, verifique los datos o sus permisos.');
219 219
         }
220 220
     }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
         }
236 236
         if ($estado === true) {
237 237
             $this->new_message('Programaci&oacute;n reiniciada correctamente.');
238
-        } else {
238
+        }else {
239 239
             $this->new_error_msg('La Programaci&oacute;n no pudo ser reiniciada, verifique los datos o sus permisos.');
240 240
         }
241 241
     }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
         $cfg = new residentes_email_config();
274 274
         $actualConfig = $cfg->currentConfig();
275 275
         $envioMails = new ResidentesEnviarMail();
276
-        switch($actualConfig->tiposervicio) {
276
+        switch ($actualConfig->tiposervicio) {
277 277
             case "mailjet":
278 278
                 echo $envioMails->mailjetEmailTest();
279 279
                 break;
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     public function guardarProgramacion()
291 291
     {
292 292
         $residentesProcesar = $this->cantidadResidentesProcesar();
293
-        $cantidadResidentesProcesar  = count($residentesProcesar);
293
+        $cantidadResidentesProcesar = count($residentesProcesar);
294 294
         $idProgramacion = $this->cabeceraProgramacion($cantidadResidentesProcesar);
295 295
         
296 296
         if ($idProgramacion) {
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
         $edificacionesDisponibles = $edificaciones_residentes->get_by_field('id_edificacion', $edificacion);
386 386
         foreach ($edificacionesDisponibles as $edif) {
387 387
             if ($edif->ocupado === true) {
388
-                $residentesDisponibles[] = ['id_edificacion'=>$edif->id_edificacion,'codcliente'=>$edif->codcliente];
388
+                $residentesDisponibles[] = ['id_edificacion'=>$edif->id_edificacion, 'codcliente'=>$edif->codcliente];
389 389
             }
390 390
         }
391 391
         $this->cargarResidentesFacturables($residentesDisponibles, $listaResidentes);
Please login to merge, or discard this patch.
controller/edificaciones.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -444,9 +444,9 @@
 block discarded – undo
444 444
         echo json_encode($hijos, JSON_THROW_ON_ERROR);
445 445
     }
446 446
 
447
-     /**
448
-     * funcion para guardar los codigos de las edificaciones base Manzana, Zona, Grupo, Edificio, etc
449
-     */
447
+        /**
448
+         * funcion para guardar los codigos de las edificaciones base Manzana, Zona, Grupo, Edificio, etc
449
+         */
450 450
     public function agregar($objeto)
451 451
     {
452 452
         $inicio = \filter_input(INPUT_POST, 'inicio');
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
     public function init()
95 95
     {
96
-        $this->allow_delete = ($this->user->admin)?TRUE:$this->user->allow_delete_on(__CLASS__);
96
+        $this->allow_delete = ($this->user->admin) ?TRUE:$this->user->allow_delete_on(__CLASS__);
97 97
         $this->edificaciones_tipo = new residentes_edificaciones_tipo();
98 98
         $this->edificaciones_mapa = new residentes_edificaciones_mapa();
99 99
         $this->edificaciones = new residentes_edificaciones();
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             return 'index.php?page='.__CLASS__.'&interior='.$interior;
143 143
         } elseif ($inmuebles) {
144 144
             return 'index.php?page='.__CLASS__.'&inmuebles='.$inmuebles;
145
-        } else {
145
+        }else {
146 146
             return 'index.php?page='.__CLASS__;
147 147
         }
148 148
     }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             $edificacion->codcliente = '';
163 163
             $edificacion->fecha_disponibilidad = null;
164 164
             $edificacion->fecha_ocupacion = null;
165
-            try{
165
+            try {
166 166
                 $edificacion->save();
167 167
                 $this->new_message('Inmueble desocupado exitosamente.');
168 168
             } catch (Exception $ex) {
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             $this->new_error_msg('Esta edificacion tiene un residente, '.
181 181
                                 'primero debe quitar al residente para proceder '.
182 182
                                 'a eliminar esta edificacion.');
183
-        } else {
183
+        }else {
184 184
             try {
185 185
                 $edificacion->delete();
186 186
                 $this->new_message('Edificación eliminada correctamente.');
@@ -211,15 +211,15 @@  discard block
 block discarded – undo
211 211
     public function buscar_padre($id, &$codigo, &$unir = false)
212 212
     {
213 213
         $dato = $this->edificaciones_mapa->get($id);
214
-        $codigo[] = ($unir)?'"'.$dato->id_tipo.'":"'.$dato->codigo_edificacion.'"':$dato->codigo_edificacion;
214
+        $codigo[] = ($unir) ? '"'.$dato->id_tipo.'":"'.$dato->codigo_edificacion.'"' : $dato->codigo_edificacion;
215 215
         if ($dato->padre_id === 0) {
216 216
             return $codigo;
217
-        } else {
217
+        }else {
218 218
             $this->buscar_padre($dato->padre_id, $codigo, $unir);
219 219
         }
220 220
     }
221 221
 
222
-    public function crear_codigo($id,$unir = false)
222
+    public function crear_codigo($id, $unir = false)
223 223
     {
224 224
         $codigo = array();
225 225
         $this->buscar_padre($id, $codigo, $unir);
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
                 array_unshift($lista, $linea);
230 230
             }
231 231
             $codigo = $lista;
232
-        } else {
232
+        }else {
233 233
             rsort($codigo);
234 234
         }
235 235
         return $codigo;
@@ -241,16 +241,16 @@  discard block
 block discarded – undo
241 241
         $final_p = \filter_input(INPUT_POST, 'final');
242 242
         $cantidad = \filter_input(INPUT_POST, 'cantidad');
243 243
         $incremento = \filter_input(INPUT_POST, 'incremento');
244
-        $final=(!empty($final_p))?$final_p:$inicio;
244
+        $final = (!empty($final_p)) ? $final_p : $inicio;
245 245
         $inmuebles = 0;
246 246
         $error = 0;
247 247
         $linea = 0;
248 248
         if ($inicio === $final) {
249 249
             $this->inmueble($inicio, $inmuebles, $error);
250
-        } else {
251
-            for ($i = $inicio; $i<=($final); $i++) {
252
-                if ($linea === $cantidad and $cantidad!=0) {
253
-                    $i = ($i-$cantidad)+$incremento;
250
+        }else {
251
+            for ($i = $inicio; $i <= ($final); $i++) {
252
+                if ($linea === $cantidad and $cantidad != 0) {
253
+                    $i = ($i - $cantidad) + $incremento;
254 254
                     $linea = 0;
255 255
                 }
256 256
                 $this->inmueble($i, $inmuebles, $error);
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         $ubicacion = "";
276 276
         $codcliente = "";
277 277
         $ocupado = false;
278
-        $item = (is_int($inicio))?str_pad($inicio, 3, "0", STR_PAD_LEFT):$inicio;
278
+        $item = (is_int($inicio)) ?str_pad($inicio, 3, "0", STR_PAD_LEFT) : $inicio;
279 279
         $edif0 = new residentes_edificaciones();
280 280
         $edif0->id = \filter_input(INPUT_POST, 'id');
281 281
         $edif0->id_edificacion = \filter_input(INPUT_POST, 'id_edificacion');
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
         $edif0->numero = $item;
285 285
         $edif0->ubicacion = trim($ubicacion);
286 286
         $edif0->codcliente = trim($codcliente);
287
-        $edif0->ocupado = (bool)$ocupado;
287
+        $edif0->ocupado = (bool) $ocupado;
288 288
         try {
289 289
             $edif0->save();
290 290
             $inmuebles++;
@@ -312,13 +312,13 @@  discard block
 block discarded – undo
312 312
                 $iddireccion,
313 313
                 $descripcion_direccion
314 314
             );
315
-            $inmueble->fecha_ocupacion = ($fecha_ocupacion)?\date('Y-m-d', strtotime($fecha_ocupacion)):null;
315
+            $inmueble->fecha_ocupacion = ($fecha_ocupacion) ? \date('Y-m-d', strtotime($fecha_ocupacion)) : null;
316 316
             $inmueble->fecha_disponibilidad = ($fecha_disponibilidad)
317
-                                                ?\date('Y-m-d', strtotime($fecha_disponibilidad))
317
+                                                ? \date('Y-m-d', strtotime($fecha_disponibilidad))
318 318
                                                 :null;
319 319
             if ($inmueble->save()) {
320 320
                 $this->new_message('Residente agregado exitosamente.');
321
-            } else {
321
+            }else {
322 322
                 $this->new_error_msg('No se pudo agregar al residente confirme el '.
323 323
                                     'nombre del residente y las fechs de ocupación y disponibilidad');
324 324
             }
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
             $inmueble->fecha_disponibilidad = '';
331 331
             if ($inmueble->save()) {
332 332
                 $this->new_message('Residente removido exitosamente.');
333
-            } else {
333
+            }else {
334 334
                 $this->new_error_msg('No se pudo remover al residente');
335 335
             }
336 336
         }
@@ -345,13 +345,13 @@  discard block
 block discarded – undo
345 345
             $campo = "campo_".$i->id;
346 346
             $linea = filter_input(INPUT_POST, $campo);
347 347
             $precodigo .= $linea;
348
-            $precodigo_interno[$i->id]=$linea;
348
+            $precodigo_interno[$i->id] = $linea;
349 349
         }
350 350
         $codigo_p = filter_input(INPUT_POST, 'codigo');
351 351
         $codigo_interno_p = filter_input(INPUT_POST, 'codigo_interno');
352
-        $codigo = ($codigo_p)?$codigo_p:$precodigo;
352
+        $codigo = ($codigo_p) ? $codigo_p : $precodigo;
353 353
         $codigo_interno = ($codigo_interno_p)
354
-                            ?$codigo_interno_p
354
+                            ? $codigo_interno_p
355 355
                             : \json_encode($precodigo_interno, JSON_THROW_ON_ERROR);
356 356
         $numero = filter_input(INPUT_POST, 'numero_edificacion');
357 357
         $ubicacion = filter_input(INPUT_POST, 'ubicacion');
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
                     $this->new_error_msg('Ocurrió un error al querer eliminar la Edificación. '.
369 369
                                         $exc->getTraceAsString());
370 370
                 }
371
-            } else {
371
+            }else {
372 372
                 $this->new_error_msg('¡No se puede eliminar una edificación que está ocupada!');
373 373
             }
374
-        } else {
374
+        }else {
375 375
             $edif0 = new FacturaScripts\model\residentes_edificaciones();
376 376
             $edif0->id = $id;
377 377
             $edif0->codigo = $codigo;
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
             $edif0->numero = trim($numero);
380 380
             $edif0->ubicacion = trim($ubicacion);
381 381
             $edif0->codcliente = trim($codcliente);
382
-            $edif0->ocupado = ($ocupado)?"TRUE":"FALSE";
382
+            $edif0->ocupado = ($ocupado) ? "TRUE" : "FALSE";
383 383
             try {
384 384
                 $edif0->save();
385 385
                 $this->new_message('¡Edificación guardada exitosamente!');
@@ -406,11 +406,11 @@  discard block
 block discarded – undo
406 406
                     $this->new_error_msg('Ocurrió un error al querer eliminar el tipo de edificación. '.
407 407
                                         $e->getTraceAsString());
408 408
                 }
409
-            } else {
409
+            }else {
410 410
                 $this->new_error_msg('No se puede eliminar un Tipo de edificación que es padre de otros '.
411 411
                                     'tipos de edificación.');
412 412
             }
413
-        } else {
413
+        }else {
414 414
             $tipo0 = new residentes_edificaciones_tipo();
415 415
             $tipo0->id = $id;
416 416
             $tipo0->descripcion = ucfirst(strtolower(trim(htmlspecialchars($descripcion))));
@@ -455,12 +455,12 @@  discard block
 block discarded – undo
455 455
         $id = \filter_input(INPUT_POST, 'id');
456 456
         $codigo_padre = \filter_input(INPUT_POST, 'codigo_padre');
457 457
         $padre_id = \filter_input(INPUT_POST, 'padre_id');
458
-        $final=(!empty($final_p))?$final_p:$inicio;
458
+        $final = (!empty($final_p)) ? $final_p : $inicio;
459 459
         $inmuebles = 0;
460 460
         $error = 0;
461 461
         $linea = 0;
462 462
         foreach (range($inicio, $final) as $item) {
463
-            $item = (is_int($item))?str_pad($item, 3, "0", STR_PAD_LEFT):$item;
463
+            $item = (is_int($item)) ?str_pad($item, 3, "0", STR_PAD_LEFT) : $item;
464 464
             $punto = new residentes_edificaciones_mapa();
465 465
             $punto->id = $id;
466 466
             $punto->id_tipo = $objeto->id;
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
             $punto->numero = '';
472 472
             if ($punto->save()) {
473 473
                 $inmuebles++;
474
-            } else {
474
+            }else {
475 475
                 $error++;
476 476
             }
477 477
             $linea++;
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
         foreach ($extensiones as $ext) {
536 536
             $fsext0 = new fs_extension($ext);
537 537
             if (!$fsext0->delete()) {
538
-                $this->new_error_msg('Imposible eliminar los datos de la extensión ' . $ext['name'] . '.');
538
+                $this->new_error_msg('Imposible eliminar los datos de la extensión '.$ext['name'].'.');
539 539
             }
540 540
         }
541 541
 
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
         foreach ($extensiones2 as $ext) {
573 573
             $fsext0 = new fs_extension($ext);
574 574
             if (!$fsext0->save()) {
575
-                $this->new_error_msg('Imposible guardar los datos de la extensión ' . $ext['name'] . '.');
575
+                $this->new_error_msg('Imposible guardar los datos de la extensión '.$ext['name'].'.');
576 576
             }
577 577
         }
578 578
     }
Please login to merge, or discard this patch.
controller/clientes_informacion.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -103,31 +103,31 @@  discard block
 block discarded – undo
103 103
             $ca_parentesco_obs = $this->clean_text(\filter_input(INPUT_POST, 'ca_parentesco_obs'));
104 104
             $vehiculos = \filter_input(INPUT_POST, 'vehiculos');
105 105
             $cliinfo = new residentes_informacion();
106
-            $cliinfo->codcliente=$codcliente;
107
-            $cliinfo->codigo=$codigo;
108
-            $cliinfo->ocupantes=$ocupantes;
109
-            $cliinfo->ocupantes5anos=$ocupantes5anos;
110
-            $cliinfo->ocupantes12anos=$ocupantes12anos;
111
-            $cliinfo->ocupantes18anos=$ocupantes18anos;
112
-            $cliinfo->ocupantes30anos=$ocupantes30anos;
113
-            $cliinfo->ocupantes50anos=$ocupantes50anos;
114
-            $cliinfo->ocupantes70anos=$ocupantes70anos;
115
-            $cliinfo->ocupantes71anos=$ocupantes71anos;
116
-            $cliinfo->informacion_discapacidad= $informacion_discapacidad;
117
-            $cliinfo->propietario= (bool)$propietario;
118
-            $cliinfo->profesion= $profesion;
119
-            $cliinfo->ocupacion= $ocupacion;
120
-            $cliinfo->ca_nombres= $ca_nombres;
121
-            $cliinfo->ca_apellidos= $ca_apellidos;
122
-            $cliinfo->ca_telefono= $ca_telefono;
123
-            $cliinfo->ca_email= $ca_email;
124
-            $cliinfo->ca_propietario= (bool)$ca_propietario;
125
-            $cliinfo->ca_parentesco= $ca_parentesco;
126
-            $cliinfo->ca_parentesco_obs= $ca_parentesco_obs;
127
-            $cliinfo->vehiculos= $vehiculos;
106
+            $cliinfo->codcliente = $codcliente;
107
+            $cliinfo->codigo = $codigo;
108
+            $cliinfo->ocupantes = $ocupantes;
109
+            $cliinfo->ocupantes5anos = $ocupantes5anos;
110
+            $cliinfo->ocupantes12anos = $ocupantes12anos;
111
+            $cliinfo->ocupantes18anos = $ocupantes18anos;
112
+            $cliinfo->ocupantes30anos = $ocupantes30anos;
113
+            $cliinfo->ocupantes50anos = $ocupantes50anos;
114
+            $cliinfo->ocupantes70anos = $ocupantes70anos;
115
+            $cliinfo->ocupantes71anos = $ocupantes71anos;
116
+            $cliinfo->informacion_discapacidad = $informacion_discapacidad;
117
+            $cliinfo->propietario = (bool) $propietario;
118
+            $cliinfo->profesion = $profesion;
119
+            $cliinfo->ocupacion = $ocupacion;
120
+            $cliinfo->ca_nombres = $ca_nombres;
121
+            $cliinfo->ca_apellidos = $ca_apellidos;
122
+            $cliinfo->ca_telefono = $ca_telefono;
123
+            $cliinfo->ca_email = $ca_email;
124
+            $cliinfo->ca_propietario = (bool) $ca_propietario;
125
+            $cliinfo->ca_parentesco = $ca_parentesco;
126
+            $cliinfo->ca_parentesco_obs = $ca_parentesco_obs;
127
+            $cliinfo->vehiculos = $vehiculos;
128 128
             if ($cliinfo->save()) {
129 129
                 $this->new_message('¡Información actualizada correctamente!');
130
-            } else {
130
+            }else {
131 131
                 $this->new_error_msg('Ocurrió un error al actualizar la información por favor revise los ".
132 132
                 "datos ingresados e intente nuevamente.');
133 133
             }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
         foreach ($extensiones as $ext) {
163 163
             $fsext0 = new fs_extension($ext);
164 164
             if (!$fsext0->save()) {
165
-                $this->new_error_msg('Imposible guardar los datos de la extensión ' . $ext['name'] . '.');
165
+                $this->new_error_msg('Imposible guardar los datos de la extensión '.$ext['name'].'.');
166 166
             }
167 167
         }
168 168
     }
Please login to merge, or discard this patch.
model/core/residentes_edificaciones_tipo.php 2 patches
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             $this->id = $t['id'];
45 45
             $this->descripcion = $t['descripcion'];
46 46
             $this->padre = $t['padre'];
47
-        }else{
47
+        } else{
48 48
             $this->id = null;
49 49
             $this->descripcion = null;
50 50
             $this->padre = null;
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         $data = $this->db->select($sql);
76 76
         if($data){
77 77
             return new residentes_edificaciones_tipo($data[0]);
78
-        }else{
78
+        } else{
79 79
             return false;
80 80
         }
81 81
     }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
                 $lista[] =  new residentes_edificaciones_tipo($d);
97 97
             }
98 98
             return $lista;
99
-        }else{
99
+        } else{
100 100
             return false;
101 101
         }
102 102
     }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     public function exists() {
105 105
         if(is_null($this->id)){
106 106
             return false;
107
-        }else{
107
+        } else{
108 108
             return $this->get($this->id);
109 109
         }
110 110
     }
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
                     "padre = ".$this->intval($this->padre)." ".
117 117
                     "WHERE id = ".$this->intval($this->id).";";
118 118
             return $this->db->exec($sql);
119
-        }else{
119
+        } else{
120 120
             $sql = "INSERT INTO ".$this->table_name." (descripcion, padre) VALUES (".
121 121
                     $this->var2str($this->descripcion).", ".
122 122
                     $this->intval($this->padre).");";
123 123
             if($this->db->exec($sql)){
124 124
                 return $this->db->lastval();
125
-            }else{
125
+            } else{
126 126
                 return false;
127 127
             }
128 128
         }
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  *
23 23
  * @author Joe Nilson <joenilson at gmail.com>
24 24
  */
25
-class residentes_edificaciones_tipo extends \fs_model{
25
+class residentes_edificaciones_tipo extends \fs_model {
26 26
     /**
27 27
      * El Id del tipo de edificacion
28 28
      * @var integer serial
@@ -39,19 +39,19 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public $padre;
41 41
     public function __construct($t = FALSE) {
42
-        parent::__construct('residentes_edificaciones_tipo','plugins/residentes');
43
-        if($t){
42
+        parent::__construct('residentes_edificaciones_tipo', 'plugins/residentes');
43
+        if ($t) {
44 44
             $this->id = $t['id'];
45 45
             $this->descripcion = $t['descripcion'];
46 46
             $this->padre = $t['padre'];
47
-        }else{
47
+        }else {
48 48
             $this->id = null;
49 49
             $this->descripcion = null;
50 50
             $this->padre = null;
51 51
         }
52 52
     }
53 53
 
54
-    public function install(){
54
+    public function install() {
55 55
         return "insert into residentes_edificaciones_tipo (descripcion) VALUES ('Bloque');";
56 56
     }
57 57
 
@@ -65,17 +65,17 @@  discard block
 block discarded – undo
65 65
                 $lista[] = new residentes_edificaciones_tipo($d);
66 66
             }
67 67
             return $lista;
68
-        } else {
68
+        }else {
69 69
             return false;
70 70
         }
71 71
     }
72 72
 
73
-    public function get($id){
73
+    public function get($id) {
74 74
         $sql = "SELECT * FROM ".$this->table_name." WHERE id = ".$this->intval($id).";";
75 75
         $data = $this->db->select($sql);
76
-        if($data){
76
+        if ($data) {
77 77
             return new residentes_edificaciones_tipo($data[0]);
78
-        }else{
78
+        }else {
79 79
             return false;
80 80
         }
81 81
     }
@@ -86,43 +86,43 @@  discard block
 block discarded – undo
86 86
      * @param string|integer $value
87 87
      * @return boolean|\FacturaScripts\model\residentes_edificaciones_tipo
88 88
      */
89
-    public function get_by_field($field,$value){
90
-        $query = (is_string($value))?$this->var2str($value):$this->intval($value);
89
+    public function get_by_field($field, $value) {
90
+        $query = (is_string($value)) ? $this->var2str($value) : $this->intval($value);
91 91
         $sql = "SELECT * FROM ".$this->table_name." WHERE ".strtoupper(trim($field))." = ".$query.";";
92 92
         $data = $this->db->select($sql);
93
-        if($data){
93
+        if ($data) {
94 94
             $lista = array();
95
-            foreach($data as $d){
96
-                $lista[] =  new residentes_edificaciones_tipo($d);
95
+            foreach ($data as $d) {
96
+                $lista[] = new residentes_edificaciones_tipo($d);
97 97
             }
98 98
             return $lista;
99
-        }else{
99
+        }else {
100 100
             return false;
101 101
         }
102 102
     }
103 103
 
104 104
     public function exists() {
105
-        if(is_null($this->id)){
105
+        if (is_null($this->id)) {
106 106
             return false;
107
-        }else{
107
+        }else {
108 108
             return $this->get($this->id);
109 109
         }
110 110
     }
111 111
 
112 112
     public function save() {
113
-        if($this->exists()){
113
+        if ($this->exists()) {
114 114
             $sql = "UPDATE ".$this->table_name." SET ".
115 115
                     "descripcion = ".$this->var2str($this->descripcion).", ".
116 116
                     "padre = ".$this->intval($this->padre)." ".
117 117
                     "WHERE id = ".$this->intval($this->id).";";
118 118
             return $this->db->exec($sql);
119
-        }else{
119
+        }else {
120 120
             $sql = "INSERT INTO ".$this->table_name." (descripcion, padre) VALUES (".
121 121
                     $this->var2str($this->descripcion).", ".
122 122
                     $this->intval($this->padre).");";
123
-            if($this->db->exec($sql)){
123
+            if ($this->db->exec($sql)) {
124 124
                 return $this->db->lastval();
125
-            }else{
125
+            }else {
126 126
                 return false;
127 127
             }
128 128
         }
@@ -132,25 +132,25 @@  discard block
 block discarded – undo
132 132
         return $this->db->exec($sql);
133 133
     }
134 134
 
135
-    public function jerarquia(){
135
+    public function jerarquia() {
136 136
         $lista = $this->all();
137
-        return ($lista)?$this->estructura($lista):null;
137
+        return ($lista) ? $this->estructura($lista) : null;
138 138
     }
139 139
 
140
-    public function estructura($lista, $raiz = 0){
140
+    public function estructura($lista, $raiz = 0) {
141 141
         $estructura = array();
142
-        foreach($lista as $key=>$item){
143
-            if($item->padre == $raiz){
142
+        foreach ($lista as $key=>$item) {
143
+            if ($item->padre == $raiz) {
144 144
                 unset($lista[$key]);
145
-                $estructura[]=array(
145
+                $estructura[] = array(
146 146
                     'id'=>$item->id,
147 147
                     'text'=>$item->descripcion,
148 148
                     'padre'=>$item->padre,
149
-                    'nodes'=>$this->estructura($lista,$item->id)
149
+                    'nodes'=>$this->estructura($lista, $item->id)
150 150
                 );
151 151
             }
152 152
         }
153
-        return empty($estructura)?null:$estructura;
153
+        return empty($estructura) ?null:$estructura;
154 154
     }
155 155
 
156 156
     /**
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
     public function datosInformacion()
160 160
     {
161 161
         //Cantidad de Edificaciones
162
-        $sql_edificaciones = "SELECT ret.id,ret.descripcion, count(rme.id) as total " .
163
-            "FROM ". $this->table_name ." as ret " .
164
-            " join residentes_mapa_edificaciones as rme on (rme.id_tipo = ret.id) " .
165
-            " group by ret.id,ret.descripcion " .
162
+        $sql_edificaciones = "SELECT ret.id,ret.descripcion, count(rme.id) as total ".
163
+            "FROM ".$this->table_name." as ret ".
164
+            " join residentes_mapa_edificaciones as rme on (rme.id_tipo = ret.id) ".
165
+            " group by ret.id,ret.descripcion ".
166 166
             " order by ret.padre;";
167 167
         $data_edificaciones = $this->db->select($sql_edificaciones);
168 168
         //cantidad de Inmuebles
Please login to merge, or discard this patch.
model/core/residentes_edificaciones.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -192,8 +192,8 @@
 block discarded – undo
192 192
     public function all_ocupados()
193 193
     {
194 194
         $sql = "SELECT re.*, c.nombre FROM ".$this->table_name." as re, clientes as c ".
195
-               " WHERE ocupado = TRUE and re.codcliente != '' and re.codcliente = c.codcliente ".
196
-               " ORDER BY re.codigo_interno, re.numero";
195
+                " WHERE ocupado = TRUE and re.codcliente != '' and re.codcliente = c.codcliente ".
196
+                " ORDER BY re.codigo_interno, re.numero";
197 197
         $data = $this->db->select($sql);
198 198
         return $this->listaInfo($data);
199 199
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             $this->ocupado = $this->str2bool($t['ocupado']);
110 110
             $this->fecha_ocupacion = $t['fecha_ocupacion'];
111 111
             $this->fecha_disponibilidad = $t['fecha_disponibilidad'];
112
-        }else{
112
+        } else{
113 113
             $this->id = null;
114 114
             $this->iddireccion = 0;
115 115
             $this->id_edificacion = null;
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
             $item->pertenencia = $this->pertenencia($item);
207 207
             $this->info($item);
208 208
             return $item;
209
-        }else{
209
+        } else{
210 210
             return false;
211 211
         }
212 212
     }
Please login to merge, or discard this patch.
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @author Joe Nilson <joenilson at gmail.com>
23 23
  */
24
-class residentes_edificaciones extends \fs_model{
24
+class residentes_edificaciones extends \fs_model {
25 25
     /**
26 26
      * El Id de la de edificacion
27 27
      * @var integer serial
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
     public $cliente_info;
96 96
     public $cliente_vehiculo;
97 97
     public function __construct($t = FALSE) {
98
-        parent::__construct('residentes_edificaciones','plugins/residentes');
99
-        if($t){
98
+        parent::__construct('residentes_edificaciones', 'plugins/residentes');
99
+        if ($t) {
100 100
             $this->id = $t['id'];
101 101
             $this->iddireccion = $t['iddireccion'];
102 102
             $this->id_edificacion = $t['id_edificacion'];
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             $this->ocupado = $this->str2bool($t['ocupado']);
110 110
             $this->fecha_ocupacion = $t['fecha_ocupacion'];
111 111
             $this->fecha_disponibilidad = $t['fecha_disponibilidad'];
112
-        }else{
112
+        }else {
113 113
             $this->id = null;
114 114
             $this->iddireccion = 0;
115 115
             $this->id_edificacion = null;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     {
148 148
         if (!is_null($this->id)) {
149 149
             return FS_PATH.'index.php?page=ver_residente&id='.$this->id;
150
-        } else {
150
+        }else {
151 151
             return FS_PATH.'index.php?page=residentes';
152 152
         }
153 153
     }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
                 $lista[] = $item;
178 178
             }
179 179
             return $lista;
180
-        } else {
180
+        }else {
181 181
             return false;
182 182
         }
183 183
     }
@@ -198,15 +198,15 @@  discard block
 block discarded – undo
198 198
         return $this->listaInfo($data);
199 199
     }
200 200
 
201
-    public function get($id){
201
+    public function get($id) {
202 202
         $sql = "SELECT * FROM ".$this->table_name." WHERE id = ".$this->intval($id).";";
203 203
         $data = $this->db->select($sql);
204
-        if($data){
204
+        if ($data) {
205 205
             $item = new residentes_edificaciones($data[0]);
206 206
             $item->pertenencia = $this->pertenencia($item);
207 207
             $this->info($item);
208 208
             return $item;
209
-        }else{
209
+        }else {
210 210
             return false;
211 211
         }
212 212
     }
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
      * @param string $value
218 218
      * @return boolean|\FacturaScripts\model\residentes_edificaciones
219 219
      */
220
-    public function get_by_field($field,$value){
221
-        $query = (is_string($value))?$this->var2str($value):$this->intval($value);
220
+    public function get_by_field($field, $value) {
221
+        $query = (is_string($value)) ? $this->var2str($value) : $this->intval($value);
222 222
         $sql = "SELECT * FROM ".$this->table_name." WHERE ".strtoupper(trim($field))." = ".$query.
223 223
             " ORDER BY codigo_interno,numero;";
224 224
         $data = $this->db->select($sql);
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     {
230 230
         if (is_null($this->id)) {
231 231
             return false;
232
-        } else {
232
+        }else {
233 233
             return $this->get($this->id);
234 234
         }
235 235
     }
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
                     "ocupado = ".$this->var2str($this->ocupado)." ".
252 252
                     "WHERE id = ".$this->intval($this->id).";";
253 253
             return $this->db->exec($sql);
254
-        } else {
254
+        }else {
255 255
             $sql = "INSERT INTO ".$this->table_name." (id_edificacion, iddireccion, codigo, codigo_interno, numero, ubicacion, coordenadas,codcliente, ocupado, fecha_ocupacion, fecha_disponibilidad) VALUES (".
256 256
                     $this->intval($this->id_edificacion).", ".
257 257
                     $this->intval($this->iddireccion).", ".
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
                     $this->var2str($this->fecha_disponibilidad).");";
267 267
             if ($this->db->exec($sql)) {
268 268
                 return $this->db->lastval();
269
-            } else {
269
+            }else {
270 270
                 return false;
271 271
             }
272 272
         }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 
309 309
     public function buscar_ubicacion_inmueble($id, $linea)
310 310
     {
311
-        $inicio_busqueda = ($linea===0)?"{\"":"{%\"";
311
+        $inicio_busqueda = ($linea === 0) ? "{\"" : "{%\"";
312 312
         $sql = "SELECT * FROM ".$this->table_name." WHERE codigo_interno LIKE '".
313 313
             $inicio_busqueda.$id."\":%}' ORDER BY codigo;";
314 314
         $data = $this->db->select($sql);
@@ -319,14 +319,14 @@  discard block
 block discarded – undo
319 319
                 $lista[] = $this->pertenencia($l);
320 320
             }
321 321
             return $lista;
322
-        } else {
322
+        }else {
323 323
             return false;
324 324
         }
325 325
     }
326 326
 
327
-    public function buscar_cantidad_inmuebles($id,$linea)
327
+    public function buscar_cantidad_inmuebles($id, $linea)
328 328
     {
329
-        $inicio_busqueda = ($linea===0)?"{\"":"{%\"";
329
+        $inicio_busqueda = ($linea === 0) ? "{\"" : "{%\"";
330 330
         $sql = "SELECT DISTINCT codigo FROM ".$this->table_name." WHERE codigo_interno LIKE '".
331 331
             $inicio_busqueda.$id."\":%}' ORDER BY codigo;";
332 332
         $data = $this->db->select($sql);
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
                 $lista[] = $l;
338 338
             }
339 339
             return $lista;
340
-        } else {
340
+        }else {
341 341
             return false;
342 342
         }
343 343
     }
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
         $data = $this->db->select($sql);
350 350
         if ($data) {
351 351
             return $data[0]['cantidad'];
352
-        } else {
352
+        }else {
353 353
             return false;
354 354
         }
355 355
     }
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
         $mapa = array();
361 361
         $linea = 0;
362 362
         foreach ($edificaciones_tipo->all() as $data) {
363
-            if ($linea===1) {
363
+            if ($linea === 1) {
364 364
                 break;
365 365
             }
366 366
             $items = $this->buscar_cantidad_inmuebles($data->id, $data->padre);
@@ -376,19 +376,19 @@  discard block
 block discarded – undo
376 376
     {
377 377
         $sql = "SELECT * FROM ".$this->table_name." WHERE ";
378 378
         $OR = "";
379
-        if ($type=='inmueble') {
380
-            $sql.=" numero LIKE '%".strtoupper($query)."%' ";
381
-            $sql.=" OR codigo LIKE '%".strtoupper($query)."%' ";
382
-        } else {
379
+        if ($type == 'inmueble') {
380
+            $sql .= " numero LIKE '%".strtoupper($query)."%' ";
381
+            $sql .= " OR codigo LIKE '%".strtoupper($query)."%' ";
382
+        }else {
383 383
             if (is_int($query)) {
384
-                $sql.=" id_edificacion LIKE '%".$query."%' ";
385
-                $sql.=" id LIKE '%".$query."%' ";
384
+                $sql .= " id_edificacion LIKE '%".$query."%' ";
385
+                $sql .= " id LIKE '%".$query."%' ";
386 386
                 $OR = "OR";
387 387
             }
388
-            $sql.=" $OR numero LIKE '%".strtoupper($query)."%' ";
389
-            $sql.=" OR codigo LIKE '%".strtoupper($query)."%' ";
388
+            $sql .= " $OR numero LIKE '%".strtoupper($query)."%' ";
389
+            $sql .= " OR codigo LIKE '%".strtoupper($query)."%' ";
390 390
         }
391
-        $sql.=" ORDER BY codigo,numero";
391
+        $sql .= " ORDER BY codigo,numero";
392 392
         $data = $this->db->select($sql);
393 393
         $lista = array();
394 394
         if ($data) {
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
             " order by ".$sort." ".$order;
469 469
         if ($todo) {
470 470
             $data = $this->db->select($sql);
471
-        } else {
471
+        }else {
472 472
             $data = $this->db->select_limit($sql, $limit, $offset);
473 473
         }
474 474
         $sql_cantidad = "select count(r.id) as total from residentes_edificaciones as r ".
@@ -506,13 +506,13 @@  discard block
 block discarded – undo
506 506
             " order by ".$sort." ".$order;
507 507
         if ($todo) {
508 508
             $data = $this->db->select($sql);
509
-        } else {
509
+        }else {
510 510
             $data = $this->db->select_limit($sql, $limit, $offset);
511 511
         }
512 512
 
513 513
         $sql_cantidad = "select count(r.id) as total from residentes_edificaciones as r";
514 514
         if ($whereSQL) {
515
-            $sql_cantidad.=" WHERE r.codigo!='' ".$whereSQL;
515
+            $sql_cantidad .= " WHERE r.codigo!='' ".$whereSQL;
516 516
         }
517 517
         $data_cantidad = $this->db->select($sql_cantidad);
518 518
         return array($data, $data_cantidad[0]['total']);
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
             " order by ".$sort." ".$order;
551 551
         if ($todo) {
552 552
             $data = $this->db->select($sql);
553
-        } else {
553
+        }else {
554 554
             $data = $this->db->select_limit($sql, $limit, $offset);
555 555
         }
556 556
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
      */
567 567
     public function totalFacturas()
568 568
     {
569
-        $sql = "SELECT count(idfactura) as total from facturascli where codcliente = ". $this->codcliente ." and anulada = false;";
569
+        $sql = "SELECT count(idfactura) as total from facturascli where codcliente = ".$this->codcliente." and anulada = false;";
570 570
         $data = $this->db->select($sql);
571 571
         return $data[0]['total'];
572 572
     }
@@ -574,33 +574,33 @@  discard block
 block discarded – undo
574 574
     public function facturas_from_cliente($orden)
575 575
     {
576 576
         $sql = "SELECT ".
577
-            "fa.codcliente, fa.idfactura, fa.numero2, fa.codigo, fa.fecha, fa.vencimiento, " .
578
-            "fa.observaciones, fa.idfacturarect, fa.pagada as estadopago, fa.pagada, " .
579
-            "fa.total, fa.referencia, fa.descripcion, fa.cantidad, fa.pvptotal, " .
580
-            "d.numero2, d.idfacturarect, " .
581
-            "COALESCE(d.cantidad,0) as cantidaddev, COALESCE(d.pvptotal,0) as pvptotaldev, " .
582
-            "(COALESCE(fa.cantidad,0)+COALESCE(d.cantidad,0)) as qdadfinal, " .
583
-            "(COALESCE(fa.pvptotal,0)+COALESCE(d.pvptotal,0)) as pvpfinal " .
584
-            "FROM " .
585
-            "(SELECT f.codcliente, f.idfactura, f.numero2, f.codigo, f.fecha, f.vencimiento, f.observaciones, f.idfacturarect, " .
586
-            "(CASE WHEN f.pagada = true THEN 'Pagada' ELSE 'Pendiente' END) AS pagada, f.total, " .
587
-            "lf.referencia, lf.descripcion, lf.cantidad, lf.pvptotal " .
588
-            "FROM facturascli as f " .
589
-            "LEFT JOIN lineasfacturascli as lf ON (lf.idfactura = f.idfactura) " .
590
-            "WHERE f.anulada = false " .
591
-            "order by f.fecha ". $orden .", f.idfactura ". $orden .") AS fa " .
592
-            "LEFT OUTER JOIN " .
593
-            "(SELECT f2.codcliente, f2.idfactura, f2.numero2, f2.codigo, f2.fecha, f2.idfacturarect, " .
594
-            "(CASE WHEN f2.pagada = true THEN 'Pagada' ELSE 'Pendiente' END) AS pagada, f2.total, " .
595
-            "lf2.referencia, lf2.descripcion, lf2.cantidad, lf2.pvptotal " .
596
-            "FROM facturascli as f2 " .
597
-            "LEFT JOIN lineasfacturascli as lf2 ON (lf2.idfactura = f2.idfactura) " .
598
-            "WHERE f2.anulada = false  and f2.codcliente = '". $this->codcliente ."' and f2.idfacturarect is not null " .
599
-            ") AS d " .
600
-            "ON (fa.idfactura = d.idfacturarect AND fa.referencia = d.referencia) " .
601
-            "WHERE " .
602
-            "fa.codcliente = '". $this->codcliente ."' " .
603
-            "order by fa.fecha ". $orden .", fa.idfactura ". $orden .";";
577
+            "fa.codcliente, fa.idfactura, fa.numero2, fa.codigo, fa.fecha, fa.vencimiento, ".
578
+            "fa.observaciones, fa.idfacturarect, fa.pagada as estadopago, fa.pagada, ".
579
+            "fa.total, fa.referencia, fa.descripcion, fa.cantidad, fa.pvptotal, ".
580
+            "d.numero2, d.idfacturarect, ".
581
+            "COALESCE(d.cantidad,0) as cantidaddev, COALESCE(d.pvptotal,0) as pvptotaldev, ".
582
+            "(COALESCE(fa.cantidad,0)+COALESCE(d.cantidad,0)) as qdadfinal, ".
583
+            "(COALESCE(fa.pvptotal,0)+COALESCE(d.pvptotal,0)) as pvpfinal ".
584
+            "FROM ".
585
+            "(SELECT f.codcliente, f.idfactura, f.numero2, f.codigo, f.fecha, f.vencimiento, f.observaciones, f.idfacturarect, ".
586
+            "(CASE WHEN f.pagada = true THEN 'Pagada' ELSE 'Pendiente' END) AS pagada, f.total, ".
587
+            "lf.referencia, lf.descripcion, lf.cantidad, lf.pvptotal ".
588
+            "FROM facturascli as f ".
589
+            "LEFT JOIN lineasfacturascli as lf ON (lf.idfactura = f.idfactura) ".
590
+            "WHERE f.anulada = false ".
591
+            "order by f.fecha ".$orden.", f.idfactura ".$orden.") AS fa ".
592
+            "LEFT OUTER JOIN ".
593
+            "(SELECT f2.codcliente, f2.idfactura, f2.numero2, f2.codigo, f2.fecha, f2.idfacturarect, ".
594
+            "(CASE WHEN f2.pagada = true THEN 'Pagada' ELSE 'Pendiente' END) AS pagada, f2.total, ".
595
+            "lf2.referencia, lf2.descripcion, lf2.cantidad, lf2.pvptotal ".
596
+            "FROM facturascli as f2 ".
597
+            "LEFT JOIN lineasfacturascli as lf2 ON (lf2.idfactura = f2.idfactura) ".
598
+            "WHERE f2.anulada = false  and f2.codcliente = '".$this->codcliente."' and f2.idfacturarect is not null ".
599
+            ") AS d ".
600
+            "ON (fa.idfactura = d.idfacturarect AND fa.referencia = d.referencia) ".
601
+            "WHERE ".
602
+            "fa.codcliente = '".$this->codcliente."' ".
603
+            "order by fa.fecha ".$orden.", fa.idfactura ".$orden.";";
604 604
         $data = $this->db->select($sql);
605 605
         $list = [];
606 606
         if ($data) {
Please login to merge, or discard this patch.