@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | 'page_to' => 'ventas_factura', |
| 38 | 38 | 'type' => 'head', |
| 39 | 39 | 'text' => '<script src="'.FS_PATH.'plugins/residentes/view/js/seguridad_documentos.js?cod='. |
| 40 | - rand(1000,10000).'" type="text/javascript"></script>', |
|
| 40 | + rand(1000, 10000).'" type="text/javascript"></script>', |
|
| 41 | 41 | 'params' => '' |
| 42 | 42 | ), |
| 43 | 43 | array( |
@@ -46,15 +46,15 @@ discard block |
||
| 46 | 46 | 'page_to' => 'compras_factura', |
| 47 | 47 | 'type' => 'head', |
| 48 | 48 | 'text' => '<script src="'.FS_PATH.'plugins/residentes/view/js/seguridad_documentos.js?cod='. |
| 49 | - rand(1000,10000).'" type="text/javascript"></script>', |
|
| 49 | + rand(1000, 10000).'" type="text/javascript"></script>', |
|
| 50 | 50 | 'params' => '' |
| 51 | 51 | ), |
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | - foreach($extensiones as $del){ |
|
| 54 | + foreach ($extensiones as $del) { |
|
| 55 | 55 | $fext = new fs_extension($del); |
| 56 | - if(!$fext->save()){ |
|
| 57 | - $this->new_error_msg('Imposible guardar los datos de la extensión ' . $ext['name'] . '.'); |
|
| 56 | + if (!$fext->save()) { |
|
| 57 | + $this->new_error_msg('Imposible guardar los datos de la extensión '.$ext['name'].'.'); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $this->estado = $t['estado']; |
| 65 | 65 | $this->fecha_creacion = $t['fecha_creacion']; |
| 66 | 66 | $this->fecha_modificacion = $t['fecha_modificacion']; |
| 67 | - } else { |
|
| 67 | + }else { |
|
| 68 | 68 | $this->id = null; |
| 69 | 69 | $this->descripcion = ''; |
| 70 | 70 | $this->tipo_programacion = 'generar'; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | public function save() |
| 101 | 101 | { |
| 102 | 102 | if ($this->exists()) { |
| 103 | - $sql = "UPDATE " . $this->table_name . " SET ". |
|
| 103 | + $sql = "UPDATE ".$this->table_name." SET ". |
|
| 104 | 104 | "descripcion = ".$this->var2str($this->descripcion).", ". |
| 105 | 105 | "tipo_programacion = ".$this->var2str($this->tipo_programacion).", ". |
| 106 | 106 | "forma_pago = ".$this->var2str($this->forma_pago).", ". |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | "WHERE id = ".$this->intval($this->id).";"; |
| 117 | 117 | $data = $this->db->exec($sql); |
| 118 | 118 | return $data; |
| 119 | - } else { |
|
| 119 | + }else { |
|
| 120 | 120 | $sql = "INSERT INTO ".$this->table_name. |
| 121 | 121 | " (descripcion, tipo_programacion, forma_pago, formato_factura, fecha_vencimiento, fecha_envio, hora_envio, ". |
| 122 | 122 | "residentes_facturar, facturas_generadas, usuario_creacion, fecha_creacion, estado) VALUES (". |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $this->var2str($this->estado).");"; |
| 135 | 135 | if ($this->db->exec($sql)) { |
| 136 | 136 | return $this->db->lastval(); |
| 137 | - } else { |
|
| 137 | + }else { |
|
| 138 | 138 | return false; |
| 139 | 139 | } |
| 140 | 140 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $this->usuario_modificacion = $t['usuario_modificacion']; |
| 56 | 56 | $this->fecha_creacion = $t['fecha_creacion']; |
| 57 | 57 | $this->fecha_modificacion = $t['fecha_modificacion']; |
| 58 | - } else { |
|
| 58 | + }else { |
|
| 59 | 59 | $this->id = null; |
| 60 | 60 | $this->tiposervicio = 'interno'; |
| 61 | 61 | $this->apikey = ''; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | public function save() |
| 88 | 88 | { |
| 89 | 89 | if ($this->exists()) { |
| 90 | - $sql = "UPDATE " . $this->table_name . " SET ". |
|
| 90 | + $sql = "UPDATE ".$this->table_name." SET ". |
|
| 91 | 91 | "tiposervicio = ".$this->var2str($this->tiposervicio).", ". |
| 92 | 92 | "apikey = ".$this->var2str($this->apikey).", ". |
| 93 | 93 | "apisecret = ".$this->var2str($this->apisecret).", ". |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | "WHERE id = ".$this->intval($this->id).";"; |
| 100 | 100 | $data = $this->db->exec($sql); |
| 101 | 101 | return $data; |
| 102 | - } else { |
|
| 102 | + }else { |
|
| 103 | 103 | $sql = "INSERT INTO ".$this->table_name. |
| 104 | - " (tiposervicio, apikey, apisecret, apisenderemail, apisendername, emailsubject, usuario_creacion, fecha_creacion) " . |
|
| 104 | + " (tiposervicio, apikey, apisecret, apisenderemail, apisendername, emailsubject, usuario_creacion, fecha_creacion) ". |
|
| 105 | 105 | " VALUES (". |
| 106 | 106 | $this->var2str($this->tiposervicio).", ". |
| 107 | 107 | $this->var2str($this->apikey).", ". |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $this->var2str($this->fecha_creacion).");"; |
| 114 | 114 | if ($this->db->exec($sql)) { |
| 115 | 115 | return $this->db->lastval(); |
| 116 | - } else { |
|
| 116 | + }else { |
|
| 117 | 117 | return false; |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | public $importe; |
| 38 | 38 | |
| 39 | 39 | public function __construct($t = FALSE) { |
| 40 | - parent::__construct('residentes_fact_prog_conceptos','plugins/residentes'); |
|
| 41 | - if($t){ |
|
| 40 | + parent::__construct('residentes_fact_prog_conceptos', 'plugins/residentes'); |
|
| 41 | + if ($t) { |
|
| 42 | 42 | $this->id = $t['id']; |
| 43 | 43 | $this->idprogramacion = $t['idprogramacion']; |
| 44 | 44 | $this->referencia = $t['referencia']; |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $this->cantidad = (float) ($t['cantidad']); |
| 47 | 47 | $this->codimpuesto = $t['codimpuesto']; |
| 48 | 48 | $this->importe = (float) ($t['importe']); |
| 49 | - }else{ |
|
| 49 | + }else { |
|
| 50 | 50 | $this->id = null; |
| 51 | 51 | $this->idprogramacion = null; |
| 52 | 52 | $this->referencia = ''; |
@@ -57,13 +57,13 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - public function install(){ |
|
| 60 | + public function install() { |
|
| 61 | 61 | return ""; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | public function exists() |
| 65 | 65 | { |
| 66 | - if(is_null($this->id)) { |
|
| 66 | + if (is_null($this->id)) { |
|
| 67 | 67 | return false; |
| 68 | 68 | } |
| 69 | 69 | return true; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | public function save() |
| 73 | 73 | { |
| 74 | - if($this->exists()){ |
|
| 74 | + if ($this->exists()) { |
|
| 75 | 75 | $sql = "UPDATE ".$this->table_name." SET ". |
| 76 | 76 | "referencia = ".$this->var2str($this->referencia).", ". |
| 77 | 77 | "pvp = ".$this->var2str($this->pvp).", ". |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | "WHERE id = ".$this->intval($this->id).";"; |
| 82 | 82 | $data = $this->db->exec($sql); |
| 83 | 83 | return $data; |
| 84 | - }else{ |
|
| 84 | + }else { |
|
| 85 | 85 | $sql = "INSERT INTO ".$this->table_name. |
| 86 | 86 | " (idprogramacion, referencia, pvp, cantidad, codimpuesto, importe) VALUES (". |
| 87 | 87 | $this->intval($this->idprogramacion).", ". |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | $this->var2str($this->codimpuesto).", ". |
| 92 | 92 | $this->var2str($this->importe).");"; |
| 93 | 93 | |
| 94 | - if($this->db->exec($sql)){ |
|
| 94 | + if ($this->db->exec($sql)) { |
|
| 95 | 95 | return true; |
| 96 | - }else{ |
|
| 96 | + }else { |
|
| 97 | 97 | return false; |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | $sql = "select * from ".$this->table_name." WHERE id = ".$this->intval($id); |
| 106 | 106 | $data = $this->db->select($sql); |
| 107 | - if($data) { |
|
| 107 | + if ($data) { |
|
| 108 | 108 | return new residentes_facturacion_programada_conceptos($data[0]); |
| 109 | 109 | } |
| 110 | 110 | return false; |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | $sql = "select * from ".$this->table_name." WHERE idprogramacion = ".$this->intval($idProg)." ORDER BY id"; |
| 116 | 116 | $data = $this->db->select($sql); |
| 117 | 117 | $lista = array(); |
| 118 | - if($data) { |
|
| 119 | - foreach($data as $d) { |
|
| 118 | + if ($data) { |
|
| 119 | + foreach ($data as $d) { |
|
| 120 | 120 | $lista[] = new residentes_facturacion_programada_conceptos($d); |
| 121 | 121 | } |
| 122 | 122 | return $lista; |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | $sql = "select * from ".$this->table_name." WHERE fecha_envio = ".$this->var2str($date)." ORDER BY fecha_envio, hora_envio"; |
| 130 | 130 | $data = $this->db->select($sql); |
| 131 | 131 | $lista = array(); |
| 132 | - if($data) { |
|
| 133 | - foreach($data as $d) { |
|
| 132 | + if ($data) { |
|
| 133 | + foreach ($data as $d) { |
|
| 134 | 134 | $lista[] = new residentes_facturacion_programada_conceptos($d); |
| 135 | 135 | } |
| 136 | 136 | return $lista; |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | ." AND "."estado = ".$this->var2str($status)." ORDER BY fecha_envio, hora_envio"; |
| 145 | 145 | $data = $this->db->select($sql); |
| 146 | 146 | $lista = array(); |
| 147 | - if($data) { |
|
| 148 | - foreach($data as $d) { |
|
| 147 | + if ($data) { |
|
| 148 | + foreach ($data as $d) { |
|
| 149 | 149 | $lista[] = new residentes_facturacion_programada_conceptos($d); |
| 150 | 150 | } |
| 151 | 151 | return $lista; |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | $sql = "select * from ".$this->table_name." ORDER BY fecha_envio, hora_envio"; |
| 159 | 159 | $data = $this->db->select($sql); |
| 160 | 160 | $lista = array(); |
| 161 | - if($data) { |
|
| 162 | - foreach($data as $d) { |
|
| 161 | + if ($data) { |
|
| 162 | + foreach ($data as $d) { |
|
| 163 | 163 | $lista[] = new residentes_facturacion_programada_conceptos($d); |
| 164 | 164 | } |
| 165 | 165 | return $lista; |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | { |
| 172 | 172 | $sql = "DELETE from ".$this->table_name." WHERE id = ".$this->intval($this->id); |
| 173 | 173 | $data = $this->db->exec($sql); |
| 174 | - if($data) { |
|
| 174 | + if ($data) { |
|
| 175 | 175 | return true; |
| 176 | 176 | } |
| 177 | 177 | return false; |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | if (isset($i['deudas'])) { |
| 57 | 57 | $this->deudas = (float) ($i['deudas']); |
| 58 | 58 | } |
| 59 | - } else { |
|
| 59 | + }else { |
|
| 60 | 60 | $this->id = null; |
| 61 | 61 | $this->codcliente = null; |
| 62 | 62 | $this->fechaalta = Date('d-m-Y'); |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | return '-'; |
| 90 | 90 | } elseif (strlen($this->observaciones) < 60) { |
| 91 | 91 | return $this->observaciones; |
| 92 | - } else { |
|
| 93 | - return substr($this->observaciones, 0, 60) . '...'; |
|
| 92 | + }else { |
|
| 93 | + return substr($this->observaciones, 0, 60).'...'; |
|
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | |
@@ -99,16 +99,16 @@ discard block |
||
| 99 | 99 | $data = $this->db->select("SELECT * FROM residentes WHERE id = ".$this->var2str($id).";"); |
| 100 | 100 | if ($data) { |
| 101 | 101 | return new residente($data[0]); |
| 102 | - } else { |
|
| 102 | + }else { |
|
| 103 | 103 | return false; |
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | public function exists() |
| 108 | 108 | { |
| 109 | - if(is_null($this->id)) { |
|
| 109 | + if (is_null($this->id)) { |
|
| 110 | 110 | return false; |
| 111 | - } else { |
|
| 111 | + }else { |
|
| 112 | 112 | return $this->db->select("SELECT * FROM residentes WHERE id = ".$this->var2str($this->id).";"); |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | deudas = ".$this->var2str($this->deudas)." WHERE id = ".$this->var2str($this->id).";"; |
| 126 | 126 | |
| 127 | 127 | return $this->db->exec($sql); |
| 128 | - } else { |
|
| 128 | + }else { |
|
| 129 | 129 | $sql = "INSERT INTO residentes (codcliente,nombre,fechaalta,piso,bloque,mensualidad,agua,gas,". |
| 130 | - "observaciones,fechaagua,fechagas,deudas) " . "VALUES (".$this->var2str($this->codcliente).",". |
|
| 130 | + "observaciones,fechaagua,fechagas,deudas) "."VALUES (".$this->var2str($this->codcliente).",". |
|
| 131 | 131 | $this->var2str($this->nombre).",".$this->var2str($this->fechaalta)."," |
| 132 | 132 | .$this->var2str($this->piso).",".$this->var2str($this->bloque).",".$this->var2str($this->mensualidad)."," |
| 133 | 133 | .$this->var2str($this->agua).",".$this->var2str($this->gas).",".$this->var2str($this->observaciones)."," |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | if ($this->db->exec($sql)) { |
| 137 | 137 | $this->id = $this->db->lastval(); |
| 138 | 138 | return true; |
| 139 | - } else { |
|
| 139 | + }else { |
|
| 140 | 140 | return false; |
| 141 | 141 | } |
| 142 | 142 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | 'page_from' => __CLASS__, |
| 100 | 100 | 'page_to' => __CLASS__, |
| 101 | 101 | 'type' => 'head', |
| 102 | - 'text' => '<link rel="stylesheet" type="text/css" media="screen" href="' . FS_PATH . |
|
| 102 | + 'text' => '<link rel="stylesheet" type="text/css" media="screen" href="'.FS_PATH. |
|
| 103 | 103 | 'plugins/residentes/view/css/bootstrap-select.min.css"/>', |
| 104 | 104 | 'params' => '' |
| 105 | 105 | ), |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | 'page_from' => __CLASS__, |
| 145 | 145 | 'page_to' => __CLASS__, |
| 146 | 146 | 'type' => 'head', |
| 147 | - 'text' => '<link rel="stylesheet" type="text/css" media="screen" href="' . FS_PATH . |
|
| 147 | + 'text' => '<link rel="stylesheet" type="text/css" media="screen" href="'.FS_PATH. |
|
| 148 | 148 | 'plugins/residentes/view/js/bootstrap-wysihtml5/bootstrap3-wysihtml5.css"/>', |
| 149 | 149 | 'params' => '' |
| 150 | 150 | ), |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | foreach ($extensiones as $ext) { |
| 155 | 155 | $fsext0 = new fs_extension($ext); |
| 156 | 156 | if (!$fsext0->save()) { |
| 157 | - $this->new_error_msg('Imposible guardar los datos de la extensión ' . $ext['name'] . '.'); |
|
| 157 | + $this->new_error_msg('Imposible guardar los datos de la extensión '.$ext['name'].'.'); |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | } |
| 215 | 215 | if ($estado === true) { |
| 216 | 216 | $this->new_message('Programación eliminada correctamente.'); |
| 217 | - } else { |
|
| 217 | + }else { |
|
| 218 | 218 | $this->new_error_msg('La Programación no pudo ser eliminada, verifique los datos o sus permisos.'); |
| 219 | 219 | } |
| 220 | 220 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | } |
| 236 | 236 | if ($estado === true) { |
| 237 | 237 | $this->new_message('Programación reiniciada correctamente.'); |
| 238 | - } else { |
|
| 238 | + }else { |
|
| 239 | 239 | $this->new_error_msg('La Programación no pudo ser reiniciada, verifique los datos o sus permisos.'); |
| 240 | 240 | } |
| 241 | 241 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $cfg = new residentes_email_config(); |
| 274 | 274 | $actualConfig = $cfg->currentConfig(); |
| 275 | 275 | $envioMails = new ResidentesEnviarMail(); |
| 276 | - switch($actualConfig->tiposervicio) { |
|
| 276 | + switch ($actualConfig->tiposervicio) { |
|
| 277 | 277 | case "mailjet": |
| 278 | 278 | echo $envioMails->mailjetEmailTest(); |
| 279 | 279 | break; |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | public function guardarProgramacion() |
| 291 | 291 | { |
| 292 | 292 | $residentesProcesar = $this->cantidadResidentesProcesar(); |
| 293 | - $cantidadResidentesProcesar = count($residentesProcesar); |
|
| 293 | + $cantidadResidentesProcesar = count($residentesProcesar); |
|
| 294 | 294 | $idProgramacion = $this->cabeceraProgramacion($cantidadResidentesProcesar); |
| 295 | 295 | |
| 296 | 296 | if ($idProgramacion) { |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | $edificacionesDisponibles = $edificaciones_residentes->get_by_field('id_edificacion', $edificacion); |
| 386 | 386 | foreach ($edificacionesDisponibles as $edif) { |
| 387 | 387 | if ($edif->ocupado === true) { |
| 388 | - $residentesDisponibles[] = ['id_edificacion'=>$edif->id_edificacion,'codcliente'=>$edif->codcliente]; |
|
| 388 | + $residentesDisponibles[] = ['id_edificacion'=>$edif->id_edificacion, 'codcliente'=>$edif->codcliente]; |
|
| 389 | 389 | } |
| 390 | 390 | } |
| 391 | 391 | $this->cargarResidentesFacturables($residentesDisponibles, $listaResidentes); |
@@ -75,10 +75,10 @@ discard block |
||
| 75 | 75 | $inq->fecha_ocupacion = null; |
| 76 | 76 | if ($inq->save()) { |
| 77 | 77 | $this->new_message('Inquilino removido correctamente.'); |
| 78 | - } else { |
|
| 78 | + }else { |
|
| 79 | 79 | $this->new_error_msg('Error al remover el inquilino.'); |
| 80 | 80 | } |
| 81 | - } else { |
|
| 81 | + }else { |
|
| 82 | 82 | $this->new_error_msg('Inquilino no encontrado.'); |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -188,22 +188,22 @@ discard block |
||
| 188 | 188 | public function buscar_residentes($param) |
| 189 | 189 | { |
| 190 | 190 | if (is_numeric($param)) { |
| 191 | - $where = "(r.codcliente LIKE '%" . $param . "%'" |
|
| 192 | - . " OR c.cifnif LIKE '%" . $param . "%'" |
|
| 193 | - . " OR c.telefono1 LIKE '" . $param . "%'" |
|
| 194 | - . " OR c.telefono2 LIKE '" . $param . "%'" |
|
| 195 | - . " OR ca_telefono LIKE '" . $param . "%'" |
|
| 196 | - . " OR c.observaciones LIKE '%" . $param . "%')"; |
|
| 197 | - } else { |
|
| 191 | + $where = "(r.codcliente LIKE '%".$param."%'" |
|
| 192 | + . " OR c.cifnif LIKE '%".$param."%'" |
|
| 193 | + . " OR c.telefono1 LIKE '".$param."%'" |
|
| 194 | + . " OR c.telefono2 LIKE '".$param."%'" |
|
| 195 | + . " OR ca_telefono LIKE '".$param."%'" |
|
| 196 | + . " OR c.observaciones LIKE '%".$param."%')"; |
|
| 197 | + }else { |
|
| 198 | 198 | $buscar = str_replace(' ', '%', $param); |
| 199 | - $where = "(lower(nombre) LIKE '%" . $buscar . "%'" |
|
| 200 | - . " OR lower(razonsocial) LIKE '%" . $buscar . "%'" |
|
| 201 | - . " OR lower(ca_apellidos) LIKE '%" . $buscar . "%'" |
|
| 202 | - . " OR lower(ca_nombres) LIKE '%" . $buscar . "%'" |
|
| 203 | - . " OR lower(cifnif) LIKE '%" . $buscar . "%'" |
|
| 204 | - . " OR lower(observaciones) LIKE '%" . $buscar . "%'" |
|
| 205 | - . " OR lower(ca_email) LIKE '%" . $buscar . "%'" |
|
| 206 | - . " OR lower(email) LIKE '%" . $buscar . "%')"; |
|
| 199 | + $where = "(lower(nombre) LIKE '%".$buscar."%'" |
|
| 200 | + . " OR lower(razonsocial) LIKE '%".$buscar."%'" |
|
| 201 | + . " OR lower(ca_apellidos) LIKE '%".$buscar."%'" |
|
| 202 | + . " OR lower(ca_nombres) LIKE '%".$buscar."%'" |
|
| 203 | + . " OR lower(cifnif) LIKE '%".$buscar."%'" |
|
| 204 | + . " OR lower(observaciones) LIKE '%".$buscar."%'" |
|
| 205 | + . " OR lower(ca_email) LIKE '%".$buscar."%'" |
|
| 206 | + . " OR lower(email) LIKE '%".$buscar."%')"; |
|
| 207 | 207 | } |
| 208 | 208 | return $where; |
| 209 | 209 | } |
@@ -211,14 +211,14 @@ discard block |
||
| 211 | 211 | public function buscar_inmuebles($param) |
| 212 | 212 | { |
| 213 | 213 | if (is_numeric($param)) { |
| 214 | - $where = " r.codigo LIKE '%" . $param . "%'" |
|
| 215 | - . " OR r.numero LIKE '%" . $param . "%'" |
|
| 216 | - . " OR CONCAT(r.codigo, r.numero) LIKE '%" . $param . "%'"; |
|
| 217 | - } else { |
|
| 214 | + $where = " r.codigo LIKE '%".$param."%'" |
|
| 215 | + . " OR r.numero LIKE '%".$param."%'" |
|
| 216 | + . " OR CONCAT(r.codigo, r.numero) LIKE '%".$param."%'"; |
|
| 217 | + }else { |
|
| 218 | 218 | $buscar = str_replace(' ', '%', $param); |
| 219 | - $where = " lower(r.codigo) LIKE '%" . $buscar . "%'" |
|
| 220 | - . " OR lower(r.numero) LIKE '%" . $buscar . "%'" |
|
| 221 | - . " OR CONCAT(lower(r.codigo), r.numero) LIKE '%" . $param . "%'"; |
|
| 219 | + $where = " lower(r.codigo) LIKE '%".$buscar."%'" |
|
| 220 | + . " OR lower(r.numero) LIKE '%".$buscar."%'" |
|
| 221 | + . " OR CONCAT(lower(r.codigo), r.numero) LIKE '%".$param."%'"; |
|
| 222 | 222 | } |
| 223 | 223 | return $where; |
| 224 | 224 | } |
@@ -226,19 +226,19 @@ discard block |
||
| 226 | 226 | public function buscar_vehiculos($param) |
| 227 | 227 | { |
| 228 | 228 | if (is_numeric($param)) { |
| 229 | - $where = "(r.codcliente LIKE '%" . $param . "%'" |
|
| 230 | - . " OR vehiculo_placa LIKE '%" . $param . "%'" |
|
| 231 | - . " OR CAST(idvehiculo AS CHAR) LIKE '" . $param . "%'" |
|
| 232 | - . " OR telefono2 LIKE '" . $param . "%'" |
|
| 233 | - . " OR observaciones LIKE '%" . $param . "%')"; |
|
| 234 | - } else { |
|
| 229 | + $where = "(r.codcliente LIKE '%".$param."%'" |
|
| 230 | + . " OR vehiculo_placa LIKE '%".$param."%'" |
|
| 231 | + . " OR CAST(idvehiculo AS CHAR) LIKE '".$param."%'" |
|
| 232 | + . " OR telefono2 LIKE '".$param."%'" |
|
| 233 | + . " OR observaciones LIKE '%".$param."%')"; |
|
| 234 | + }else { |
|
| 235 | 235 | $buscar = str_replace(' ', '%', $param); |
| 236 | - $where = "(lower(vehiculo_marca) LIKE '%" . $buscar . "%'" |
|
| 237 | - . " OR lower(vehiculo_modelo) LIKE '%" . $buscar . "%'" |
|
| 238 | - . " OR lower(vehiculo_color) LIKE '%" . $buscar . "%'" |
|
| 239 | - . " OR lower(vehiculo_placa) LIKE '%" . $buscar . "%'" |
|
| 240 | - . " OR lower(vehiculo_tipo) LIKE '%" . $buscar . "%'" |
|
| 241 | - . " OR lower(codigo_tarjeta) LIKE '%" . $buscar . "%')"; |
|
| 236 | + $where = "(lower(vehiculo_marca) LIKE '%".$buscar."%'" |
|
| 237 | + . " OR lower(vehiculo_modelo) LIKE '%".$buscar."%'" |
|
| 238 | + . " OR lower(vehiculo_color) LIKE '%".$buscar."%'" |
|
| 239 | + . " OR lower(vehiculo_placa) LIKE '%".$buscar."%'" |
|
| 240 | + . " OR lower(vehiculo_tipo) LIKE '%".$buscar."%'" |
|
| 241 | + . " OR lower(codigo_tarjeta) LIKE '%".$buscar."%')"; |
|
| 242 | 242 | } |
| 243 | 243 | return $where; |
| 244 | 244 | } |
@@ -257,13 +257,13 @@ discard block |
||
| 257 | 257 | $inmueble->ocupado = true; |
| 258 | 258 | $inmueble->codcliente = $codcliente; |
| 259 | 259 | $inmueble->iddireccion = $this->actualizar_direccion_residente($codcliente, $iddireccion, $nueva_direccion); |
| 260 | - $inmueble->fecha_ocupacion = ($fecha_ocupacion)?\date('Y-m-d', strtotime($fecha_ocupacion)):null; |
|
| 260 | + $inmueble->fecha_ocupacion = ($fecha_ocupacion) ? \date('Y-m-d', strtotime($fecha_ocupacion)) : null; |
|
| 261 | 261 | $inmueble->fecha_disponibilidad = ($fecha_disponibilidad) |
| 262 | - ?\date('Y-m-d', strtotime($fecha_disponibilidad)) |
|
| 262 | + ? \date('Y-m-d', strtotime($fecha_disponibilidad)) |
|
| 263 | 263 | :null; |
| 264 | 264 | if ($inmueble->save()) { |
| 265 | 265 | $this->new_message('Residente agregado exitosamente.'); |
| 266 | - } else { |
|
| 266 | + }else { |
|
| 267 | 267 | $this->new_error_msg('No se pudo agregar al residente confirme el nombre '. |
| 268 | 268 | 'del residente y las fechs de ocupación y disponibilidad'); |
| 269 | 269 | } |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | $inmueble->fecha_disponibilidad = ''; |
| 276 | 276 | if ($inmueble->save()) { |
| 277 | 277 | $this->new_message('Residente removido exitosamente.'); |
| 278 | - } else { |
|
| 278 | + }else { |
|
| 279 | 279 | $this->new_error_msg('No se pudo remover al residente'); |
| 280 | 280 | } |
| 281 | 281 | } |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | 'nombre' => $cli->nombre, |
| 311 | 311 | 'asignado' => true); |
| 312 | 312 | } |
| 313 | - } else { |
|
| 313 | + }else { |
|
| 314 | 314 | $json[$cli->codcliente] = array('value' => $cli->nombre, |
| 315 | 315 | 'data' => $cli->codcliente, |
| 316 | 316 | 'nombre' => $cli->nombre, |
@@ -367,13 +367,13 @@ discard block |
||
| 367 | 367 | |
| 368 | 368 | public function paginas() |
| 369 | 369 | { |
| 370 | - $url = $this->url() . "&query=" . $this->query |
|
| 371 | - . "&query_r=" . $this->query_r |
|
| 372 | - . "&query_v=" . $this->query_v |
|
| 373 | - . "&query_i=" . $this->query_i |
|
| 374 | - . "&orden=" . $this->order |
|
| 375 | - . "&deudores=" . $this->deudores |
|
| 376 | - . "&disponibles=" . $this->disponibles; |
|
| 370 | + $url = $this->url()."&query=".$this->query |
|
| 371 | + . "&query_r=".$this->query_r |
|
| 372 | + . "&query_v=".$this->query_v |
|
| 373 | + . "&query_i=".$this->query_i |
|
| 374 | + . "&orden=".$this->order |
|
| 375 | + . "&deudores=".$this->deudores |
|
| 376 | + . "&disponibles=".$this->disponibles; |
|
| 377 | 377 | |
| 378 | 378 | $paginas = array(); |
| 379 | 379 | $i = 0; |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | /// añadimos todas la página |
| 384 | 384 | while ($num < $this->total_resultados) { |
| 385 | 385 | $paginas[$i] = array( |
| 386 | - 'url' => $url . "&offset=" . ($i * FS_ITEM_LIMIT), |
|
| 386 | + 'url' => $url."&offset=".($i * FS_ITEM_LIMIT), |
|
| 387 | 387 | 'num' => $i + 1, |
| 388 | 388 | 'actual' => ($num === $this->offset) |
| 389 | 389 | ); |
@@ -398,20 +398,20 @@ discard block |
||
| 398 | 398 | |
| 399 | 399 | /// ahora descartamos |
| 400 | 400 | foreach ($paginas as $j => $value) { |
| 401 | - $enmedio = (int)($i / 2); |
|
| 401 | + $enmedio = (int) ($i / 2); |
|
| 402 | 402 | |
| 403 | 403 | /** |
| 404 | 404 | * descartamos todo excepto la primera, la última, la de enmedio, |
| 405 | 405 | * la actual, las 5 anteriores y las 5 siguientes |
| 406 | 406 | */ |
| 407 | - if (($j>1 && $j<$actual-5 && $j !== $enmedio) || ($j > $actual + 5 && $j < $i - 1 && $j !== $enmedio)) { |
|
| 407 | + if (($j > 1 && $j < $actual - 5 && $j !== $enmedio) || ($j > $actual + 5 && $j < $i - 1 && $j !== $enmedio)) { |
|
| 408 | 408 | unset($paginas[$j]); |
| 409 | 409 | } |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | if (count($paginas) > 1) { |
| 413 | 413 | return $paginas; |
| 414 | - } else { |
|
| 414 | + }else { |
|
| 415 | 415 | return array(); |
| 416 | 416 | } |
| 417 | 417 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | public function init() |
| 95 | 95 | { |
| 96 | - $this->allow_delete = ($this->user->admin)?TRUE:$this->user->allow_delete_on(__CLASS__); |
|
| 96 | + $this->allow_delete = ($this->user->admin) ?TRUE:$this->user->allow_delete_on(__CLASS__); |
|
| 97 | 97 | $this->edificaciones_tipo = new residentes_edificaciones_tipo(); |
| 98 | 98 | $this->edificaciones_mapa = new residentes_edificaciones_mapa(); |
| 99 | 99 | $this->edificaciones = new residentes_edificaciones(); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | return 'index.php?page='.__CLASS__.'&interior='.$interior; |
| 143 | 143 | } elseif ($inmuebles) { |
| 144 | 144 | return 'index.php?page='.__CLASS__.'&inmuebles='.$inmuebles; |
| 145 | - } else { |
|
| 145 | + }else { |
|
| 146 | 146 | return 'index.php?page='.__CLASS__; |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $edificacion->codcliente = ''; |
| 163 | 163 | $edificacion->fecha_disponibilidad = null; |
| 164 | 164 | $edificacion->fecha_ocupacion = null; |
| 165 | - try{ |
|
| 165 | + try { |
|
| 166 | 166 | $edificacion->save(); |
| 167 | 167 | $this->new_message('Inmueble desocupado exitosamente.'); |
| 168 | 168 | } catch (Exception $ex) { |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $this->new_error_msg('Esta edificacion tiene un residente, '. |
| 181 | 181 | 'primero debe quitar al residente para proceder '. |
| 182 | 182 | 'a eliminar esta edificacion.'); |
| 183 | - } else { |
|
| 183 | + }else { |
|
| 184 | 184 | try { |
| 185 | 185 | $edificacion->delete(); |
| 186 | 186 | $this->new_message('Edificación eliminada correctamente.'); |
@@ -211,15 +211,15 @@ discard block |
||
| 211 | 211 | public function buscar_padre($id, &$codigo, &$unir = false) |
| 212 | 212 | { |
| 213 | 213 | $dato = $this->edificaciones_mapa->get($id); |
| 214 | - $codigo[] = ($unir)?'"'.$dato->id_tipo.'":"'.$dato->codigo_edificacion.'"':$dato->codigo_edificacion; |
|
| 214 | + $codigo[] = ($unir) ? '"'.$dato->id_tipo.'":"'.$dato->codigo_edificacion.'"' : $dato->codigo_edificacion; |
|
| 215 | 215 | if ($dato->padre_id === 0) { |
| 216 | 216 | return $codigo; |
| 217 | - } else { |
|
| 217 | + }else { |
|
| 218 | 218 | $this->buscar_padre($dato->padre_id, $codigo, $unir); |
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - public function crear_codigo($id,$unir = false) |
|
| 222 | + public function crear_codigo($id, $unir = false) |
|
| 223 | 223 | { |
| 224 | 224 | $codigo = array(); |
| 225 | 225 | $this->buscar_padre($id, $codigo, $unir); |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | array_unshift($lista, $linea); |
| 230 | 230 | } |
| 231 | 231 | $codigo = $lista; |
| 232 | - } else { |
|
| 232 | + }else { |
|
| 233 | 233 | rsort($codigo); |
| 234 | 234 | } |
| 235 | 235 | return $codigo; |
@@ -241,16 +241,16 @@ discard block |
||
| 241 | 241 | $final_p = \filter_input(INPUT_POST, 'final'); |
| 242 | 242 | $cantidad = \filter_input(INPUT_POST, 'cantidad'); |
| 243 | 243 | $incremento = \filter_input(INPUT_POST, 'incremento'); |
| 244 | - $final=(!empty($final_p))?$final_p:$inicio; |
|
| 244 | + $final = (!empty($final_p)) ? $final_p : $inicio; |
|
| 245 | 245 | $inmuebles = 0; |
| 246 | 246 | $error = 0; |
| 247 | 247 | $linea = 0; |
| 248 | 248 | if ($inicio === $final) { |
| 249 | 249 | $this->inmueble($inicio, $inmuebles, $error); |
| 250 | - } else { |
|
| 251 | - for ($i = $inicio; $i<=($final); $i++) { |
|
| 252 | - if ($linea === $cantidad and $cantidad!=0) { |
|
| 253 | - $i = ($i-$cantidad)+$incremento; |
|
| 250 | + }else { |
|
| 251 | + for ($i = $inicio; $i <= ($final); $i++) { |
|
| 252 | + if ($linea === $cantidad and $cantidad != 0) { |
|
| 253 | + $i = ($i - $cantidad) + $incremento; |
|
| 254 | 254 | $linea = 0; |
| 255 | 255 | } |
| 256 | 256 | $this->inmueble($i, $inmuebles, $error); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | $ubicacion = ""; |
| 276 | 276 | $codcliente = ""; |
| 277 | 277 | $ocupado = false; |
| 278 | - $item = (is_int($inicio))?str_pad($inicio, 3, "0", STR_PAD_LEFT):$inicio; |
|
| 278 | + $item = (is_int($inicio)) ?str_pad($inicio, 3, "0", STR_PAD_LEFT) : $inicio; |
|
| 279 | 279 | $edif0 = new residentes_edificaciones(); |
| 280 | 280 | $edif0->id = \filter_input(INPUT_POST, 'id'); |
| 281 | 281 | $edif0->id_edificacion = \filter_input(INPUT_POST, 'id_edificacion'); |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | $edif0->numero = $item; |
| 285 | 285 | $edif0->ubicacion = trim($ubicacion); |
| 286 | 286 | $edif0->codcliente = trim($codcliente); |
| 287 | - $edif0->ocupado = (bool)$ocupado; |
|
| 287 | + $edif0->ocupado = (bool) $ocupado; |
|
| 288 | 288 | try { |
| 289 | 289 | $edif0->save(); |
| 290 | 290 | $inmuebles++; |
@@ -312,13 +312,13 @@ discard block |
||
| 312 | 312 | $iddireccion, |
| 313 | 313 | $descripcion_direccion |
| 314 | 314 | ); |
| 315 | - $inmueble->fecha_ocupacion = ($fecha_ocupacion)?\date('Y-m-d', strtotime($fecha_ocupacion)):null; |
|
| 315 | + $inmueble->fecha_ocupacion = ($fecha_ocupacion) ? \date('Y-m-d', strtotime($fecha_ocupacion)) : null; |
|
| 316 | 316 | $inmueble->fecha_disponibilidad = ($fecha_disponibilidad) |
| 317 | - ?\date('Y-m-d', strtotime($fecha_disponibilidad)) |
|
| 317 | + ? \date('Y-m-d', strtotime($fecha_disponibilidad)) |
|
| 318 | 318 | :null; |
| 319 | 319 | if ($inmueble->save()) { |
| 320 | 320 | $this->new_message('Residente agregado exitosamente.'); |
| 321 | - } else { |
|
| 321 | + }else { |
|
| 322 | 322 | $this->new_error_msg('No se pudo agregar al residente confirme el '. |
| 323 | 323 | 'nombre del residente y las fechs de ocupación y disponibilidad'); |
| 324 | 324 | } |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | $inmueble->fecha_disponibilidad = ''; |
| 331 | 331 | if ($inmueble->save()) { |
| 332 | 332 | $this->new_message('Residente removido exitosamente.'); |
| 333 | - } else { |
|
| 333 | + }else { |
|
| 334 | 334 | $this->new_error_msg('No se pudo remover al residente'); |
| 335 | 335 | } |
| 336 | 336 | } |
@@ -345,13 +345,13 @@ discard block |
||
| 345 | 345 | $campo = "campo_".$i->id; |
| 346 | 346 | $linea = filter_input(INPUT_POST, $campo); |
| 347 | 347 | $precodigo .= $linea; |
| 348 | - $precodigo_interno[$i->id]=$linea; |
|
| 348 | + $precodigo_interno[$i->id] = $linea; |
|
| 349 | 349 | } |
| 350 | 350 | $codigo_p = filter_input(INPUT_POST, 'codigo'); |
| 351 | 351 | $codigo_interno_p = filter_input(INPUT_POST, 'codigo_interno'); |
| 352 | - $codigo = ($codigo_p)?$codigo_p:$precodigo; |
|
| 352 | + $codigo = ($codigo_p) ? $codigo_p : $precodigo; |
|
| 353 | 353 | $codigo_interno = ($codigo_interno_p) |
| 354 | - ?$codigo_interno_p |
|
| 354 | + ? $codigo_interno_p |
|
| 355 | 355 | : \json_encode($precodigo_interno, JSON_THROW_ON_ERROR); |
| 356 | 356 | $numero = filter_input(INPUT_POST, 'numero_edificacion'); |
| 357 | 357 | $ubicacion = filter_input(INPUT_POST, 'ubicacion'); |
@@ -368,10 +368,10 @@ discard block |
||
| 368 | 368 | $this->new_error_msg('Ocurrió un error al querer eliminar la Edificación. '. |
| 369 | 369 | $exc->getTraceAsString()); |
| 370 | 370 | } |
| 371 | - } else { |
|
| 371 | + }else { |
|
| 372 | 372 | $this->new_error_msg('¡No se puede eliminar una edificación que está ocupada!'); |
| 373 | 373 | } |
| 374 | - } else { |
|
| 374 | + }else { |
|
| 375 | 375 | $edif0 = new FacturaScripts\model\residentes_edificaciones(); |
| 376 | 376 | $edif0->id = $id; |
| 377 | 377 | $edif0->codigo = $codigo; |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | $edif0->numero = trim($numero); |
| 380 | 380 | $edif0->ubicacion = trim($ubicacion); |
| 381 | 381 | $edif0->codcliente = trim($codcliente); |
| 382 | - $edif0->ocupado = ($ocupado)?"TRUE":"FALSE"; |
|
| 382 | + $edif0->ocupado = ($ocupado) ? "TRUE" : "FALSE"; |
|
| 383 | 383 | try { |
| 384 | 384 | $edif0->save(); |
| 385 | 385 | $this->new_message('¡Edificación guardada exitosamente!'); |
@@ -406,11 +406,11 @@ discard block |
||
| 406 | 406 | $this->new_error_msg('Ocurrió un error al querer eliminar el tipo de edificación. '. |
| 407 | 407 | $e->getTraceAsString()); |
| 408 | 408 | } |
| 409 | - } else { |
|
| 409 | + }else { |
|
| 410 | 410 | $this->new_error_msg('No se puede eliminar un Tipo de edificación que es padre de otros '. |
| 411 | 411 | 'tipos de edificación.'); |
| 412 | 412 | } |
| 413 | - } else { |
|
| 413 | + }else { |
|
| 414 | 414 | $tipo0 = new residentes_edificaciones_tipo(); |
| 415 | 415 | $tipo0->id = $id; |
| 416 | 416 | $tipo0->descripcion = ucfirst(strtolower(trim(htmlspecialchars($descripcion)))); |
@@ -455,12 +455,12 @@ discard block |
||
| 455 | 455 | $id = \filter_input(INPUT_POST, 'id'); |
| 456 | 456 | $codigo_padre = \filter_input(INPUT_POST, 'codigo_padre'); |
| 457 | 457 | $padre_id = \filter_input(INPUT_POST, 'padre_id'); |
| 458 | - $final=(!empty($final_p))?$final_p:$inicio; |
|
| 458 | + $final = (!empty($final_p)) ? $final_p : $inicio; |
|
| 459 | 459 | $inmuebles = 0; |
| 460 | 460 | $error = 0; |
| 461 | 461 | $linea = 0; |
| 462 | 462 | foreach (range($inicio, $final) as $item) { |
| 463 | - $item = (is_int($item))?str_pad($item, 3, "0", STR_PAD_LEFT):$item; |
|
| 463 | + $item = (is_int($item)) ?str_pad($item, 3, "0", STR_PAD_LEFT) : $item; |
|
| 464 | 464 | $punto = new residentes_edificaciones_mapa(); |
| 465 | 465 | $punto->id = $id; |
| 466 | 466 | $punto->id_tipo = $objeto->id; |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | $punto->numero = ''; |
| 472 | 472 | if ($punto->save()) { |
| 473 | 473 | $inmuebles++; |
| 474 | - } else { |
|
| 474 | + }else { |
|
| 475 | 475 | $error++; |
| 476 | 476 | } |
| 477 | 477 | $linea++; |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | foreach ($extensiones as $ext) { |
| 536 | 536 | $fsext0 = new fs_extension($ext); |
| 537 | 537 | if (!$fsext0->delete()) { |
| 538 | - $this->new_error_msg('Imposible eliminar los datos de la extensión ' . $ext['name'] . '.'); |
|
| 538 | + $this->new_error_msg('Imposible eliminar los datos de la extensión '.$ext['name'].'.'); |
|
| 539 | 539 | } |
| 540 | 540 | } |
| 541 | 541 | |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | foreach ($extensiones2 as $ext) { |
| 573 | 573 | $fsext0 = new fs_extension($ext); |
| 574 | 574 | if (!$fsext0->save()) { |
| 575 | - $this->new_error_msg('Imposible guardar los datos de la extensión ' . $ext['name'] . '.'); |
|
| 575 | + $this->new_error_msg('Imposible guardar los datos de la extensión '.$ext['name'].'.'); |
|
| 576 | 576 | } |
| 577 | 577 | } |
| 578 | 578 | } |
@@ -49,20 +49,20 @@ discard block |
||
| 49 | 49 | $this->log->new_message('Enviando factura a: '.$email); |
| 50 | 50 | $mail->addAddress($email, $customer->nombre); |
| 51 | 51 | $mail->Subject = $subject; |
| 52 | - $mail->AltBody = strip_tags(str_replace("<br>", "\n",html_entity_decode($this->emailConfig->emailsubject))); |
|
| 52 | + $mail->AltBody = strip_tags(str_replace("<br>", "\n", html_entity_decode($this->emailConfig->emailsubject))); |
|
| 53 | 53 | $this->emailAdditionalInfo($mail, $customer); |
| 54 | 54 | $mail->msgHTML(html_entity_decode($this->emailConfig->emailsubject)); |
| 55 | 55 | $mail->isHTML(true); |
| 56 | - $mail->addAttachment('tmp/' . FS_TMP_NAME . 'enviar/' . $archivo); |
|
| 56 | + $mail->addAttachment('tmp/'.FS_TMP_NAME.'enviar/'.$archivo); |
|
| 57 | 57 | $this->emailAdditionalAttachments($mail); |
| 58 | 58 | if ($companyInformation->mail_connect($mail) && $mail->send()) { |
| 59 | - $invoice->femail = \date('d-m-Y');; |
|
| 59 | + $invoice->femail = \date('d-m-Y'); ; |
|
| 60 | 60 | $invoice->save(); |
| 61 | 61 | $companyInformation->save_mail($mail); |
| 62 | - } else { |
|
| 63 | - $this->log->new_error("Error al enviar el email: " . $mail->ErrorInfo); |
|
| 62 | + }else { |
|
| 63 | + $this->log->new_error("Error al enviar el email: ".$mail->ErrorInfo); |
|
| 64 | 64 | } |
| 65 | - unlink('tmp/' . FS_TMP_NAME . 'enviar/' . $archivo); |
|
| 65 | + unlink('tmp/'.FS_TMP_NAME.'enviar/'.$archivo); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | public function sendgridEmailTest() |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | $email->setFrom($this->emailConfig->apisenderemail, $this->emailConfig->apisendername); |
| 91 | 91 | $email->setSubject($subject); |
| 92 | 92 | $email->addTo($customer->email, $customer->nombre); |
| 93 | - $email->addContent("text/plain", strip_tags(str_replace("<br>", "\n",html_entity_decode($this->emailConfig->emailsubject))),); |
|
| 93 | + $email->addContent("text/plain", strip_tags(str_replace("<br>", "\n", html_entity_decode($this->emailConfig->emailsubject))),); |
|
| 94 | 94 | $email->addContent("text/html", html_entity_decode($this->emailConfig->emailsubject)); |
| 95 | - $file_encoded = base64_encode(file_get_contents('tmp/' . FS_TMP_NAME . 'enviar/' . $archivo)); |
|
| 95 | + $file_encoded = base64_encode(file_get_contents('tmp/'.FS_TMP_NAME.'enviar/'.$archivo)); |
|
| 96 | 96 | $email->addAttachment( |
| 97 | 97 | $file_encoded, |
| 98 | 98 | "application/pdf", |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | public function mailjetEmailTest() |
| 113 | 113 | { |
| 114 | - $mj = new \Mailjet\Client($this->emailConfig->apikey,$this->emailConfig->apisecret,true,['version' => 'v3.1']); |
|
| 114 | + $mj = new \Mailjet\Client($this->emailConfig->apikey, $this->emailConfig->apisecret, true, ['version' => 'v3.1']); |
|
| 115 | 115 | $body = [ |
| 116 | 116 | 'Messages' => [ |
| 117 | 117 | [ |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | public function mailjetEmail(&$companyInformation, &$invoice, &$customer, $user, $archivo, $subject) |
| 140 | 140 | { |
| 141 | - $mj = new \Mailjet\Client($this->emailConfig->apikey,$this->emailConfig->apisecret,true,['version' => 'v3.1']); |
|
| 141 | + $mj = new \Mailjet\Client($this->emailConfig->apikey, $this->emailConfig->apisecret, true, ['version' => 'v3.1']); |
|
| 142 | 142 | $body = [ |
| 143 | 143 | 'Messages' => [ |
| 144 | 144 | [ |
@@ -153,14 +153,14 @@ discard block |
||
| 153 | 153 | ] |
| 154 | 154 | ], |
| 155 | 155 | 'Subject' => $subject, |
| 156 | - 'TextPart' => strip_tags(str_replace("<br>", "\n",html_entity_decode($this->emailConfig->emailsubject))), |
|
| 156 | + 'TextPart' => strip_tags(str_replace("<br>", "\n", html_entity_decode($this->emailConfig->emailsubject))), |
|
| 157 | 157 | 'HTMLPart' => html_entity_decode($this->emailConfig->emailsubject), |
| 158 | 158 | 'Attachments' => [ |
| 159 | 159 | [ |
| 160 | 160 | 'ContentType' => 'application/pdf', |
| 161 | 161 | 'Filename' => $invoice->numero2.'.pdf', |
| 162 | 162 | 'Base64Content' => base64_encode( |
| 163 | - file_get_contents('tmp/' . FS_TMP_NAME . 'enviar/' . $archivo) |
|
| 163 | + file_get_contents('tmp/'.FS_TMP_NAME.'enviar/'.$archivo) |
|
| 164 | 164 | ) |
| 165 | 165 | ] |
| 166 | 166 | ] |
@@ -175,9 +175,9 @@ discard block |
||
| 175 | 175 | public function invoiceEmail(&$companyInformation, &$invoice, &$customer, $user, $archivo) |
| 176 | 176 | { |
| 177 | 177 | if (file_exists('tmp/'.FS_TMP_NAME.'enviar/'.$archivo)) { |
| 178 | - $subject = fs_fix_html($companyInformation->nombre) . |
|
| 179 | - ' - Su Factura ' . $invoice->codigo . ' ' . $invoice->numero2; |
|
| 180 | - switch($this->emailConfig->tiposervicio) { |
|
| 178 | + $subject = fs_fix_html($companyInformation->nombre). |
|
| 179 | + ' - Su Factura '.$invoice->codigo.' '.$invoice->numero2; |
|
| 180 | + switch ($this->emailConfig->tiposervicio) { |
|
| 181 | 181 | case "sendgrid": |
| 182 | 182 | $this->sendgridEmail($companyInformation, $invoice, $customer, $user, $archivo, $subject); |
| 183 | 183 | break; |
@@ -213,8 +213,8 @@ discard block |
||
| 213 | 213 | // } else { |
| 214 | 214 | // $this->log->new_error("Error al enviar el email: " . $mail->ErrorInfo); |
| 215 | 215 | // } |
| 216 | - unlink('tmp/' . FS_TMP_NAME . 'enviar/' . $archivo); |
|
| 217 | - } else { |
|
| 216 | + unlink('tmp/'.FS_TMP_NAME.'enviar/'.$archivo); |
|
| 217 | + }else { |
|
| 218 | 218 | $this->log->new_error('Imposible generar el PDF.'); |
| 219 | 219 | } |
| 220 | 220 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | trim($this->rc->filter_request('email_copia')), |
| 228 | 228 | $customer->nombre |
| 229 | 229 | ); |
| 230 | - } else { |
|
| 230 | + }else { |
|
| 231 | 231 | $mail->addCC( |
| 232 | 232 | trim($this->rc->filter_request('email_copia')), |
| 233 | 233 | $customer->nombre |
@@ -252,19 +252,19 @@ discard block |
||
| 252 | 252 | : $customer->email; |
| 253 | 253 | $this->log->new_message('Enviando Estado de cuenta a: '.$email); |
| 254 | 254 | $mail->addAddress($email, $customer->nombre); |
| 255 | - $elSubject = ': Su Estado de cuenta al '. \date('d-m-Y'); |
|
| 256 | - $mail->Subject = fs_fix_html($empresa->nombre) . $elSubject; |
|
| 255 | + $elSubject = ': Su Estado de cuenta al '.\date('d-m-Y'); |
|
| 256 | + $mail->Subject = fs_fix_html($empresa->nombre).$elSubject; |
|
| 257 | 257 | $mail->AltBody = strip_tags($_POST['mensaje']); |
| 258 | 258 | $this->emailAdditionalAttachments($mail); |
| 259 | 259 | $mail->msgHTML(nl2br($mail->AltBody)); |
| 260 | 260 | $mail->isHTML(true); |
| 261 | - $mail->addAttachment('tmp/' . FS_TMP_NAME . 'enviar/' . $archivo); |
|
| 261 | + $mail->addAttachment('tmp/'.FS_TMP_NAME.'enviar/'.$archivo); |
|
| 262 | 262 | $this->emailAdditionalAttachments($mail); |
| 263 | 263 | if ($empresa->mail_connect($mail) && $mail->send()) { |
| 264 | 264 | $empresa->save_mail($mail); |
| 265 | - } else { |
|
| 266 | - $this->log->new_error("Error al enviar el email: " . $mail->ErrorInfo); |
|
| 265 | + }else { |
|
| 266 | + $this->log->new_error("Error al enviar el email: ".$mail->ErrorInfo); |
|
| 267 | 267 | } |
| 268 | - unlink('tmp/' . FS_TMP_NAME . 'enviar/' . $archivo); |
|
| 268 | + unlink('tmp/'.FS_TMP_NAME.'enviar/'.$archivo); |
|
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | \ No newline at end of file |