@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @author Joe Nilson <joenilson at gmail.com> |
| 25 | 25 | * @version 1 |
| 26 | 26 | */ |
| 27 | -class residentes_informacion extends \fs_model{ |
|
| 27 | +class residentes_informacion extends \fs_model { |
|
| 28 | 28 | /** |
| 29 | 29 | * Codigo del cliente |
| 30 | 30 | * @var string |
@@ -142,60 +142,60 @@ discard block |
||
| 142 | 142 | { |
| 143 | 143 | parent::__construct('residentes_informacion', 'plugins/residentes'); |
| 144 | 144 | if ($t) { |
| 145 | - $this->codcliente=$t['codcliente']; |
|
| 146 | - $this->codigo=$t['codigo']; |
|
| 147 | - $this->ocupantes=$t['ocupantes']; |
|
| 148 | - $this->ocupantes5anos=$t['ocupantes5anos']; |
|
| 149 | - $this->ocupantes12anos=$t['ocupantes12anos']; |
|
| 150 | - $this->ocupantes18anos=$t['ocupantes18anos']; |
|
| 151 | - $this->ocupantes30anos=$t['ocupantes30anos']; |
|
| 152 | - $this->ocupantes50anos=$t['ocupantes50anos']; |
|
| 153 | - $this->ocupantes70anos=$t['ocupantes70anos']; |
|
| 154 | - $this->ocupantes71anos=$t['ocupantes71anos']; |
|
| 155 | - $this->informacion_discapacidad=$t['informacion_discapacidad']; |
|
| 156 | - $this->propietario=$this->str2bool($t['propietario']); |
|
| 157 | - $this->profesion=$t['profesion']; |
|
| 158 | - $this->ocupacion=$t['ocupacion']; |
|
| 159 | - $this->ca_nombres=$t['ca_nombres']; |
|
| 160 | - $this->ca_apellidos=$t['ca_apellidos']; |
|
| 161 | - $this->ca_telefono=$t['ca_telefono']; |
|
| 162 | - $this->ca_email=$t['ca_email']; |
|
| 163 | - $this->ca_propietario=$this->str2bool($t['ca_propietario']); |
|
| 164 | - $this->ca_parentesco=$t['ca_parentesco']; |
|
| 165 | - $this->ca_parentesco_obs=$t['ca_parentesco_obs']; |
|
| 166 | - $this->vehiculos=$t['vehiculos']; |
|
| 167 | - } else { |
|
| 168 | - $this->codcliente=NULL; |
|
| 169 | - $this->codigo=NULL; |
|
| 170 | - $this->ocupantes=NULL; |
|
| 171 | - $this->ocupantes5anos=NULL; |
|
| 172 | - $this->ocupantes12anos=NULL; |
|
| 173 | - $this->ocupantes18anos=NULL; |
|
| 174 | - $this->ocupantes30anos=NULL; |
|
| 175 | - $this->ocupantes50anos=NULL; |
|
| 176 | - $this->ocupantes70anos=NULL; |
|
| 177 | - $this->ocupantes71anos=NULL; |
|
| 178 | - $this->informacion_discapacidad=NULL; |
|
| 179 | - $this->propietario='FALSE'; |
|
| 180 | - $this->profesion=NULL; |
|
| 181 | - $this->ocupacion=NULL; |
|
| 182 | - $this->ca_nombres=NULL; |
|
| 183 | - $this->ca_apellidos=NULL; |
|
| 184 | - $this->ca_telefono=NULL; |
|
| 185 | - $this->ca_email=NULL; |
|
| 186 | - $this->ca_propietario='FALSE'; |
|
| 187 | - $this->ca_parentesco=NULL; |
|
| 188 | - $this->ca_parentesco_obs=''; |
|
| 189 | - $this->vehiculos=0; |
|
| 145 | + $this->codcliente = $t['codcliente']; |
|
| 146 | + $this->codigo = $t['codigo']; |
|
| 147 | + $this->ocupantes = $t['ocupantes']; |
|
| 148 | + $this->ocupantes5anos = $t['ocupantes5anos']; |
|
| 149 | + $this->ocupantes12anos = $t['ocupantes12anos']; |
|
| 150 | + $this->ocupantes18anos = $t['ocupantes18anos']; |
|
| 151 | + $this->ocupantes30anos = $t['ocupantes30anos']; |
|
| 152 | + $this->ocupantes50anos = $t['ocupantes50anos']; |
|
| 153 | + $this->ocupantes70anos = $t['ocupantes70anos']; |
|
| 154 | + $this->ocupantes71anos = $t['ocupantes71anos']; |
|
| 155 | + $this->informacion_discapacidad = $t['informacion_discapacidad']; |
|
| 156 | + $this->propietario = $this->str2bool($t['propietario']); |
|
| 157 | + $this->profesion = $t['profesion']; |
|
| 158 | + $this->ocupacion = $t['ocupacion']; |
|
| 159 | + $this->ca_nombres = $t['ca_nombres']; |
|
| 160 | + $this->ca_apellidos = $t['ca_apellidos']; |
|
| 161 | + $this->ca_telefono = $t['ca_telefono']; |
|
| 162 | + $this->ca_email = $t['ca_email']; |
|
| 163 | + $this->ca_propietario = $this->str2bool($t['ca_propietario']); |
|
| 164 | + $this->ca_parentesco = $t['ca_parentesco']; |
|
| 165 | + $this->ca_parentesco_obs = $t['ca_parentesco_obs']; |
|
| 166 | + $this->vehiculos = $t['vehiculos']; |
|
| 167 | + }else { |
|
| 168 | + $this->codcliente = NULL; |
|
| 169 | + $this->codigo = NULL; |
|
| 170 | + $this->ocupantes = NULL; |
|
| 171 | + $this->ocupantes5anos = NULL; |
|
| 172 | + $this->ocupantes12anos = NULL; |
|
| 173 | + $this->ocupantes18anos = NULL; |
|
| 174 | + $this->ocupantes30anos = NULL; |
|
| 175 | + $this->ocupantes50anos = NULL; |
|
| 176 | + $this->ocupantes70anos = NULL; |
|
| 177 | + $this->ocupantes71anos = NULL; |
|
| 178 | + $this->informacion_discapacidad = NULL; |
|
| 179 | + $this->propietario = 'FALSE'; |
|
| 180 | + $this->profesion = NULL; |
|
| 181 | + $this->ocupacion = NULL; |
|
| 182 | + $this->ca_nombres = NULL; |
|
| 183 | + $this->ca_apellidos = NULL; |
|
| 184 | + $this->ca_telefono = NULL; |
|
| 185 | + $this->ca_email = NULL; |
|
| 186 | + $this->ca_propietario = 'FALSE'; |
|
| 187 | + $this->ca_parentesco = NULL; |
|
| 188 | + $this->ca_parentesco_obs = ''; |
|
| 189 | + $this->vehiculos = 0; |
|
| 190 | 190 | } |
| 191 | 191 | $this->cliente = new cliente(); |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - public function install(){ |
|
| 194 | + public function install() { |
|
| 195 | 195 | return ""; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - public function info_adicional($i){ |
|
| 198 | + public function info_adicional($i) { |
|
| 199 | 199 | $data = $this->cliente->get($i->codcliente); |
| 200 | 200 | $i->nombre = $data->nombre; |
| 201 | 201 | $i->telefono1 = $data->telefono1; |
@@ -205,17 +205,17 @@ discard block |
||
| 205 | 205 | return $i; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - public function all(){ |
|
| 208 | + public function all() { |
|
| 209 | 209 | $sql = "SELECT * FROM ".$this->table_name." ORDER BY codcliente"; |
| 210 | 210 | $data = $this->db->select($sql); |
| 211 | - if($data){ |
|
| 211 | + if ($data) { |
|
| 212 | 212 | $lista = array(); |
| 213 | - foreach($data as $d){ |
|
| 213 | + foreach ($data as $d) { |
|
| 214 | 214 | $item = new residentes_informacion($d); |
| 215 | 215 | $lista[] = $item->info_adicional($item); |
| 216 | 216 | } |
| 217 | 217 | return $lista; |
| 218 | - }else{ |
|
| 218 | + }else { |
|
| 219 | 219 | return false; |
| 220 | 220 | } |
| 221 | 221 | } |
@@ -227,14 +227,14 @@ discard block |
||
| 227 | 227 | * @param integer $padre_tipo |
| 228 | 228 | * @return \FacturaScripts\model\residentes_informacion|boolean |
| 229 | 229 | */ |
| 230 | - public function get($codcliente){ |
|
| 230 | + public function get($codcliente) { |
|
| 231 | 231 | $sql = "SELECT * FROM ".$this->table_name. |
| 232 | 232 | " WHERE codcliente = ".$this->var2str($codcliente).";"; |
| 233 | 233 | $data = $this->db->select($sql); |
| 234 | - if($data){ |
|
| 234 | + if ($data) { |
|
| 235 | 235 | $item = new residentes_informacion($data[0]); |
| 236 | 236 | return $item->info_adicional($item); |
| 237 | - }else{ |
|
| 237 | + }else { |
|
| 238 | 238 | return false; |
| 239 | 239 | } |
| 240 | 240 | } |
@@ -245,32 +245,32 @@ discard block |
||
| 245 | 245 | * @param string $value |
| 246 | 246 | * @return boolean|\FacturaScripts\model\residentes_informacion |
| 247 | 247 | */ |
| 248 | - public function get_by_field($field,$value){ |
|
| 249 | - $query = (is_string($value))?$this->var2str($value):$this->intval($value); |
|
| 248 | + public function get_by_field($field, $value) { |
|
| 249 | + $query = (is_string($value)) ? $this->var2str($value) : $this->intval($value); |
|
| 250 | 250 | $sql = "SELECT * FROM ".$this->table_name." WHERE ".strtoupper(trim($field))." = ".$query.";"; |
| 251 | 251 | $data = $this->db->select($sql); |
| 252 | - if($data){ |
|
| 252 | + if ($data) { |
|
| 253 | 253 | $lista = array(); |
| 254 | - foreach($data as $d){ |
|
| 254 | + foreach ($data as $d) { |
|
| 255 | 255 | $item = new residentes_informacion($d); |
| 256 | 256 | $lista[] = $item->info_adicional($item); |
| 257 | 257 | } |
| 258 | 258 | return $lista; |
| 259 | - }else{ |
|
| 259 | + }else { |
|
| 260 | 260 | return false; |
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | public function exists() { |
| 265 | - if(!$this->get($this->codcliente)){ |
|
| 265 | + if (!$this->get($this->codcliente)) { |
|
| 266 | 266 | return false; |
| 267 | - }else{ |
|
| 267 | + }else { |
|
| 268 | 268 | return $this->get($this->codcliente); |
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | public function save() { |
| 273 | - if($this->exists()){ |
|
| 273 | + if ($this->exists()) { |
|
| 274 | 274 | $sql = "UPDATE ".$this->table_name." SET ". |
| 275 | 275 | "codigo = ".$this->var2str($this->codigo).", ". |
| 276 | 276 | "ocupantes = ".$this->intval($this->ocupantes).", ". |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | "vehiculos = ".$this->intval($this->vehiculos)." ". |
| 296 | 296 | "WHERE codcliente = ".$this->var2str($this->codcliente).";"; |
| 297 | 297 | return $this->db->exec($sql); |
| 298 | - }else{ |
|
| 298 | + }else { |
|
| 299 | 299 | $sql = "INSERT INTO ".$this->table_name." (codcliente, codigo, ocupantes, ocupantes5anos, ocupantes12anos, ocupantes18anos, ocupantes30anos, ocupantes50anos, ocupantes70anos, ocupantes71anos, informacion_discapacidad, propietario, profesion, ocupacion, ca_nombres, ca_apellidos, ca_telefono, ca_email, ca_propietario, ca_parentesco, ca_parentesco_obs, vehiculos) VALUES (". |
| 300 | 300 | $this->var2str($this->codcliente).", ". |
| 301 | 301 | $this->var2str($this->codigo).", ". |
@@ -319,9 +319,9 @@ discard block |
||
| 319 | 319 | $this->var2str($this->ca_parentesco).", ". |
| 320 | 320 | $this->var2str($this->ca_parentesco_obs).", ". |
| 321 | 321 | $this->intval($this->vehiculos).");"; |
| 322 | - if($this->db->exec($sql)){ |
|
| 322 | + if ($this->db->exec($sql)) { |
|
| 323 | 323 | return true; |
| 324 | - }else{ |
|
| 324 | + }else { |
|
| 325 | 325 | return false; |
| 326 | 326 | } |
| 327 | 327 | } |
@@ -335,14 +335,14 @@ discard block |
||
| 335 | 335 | $clilist = array(); |
| 336 | 336 | $query = mb_strtolower($this->no_html($busqueda), 'UTF8'); |
| 337 | 337 | |
| 338 | - $consulta = "SELECT * FROM " . $this->table_name . " WHERE "; |
|
| 338 | + $consulta = "SELECT * FROM ".$this->table_name." WHERE "; |
|
| 339 | 339 | if (is_numeric($query)) { |
| 340 | - $consulta .= "(ca_telefono LIKE '%" . $query . "%' OR codigo LIKE '%" . $query . "%')"; |
|
| 341 | - } else { |
|
| 340 | + $consulta .= "(ca_telefono LIKE '%".$query."%' OR codigo LIKE '%".$query."%')"; |
|
| 341 | + }else { |
|
| 342 | 342 | $buscar = str_replace(' ', '%', $query); |
| 343 | - $consulta .= "(lower(ca_nombres) LIKE '%" . $buscar . "%' OR lower(ca_apellidos) LIKE '%" . $buscar . "%'" |
|
| 344 | - . " OR lower(ocupacion) LIKE '%" . $buscar . "%' OR lower(profesion) LIKE '%" . $buscar . "%'" |
|
| 345 | - . " OR lower(ca_email) LIKE '%" . $buscar . "%')"; |
|
| 343 | + $consulta .= "(lower(ca_nombres) LIKE '%".$buscar."%' OR lower(ca_apellidos) LIKE '%".$buscar."%'" |
|
| 344 | + . " OR lower(ocupacion) LIKE '%".$buscar."%' OR lower(profesion) LIKE '%".$buscar."%'" |
|
| 345 | + . " OR lower(ca_email) LIKE '%".$buscar."%')"; |
|
| 346 | 346 | } |
| 347 | 347 | $consulta .= " ORDER BY codcliente ASC"; |
| 348 | 348 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $this->estado = $t['estado']; |
| 61 | 61 | $this->fecha_creacion = $t['fecha_creacion']; |
| 62 | 62 | $this->fecha_modificacion = $t['fecha_modificacion']; |
| 63 | - } else { |
|
| 63 | + }else { |
|
| 64 | 64 | $this->id = null; |
| 65 | 65 | $this->descripcion = ''; |
| 66 | 66 | $this->forma_pago = ''; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | "WHERE id = ".$this->intval($this->id).";"; |
| 110 | 110 | $data = $this->db->exec($sql); |
| 111 | 111 | return $data; |
| 112 | - } else { |
|
| 112 | + }else { |
|
| 113 | 113 | $sql = "INSERT INTO ".$this->table_name. |
| 114 | 114 | " (descripcion, forma_pago, formato_factura, fecha_envio, hora_envio, residentes_facturar, ". |
| 115 | 115 | "facturas_generadas, usuario_creacion, fecha_creacion, estado) VALUES (". |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $this->var2str($this->estado).");"; |
| 126 | 126 | if ($this->db->exec($sql)) { |
| 127 | 127 | return $this->db->lastval(); |
| 128 | - } else { |
|
| 128 | + }else { |
|
| 129 | 129 | return false; |
| 130 | 130 | } |
| 131 | 131 | } |
@@ -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 string $value |
| 218 | 218 | * @return boolean|\FacturaScripts\model\residentes_edificaciones |
| 219 | 219 | */ |
| 220 | - public function get_by_field($field,$value){ |
|
| 221 | - $query = (is_string($value))?$this->var2str($value):$this->intval($value); |
|
| 220 | + public function get_by_field($field, $value) { |
|
| 221 | + $query = (is_string($value)) ? $this->var2str($value) : $this->intval($value); |
|
| 222 | 222 | $sql = "SELECT * FROM ".$this->table_name." WHERE ".strtoupper(trim($field))." = ".$query. |
| 223 | 223 | " ORDER BY codigo_interno,numero;"; |
| 224 | 224 | $data = $this->db->select($sql); |
@@ -229,7 +229,7 @@ discard block |
||
| 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 | |
@@ -80,7 +80,7 @@ discard block |
||
| 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; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $lista[] = $item; |
| 121 | 121 | } |
| 122 | 122 | return $lista; |
| 123 | - } else { |
|
| 123 | + }else { |
|
| 124 | 124 | return false; |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $data = $this->db->select($sql); |
| 133 | 133 | if ($data) { |
| 134 | 134 | return new residentes_vehiculos($data[0]); |
| 135 | - } else { |
|
| 135 | + }else { |
|
| 136 | 136 | return false; |
| 137 | 137 | } |
| 138 | 138 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public function get_by_field($field, $value) |
| 147 | 147 | { |
| 148 | - $query = (is_string($value))?$this->var2str($value):$this->intval($value); |
|
| 148 | + $query = (is_string($value)) ? $this->var2str($value) : $this->intval($value); |
|
| 149 | 149 | $sql = "SELECT * FROM ".$this->table_name." WHERE ".strtoupper(trim($field))." = ".$query.";"; |
| 150 | 150 | $data = $this->db->select($sql); |
| 151 | 151 | if ($data) { |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $lista[] = $item; |
| 156 | 156 | } |
| 157 | 157 | return $lista; |
| 158 | - } else { |
|
| 158 | + }else { |
|
| 159 | 159 | return false; |
| 160 | 160 | } |
| 161 | 161 | } |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | { |
| 165 | 165 | if (is_null($this->idvehiculo)) { |
| 166 | 166 | return false; |
| 167 | - } else { |
|
| 167 | + }else { |
|
| 168 | 168 | return $this->get($this->codcliente, $this->idvehiculo); |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | "WHERE idvehiculo = ".$this->intval($this->idvehiculo)." AND ". |
| 183 | 183 | "codcliente = ".$this->var2str($this->codcliente).";"; |
| 184 | 184 | return $this->db->exec($sql); |
| 185 | - } else { |
|
| 185 | + }else { |
|
| 186 | 186 | $sql = "INSERT INTO ".$this->table_name." (codcliente, vehiculo_marca, vehiculo_modelo, vehiculo_color, ". |
| 187 | 187 | "vehiculo_placa, vehiculo_tipo, codigo_tarjeta) VALUES (". |
| 188 | 188 | $this->var2str($this->codcliente).", ". |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $this->var2str($this->codigo_tarjeta).");"; |
| 195 | 195 | if ($this->db->exec($sql)) { |
| 196 | 196 | return $this->db->lastval(); |
| 197 | - } else { |
|
| 197 | + }else { |
|
| 198 | 198 | return false; |
| 199 | 199 | } |
| 200 | 200 | } |
@@ -209,17 +209,17 @@ discard block |
||
| 209 | 209 | $clilist = array(); |
| 210 | 210 | $query = mb_strtolower($this->no_html($busqueda), 'UTF8'); |
| 211 | 211 | |
| 212 | - $consulta = "SELECT * FROM " . $this->table_name . " WHERE "; |
|
| 212 | + $consulta = "SELECT * FROM ".$this->table_name." WHERE "; |
|
| 213 | 213 | if (is_numeric($query)) { |
| 214 | - $consulta .= "(codigo_tarjeta LIKE '%" . $query . "%' OR CAST(idvehiculo as CHAR) = '%" . $query . "%')"; |
|
| 215 | - } else { |
|
| 214 | + $consulta .= "(codigo_tarjeta LIKE '%".$query."%' OR CAST(idvehiculo as CHAR) = '%".$query."%')"; |
|
| 215 | + }else { |
|
| 216 | 216 | $buscar = str_replace(' ', '%', $query); |
| 217 | - $consulta .= "(lower(codigo_tarjeta) LIKE '%" . $buscar . |
|
| 218 | - "%' OR lower(vehiculo_color) LIKE '%" . $buscar . "%'" . |
|
| 219 | - " OR lower(vehiculo_marca) LIKE '%" . $buscar . |
|
| 220 | - "%' OR lower(vehiculo_modelo) LIKE '%" . $buscar . "%'" . |
|
| 221 | - " OR lower(vehiculo_placa) LIKE '%" . $buscar . |
|
| 222 | - "%' OR lower(vehiculo_tipo) LIKE '%" . $buscar . "%')"; |
|
| 217 | + $consulta .= "(lower(codigo_tarjeta) LIKE '%".$buscar. |
|
| 218 | + "%' OR lower(vehiculo_color) LIKE '%".$buscar."%'". |
|
| 219 | + " OR lower(vehiculo_marca) LIKE '%".$buscar. |
|
| 220 | + "%' OR lower(vehiculo_modelo) LIKE '%".$buscar."%'". |
|
| 221 | + " OR lower(vehiculo_placa) LIKE '%".$buscar. |
|
| 222 | + "%' OR lower(vehiculo_tipo) LIKE '%".$buscar."%')"; |
|
| 223 | 223 | } |
| 224 | 224 | $consulta .= " ORDER BY codcliente ASC"; |
| 225 | 225 | |
@@ -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 string|integer $value |
| 87 | 87 | * @return boolean|\FacturaScripts\model\residentes_edificaciones_tipo |
| 88 | 88 | */ |
| 89 | - public function get_by_field($field,$value){ |
|
| 90 | - $query = (is_string($value))?$this->var2str($value):$this->intval($value); |
|
| 89 | + public function get_by_field($field, $value) { |
|
| 90 | + $query = (is_string($value)) ? $this->var2str($value) : $this->intval($value); |
|
| 91 | 91 | $sql = "SELECT * FROM ".$this->table_name." WHERE ".strtoupper(trim($field))." = ".$query.";"; |
| 92 | 92 | $data = $this->db->select($sql); |
| 93 | - if($data){ |
|
| 93 | + if ($data) { |
|
| 94 | 94 | $lista = array(); |
| 95 | - foreach($data as $d){ |
|
| 96 | - $lista[] = new residentes_edificaciones_tipo($d); |
|
| 95 | + foreach ($data as $d) { |
|
| 96 | + $lista[] = new residentes_edificaciones_tipo($d); |
|
| 97 | 97 | } |
| 98 | 98 | return $lista; |
| 99 | - }else{ |
|
| 99 | + }else { |
|
| 100 | 100 | return false; |
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | public function exists() { |
| 105 | - if(is_null($this->id)){ |
|
| 105 | + if (is_null($this->id)) { |
|
| 106 | 106 | return false; |
| 107 | - }else{ |
|
| 107 | + }else { |
|
| 108 | 108 | return $this->get($this->id); |
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | public function save() { |
| 113 | - if($this->exists()){ |
|
| 113 | + if ($this->exists()) { |
|
| 114 | 114 | $sql = "UPDATE ".$this->table_name." SET ". |
| 115 | 115 | "descripcion = ".$this->var2str($this->descripcion).", ". |
| 116 | 116 | "padre = ".$this->intval($this->padre)." ". |
| 117 | 117 | "WHERE id = ".$this->intval($this->id).";"; |
| 118 | 118 | return $this->db->exec($sql); |
| 119 | - }else{ |
|
| 119 | + }else { |
|
| 120 | 120 | $sql = "INSERT INTO ".$this->table_name." (descripcion, padre) VALUES (". |
| 121 | 121 | $this->var2str($this->descripcion).", ". |
| 122 | 122 | $this->intval($this->padre).");"; |
| 123 | - if($this->db->exec($sql)){ |
|
| 123 | + if ($this->db->exec($sql)) { |
|
| 124 | 124 | return $this->db->lastval(); |
| 125 | - }else{ |
|
| 125 | + }else { |
|
| 126 | 126 | return false; |
| 127 | 127 | } |
| 128 | 128 | } |
@@ -132,25 +132,25 @@ discard block |
||
| 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 |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | public function conceptoFacturable($codcliente, $referencia) |
| 40 | 40 | { |
| 41 | 41 | $sql = "SELECT count(referencia) as facturado from lineasfacturascli where referencia = ". |
| 42 | - $this->var2str($referencia) . |
|
| 42 | + $this->var2str($referencia). |
|
| 43 | 43 | " AND idfactura IN (select idfactura from facturascli WHERE codcliente = ".$this->var2str($codcliente).");"; |
| 44 | 44 | $data = $this->db->select($sql); |
| 45 | 45 | if (!$data[0]['facturado']) { |
@@ -65,10 +65,10 @@ discard block |
||
| 65 | 65 | $this->nuevoTotalFactura($factura, $residenteProg, $empresaTable); |
| 66 | 66 | ++$jobDisponible->facturas_generadas; |
| 67 | 67 | $jobDisponible->save(); |
| 68 | - } else { |
|
| 68 | + }else { |
|
| 69 | 69 | $this->log->new_error_msg('Imposible guardar la factura.'); |
| 70 | 70 | } |
| 71 | - } else { |
|
| 71 | + }else { |
|
| 72 | 72 | $this->log->new_error_msg('Cliente no encontrado.'); |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $residenteProgramado->idfactura = $factura->idfactura; |
| 149 | 149 | $residenteProgramado->procesado = true; |
| 150 | 150 | $residenteProgramado->save(); |
| 151 | - } else { |
|
| 151 | + }else { |
|
| 152 | 152 | $factura->delete(); |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | if ($empresaTable->contintegrada) { |
| 205 | 205 | $asiento_factura = new asiento_factura(); |
| 206 | 206 | $asiento_factura->generar_asiento_venta($factura); |
| 207 | - } else { |
|
| 207 | + }else { |
|
| 208 | 208 | /// de todas formas forzamos la generación de las líneas de iva |
| 209 | 209 | $factura->get_lineas_iva(); |
| 210 | 210 | } |
@@ -110,9 +110,9 @@ |
||
| 110 | 110 | $jobDisponible->fecha_modificacion = \date('Y-m-d H:i:s'); |
| 111 | 111 | $jobDisponible->save(); |
| 112 | 112 | $this->startJob($jobDisponible); |
| 113 | - } else { |
|
| 113 | + }else { |
|
| 114 | 114 | echo " ** No coincide la hora de proceso con la de ejecucion de cron se omite el proceso ". |
| 115 | - $this->ahora . " " . $this->horaActual . " ** \n"; |
|
| 115 | + $this->ahora." ".$this->horaActual." ** \n"; |
|
| 116 | 116 | $this->log->new_advice(' ** No coincide la hora de proceso con la de ejecucion de cron se omite el proceso ** '); |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $this->envio_masivo = !(($this->filter_request('envio_masivo') === 'false')); |
| 60 | 60 | $this->tipo_accion = $tipo_documento; |
| 61 | 61 | $this->verificarCantidadFacturas(); |
| 62 | - $this->archivo = $tipo_documento.'_'.\date('dmYhis') . '.pdf'; |
|
| 62 | + $this->archivo = $tipo_documento.'_'.\date('dmYhis').'.pdf'; |
|
| 63 | 63 | if ($this->cliente_residente && $info_accion) { |
| 64 | 64 | switch ($info_accion) { |
| 65 | 65 | case 'imprimir': |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | unset($lista_facturas[0]); |
| 129 | 129 | $this->contador_facturas = count($lista_facturas); |
| 130 | 130 | $this->facturas = implode(',', $lista_facturas); |
| 131 | - } else { |
|
| 131 | + }else { |
|
| 132 | 132 | $this->contador_facturas = 0; |
| 133 | 133 | $this->facturas = ''; |
| 134 | 134 | } |
@@ -171,9 +171,9 @@ discard block |
||
| 171 | 171 | { |
| 172 | 172 | $this->documento = new residentes_pdf('letter', 'portrait'); |
| 173 | 173 | $this->documento->cliente_residente = $this->cliente_residente; |
| 174 | - $this->documento->pdf->addInfo('Title', 'Pagos Residente ' . |
|
| 174 | + $this->documento->pdf->addInfo('Title', 'Pagos Residente '. |
|
| 175 | 175 | $this->cliente_residente->codcliente); |
| 176 | - $this->documento->pdf->addInfo('Subject', 'Pagos del Residente ' . |
|
| 176 | + $this->documento->pdf->addInfo('Subject', 'Pagos del Residente '. |
|
| 177 | 177 | $this->cliente_residente->codcliente); |
| 178 | 178 | $this->documento->pdf->addInfo('Author', $this->empresa->nombre); |
| 179 | 179 | $this->documento->pdf->ezSetMargins(10, 10, 10, 10); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | public function crearFacturaDetallada() |
| 184 | 184 | { |
| 185 | 185 | $customerInfo = (array) $this->cliente_residente; |
| 186 | - $customerInfo['direccion'] = trim($this->cliente_residente->inmueble->codigo_externo()) . ' numero ' |
|
| 186 | + $customerInfo['direccion'] = trim($this->cliente_residente->inmueble->codigo_externo()).' numero ' |
|
| 187 | 187 | . $this->cliente_residente->inmueble->numero; |
| 188 | 188 | $datosFactura = $this->datosFactura(); |
| 189 | 189 | $datosEmpresa = (array) $this->empresa; |
@@ -196,13 +196,13 @@ discard block |
||
| 196 | 196 | if ($this->filter_request('info_accion') === 'enviar') { |
| 197 | 197 | $this->documento->Output( |
| 198 | 198 | 'F', |
| 199 | - 'tmp/' . FS_TMP_NAME . 'enviar/' . $this->archivo, |
|
| 199 | + 'tmp/'.FS_TMP_NAME.'enviar/'.$this->archivo, |
|
| 200 | 200 | true |
| 201 | 201 | ); |
| 202 | - } else { |
|
| 202 | + }else { |
|
| 203 | 203 | $this->documento->Output( |
| 204 | 204 | 'I', |
| 205 | - 'factura_' .$datosFactura[0]['numero2']. '_' . \date('dmYhis') . '.pdf' |
|
| 205 | + 'factura_'.$datosFactura[0]['numero2'].'_'.\date('dmYhis').'.pdf' |
|
| 206 | 206 | ); |
| 207 | 207 | } |
| 208 | 208 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | $this->documento->set_y(80); |
| 253 | 253 | if ($this->empresa->pie_factura) { |
| 254 | - $this->documento->pdf->addText(20, 40, 8, fs_fix_html('<b>Generado por:</b> ' . |
|
| 254 | + $this->documento->pdf->addText(20, 40, 8, fs_fix_html('<b>Generado por:</b> '. |
|
| 255 | 255 | $this->user->get_agente_fullname()), 0); |
| 256 | 256 | $this->documento->pdf->addText( |
| 257 | 257 | 10, |
@@ -262,9 +262,9 @@ discard block |
||
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | if ($this->filter_request('info_accion') == 'enviar') { |
| 265 | - $this->documento->save('tmp/' . FS_TMP_NAME . 'enviar/' . $this->archivo); |
|
| 266 | - } else { |
|
| 267 | - $this->documento->show('documento_cobros_' . \date('dmYhis') . '.pdf'); |
|
| 265 | + $this->documento->save('tmp/'.FS_TMP_NAME.'enviar/'.$this->archivo); |
|
| 266 | + }else { |
|
| 267 | + $this->documento->show('documento_cobros_'.\date('dmYhis').'.pdf'); |
|
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | |
@@ -285,15 +285,15 @@ discard block |
||
| 285 | 285 | $mail->addAddress($email, $this->cliente_residente->nombre); |
| 286 | 286 | |
| 287 | 287 | $elSubject = ($tipo_documento === 'informacion_cobros') |
| 288 | - ? ': Su Estado de cuenta al '. \date('d-m-Y') |
|
| 289 | - : ': Su factura ' . $this->factura->codigo . ' ' . $this->factura->numero2; |
|
| 288 | + ? ': Su Estado de cuenta al '.\date('d-m-Y') |
|
| 289 | + : ': Su factura '.$this->factura->codigo.' '.$this->factura->numero2; |
|
| 290 | 290 | |
| 291 | - $mail->Subject = fs_fix_html($this->empresa->nombre) . $elSubject; |
|
| 291 | + $mail->Subject = fs_fix_html($this->empresa->nombre).$elSubject; |
|
| 292 | 292 | $mail->AltBody = ($tipo_documento === 'informacion_cobros') |
| 293 | 293 | ? strip_tags($_POST['mensaje']) |
| 294 | 294 | : plantilla_email( |
| 295 | 295 | 'factura', |
| 296 | - $this->factura->codigo . ' ' . $this->factura->numero2, |
|
| 296 | + $this->factura->codigo.' '.$this->factura->numero2, |
|
| 297 | 297 | $this->empresa->email_config['mail_firma'] |
| 298 | 298 | ); |
| 299 | 299 | if (trim($this->filter_request('email_copia')) !== '') { |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | trim($this->filter_request('email_copia')), |
| 303 | 303 | $this->cliente_residente->nombre |
| 304 | 304 | ); |
| 305 | - } else { |
|
| 305 | + }else { |
|
| 306 | 306 | $mail->addCC( |
| 307 | 307 | trim($this->filter_request('email_copia')), |
| 308 | 308 | $this->cliente_residente->nombre |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | } |
| 312 | 312 | $mail->msgHTML(nl2br($mail->AltBody)); |
| 313 | 313 | $mail->isHTML(true); |
| 314 | - $mail->addAttachment('tmp/' . FS_TMP_NAME . 'enviar/' . $this->archivo); |
|
| 314 | + $mail->addAttachment('tmp/'.FS_TMP_NAME.'enviar/'.$this->archivo); |
|
| 315 | 315 | |
| 316 | 316 | if (isset($_FILES['adjunto']) && is_uploaded_file($_FILES['adjunto']['tmp_name'])) { |
| 317 | 317 | $mail->aºddAttachment($_FILES['adjunto']['tmp_name'], $_FILES['adjunto']['name']); |
@@ -322,12 +322,12 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | $this->empresa->save_mail($mail); |
| 324 | 324 | $done = true; |
| 325 | - } else { |
|
| 326 | - $this->new_error_msg("Error al enviar el email: " . $mail->ErrorInfo); |
|
| 325 | + }else { |
|
| 326 | + $this->new_error_msg("Error al enviar el email: ".$mail->ErrorInfo); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - unlink('tmp/' . FS_TMP_NAME . 'enviar/' . $this->archivo); |
|
| 330 | - } else { |
|
| 329 | + unlink('tmp/'.FS_TMP_NAME.'enviar/'.$this->archivo); |
|
| 330 | + }else { |
|
| 331 | 331 | $this->new_error_msg('Imposible generar el PDF.'); |
| 332 | 332 | } |
| 333 | 333 | } |
@@ -343,8 +343,8 @@ discard block |
||
| 343 | 343 | $this->envio_masivo = false; |
| 344 | 344 | $this->existe_tesoreria(); |
| 345 | 345 | $this->cliente_residente = false; |
| 346 | - if (!file_exists('tmp/' . FS_TMP_NAME . 'enviar') && |
|
| 347 | - !mkdir($concurrentDirectory = 'tmp/' . FS_TMP_NAME . 'enviar') && |
|
| 346 | + if (!file_exists('tmp/'.FS_TMP_NAME.'enviar') && |
|
| 347 | + !mkdir($concurrentDirectory = 'tmp/'.FS_TMP_NAME.'enviar') && |
|
| 348 | 348 | !is_dir($concurrentDirectory)) { |
| 349 | 349 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory)); |
| 350 | 350 | } |