@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | if ($this->codigo_edificacion) { |
| 110 | - $this->where_code = " AND r.codigo like '" . $this->codigo_edificacion . "%' "; |
|
| 110 | + $this->where_code = " AND r.codigo like '".$this->codigo_edificacion."%' "; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | if ($this->tipo === 'informacion') { |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | $this->offset = $this->confirmarValor($this->filter_request('offset'), 0); |
| 147 | 147 | $this->limit = $this->confirmarValor($this->filter_request('limit'), FS_ITEM_LIMIT); |
| 148 | 148 | $this->search = $this->confirmarValor($this->filter_request('search'), false); |
| 149 | - $this->sort = ($sort and $sort!='undefined')?$sort:'r.codigo, r.numero'; |
|
| 150 | - $this->order = ($order and $order!='undefined')?$order:'ASC'; |
|
| 149 | + $this->sort = ($sort and $sort != 'undefined') ? $sort : 'r.codigo, r.numero'; |
|
| 150 | + $this->order = ($order and $order != 'undefined') ? $order : 'ASC'; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | public function informacion_edificaciones() |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $this->resultado[] = $l; |
| 168 | 168 | } |
| 169 | 169 | //Verificamos los que están ocupados |
| 170 | - $this->inmuebles_libres = $inmuebles-$inmuebles_ocupados; |
|
| 170 | + $this->inmuebles_libres = $inmuebles - $inmuebles_ocupados; |
|
| 171 | 171 | $this->inmuebles_ocupados = $inmuebles_ocupados; |
| 172 | 172 | $this->total_vehiculos = $vehiculos; |
| 173 | 173 | $this->carpetasPlugin(); |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | public function generarArchivoExcel() |
| 178 | 178 | { |
| 179 | - $this->archivoXLSX = $this->exportDir . DIRECTORY_SEPARATOR . |
|
| 180 | - $this->archivo . "_" . $this->user->nick . ".xlsx"; |
|
| 181 | - $this->archivoXLSXPath = $this->publicPath . DIRECTORY_SEPARATOR . |
|
| 182 | - $this->archivo . "_" . $this->user->nick . ".xlsx"; |
|
| 179 | + $this->archivoXLSX = $this->exportDir.DIRECTORY_SEPARATOR. |
|
| 180 | + $this->archivo."_".$this->user->nick.".xlsx"; |
|
| 181 | + $this->archivoXLSXPath = $this->publicPath.DIRECTORY_SEPARATOR. |
|
| 182 | + $this->archivo."_".$this->user->nick.".xlsx"; |
|
| 183 | 183 | if (file_exists($this->archivoXLSX)) { |
| 184 | 184 | unlink($this->archivoXLSX); |
| 185 | 185 | } |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | |
| 365 | 365 | public function crearXLSX(&$writer, $hoja_nombre, $header, $headerText, $data) |
| 366 | 366 | { |
| 367 | - $style_header = array('border'=>'left,right,top,bottom','font'=>'Arial','font-size'=>10,'font-style'=>'bold'); |
|
| 367 | + $style_header = array('border'=>'left,right,top,bottom', 'font'=>'Arial', 'font-size'=>10, 'font-style'=>'bold'); |
|
| 368 | 368 | $writer->writeSheetRow($hoja_nombre, $headerText, $style_header); |
| 369 | 369 | $writer->writeSheetHeader($hoja_nombre, $header, true); |
| 370 | 370 | $this->agregarDatosXLSX($writer, $hoja_nombre, $data, $headerText); |
@@ -396,9 +396,9 @@ discard block |
||
| 396 | 396 | public function carpetasPlugin() |
| 397 | 397 | { |
| 398 | 398 | $basepath = dirname(__DIR__, 3); |
| 399 | - $this->documentosDir = $basepath . DIRECTORY_SEPARATOR . FS_MYDOCS . 'documentos'; |
|
| 400 | - $this->exportDir = $this->documentosDir . DIRECTORY_SEPARATOR . "informes_residentes"; |
|
| 401 | - $this->publicPath = FS_PATH . FS_MYDOCS . 'documentos' . DIRECTORY_SEPARATOR . 'informes_residentes'; |
|
| 399 | + $this->documentosDir = $basepath.DIRECTORY_SEPARATOR.FS_MYDOCS.'documentos'; |
|
| 400 | + $this->exportDir = $this->documentosDir.DIRECTORY_SEPARATOR."informes_residentes"; |
|
| 401 | + $this->publicPath = FS_PATH.FS_MYDOCS.'documentos'.DIRECTORY_SEPARATOR.'informes_residentes'; |
|
| 402 | 402 | if (!is_dir($this->documentosDir)) { |
| 403 | 403 | if (!mkdir($concurrentDirectory = $this->documentosDir) && !is_dir($concurrentDirectory)) { |
| 404 | 404 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory)); |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | public function url() |
| 416 | 416 | { |
| 417 | 417 | if (isset($_REQUEST['inmueble'])) { |
| 418 | - return 'index.php?page=informe_residentes&inmueble=' . $_REQUEST['inmueble']; |
|
| 418 | + return 'index.php?page=informe_residentes&inmueble='.$_REQUEST['inmueble']; |
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | return parent::url(); |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | 'page_from' => __CLASS__, |
| 435 | 435 | 'page_to' => __CLASS__, |
| 436 | 436 | 'type' => 'head', |
| 437 | - 'text' => '<script src="' . FS_PATH . |
|
| 437 | + 'text' => '<script src="'.FS_PATH. |
|
| 438 | 438 | 'plugins/residentes/view/js/1/bootstrap-table.min.js" type="text/javascript"></script>', |
| 439 | 439 | 'params' => '' |
| 440 | 440 | ), |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | 'page_from' => __CLASS__, |
| 444 | 444 | 'page_to' => __CLASS__, |
| 445 | 445 | 'type' => 'head', |
| 446 | - 'text' => '<script src="' . FS_PATH . |
|
| 446 | + 'text' => '<script src="'.FS_PATH. |
|
| 447 | 447 | 'plugins/residentes/view/js/1/bootstrap-table-locale-all.min.js" type="text/javascript"></script>', |
| 448 | 448 | 'params' => '' |
| 449 | 449 | ), |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | 'page_from' => __CLASS__, |
| 453 | 453 | 'page_to' => __CLASS__, |
| 454 | 454 | 'type' => 'head', |
| 455 | - 'text' => '<script src="' . FS_PATH . |
|
| 455 | + 'text' => '<script src="'.FS_PATH. |
|
| 456 | 456 | 'plugins/residentes/view/js/plugins/bootstrap-table-filter.min.js" type="text/javascript"></script>', |
| 457 | 457 | 'params' => '' |
| 458 | 458 | ), |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | 'page_from' => __CLASS__, |
| 462 | 462 | 'page_to' => __CLASS__, |
| 463 | 463 | 'type' => 'head', |
| 464 | - 'text' => '<script src="' . FS_PATH . |
|
| 464 | + 'text' => '<script src="'.FS_PATH. |
|
| 465 | 465 | 'plugins/residentes/view/js/plugins/bootstrap-table-toolbar.min.js" type="text/javascript"></script>', |
| 466 | 466 | 'params' => '' |
| 467 | 467 | ), |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | 'page_from' => __CLASS__, |
| 471 | 471 | 'page_to' => __CLASS__, |
| 472 | 472 | 'type' => 'head', |
| 473 | - 'text' => '<script src="' . FS_PATH . |
|
| 473 | + 'text' => '<script src="'.FS_PATH. |
|
| 474 | 474 | 'plugins/residentes/view/js/plugins/bootstrap-table-mobile.min.js" type="text/javascript"></script>', |
| 475 | 475 | 'params' => '' |
| 476 | 476 | ), |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | 'page_from' => __CLASS__, |
| 480 | 480 | 'page_to' => __CLASS__, |
| 481 | 481 | 'type' => 'head', |
| 482 | - 'text' => '<script src="' . FS_PATH . 'view/js/chart.bundle.min.js" type="text/javascript"></script>', |
|
| 482 | + 'text' => '<script src="'.FS_PATH.'view/js/chart.bundle.min.js" type="text/javascript"></script>', |
|
| 483 | 483 | 'params' => '' |
| 484 | 484 | ), |
| 485 | 485 | array( |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | 'page_from' => __CLASS__, |
| 488 | 488 | 'page_to' => __CLASS__, |
| 489 | 489 | 'type' => 'head', |
| 490 | - 'text' => '<link rel="stylesheet" type="text/css" media="screen" href="' . FS_PATH . |
|
| 490 | + 'text' => '<link rel="stylesheet" type="text/css" media="screen" href="'.FS_PATH. |
|
| 491 | 491 | 'plugins/residentes/view/css/bootstrap-table.min.css"/>', |
| 492 | 492 | 'params' => '' |
| 493 | 493 | ), |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | foreach ($extensiones as $ext) { |
| 497 | 497 | $fsext0 = new fs_extension($ext); |
| 498 | 498 | if (!$fsext0->save()) { |
| 499 | - $this->new_error_msg('Imposible guardar los datos de la extensión ' . $ext['name'] . '.'); |
|
| 499 | + $this->new_error_msg('Imposible guardar los datos de la extensión '.$ext['name'].'.'); |
|
| 500 | 500 | } |
| 501 | 501 | } |
| 502 | 502 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 86 | 86 | * @param type $value string or integer |
| 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 |
||
| 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 |
||
| 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 |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $this->numero = $t['numero']; |
| 74 | 74 | $this->padre_tipo = $t['padre_tipo']; |
| 75 | 75 | $this->padre_id = $t['padre_id']; |
| 76 | - } else { |
|
| 76 | + }else { |
|
| 77 | 77 | $this->id = null; |
| 78 | 78 | $this->id_tipo = null; |
| 79 | 79 | $this->codigo_edificacion = null; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $lista[] = $item; |
| 101 | 101 | } |
| 102 | 102 | return $lista; |
| 103 | - } else { |
|
| 103 | + }else { |
|
| 104 | 104 | return false; |
| 105 | 105 | } |
| 106 | 106 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $item = new residentes_edificaciones_mapa($data[0]); |
| 122 | 122 | $item->desc_id = $this->edificaciones_tipo->get($item->id_tipo)->descripcion; |
| 123 | 123 | return $item; |
| 124 | - } else { |
|
| 124 | + }else { |
|
| 125 | 125 | return false; |
| 126 | 126 | } |
| 127 | 127 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $item = new residentes_edificaciones_mapa($data[0]); |
| 143 | 143 | $item->desc_id = $this->edificaciones_tipo->get($item->id_tipo)->descripcion; |
| 144 | 144 | return $item; |
| 145 | - } else { |
|
| 145 | + }else { |
|
| 146 | 146 | return false; |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function get_by_field($field, $value) |
| 157 | 157 | { |
| 158 | - $query = (is_string($value))?$this->var2str($value):$this->intval($value); |
|
| 158 | + $query = (is_string($value)) ? $this->var2str($value) : $this->intval($value); |
|
| 159 | 159 | $sql = "SELECT rem.*, ret.descripcion FROM ".$this->table_name." as rem, residentes_edificaciones_tipo as ret ". |
| 160 | 160 | " WHERE ".strtoupper(trim($field))." = ".$query. |
| 161 | 161 | " AND rem.id_tipo = ret.id order by codigo_edificacion ASC;"; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $lista[] = $item; |
| 169 | 169 | } |
| 170 | 170 | return $lista; |
| 171 | - } else { |
|
| 171 | + }else { |
|
| 172 | 172 | return false; |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | { |
| 178 | 178 | if (!$this->getEstructura()) { |
| 179 | 179 | return false; |
| 180 | - } else { |
|
| 180 | + }else { |
|
| 181 | 181 | return $this->getEstructura(); |
| 182 | 182 | } |
| 183 | 183 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | " padre_id = ".$this->intval($this->padre_id)." ". |
| 195 | 195 | "WHERE id = ".$this->intval($this->id).";"; |
| 196 | 196 | return $this->db->exec($sql); |
| 197 | - } else { |
|
| 197 | + }else { |
|
| 198 | 198 | $sql = "INSERT INTO ".$this->table_name. |
| 199 | 199 | " (id_tipo, codigo_edificacion, codigo_padre, numero, padre_tipo, padre_id) VALUES (". |
| 200 | 200 | $this->intval($this->id_tipo).", ". |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $this->intval($this->padre_id).");"; |
| 206 | 206 | if ($this->db->exec($sql)) { |
| 207 | 207 | return true; |
| 208 | - } else { |
|
| 208 | + }else { |
|
| 209 | 209 | return false; |
| 210 | 210 | } |
| 211 | 211 | } |
@@ -237,9 +237,9 @@ discard block |
||
| 237 | 237 | return $lista; |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - public function buscar_ubicacion_inmueble($id,$linea) |
|
| 240 | + public function buscar_ubicacion_inmueble($id, $linea) |
|
| 241 | 241 | { |
| 242 | - $inicio_busqueda = ($linea===0)?"{\"":"{%\""; |
|
| 242 | + $inicio_busqueda = ($linea === 0) ? "{\"" : "{%\""; |
|
| 243 | 243 | $sql = "SELECT * FROM ".$this->table_name." WHERE codigo_interno LIKE '". |
| 244 | 244 | $inicio_busqueda.$id."\":%}' ORDER BY codigo;"; |
| 245 | 245 | $data = $this->db->select($sql); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | $lista[] = $this->pertenencia($l); |
| 251 | 251 | } |
| 252 | 252 | return $lista; |
| 253 | - } else { |
|
| 253 | + }else { |
|
| 254 | 254 | return false; |
| 255 | 255 | } |
| 256 | 256 | } |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | public function buscar_cantidad_inmuebles($id, $linea) |
| 264 | 264 | { |
| 265 | - $inicio_busqueda = ($linea===0)?"{\"":"{%\""; |
|
| 265 | + $inicio_busqueda = ($linea === 0) ? "{\"" : "{%\""; |
|
| 266 | 266 | $sql = "SELECT DISTINCT codigo FROM ".$this->table_name." WHERE codigo_interno LIKE '". |
| 267 | 267 | $inicio_busqueda.$id."\":%}' ORDER BY codigo;"; |
| 268 | 268 | $data = $this->db->select($sql); |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $lista[] = $l; |
| 274 | 274 | } |
| 275 | 275 | return $lista; |
| 276 | - } else { |
|
| 276 | + }else { |
|
| 277 | 277 | return false; |
| 278 | 278 | } |
| 279 | 279 | } |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | $mapa = array(); |
| 284 | 284 | $linea = 0; |
| 285 | 285 | foreach ($this->edificaciones_tipo->all() as $data) { |
| 286 | - if ($linea===1) { |
|
| 286 | + if ($linea === 1) { |
|
| 287 | 287 | break; |
| 288 | 288 | } |
| 289 | 289 | $items = $this->buscar_cantidad_inmuebles($data->id, $data->padre); |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | $data = $this->db->select($sql); |
| 302 | 302 | if ($data) { |
| 303 | 303 | return $data[0]['cantidad']; |
| 304 | - } else { |
|
| 304 | + }else { |
|
| 305 | 305 | return false; |
| 306 | 306 | } |
| 307 | 307 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 217 | 217 | * @param type $value string |
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |