Passed
Push — master ( 49d752...4c7773 )
by Joe Nilson
03:19
created
extras/residentesFacturaProgramada.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     public function conceptoFacturable($codcliente, $referencia)
41 41
     {
42 42
         $sql = "SELECT count(referencia) as facturado from lineasfacturascli where referencia = ".
43
-            $this->var2str($referencia) .
43
+            $this->var2str($referencia).
44 44
             " AND idfactura IN (select idfactura from facturascli WHERE codcliente = ".$this->var2str($codcliente).");";
45 45
         $data = $this->db->select($sql);
46 46
         if (!$data[0]['facturado']) {
@@ -90,16 +90,16 @@  discard block
 block discarded – undo
90 90
 
91 91
                 $this->nuevoTotalFactura($factura, $residenteProg, $empresaTable);
92 92
                 if (!in_array($cliente_residente->email, [null, ''], true) && $jobDisponible->tipo_programacion === 'enviar') {
93
-                    $archivo = $factura->codigo . '_' . $factura->numero2 . '.pdf';
93
+                    $archivo = $factura->codigo.'_'.$factura->numero2.'.pdf';
94 94
                     $documento = new residentesFacturaDetallada('L', 'mm', 'A5', $jobDisponible->tipo_programacion, $archivo, 'cron');
95 95
                     $documento->crearFactura($empresaTable, $factura, $cliente_residente);
96 96
                 }
97 97
                 ++$jobDisponible->facturas_generadas;
98 98
                 $jobDisponible->save();
99
-            } else {
99
+            }else {
100 100
                 $this->log->new_error_msg('Imposible guardar la factura.');
101 101
             }
102
-        } else {
102
+        }else {
103 103
             $this->log->new_error_msg('Cliente no encontrado.');
104 104
         }
105 105
     }
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             $residenteProgramado->idfactura = $factura->idfactura;
180 180
             $residenteProgramado->procesado = true;
181 181
             $residenteProgramado->save();
182
-        } else {
182
+        }else {
183 183
             $factura->delete();
184 184
         }
185 185
     }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
         if ($empresaTable->contintegrada) {
236 236
             $asiento_factura = new asiento_factura();
237 237
             $asiento_factura->generar_asiento_venta($factura);
238
-        } else {
238
+        }else {
239 239
             /// de todas formas forzamos la generación de las líneas de iva
240 240
             $factura->get_lineas_iva();
241 241
         }
Please login to merge, or discard this patch.
model/core/residentes_vehiculos.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             $this->vehiculo_placa = $t['vehiculo_placa'];
81 81
             $this->vehiculo_tipo = $t['vehiculo_tipo'];
82 82
             $this->codigo_tarjeta = $t['codigo_tarjeta'];
83
-        } else {
83
+        }else {
84 84
             $this->idvehiculo = null;
85 85
             $this->codcliente = null;
86 86
             $this->vehiculo_marca = null;
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
                 $lista[] = (object) $d;
163 163
             }
164 164
             return [$lista, $data_total[0]['total']];
165
-        } else {
165
+        }else {
166 166
             return false;
167 167
         }
168 168
     }
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
                 //$item = $this->info_adicional($item);
179 179
                 $lista[] = $item;
180 180
             }
181
-            ksort($lista, );
181
+            ksort($lista,);
182 182
             return $lista;
183
-        } else {
183
+        }else {
184 184
             return false;
185 185
         }
186 186
     }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         if ($data) {
194 194
             $item = new residentes_vehiculos($data[0]);
195 195
             return $item;
196
-        } else {
196
+        }else {
197 197
             return false;
198 198
         }
199 199
     }
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
      */
207 207
     public function get_by_field($field, $value)
208 208
     {
209
-        $query = (is_string($value))?$this->var2str($value):$this->intval($value);
209
+        $query = (is_string($value)) ? $this->var2str($value) : $this->intval($value);
210 210
         $sql = "SELECT * FROM ".$this->table_name." WHERE ".strtoupper(trim($field))." = ".$query.";";
211 211
         $data = $this->db->select($sql);
212 212
         if ($data) {
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
                 $lista[] = $item;
218 218
             }
219 219
             return $lista;
220
-        } else {
220
+        }else {
221 221
             return false;
222 222
         }
223 223
     }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     {
227 227
         if (is_null($this->idvehiculo)) {
228 228
             return false;
229
-        } else {
229
+        }else {
230 230
             return $this->get($this->codcliente, $this->idvehiculo);
231 231
         }
232 232
     }
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
                     "WHERE idvehiculo = ".$this->intval($this->idvehiculo)." AND ".
245 245
                     "codcliente = ".$this->var2str($this->codcliente).";";
246 246
             return $this->db->exec($sql);
247
-        } else {
247
+        }else {
248 248
             $sql = "INSERT INTO ".$this->table_name." (codcliente, vehiculo_marca, vehiculo_modelo, vehiculo_color, ".
249 249
                 "vehiculo_placa, vehiculo_tipo, codigo_tarjeta) VALUES (".
250 250
                     $this->var2str($this->codcliente).", ".
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
                     $this->var2str($this->codigo_tarjeta).");";
257 257
             if ($this->db->exec($sql)) {
258 258
                 return $this->db->lastval();
259
-            } else {
259
+            }else {
260 260
                 return false;
261 261
             }
262 262
         }
