@@ -62,10 +62,10 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |