Skip to content

Commit

Permalink
log al 70%, falta expediente y solicitud de creacion, y los que se mo…
Browse files Browse the repository at this point in the history
…difican
  • Loading branch information
jmatute committed Dec 8, 2011
1 parent c762053 commit b270565
Show file tree
Hide file tree
Showing 18 changed files with 371 additions and 3 deletions.
1 change: 1 addition & 0 deletions SIELHO/app/controllers/mensajes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def show

def create
x = Mensaje.crear(params)
x.logC
redirect_to root_path
end

Expand Down
7 changes: 6 additions & 1 deletion SIELHO/app/controllers/parametrizacion_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def create
@departamento = Departamento.new(params[:departamento])
@departamento.agregar( Oip.find_by_usuario_id(current_user.id).institucion_id,current_user.id)
if @departamento.save()
@departamento.logC()
flash[:notice] = "Nueva Departamento creado "
elsif
render :action => "newdepartamento"
Expand All @@ -58,7 +59,8 @@ def create
@estado.fechaCrear = DateTime.now
@estado.fechaMod = DateTime.now
if @estado.save()
flash[:notice] = "Nuevo Estado creado "
@estado.logC
flash[:notice] = "Nuevo Estado creado "
elsif
render :action => "newestado"
end
Expand All @@ -72,6 +74,7 @@ def create
@tipodocumento.fechaCrear = DateTime.now
@tipodocumento.fechaMod = DateTime.now
if @tipodocumento.save()
@tipodocumento.logC
flash[:notice] = "Nuevo Tipo Documento creado "
elsif
render :action => "newtipodocumento"
Expand All @@ -84,6 +87,7 @@ def create
@leyAcuerdo.fechaCrear = DateTime.now
@leyAcuerdo.fechaMod = DateTime.now
if @leyAcuerdo.save()
@leyAcuerdo.logC
flash[:notice] = "Nueva Ley/Acuerdo creado "
elsif
render :action => "newleyacuerdo"
Expand All @@ -94,6 +98,7 @@ def create
@institucion = Institucion.new(params[:institucion])
@institucion.agregar(current_user.id)
if @institucion.save()
@institucion.logC
flash[:notice] = "Nueva Institucion creada "
elsif
render :action => "newinstitucion"
Expand Down
4 changes: 4 additions & 0 deletions SIELHO/app/controllers/solicitud_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def clasificar
expediente = Expediente.new
doc.crear(temp["documento"],current_user.id)
solicitante.crear(temp["solicitante"],current_user.id,doc.id)
solicitante.logC
solicitud.crear(temp["solicitud"],Mensaje.find(params[:mensaje_id]).fecha,solicitante.id,current_user.id)
expediente.crear(solicitud.id,current_user.id)
solicitud.expediente_id = expediente.id
Expand Down Expand Up @@ -113,6 +114,7 @@ def justificar
@justificacion.clasificacion = Clasificacion.find(Solicitud.find_by_expediente_id(e).clasificacion_id).nombre
@justificacion.estado = Estado.find(Expediente.find(e).estado_id).nombre
@justificacion.save
@justificacion.logC
redirect_to ver_expediente_path(Solicitud.find_by_expediente_id(@justificacion.expediente_id),Expediente.find( @justificacion.expediente_id) )
end

Expand All @@ -130,6 +132,7 @@ def justificarCambio
@justificacion.clasificacion = Clasificacion.find(Solicitud.find_by_expediente_id(params[:expediente_id]).clasificacion_id).nombre
@expediente = Expediente.find(params[:expediente_id]).update_attributes(:estado_id=>params[:Estado])
@justificacion.save
@justificacion.logC
AplicationMailer.cambioEstado( Solicitante.find(Solicitud.find_by_expediente_id(@justificacion.expediente_id).solicitante_id).email,@justificacion.estado,@justificacion.descripcion).deliver
redirect_to ver_expediente_path(Solicitud.find_by_expediente_id(@justificacion.expediente_id),Expediente.find( @justificacion.expediente_id) )
end
Expand Down Expand Up @@ -177,6 +180,7 @@ def asignaEnlace
@asignacion.completada = false
AplicationMailer.asignacion(User.find(@asignacion.enlace_id).email).deliver
@asignacion.save
@asignacion.logC
redirect_to root_path

end
Expand Down
27 changes: 27 additions & 0 deletions SIELHO/app/models/asignacion.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@
class Asignacion < ActiveRecord::Base
validates_presence_of :expediente_id,:enlace_id,:descripcion

def logC

