Passed
Push — master ( 9f95e8...6c2f3e )
by Joe Nilson
05:48
created
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   +45 added lines, -45 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,19 +205,19 @@  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
-        } 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
+        }else {
214 214
             $buscar = str_replace(' ', '%', $param);
215
-            $where = "(lower(vehiculo_marca) LIKE '%" . $buscar . "%'"
216
-                . " OR lower(vehiculo_modelo) LIKE '%" . $buscar . "%'"
217
-                . " OR lower(vehiculo_color) LIKE '%" . $buscar . "%'"
218
-                . " OR lower(vehiculo_placa) LIKE '%" . $buscar . "%'"
219
-                . " OR lower(vehiculo_tipo) LIKE '%" . $buscar . "%'"
220
-                . " OR lower(codigo_tarjeta) LIKE '%" . $buscar . "%')";
215
+            $where = "(lower(vehiculo_marca) LIKE '%".$buscar."%'"
216
+                . " OR lower(vehiculo_modelo) LIKE '%".$buscar."%'"
217
+                . " OR lower(vehiculo_color) LIKE '%".$buscar."%'"
218
+                . " OR lower(vehiculo_placa) LIKE '%".$buscar."%'"
219
+                . " OR lower(vehiculo_tipo) LIKE '%".$buscar."%'"
220
+                . " OR lower(codigo_tarjeta) LIKE '%".$buscar."%')";
221 221
         }
222 222
         return $where;
223 223
     }
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
                         'nombre' => $cli->nombre,
252 252
                         'asignado' => true);
253 253
                 }
254
-            } else {
254
+            }else {
255 255
                 $json[$cli->codcliente] = array('value' => $cli->nombre,
256 256
                     'data' => $cli->codcliente,
257 257
                     'nombre' => $cli->nombre,
@@ -309,11 +309,11 @@  discard block
 block discarded – undo
309 309
 
310 310
     public function paginas()
311 311
     {
312
-        $url = $this->url() . "&query=" . $this->query
313
-            . "&query_r=" . $this->query_r
314
-            . "&query_v=" . $this->query_v
315
-            . "&query_i=" . $this->query_i
316
-            . "&orden=" . $this->order;
312
+        $url = $this->url()."&query=".$this->query
313
+            . "&query_r=".$this->query_r
314
+            . "&query_v=".$this->query_v
315
+            . "&query_i=".$this->query_i
316
+            . "&orden=".$this->order;
317 317
 
318 318
         $paginas = array();
319 319
         $i = 0;
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
         /// añadimos todas la página
324 324
         while ($num < $this->total_resultados) {
325 325
             $paginas[$i] = array(
326
-                'url' => $url . "&offset=" . ($i * FS_ITEM_LIMIT),
326
+                'url' => $url."&offset=".($i * FS_ITEM_LIMIT),
327 327
                 'num' => $i + 1,
328 328
                 'actual' => ($num === $this->offset)
329 329
             );
@@ -338,13 +338,13 @@  discard block
 block discarded – undo
338 338
 
339 339
         /// ahora descartamos
340 340
         foreach ($paginas as $j => $value) {
341
-            $enmedio = (int)($i / 2);
341
+            $enmedio = (int) ($i / 2);
342 342
 
343 343
             /**
344 344
              * descartamos todo excepto la primera, la última, la de enmedio,
345 345
              * la actual, las 5 anteriores y las 5 siguientes
346 346
              */
347
-            if (($j>1 && $j<$actual-5 && $j !== $enmedio) || ($j > $actual + 5 && $j < $i - 1 && $j !== $enmedio)) {
347
+            if (($j > 1 && $j < $actual - 5 && $j !== $enmedio) || ($j > $actual + 5 && $j < $i - 1 && $j !== $enmedio)) {
348 348
                 unset($paginas[$j]);
349 349
             }
350 350
         }
Please login to merge, or discard this patch.