@@ -271,17 +271,17 @@  discard block
 block discarded – undo
271 271
         $clilist = array();
272 272
         $query = mb_strtolower($this->no_html($busqueda), 'UTF8');
273 273
 
274
-        $consulta = "SELECT * FROM " . $this->table_name . " WHERE ";
274
+        $consulta = "SELECT * FROM ".$this->table_name." WHERE ";
275 275
         if (is_numeric($query)) {
276
-            $consulta .= "(codigo_tarjeta LIKE '%" . $query . "%' OR CAST(idvehiculo as CHAR) = '%" . $query . "%')";
277
-        } else {
276
+            $consulta .= "(codigo_tarjeta LIKE '%".$query."%' OR CAST(idvehiculo as CHAR) = '%".$query."%')";
277
+        }else {
278 278
             $buscar = str_replace(' ', '%', $query);
279
-            $consulta .= "(lower(codigo_tarjeta) LIKE '%" . $buscar .
280
-                "%' OR lower(vehiculo_color) LIKE '%" . $buscar . "%'" .
281
-                " OR lower(vehiculo_marca) LIKE '%" . $buscar .
282
-                "%' OR lower(vehiculo_modelo) LIKE '%" . $buscar . "%'" .
283
-                " OR lower(vehiculo_placa) LIKE '%" . $buscar .
284
-                "%' OR lower(vehiculo_tipo) LIKE '%" . $buscar . "%')";
279
+            $consulta .= "(lower(codigo_tarjeta) LIKE '%".$buscar.
280
+                "%' OR lower(vehiculo_color) LIKE '%".$buscar."%'".
281
+                " OR lower(vehiculo_marca) LIKE '%".$buscar.
282
+                "%' OR lower(vehiculo_modelo) LIKE '%".$buscar."%'".
283
+                " OR lower(vehiculo_placa) LIKE '%".$buscar.
284
+                "%' OR lower(vehiculo_tipo) LIKE '%".$buscar."%')";
285 285
         }
286 286
         $consulta .= " ORDER BY codcliente ASC";
287 287
 
Please login to merge, or discard this patch.
controller/lista_vehiculos.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
                 $inq->fecha_ocupacion = null;
63 63
                 if ($inq->save()) {
64 64
                     $this->new_message('Inquilino removido correctamente.');
65
-                } else {
65
+                }else {
66 66
                     $this->new_error_msg('Error al remover el inquilino.');
67 67
                 }
68
-            } else {
68
+            }else {
69 69
                 $this->new_error_msg('Inquilino no encontrado.');
70 70
             }
71 71
         }
@@ -167,22 +167,22 @@  discard block
 block discarded – undo
167 167
     public function buscar_residentes($param)
168 168
     {
169 169
         if (is_numeric($param)) {
170
-            $where = "(r.codcliente LIKE '%" . $param . "%'"
171
-                . " OR c.cifnif LIKE '%" . $param . "%'"
172
-                . " OR c.telefono1 LIKE '" . $param . "%'"
173
-                . " OR c.telefono2 LIKE '" . $param . "%'"
174
-                . " OR ca_telefono LIKE '" . $param . "%'"
175
-                . " OR r.observaciones LIKE '%" . $param . "%')";
176
-        } else {
170
+            $where = "(r.codcliente LIKE '%".$param."%'"
171
+                . " OR c.cifnif LIKE '%".$param."%'"
172
+                . " OR c.telefono1 LIKE '".$param."%'"
173
+                . " OR c.telefono2 LIKE '".$param."%'"
174
+                . " OR ca_telefono LIKE '".$param."%'"
175
+                . " OR r.observaciones LIKE '%".$param."%')";
176
+        }else {
177 177
             $buscar = str_replace(' ', '%', $param);
178
-            $where = "(lower(nombre) LIKE '%" . $buscar . "%'"
179
-                . " OR lower(razonsocial) LIKE '%" . $buscar . "%'"
180
-                . " OR lower(ca_apellidos) LIKE '%" . $buscar . "%'"
181
-                . " OR lower(ca_nombres) LIKE '%" . $buscar . "%'"
182
-                . " OR lower(cifnif) LIKE '%" . $buscar . "%'"
183
-                . " OR lower(observaciones) LIKE '%" . $buscar . "%'"
184
-                . " OR lower(ca_email) LIKE '%" . $buscar . "%'"
185
-                . " OR lower(email) LIKE '%" . $buscar . "%')";
178
+            $where = "(lower(nombre) LIKE '%".$buscar."%'"
179
+                . " OR lower(razonsocial) LIKE '%".$buscar."%'"
180
+                . " OR lower(ca_apellidos) LIKE '%".$buscar."%'"
181
+                . " OR lower(ca_nombres) LIKE '%".$buscar."%'"
182
+                . " OR lower(cifnif) LIKE '%".$buscar."%'"
183
+                . " OR lower(observaciones) LIKE '%".$buscar."%'"
184
+                . " OR lower(ca_email) LIKE '%".$buscar."%'"
185
+                . " OR lower(email) LIKE '%".$buscar."%')";
186 186
         }
187 187
         return $where;
188 188
     }
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
     public function buscar_inmuebles($param)