#enlace_id: integer, descripcion: text, fechaInic: datetime, expediente_id: integer, fechaCrear: datetime, fechaMod: datetime, usuarioRes: integer, usuarioMod: integer, created_at: datetime, updated_at: datetime, plazo: integer, completada: boolean
file = File.open("public/historial", "a")
fecha = DateTime.now.to_s
mod = self.usuarioRes
rol = User.find(self.usuarioRes).rol.nombre
descripcion = "creacion de asignacion"
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "asignacion" + "\t" + "descripcion" + "\t" + "N/A" + "\t" + self.descripcion + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "asignacion" + "\t" + "enlace_id" + "\t" + "N/A" + "\t" + self.enlace_id.to_s + "\t" + descripcion + "\n")

file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "asignacion" + "\t" + "fechaInic" + "\t" + "N/A" + "\t" + self.fechaInic.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "asignacion" + "\t" + "expediente_id" + "\t" + "N/A" + "\t" + self.expediente_id.to_s + "\t" + descripcion + "\n")


file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "asignacion" + "\t" + "fechaCrear" + "\t" + "N/A" + "\t" + self.fechaCrear.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "asignacion" + "\t" + "fechaMod" + "\t" + "N/A" + "\t" + self.fechaMod.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "asignacion" + "\t" + "usuarioRes" + "\t" + "N/A" + "\t" + self.usuarioRes.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "asignacion" + "\t" + "usuarioMod" + "\t" + "N/A" + "\t" + self.usuarioMod.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "asignacion" + "\t" + "plazo" + "\t" + "N/A" + "\t" + self.plazo.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "asignacion" + "\t" + "completada" + "\t" + "N/A" + "\t" + "false" + "\t" + descripcion + "\n")

file.close()


end

end
26 changes: 25 additions & 1 deletion SIELHO/app/models/departamento.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,31 @@ def agregar(institucion,usuario)
self.fechaCrear = DateTime.now
self.fechaMod = DateTime.now
end



def logC
file = File.open("public/historial", "a")
fecha = DateTime.now.to_s
mod = self.usuarioRes
rol = User.find(self.usuarioRes).rol.nombre
descripcion = "creacion de departamento"
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "departamento" + "\t" + "descripcion" + "\t" + "N/A" + "\t" + self.descripcion + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "departamento" + "\t" + "nombre" + "\t" + "N/A" + "\t" + self.nombre + "\t" + descripcion + "\n")

file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "departamento" + "\t" + "fechaCrear" + "\t" + "N/A" + "\t" + self.fechaCrear.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "departamento" + "\t" + "fechaMod" + "\t" + "N/A" + "\t" + self.fechaMod.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "departamento" + "\t" + "usuarioRes" + "\t" + "N/A" + "\t" + self.usuarioRes.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "departamento" + "\t" + "usuarioMod" + "\t" + "N/A" + "\t" + self.usuarioMod.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "departamento" + "\t" + "institucion" + "\t" + "N/A" + "\t" + self.institucion_id.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "departamento" + "\t" + "enlace_id" + "\t" + "N/A" + "\t" + self.enlace_id.to_s + "\t" + descripcion + "\n")

file.close()


end



def self.departamentos(id)
x = []
todos =Departamento.all
Expand Down
13 changes: 13 additions & 0 deletions SIELHO/app/models/documento.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ def crear(doc,usuario)
self.usuarioRes = usuario
self.fechaCrear = DateTime.now
self.fechaMod = DateTime.now

file = File.open("public/historial", "a")
fecha = DateTime.now.to_s
mod = usuario
rol = User.find(usuario).rol.nombre
descripcion = "creacion de documento"
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "documento" + "\t" + "numero" + "\t" + "N/A" + "\t" + self.numero + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "documento" + "\t" + "fechaCrear" + "\t" + "N/A" + "\t" + self.fechaCrear.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "documento" + "\t" + "fechaMod" + "\t" + "N/A" + "\t" + self.fechaMod.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "documento" + "\t" + "usuarioRes" + "\t" + "N/A" + "\t" + self.usuarioRes.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "documento" + "\t" + "usuarioMod" + "\t" + "N/A" + "\t" + self.usuarioMod.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "documento" + "\t" + "tipoDocumento" + "\t" + "N/A" + "\t" + self.tipoDocumento_id.to_s + "\t" + descripcion + "\n")
file.close()
self.save
end

Expand Down
39 changes: 38 additions & 1 deletion SIELHO/app/models/enlace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,47 @@ def crear(usuario)
u.password = pass
u.password_confirmation = pass
end

file = File.open("public/historial", "a")
fecha = DateTime.now.to_s
mod = usuario
rol = User.find(usuario).rol.nombre
descripcion = "creacion de usuario"
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "user" + "\t" + "username" + "\t" + "N/A" + "\t" + User.last.username + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "user" + "\t" + "email" + "\t" + "N/A" + "\t" + self.email + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "user" + "\t" + "activo" + "\t" + "N/A" + "\t" + "false" + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "user" + "\t" + "rol_id" + "\t" + "N/A" + "\t" + 3.to_s + "\t" + descripcion + "\n")
file.close()