191 191
     {
192 192
         if (is_numeric($param)) {
193
-            $where = " r.codigo LIKE '%" . $param . "%'"
194
-                . " OR r.numero LIKE '%" . $param . "%'"
195
-                . " OR CONCAT(r.codigo, r.numero) LIKE '%" . $param . "%'";
196
-        } else {
193
+            $where = " r.codigo LIKE '%".$param."%'"
194
+                . " OR r.numero LIKE '%".$param."%'"
195
+                . " OR CONCAT(r.codigo, r.numero) LIKE '%".$param."%'";
196
+        }else {
197 197
             $buscar = str_replace(' ', '%', $param);
198
-            $where = " lower(r.codigo) LIKE '%" . $buscar . "%'"
199
-                . " OR lower(r.numero) LIKE '%" . $buscar . "%'"
200
-                . " OR CONCAT(lower(r.codigo), r.numero) LIKE '%" . $param . "%'";
198
+            $where = " lower(r.codigo) LIKE '%".$buscar."%'"
199
+                . " OR lower(r.numero) LIKE '%".$buscar."%'"
200
+                . " OR CONCAT(lower(r.codigo), r.numero) LIKE '%".$param."%'";
201 201
         }
202 202
         return $where;
203 203
     }
@@ -205,20 +205,20 @@  discard block
 block discarded – undo
205 205
     public function buscar_vehiculos($param)
206 206
     {
207 207
         if (is_numeric($param)) {
208
-            $where = "(r.codcliente LIKE '%" . $param . "%'"
209
-                . " OR vehiculo_placa LIKE '%" . $param . "%'"
210
-                . " OR CAST(idvehiculo AS CHAR) LIKE '" . $param . "%'"
211
-                . " OR telefono2 LIKE '" . $param . "%'"
212
-                . " OR observaciones LIKE '%" . $param . "%'"
213
-                . " OR codigo_tarjeta LIKE '%" . $param . "%')";
214
-        } else {
208
+            $where = "(r.codcliente LIKE '%".$param."%'"
209
+                . " OR vehiculo_placa LIKE '%".$param."%'"
210
+                . " OR CAST(idvehiculo AS CHAR) LIKE '".$param."%'"
211
+                . " OR telefono2 LIKE '".$param."%'"
212
+                . " OR observaciones LIKE '%".$param."%'"
213
+                . " OR codigo_tarjeta LIKE '%".$param."%')";
214
+        }else {
215 215
             $buscar = str_replace(' ', '%', $param);
216
-            $where = "(lower(vehiculo_marca) LIKE '%" . $buscar . "%'"
217
-                . " OR lower(vehiculo_modelo) LIKE '%" . $buscar . "%'"
218
-                . " OR lower(vehiculo_color) LIKE '%" . $buscar . "%'"
219
-                . " OR lower(vehiculo_placa) LIKE '%" . $buscar . "%'"
220
-                . " OR lower(vehiculo_tipo) LIKE '%" . $buscar . "%'"
221
-                . " OR lower(codigo_tarjeta) LIKE '%" . $buscar . "%')";
216
+            $where = "(lower(vehiculo_marca) LIKE '%".$buscar."%'"
217
+                . " OR lower(vehiculo_modelo) LIKE '%".$buscar."%'"
218
+                . " OR lower(vehiculo_color) LIKE '%".$buscar."%'"
219
+                . " OR lower(vehiculo_placa) LIKE '%".$buscar."%'"
220
+                . " OR lower(vehiculo_tipo) LIKE '%".$buscar."%'"
221
+                . " OR lower(codigo_tarjeta) LIKE '%".$buscar."%')";
222 222
         }
223 223
         return $where;
224 224
     }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
                         'nombre' => $cli->nombre,
253 253
                         'asignado' => true);
254 254
                 }