AplicationMailer.bienvenido(User.last,pass).deliver
self.usuario_id = User.last.id
self.save


file = File.open("public/historial", "a")
descripcion = "creacion de enlace"
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "enlace" + "\t" + "usuario_id" + "\t" + "N/A" + "\t" + self.usuario_id.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "enlace" + "\t" + "departamento" + "\t" + "N/A" + "\t" + self.departamento_id.to_s + "\t" + descripcion + "\n")

file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "enlace" + "\t" + "fechaCrear" + "\t" + "N/A" + "\t" + self.fechaCrear.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "enlace" + "\t" + "fechaMod" + "\t" + "N/A" + "\t" + self.fechaMod.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "enlace" + "\t" + "usuarioRes" + "\t" + "N/A" + "\t" + self.usuarioRes.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "enlace" + "\t" + "usuarioMod" + "\t" + "N/A" + "\t" + self.usuarioMod.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "enlace" + "\t" + "institucion" + "\t" + "N/A" + "\t" + self.institucion_id.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "enlace" + "\t" + "pnombre" + "\t" + "N/A" + "\t" + self.pnombre + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "enlace" + "\t" + "snombre" + "\t" + "N/A" + "\t" + self.snombre + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "enlace" + "\t" + "papellido" + "\t" + "N/A" + "\t" + self.papellido + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "enlace" + "\t" + "sapellido" + "\t" + "N/A" + "\t" + self.sapellido + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "enlace" + "\t" + "sapellido" + "\t" + "N/A" + "\t" + self.sapellido + "\t" + descripcion + "\n")

file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "enlace" + "\t" + "email" + "\t" + "N/A" + "\t" + self.email + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "enlace" + "\t" + "email2" + "\t" + "N/A" + "\t" + self.email2 + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "enlace" + "\t" + "tlf" + "\t" + "N/A" + "\t" + self.tlf + "\t" + descripcion + "\n")

file.close()




end


Expand Down
22 changes: 22 additions & 0 deletions SIELHO/app/models/estado.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,27 @@ def self.estados()
x << ["ninguno",0]
return x
end

def logC
#tado(id: integer, nombre: string, descripcion: text, fechaCrear: datetime, fechaMod: datetime, usuarioRes: integer, usuarioMod: integer, created_at: datetime, updated_at: datetime, anterior_id: integer)
file = File.open("public/historial", "a")
fecha = DateTime.now.to_s
mod = self.usuarioRes
rol = User.find(self.usuarioRes).rol.nombre
descripcion = "creacion de estado"
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "estado" + "\t" + "descripcion" + "\t" + "N/A" + "\t" + self.descripcion + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "estado" + "\t" + "nombre" + "\t" + "N/A" + "\t" + self.nombre + "\t" + descripcion + "\n")

file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "estado" + "\t" + "anteriorId" + "\t" + "N/A" + "\t" + self.anterior_id.to_s + "\t" + descripcion + "\n")

file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "estado" + "\t" + "fechaCrear" + "\t" + "N/A" + "\t" + self.fechaCrear.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "estado" + "\t" + "fechaMod" + "\t" + "N/A" + "\t" + self.fechaMod.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "estado" + "\t" + "usuarioRes" + "\t" + "N/A" + "\t" + self.usuarioRes.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "estado" + "\t" + "usuarioMod" + "\t" + "N/A" + "\t" + self.usuarioMod.to_s + "\t" + descripcion + "\n")

file.close()


end

end
3 changes: 3 additions & 0 deletions SIELHO/app/models/expediente.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ def crear(solicitud,usuario)

end




def cambiadaClasificacion(id)
clasificacion = Clasificacion.find(id).nombre
if clasificacion.eql?"publica"
Expand Down
22 changes: 22 additions & 0 deletions SIELHO/app/models/institucion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,28 @@ def self.instituciones()
end
return x
end

def logC
#Institucion(id: integer, descripcion: text, nombre: string, tipo_institucion: string, fechaCrear: datetime, fechaMod: datetime, usuarioRes: integer, usuarioMod: integer, created_at: datetime, updated_at: datetime)
file = File.open("public/historial", "a")
fecha = DateTime.now.to_s
mod = self.usuarioRes
rol = User.find(self.usuarioRes).rol.nombre
descripcion = "creacion de institucion"
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "institucion" + "\t" + "descripcion" + "\t" + "N/A" + "\t" + self.descripcion + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "institucion" + "\t" + "nombre" + "\t" + "N/A" + "\t" + self.nombre + "\t" + descripcion + "\n")

file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "institucion" + "\t" + "tipoInstitucion" + "\t" + "N/A" + "\t" + self.tipo_institucion + "\t" + descripcion + "\n")

file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "institucion" + "\t" + "fechaCrear" + "\t" + "N/A" + "\t" + self.fechaCrear.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "institucion" + "\t" + "fechaMod" + "\t" + "N/A" + "\t" + self.fechaMod.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "institucion" + "\t" + "usuarioRes" + "\t" + "N/A" + "\t" + self.usuarioRes.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "institucion" + "\t" + "usuarioMod" + "\t" + "N/A" + "\t" + self.usuarioMod.to_s + "\t" + descripcion + "\n")

file.close()


end


end
24 changes: 24 additions & 0 deletions SIELHO/app/models/justificacion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,28 @@ def basics(usuario)
self.fechaCrear = DateTime.now
self.fechaMod = DateTime.now
end

def logC
#Justificacion(id: integer, descripcion: text, fecha_cambio: datetime, fechaCrear: datetime, fechaMod: datetime, usuarioRes: integer, usuarioMod: integer, created_at: datetime, updated_at: datetime, expediente_id: integer, clasificacion: string, estado: string)
file = File.open("public/historial", "a")
fecha = DateTime.now.to_s
mod = self.usuarioRes
rol = User.find(self.usuarioRes).rol.nombre
descripcion = "creacion de institucion"
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "institucion" + "\t" + "descripcion" + "\t" + "N/A" + "\t" + self.descripcion + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "institucion" + "\t" + "fechaCambio" + "\t" + "N/A" + "\t" + self.fecha_cambio.to_s + "\t" + descripcion + "\n")

file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "institucion" + "\t" + "expediente_id" + "\t" + "N/A" + "\t" + self.expediente_id + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "institucion" + "\t" + "clasificacion" + "\t" + "N/A" + "\t" + self.clasificacion + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "institucion" + "\t" + "estado" + "\t" + "N/A" + "\t" + self.estado + "\t" + descripcion + "\n")

file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "institucion" + "\t" + "fechaCrear" + "\t" + "N/A" + "\t" + self.fechaCrear.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "institucion" + "\t" + "fechaMod" + "\t" + "N/A" + "\t" + self.fechaMod.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "institucion" + "\t" + "usuarioRes" + "\t" + "N/A" + "\t" + self.usuarioRes.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "institucion" + "\t" + "usuarioMod" + "\t" + "N/A" + "\t" + self.usuarioMod.to_s + "\t" + descripcion + "\n")

file.close()


end
end
24 changes: 24 additions & 0 deletions SIELHO/app/models/ley_acuerdo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,28 @@ class LeyAcuerdo < ActiveRecord::Base
validates :noLey, :format => { :with => /\A[0-9a-zA-Z\- ]+\z/, :message => " - Solo se permiten letras y numeros" }
validates :noAcuerdo, :format => { :with => /\A[0-9a-zA-Z\- ]+\z/, :message => " - Solo se permiten letras y numeros" }
has_and_belongs_to_many :justificacions
def logC


file = File.open("public/historial", "a")
fecha = DateTime.now.to_s
mod = self.usuarioRes
rol = User.find(self.usuarioRes).rol.nombre
descripcion = "creacion de leyacuerdo"
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "leyacuerdo" + "\t" + "descripcion" + "\t" + "N/A" + "\t" + self.descripcion + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "leyacuerdo" + "\t" + "noLEY" + "\t" + "N/A" + "\t" + self.noLey + "\t" + descripcion + "\n")

file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "leyacuerdo" + "\t" + "noAcuerdo" + "\t" + "N/A" + "\t" + self.noAcuerdo + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "leyacuerdo" + "\t" + "fechaGaceta" + "\t" + "N/A" + "\t" + self.fechaGaceta.to_s + "\t" + descripcion + "\n")

file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "leyacuerdo" + "\t" + "fechaCrear" + "\t" + "N/A" + "\t" + self.fechaCrear.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "leyacuerdo" + "\t" + "fechaMod" + "\t" + "N/A" + "\t" + self.fechaMod.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "leyacuerdo" + "\t" + "usuarioRes" + "\t" + "N/A" + "\t" + self.usuarioRes.to_s + "\t" + descripcion + "\n")
file.write(fecha + "\t" +mod.to_s+ "\t" +rol.to_s+ "\t" + "leyacuerdo" + "\t" + "usuarioMod" + "\t" + "N/A" + "\t" + self.usuarioMod.to_s + "\t" + descripcion + "\n")

file.close()


end

end
Loading

0 comments on commit b270565

Please sign in to comment.