255
-            } else {
255
+            }else {
256 256
                 $json[$cli->codcliente] = array('value' => $cli->nombre,
257 257
                     'data' => $cli->codcliente,
258 258
                     'nombre' => $cli->nombre,
@@ -310,11 +310,11 @@  discard block
 block discarded – undo
310 310
 
311 311
     public function paginas()
312 312
     {
313
-        $url = $this->url() . "&query=" . $this->query
314
-            . "&query_r=" . $this->query_r
315
-            . "&query_v=" . $this->query_v
316
-            . "&query_i=" . $this->query_i
317
-            . "&orden=" . $this->order;
313
+        $url = $this->url()."&query=".$this->query
314
+            . "&query_r=".$this->query_r
315
+            . "&query_v=".$this->query_v
316
+            . "&query_i=".$this->query_i
317
+            . "&orden=".$this->order;
318 318
 
319 319
         $paginas = array();
320 320
         $i = 0;
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
         /// añadimos todas la página
325 325
         while ($num < $this->total_resultados) {
326 326
             $paginas[$i] = array(
327
-                'url' => $url . "&offset=" . ($i * FS_ITEM_LIMIT),
327
+                'url' => $url."&offset=".($i * FS_ITEM_LIMIT),
328 328
                 'num' => $i + 1,
329 329
                 'actual' => ($num === $this->offset)
330 330
             );
@@ -339,13 +339,13 @@  discard block
 block discarded – undo
339 339
 
340 340
         /// ahora descartamos
341 341
         foreach ($paginas as $j => $value) {
342
-            $enmedio = (int)($i / 2);
342
+            $enmedio = (int) ($i / 2);
343 343
 
344 344
             /**
345 345
              * descartamos todo excepto la primera, la última, la de enmedio,
346 346
              * la actual, las 5 anteriores y las 5 siguientes
347 347
              */
348
-            if (($j>1 && $j<$actual-5 && $j !== $enmedio) || ($j > $actual + 5 && $j < $i - 1 && $j !== $enmedio)) {
348
+            if (($j > 1 && $j < $actual - 5 && $j !== $enmedio) || ($j > $actual + 5 && $j < $i - 1 && $j !== $enmedio)) {
349 349
                 unset($paginas[$j]);
350 350
             }
351 351
         }
Please login to merge, or discard this patch.
controller/seguridad_documentos.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
                 'page_to' => 'ventas_factura',
38 38
                 'type' => 'head',
39 39
                 'text' => '<script src="'.FS_PATH.'plugins/residentes/view/js/seguridad_documentos.js?cod='.
40
-                    rand(1000,10000).'" type="text/javascript"></script>',
40
+                    rand(1000, 10000).'" type="text/javascript"></script>',
41 41
                 'params' => ''
42 42
             ),
43 43
             array(
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
                 'page_to' => 'compras_factura',
47 47
                 'type' => 'head',
48 48
                 'text' => '<script src="'.FS_PATH.'plugins/residentes/view/js/seguridad_documentos.js?cod='.
49
-                    rand(1000,10000).'" type="text/javascript"></script>',
49
+                    rand(1000, 10000).'" type="text/javascript"></script>',
50 50
                 'params' => ''
51 51
             ),
52 52
         );
53 53
 
54
-        foreach($extensiones as $del){
54
+        foreach ($extensiones as $del) {
55 55
             $fext = new fs_extension($del);
56
-            if(!$fext->save()){
57
-                $this->new_error_msg('Imposible guardar los datos de la extensión ' . $ext['name'] . '.');
56
+            if (!$fext->save()) {
57
+                $this->new_error_msg('Imposible guardar los datos de la extensión '.$ext['name'].'.');
58 58
             }
59 59
         }
60 60
     }
Please login to merge, or discard this patch.
model/core/residentes_facturacion_programada.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             $this->estado = $t['estado'];
65 65
             $this->fecha_creacion = $t['fecha_creacion'];
66 66
             $this->fecha_modificacion = $t['fecha_modificacion'];
67
-        } else {
67
+        }else {
68 68
             $this->id = null;
69 69
             $this->descripcion = '';
70 70
             $this->tipo_programacion = 'generar';
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     public function save()
101 101
     {
102 102
         if ($this->exists()) {
103
-            $sql = "UPDATE " . $this->table_name . " SET ".
103
+            $sql = "UPDATE ".$this->table_name." SET ".
104 104
             "descripcion = ".$this->var2str($this->descripcion).", ".
105 105
             "tipo_programacion = ".$this->var2str($this->tipo_programacion).", ".
106 106
             "forma_pago = ".$this->var2str($this->forma_pago).", ".
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
             "WHERE id = ".$this->intval($this->id).";";
117 117
             $data = $this->db->exec($sql);
118 118
             return $data;
119
-        } else {
119
+        }else {
120 120
             $sql = "INSERT INTO ".$this->table_name.
121 121
             " (descripcion, tipo_programacion, forma_pago, formato_factura, fecha_vencimiento, fecha_envio, hora_envio, ".
122 122
                 "residentes_facturar, facturas_generadas, usuario_creacion, fecha_creacion, estado) VALUES (".
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
             $this->var2str($this->estado).");";
135 135
             if ($this->db->exec($sql)) {
136 136
                 return $this->db->lastval();
137
-            } else {
137
+            }else {
138 138
                 return false;
139 139
             }
140 140
         }
Please login to merge, or discard this patch.
model/core/residentes_email_config.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
             $this->usuario_modificacion = $t['usuario_modificacion'];
56 56
             $this->fecha_creacion = $t['fecha_creacion'];
57 57
             $this->fecha_modificacion = $t['fecha_modificacion'];
58
-        } else {
58
+        }else {
59 59
             $this->id = null;
60 60
             $this->tiposervicio = 'interno';
61 61
             $this->apikey = '';
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     public function save()
88 88
     {
89 89
         if ($this->exists()) {
90
-            $sql = "UPDATE " . $this->table_name . " SET ".
90
+            $sql = "UPDATE ".$this->table_name." SET ".
91 91
             "tiposervicio = ".$this->var2str($this->tiposervicio).", ".
92 92
             "apikey = ".$this->var2str($this->apikey).", ".
93 93
             "apisecret = ".$this->var2str($this->apisecret).", ".
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
             "WHERE id = ".$this->intval($this->id).";";
100 100
             $data = $this->db->exec($sql);
101 101
             return $data;
102
-        } else {
102
+        }else {
103 103
             $sql = "INSERT INTO ".$this->table_name.
104
-            " (tiposervicio, apikey, apisecret, apisenderemail, apisendername, emailsubject, usuario_creacion, fecha_creacion) " .
104
+            " (tiposervicio, apikey, apisecret, apisenderemail, apisendername, emailsubject, usuario_creacion, fecha_creacion) ".
105 105
             " VALUES (".
106 106
             $this->var2str($this->tiposervicio).", ".
107 107
             $this->var2str($this->apikey).", ".
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             $this->var2str($this->fecha_creacion).");";
114 114
             if ($this->db->exec($sql)) {
115 115
                 return $this->db->lastval();
116
-            } else {
116
+            }else {
117 117
                 return false;
118 118
             }
119 119
         }
Please login to merge, or discard this patch.
model/core/residentes_facturacion_programada_conceptos.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
     public $importe;
38 38
     
39 39
     public function __construct($t = FALSE) {
40
-        parent::__construct('residentes_fact_prog_conceptos','plugins/residentes');
41
-        if($t){
40
+        parent::__construct('residentes_fact_prog_conceptos', 'plugins/residentes');
41
+        if ($t) {
42 42
             $this->id = $t['id'];
43 43
             $this->idprogramacion = $t['idprogramacion'];
44 44
             $this->referencia = $t['referencia'];
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             $this->cantidad = (float) ($t['cantidad']);
47 47
             $this->codimpuesto = $t['codimpuesto'];
48 48
             $this->importe = (float) ($t['importe']);
49
-        }else{
49
+        }else {
50 50
             $this->id = null;
51 51
             $this->idprogramacion = null;
52 52
             $this->referencia = '';
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
         }
58 58
     }
59 59
 
60
-    public function install(){
60
+    public function install() {
61 61
         return "";
62 62
     }
63 63
     
64 64
     public function exists()
65 65
     {
66
-        if(is_null($this->id)) {
66
+        if (is_null($this->id)) {
67 67
             return false;
68 68
         }
69 69
         return true;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     
72 72
     public function save()
73 73
     {
74
-        if($this->exists()){
74
+        if ($this->exists()) {
75 75
             $sql = "UPDATE ".$this->table_name." SET ".
76 76
             "referencia = ".$this->var2str($this->referencia).", ".
77 77
             "pvp = ".$this->var2str($this->pvp).", ".
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             "WHERE id = ".$this->intval($this->id).";";
82 82
             $data = $this->db->exec($sql);
83 83
             return $data;
84
-        }else{
84
+        }else {
85 85
             $sql = "INSERT INTO ".$this->table_name.
86 86
             " (idprogramacion, referencia, pvp, cantidad, codimpuesto, importe) VALUES (".
87 87
             $this->intval($this->idprogramacion).", ".
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
             $this->var2str($this->codimpuesto).", ".
92 92
             $this->var2str($this->importe).");";
93 93
             
94
-            if($this->db->exec($sql)){
94
+            if ($this->db->exec($sql)) {
95 95
                 return true;
96
-            }else{
96
+            }else {
97 97
                 return false;
98 98
             }
99 99
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     {
105 105
         $sql = "select * from ".$this->table_name." WHERE id = ".$this->intval($id);
106 106
         $data = $this->db->select($sql);
107
-        if($data) {
107
+        if ($data) {
108 108
             return new residentes_facturacion_programada_conceptos($data[0]);
109 109
         }
110 110
         return false;
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
         $sql = "select * from ".$this->table_name." WHERE idprogramacion = ".$this->intval($idProg)." ORDER BY id";
116 116
         $data = $this->db->select($sql);
117 117
         $lista = array();
118
-        if($data) {
119
-            foreach($data as $d) {
118
+        if ($data) {
119
+            foreach ($data as $d) {
120 120
                 $lista[] = new residentes_facturacion_programada_conceptos($d);
121 121
             }
122 122
             return $lista;
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
         $sql = "select * from ".$this->table_name." WHERE fecha_envio = ".$this->var2str($date)." ORDER BY fecha_envio, hora_envio";
130 130
         $data = $this->db->select($sql);
131 131
         $lista = array();
132
-        if($data) {
133
-            foreach($data as $d) {
132
+        if ($data) {
133
+            foreach ($data as $d) {
134 134
                 $lista[] = new residentes_facturacion_programada_conceptos($d);
135 135
             }
136 136
             return $lista;
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
                 ." AND "."estado = ".$this->var2str($status)." ORDER BY fecha_envio, hora_envio";
145 145
         $data = $this->db->select($sql);
146 146
         $lista = array();
147
-        if($data) {
148
-            foreach($data as $d) {
147
+        if ($data) {
148
+            foreach ($data as $d) {
149 149
                 $lista[] = new residentes_facturacion_programada_conceptos($d);
150 150
             }
151 151
             return $lista;
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
         $sql = "select * from ".$this->table_name." ORDER BY fecha_envio, hora_envio";
159 159
         $data = $this->db->select($sql);
160 160
         $lista = array();
161
-        if($data) {
162
-            foreach($data as $d) {
161
+        if ($data) {
162
+            foreach ($data as $d) {
163 163
                 $lista[] = new residentes_facturacion_programada_conceptos($d);
164 164
             }
165 165
             return $lista;
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     {
172 172
         $sql = "DELETE from ".$this->table_name." WHERE id = ".$this->intval($this->id);
173 173
         $data = $this->db->exec($sql);
174
-        if($data) {
174
+        if ($data) {
175 175
             return true;
176 176
         }
177 177
         return false;   
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             $this->cantidad = (float) ($t['cantidad']);
47 47
             $this->codimpuesto = $t['codimpuesto'];
48 48
             $this->importe = (float) ($t['importe']);
49
-        }else{
49
+        } else{
50 50
             $this->id = null;
51 51
             $this->idprogramacion = null;
52 52
             $this->referencia = '';
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             "WHERE id = ".$this->intval($this->id).";";
82 82
             $data = $this->db->exec($sql);
83 83
             return $data;
84
-        }else{
84
+        } else{
85 85
             $sql = "INSERT INTO ".$this->table_name.
86 86
             " (idprogramacion, referencia, pvp, cantidad, codimpuesto, importe) VALUES (".
87 87
             $this->intval($this->idprogramacion).", ".
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             
94 94
             if($this->db->exec($sql)){
95 95
                 return true;
96
-            }else{
96
+            } else{
97 97
                 return false;
98 98
             }
99 99
         }
Please login to merge, or discard this patch.
model/core/residente.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             if (isset($i['deudas'])) {
57 57
                 $this->deudas = (float) ($i['deudas']);
58 58
             }
59
-        } else {
59
+        }else {
60 60
             $this->id = null;
61 61
             $this->codcliente = null;
62 62
             $this->fechaalta = Date('d-m-Y');
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
             return '-';
90 90
         } elseif (strlen($this->observaciones) < 60) {
91 91
             return $this->observaciones;
92
-        } else {
93
-            return substr($this->observaciones, 0, 60) . '...';
92
+        }else {
93
+            return substr($this->observaciones, 0, 60).'...';
94 94
         }
95 95
     }
96 96
 
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
         $data = $this->db->select("SELECT * FROM residentes WHERE id = ".$this->var2str($id).";");
100 100
         if ($data) {
101 101
             return new residente($data[0]);
102
-        } else {
102
+        }else {
103 103
             return false;
104 104
         }
105 105
     }
106 106
 
107 107
     public function exists()
108 108
     {
109
-        if(is_null($this->id)) {
109
+        if (is_null($this->id)) {
110 110
             return false;
111
-        } else {
111
+        }else {
112 112
             return $this->db->select("SELECT * FROM residentes WHERE id = ".$this->var2str($this->id).";");
113 113
         }
114 114
     }
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
                 deudas = ".$this->var2str($this->deudas)." WHERE id = ".$this->var2str($this->id).";";
126 126
 
127 127
             return $this->db->exec($sql);
128
-        } else {
128
+        }else {
129 129
             $sql = "INSERT INTO residentes (codcliente,nombre,fechaalta,piso,bloque,mensualidad,agua,gas,".
130
-            "observaciones,fechaagua,fechagas,deudas) " . "VALUES (".$this->var2str($this->codcliente).",".
130
+            "observaciones,fechaagua,fechagas,deudas) "."VALUES (".$this->var2str($this->codcliente).",".
131 131
             $this->var2str($this->nombre).",".$this->var2str($this->fechaalta).","
132 132
             .$this->var2str($this->piso).",".$this->var2str($this->bloque).",".$this->var2str($this->mensualidad).","
133 133
             .$this->var2str($this->agua).",".$this->var2str($this->gas).",".$this->var2str($this->observaciones).","
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             if ($this->db->exec($sql)) {
137 137
                 $this->id = $this->db->lastval();
138 138
                 return true;
139
-            } else {
139
+            }else {
140 140
                 return false;
141 141
             }
142 142
         }
Please login to merge, or discard this patch.
controller/lista_residentes.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
                 $inq->fecha_ocupacion = null;
76 76
                 if ($inq->save()) {
77 77
                     $this->new_message('Inquilino removido correctamente.');
78
-                } else {
78
+                }else {
79 79
                     $this->new_error_msg('Error al remover el inquilino.');
80 80
                 }
81
-            } else {
81
+            }else {
82 82
                 $this->new_error_msg('Inquilino no encontrado.');
83 83
             }
84 84
         }
@@ -188,22 +188,22 @@  discard block
 block discarded – undo
188 188
     public function buscar_residentes($param)
189 189
     {
190 190
         if (is_numeric($param)) {
191
-            $where = "(r.codcliente LIKE '%" . $param . "%'"
192
-                    . " OR c.cifnif LIKE '%" . $param . "%'"
193
-                    . " OR c.telefono1 LIKE '" . $param . "%'"
194
-                    . " OR c.telefono2 LIKE '" . $param . "%'"
195
-                    . " OR ca_telefono LIKE '" . $param . "%'"
196
-                    . " OR c.observaciones LIKE '%" . $param . "%')";
197
-        } else {
191
+            $where = "(r.codcliente LIKE '%".$param."%'"
192
+                    . " OR c.cifnif LIKE '%".$param."%'"
193
+                    . " OR c.telefono1 LIKE '".$param."%'"
194
+                    . " OR c.telefono2 LIKE '".$param."%'"
195
+                    . " OR ca_telefono LIKE '".$param."%'"
196
+                    . " OR c.observaciones LIKE '%".$param."%')";
197
+        }else {
198 198
             $buscar = str_replace(' ', '%', $param);
199
-            $where = "(lower(nombre) LIKE '%" . $buscar . "%'"
200
-                    . " OR lower(razonsocial) LIKE '%" . $buscar . "%'"
201
-                    . " OR lower(ca_apellidos) LIKE '%" . $buscar . "%'"
202
-                    . " OR lower(ca_nombres) LIKE '%" . $buscar . "%'"
203
-                    . " OR lower(cifnif) LIKE '%" . $buscar . "%'"
204
-                    . " OR lower(observaciones) LIKE '%" . $buscar . "%'"
205
-                    . " OR lower(ca_email) LIKE '%" . $buscar . "%'"
206
-                    . " OR lower(email) LIKE '%" . $buscar . "%')";
199
+            $where = "(lower(nombre) LIKE '%".$buscar."%'"
200
+                    . " OR lower(razonsocial) LIKE '%".$buscar."%'"
201
+                    . " OR lower(ca_apellidos) LIKE '%".$buscar."%'"
202
+                    . " OR lower(ca_nombres) LIKE '%".$buscar."%'"
203
+                    . " OR lower(cifnif) LIKE '%".$buscar."%'"
204
+                    . " OR lower(observaciones) LIKE '%".$buscar."%'"
205
+                    . " OR lower(ca_email) LIKE '%".$buscar."%'"
206
+                    . " OR lower(email) LIKE '%".$buscar."%')";
207 207
         }
208 208
         return $where;
209 209
     }
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
     public function buscar_inmuebles($param)
212 212
     {
213 213
         if (is_numeric($param)) {
214
-            $where = " r.codigo LIKE '%" . $param . "%'"
215
-                    . " OR r.numero LIKE '%" . $param . "%'"
216
-                    . " OR CONCAT(r.codigo, r.numero) LIKE '%" . $param . "%'";
217
-        } else {
214
+            $where = " r.codigo LIKE '%".$param."%'"
215
+                    . " OR r.numero LIKE '%".$param."%'"
216
+                    . " OR CONCAT(r.codigo, r.numero) LIKE '%".$param."%'";
217
+        }else {
218 218
             $buscar = str_replace(' ', '%', $param);
219
-            $where = " lower(r.codigo) LIKE '%" . $buscar . "%'"
220
-                    . " OR lower(r.numero) LIKE '%" . $buscar . "%'"
221
-                    . " OR CONCAT(lower(r.codigo), r.numero) LIKE '%" . $param . "%'";
219
+            $where = " lower(r.codigo) LIKE '%".$buscar."%'"
220
+                    . " OR lower(r.numero) LIKE '%".$buscar."%'"
221
+                    . " OR CONCAT(lower(r.codigo), r.numero) LIKE '%".$param."%'";
222 222
         }
223 223
         return $where;
224 224
     }
@@ -226,19 +226,19 @@  discard block
 block discarded – undo
226 226
     public function buscar_vehiculos($param)
227 227
     {
228 228
         if (is_numeric($param)) {
229
-            $where = "(r.codcliente LIKE '%" . $param . "%'"
230
-                    . " OR vehiculo_placa LIKE '%" . $param . "%'"
231
-                    . " OR CAST(idvehiculo AS CHAR) LIKE '" . $param . "%'"
232
-                    . " OR telefono2 LIKE '" . $param . "%'"
233
-                    . " OR observaciones LIKE '%" . $param . "%')";
234
-        } else {
229
+            $where = "(r.codcliente LIKE '%".$param."%'"
230
+                    . " OR vehiculo_placa LIKE '%".$param."%'"
231
+                    . " OR CAST(idvehiculo AS CHAR) LIKE '".$param."%'"
232
+                    . " OR telefono2 LIKE '".$param."%'"
233
+                    . " OR observaciones LIKE '%".$param."%')";
234
+        }else {
235 235
             $buscar = str_replace(' ', '%', $param);
236
-            $where = "(lower(vehiculo_marca) LIKE '%" . $buscar . "%'"
237
-                    . " OR lower(vehiculo_modelo) LIKE '%" . $buscar . "%'"
238
-                    . " OR lower(vehiculo_color) LIKE '%" . $buscar . "%'"
239
-                    . " OR lower(vehiculo_placa) LIKE '%" . $buscar . "%'"
240
-                    . " OR lower(vehiculo_tipo) LIKE '%" . $buscar . "%'"
241
-                    . " OR lower(codigo_tarjeta) LIKE '%" . $buscar . "%')";
236
+            $where = "(lower(vehiculo_marca) LIKE '%".$buscar."%'"
237
+                    . " OR lower(vehiculo_modelo) LIKE '%".$buscar."%'"
238
+                    . " OR lower(vehiculo_color) LIKE '%".$buscar."%'"
239
+                    . " OR lower(vehiculo_placa) LIKE '%".$buscar."%'"
240
+                    . " OR lower(vehiculo_tipo) LIKE '%".$buscar."%'"
241
+                    . " OR lower(codigo_tarjeta) LIKE '%".$buscar."%')";
242 242
         }
243 243
         return $where;
244 244
     }
@@ -257,13 +257,13 @@  discard block
 block discarded – undo
257 257
             $inmueble->ocupado = true;
258 258
             $inmueble->codcliente = $codcliente;
259 259
             $inmueble->iddireccion = $this->actualizar_direccion_residente($codcliente, $iddireccion, $nueva_direccion);
260
-            $inmueble->fecha_ocupacion = ($fecha_ocupacion)?\date('Y-m-d', strtotime($fecha_ocupacion)):null;
260
+            $inmueble->fecha_ocupacion = ($fecha_ocupacion) ? \date('Y-m-d', strtotime($fecha_ocupacion)) : null;
261 261
             $inmueble->fecha_disponibilidad = ($fecha_disponibilidad)
262
-                ?\date('Y-m-d', strtotime($fecha_disponibilidad))
262
+                ? \date('Y-m-d', strtotime($fecha_disponibilidad))
263 263
                 :null;
264 264
             if ($inmueble->save()) {
265 265
                 $this->new_message('Residente agregado exitosamente.');
266
-            } else {
266
+            }else {
267 267
                 $this->new_error_msg('No se pudo agregar al residente confirme el nombre '.
268 268
                                     'del residente y las fechs de ocupación y disponibilidad');
269 269
             }
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
             $inmueble->fecha_disponibilidad = '';
276 276
             if ($inmueble->save()) {
277 277
                 $this->new_message('Residente removido exitosamente.');
278
-            } else {
278
+            }else {
279 279
                 $this->new_error_msg('No se pudo remover al residente');
280 280
             }
281 281
         }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
                         'nombre' => $cli->nombre,
311 311
                         'asignado' => true);
312 312
                 }
313
-            } else {
313
+            }else {
314 314
                 $json[$cli->codcliente] = array('value' => $cli->nombre,
315 315
                     'data' => $cli->codcliente,
316 316
                     'nombre' => $cli->nombre,
@@ -367,13 +367,13 @@  discard block
 block discarded – undo
367 367
 
368 368
     public function paginas()
369 369
     {
370
-        $url = $this->url() . "&query=" . $this->query
371
-                . "&query_r=" . $this->query_r
372
-                . "&query_v=" . $this->query_v
373
-                . "&query_i=" . $this->query_i
374
-                . "&orden=" . $this->order
375
-                . "&deudores=" . $this->deudores
376
-                . "&disponibles=" . $this->disponibles;
370
+        $url = $this->url()."&query=".$this->query
371
+                . "&query_r=".$this->query_r
372
+                . "&query_v=".$this->query_v
373
+                . "&query_i=".$this->query_i
374
+                . "&orden=".$this->order
375
+                . "&deudores=".$this->deudores
376
+                . "&disponibles=".$this->disponibles;
377 377
 
378 378
         $paginas = array();
379 379
         $i = 0;
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
         /// añadimos todas la página
384 384
         while ($num < $this->total_resultados) {
385 385
             $paginas[$i] = array(
386
-                'url' => $url . "&offset=" . ($i * FS_ITEM_LIMIT),
386
+                'url' => $url."&offset=".($i * FS_ITEM_LIMIT),
387 387
                 'num' => $i + 1,
388 388
                 'actual' => ($num === $this->offset)
389 389
             );
@@ -398,20 +398,20 @@  discard block
 block discarded – undo
398 398
 
399 399
         /// ahora descartamos
400 400
         foreach ($paginas as $j => $value) {
401
-            $enmedio = (int)($i / 2);
401
+            $enmedio = (int) ($i / 2);
402 402
 
403 403
             /**
404 404
              * descartamos todo excepto la primera, la última, la de enmedio,
405 405
              * la actual, las 5 anteriores y las 5 siguientes
406 406
              */
407
-            if (($j>1 && $j<$actual-5 && $j !== $enmedio) || ($j > $actual + 5 && $j < $i - 1 && $j !== $enmedio)) {
407
+            if (($j > 1 && $j < $actual - 5 && $j !== $enmedio) || ($j > $actual + 5 && $j < $i - 1 && $j !== $enmedio)) {
408 408
                 unset($paginas[$j]);
409 409
             }
410 410
         }
411 411
 
412 412
         if (count($paginas) > 1) {
413 413
             return $paginas;
414
-        } else {
414
+        }else {
415 415
             return array();
416 416
         }
417 417
     }
Please login to merge, or discard this patch.