Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: C:/fa/gailen.laura/trunk/application.properties
- ===================================================================
- --- C:/fa/gailen.laura/trunk/application.properties (revision 2360)
- +++ C:/fa/gailen.laura/trunk/application.properties (revision 2361)
- @@ -1,33 +1,33 @@
- -#utf-8
- -#Sat Nov 07 00:28:56 CET 2009
- -app.grails.version=1.2-M2
- -app.name=laura
- -app.servlet.version=2.4
- -app.version=0.1
- -jquery.plugins.boxy=jquery.boxy.js
- -jquery.plugins.colorbox=jquery.colorbox.js
- -jquery.plugins.colorbox-min=jquery.colorbox-min.js
- -jquery.plugins.fgmenu=jquery.fgmenu.js
- -jquery.plugins.jquery-ui=jquery-ui-1.7.1.custom.min.js
- -jquery.plugins.tools=jquery.tools.js
- -plugins.authentication=1.0
- -plugins.bean-fields=0.4
- -plugins.bubbling=2.1.1
- -plugins.code-coverage=1.1.7
- -plugins.export=0.6
- -plugins.fixtures=0.7
- -plugins.fsm=0.6.3
- -plugins.google-analytics=0.1
- -plugins.grails-template-engine=0.2
- -plugins.grails-ui=1.0.4
- -plugins.h2=0.2.6
- -plugins.hibernate=1.2-M2
- -plugins.ivy=2.0.0-rc1
- -plugins.jquery=1.3.2.4
- -plugins.mail=0.7.1
- -plugins.paypal=0.5
- -#plugins.profiler=0.2
- -plugins.quartz=0.4.1
- -plugins.searchable=0.5.5
- -plugins.tomcat=1.2-M2
- -plugins.yui=2.7.0.1
- +#utf-8
- +#Wed Feb 24 18:02:06 GMT-03:00 2010
- +app.grails.version=1.2-M2
- +app.name=laura
- +app.servlet.version=2.4
- +app.version=0.1
- +jquery.plugins.boxy=jquery.boxy.js
- +jquery.plugins.colorbox=jquery.colorbox.js
- +jquery.plugins.colorbox-min=jquery.colorbox-min.js
- +jquery.plugins.fgmenu=jquery.fgmenu.js
- +jquery.plugins.jquery-ui=jquery-ui-1.7.1.custom.min.js
- +jquery.plugins.tools=jquery.tools.js
- +plugins.authentication=1.0
- +plugins.bean-fields=0.4
- +plugins.bubbling=2.1.1
- +plugins.code-coverage=1.1.7
- +plugins.cookie=0.2
- +plugins.export=0.6
- +plugins.fixtures=0.7
- +plugins.fsm=0.6.3
- +plugins.google-analytics=0.1
- +plugins.grails-template-engine=0.2
- +plugins.grails-ui=1.0.4
- +plugins.h2=0.2.6
- +plugins.hibernate=1.2-M2
- +plugins.ivy=2.0.0-rc1
- +plugins.jquery=1.3.2.4
- +plugins.mail=0.7.1
- +plugins.paypal=0.5
- +plugins.quartz=0.4.1
- +plugins.searchable=0.5.5
- +plugins.tomcat=1.2-M2
- +plugins.yui=2.7.0.1
- Index: C:/fa/gailen.laura/trunk/grails-app/services/entradia/EntradaService.groovy
- ===================================================================
- --- C:/fa/gailen.laura/trunk/grails-app/services/entradia/EntradaService.groovy (revision 2360)
- +++ C:/fa/gailen.laura/trunk/grails-app/services/entradia/EntradaService.groovy (revision 2361)
- @@ -429,11 +429,29 @@
- * @todo: Todas las operaciones realizadas en este método deberían ejecutarse
- * en el marco de una transacción, para que en caso de error se pueda realizar
- * un rollback y no se guarden ni las direcciones ni formas de pago ni nada
- + *
- + * (se carga el afiliado como null)
- */
- public Compra comprar(Entrada entrada, Usuario usuario, int cantidad, params) {
- + comprar(entrada, usuario, null, cantidad, params)
- +
- + }
- +
- + /**
- + * Usa el otro método comprar (que no tiene el parámetro afiliado)
- + * @param afiliado : agrega el parámetro de afiliado por si viene de uno de los sitios
- + * "amigos" de ticketbis
- + */
- + public Compra comprar(Entrada entrada, Usuario usuario, Afiliado af, int cantidad, params) {
- log.debug "comprar(entrada=${entrada}, usuario=${usuario}, cantidad=${cantidad}, params=${params}"
- - Compra compra = new Compra()
- -
- + Compra compra = new Compra();
- +
- + // Agregamos la información del afiliado
- + if (af) {
- + log.debug "La compra será asociada al afiliado, ${af.token} - ${af.id}"
- + compra.afiliado = af;
- + }
- +
- // Creamos u obtenemos la direccion de entrega a utilizar.
- log.debug "Procesando direccion: ${params.direccionActiva}"
- Direccion direccion
- Index: C:/fa/gailen.laura/trunk/grails-app/services/entradia/LogVisitasService.groovy
- ===================================================================
- --- C:/fa/gailen.laura/trunk/grails-app/services/entradia/LogVisitasService.groovy (revision 2360)
- +++ C:/fa/gailen.laura/trunk/grails-app/services/entradia/LogVisitasService.groovy (revision 2361)
- @@ -5,18 +5,34 @@
- boolean transactional = false
- static profiled = true
- - def registro = [:]
- + def registro = [:];
- /**
- * Registra una visita para un evento
- */
- def visitar(ev) {
- - if (ev) {
- - def cantidad = registro[ev.id]?:0
- - registro[ev.id] = ++cantidad
- - }
- + log.debug "visitar --- ev"
- + visitar(ev, null);
- }
- +
- + def visitar(ev, afiliado) {
- + log.error "visitar --- ev + afiliado ---- ufffffff"
- + if (ev) {
- + log.debug "tengo evento?"
- + // busco el evento en el registro
- + def afiliadosEvento = registro[ev.id]?:[:];
- + registro[ev.id] = afiliadosEvento;
- + //
- + def id = afiliado?.id?:-1;
- + def cantidad = afiliadosEvento[id]?:0;
- + afiliadosEvento[id] = ++cantidad;
- + log.debug "agregado ${cantidad} el evento ${ev.nombre} y el afiliado_id ${id} "
- + } else {
- + log.debug "no tengo evento?"
- + }
- + }
- +
- /**
- * Retorna el hash de registro y lo inicializa nuevamente a cero
- */
- Index: C:/fa/gailen.laura/trunk/grails-app/conf/LauraFilters.groovy
- ===================================================================
- --- C:/fa/gailen.laura/trunk/grails-app/conf/LauraFilters.groovy (revision 2360)
- +++ C:/fa/gailen.laura/trunk/grails-app/conf/LauraFilters.groovy (revision 2361)
- @@ -3,7 +3,29 @@
- class LauraFilters {
- static def allowedIPs = ['192.168.*', '127.0.0.1', '0:0:0:0:0:0:0:1']
- +
- def filters = {
- +
- + tokenAfiliado(controller:"*", action:"*") {
- + before = {
- + if (params.tokenAfiliado) {
- + // Validamos el afiliado
- + int lifetime = 21600
- + log.debug "Ingreso por afiliado, setearemos el cookie. ${params.tokenAfiliado} -> vida: ${lifetime}"
- +
- + Afiliado af
- + try {
- + af = Afiliado.findByToken(params.tokenAfiliado);
- + } catch (Exception e) {
- + log.warn "No se pudo setear el cookie del afiliado!";
- + }
- +
- + // lo dejamos activado por unas 6 horas...
- + response.setCookie("afiliado_id", af.id.toString(), lifetime)
- + }
- + }
- + }
- +
- ipFilter(controller:"*",action:"*") {
- before = {
- return true
- @@ -20,6 +42,7 @@
- return bGo
- }
- }
- +
- sessionHack(controller:"*", action:"*") {
- // TODO: Se puede quitar esto que no es eficiente??
- // POR AHORA PARECE LA UNICA MANERA DE QUE ESTO FUNCIONE EN TOMCAT!!!
- @@ -27,15 +50,19 @@
- def session = request.session
- }
- }
- +
- homeTitle(controller:"*", action:"*") {
- before = {
- request['homeTitle'] = Parametro.findByClave("home_title", [cache:true])?.valor
- }
- }
- +
- httpProtocol(controller:"*", action:"*") {
- before = {
- request['httpProtocol'] = request.getScheme()
- }
- }
- +
- }
- +
- }
- Index: C:/fa/gailen.laura/trunk/grails-app/conf/entradia/LogVisitasFilters.groovy
- ===================================================================
- --- C:/fa/gailen.laura/trunk/grails-app/conf/entradia/LogVisitasFilters.groovy (revision 2360)
- +++ C:/fa/gailen.laura/trunk/grails-app/conf/entradia/LogVisitasFilters.groovy (revision 2361)
- @@ -1,7 +1,7 @@
- package entradia
- class LogVisitasFilters {
- - def logVisitasService
- + LogVisitasService logVisitasService
- def filters = {
- @@ -11,7 +11,23 @@
- */
- eventosVisitados(controller:'evento', action:'entradas') {
- after = { viewModel ->
- - logVisitasService.visitar( viewModel.evento )
- + try {
- + def afiliado_id = request.getCookie("afiliado_id");
- + Afiliado af;
- +
- + if (afiliado_id) {
- + af = entradia.Afiliado.findById(afiliado_id)
- + }
- +
- + if (af) {
- + logVisitasService.visitar( viewModel.evento, af )
- + } else {
- + logVisitasService.visitar( viewModel.evento )
- + }
- + } catch (Exception e) {
- + log.error "Hubo un problema con el registro de visitas :( ", e
- + }
- +
- }
- }
- }
- Index: C:/fa/gailen.laura/trunk/grails-app/conf/Config.groovy
- ===================================================================
- --- C:/fa/gailen.laura/trunk/grails-app/conf/Config.groovy (revision 2360)
- +++ C:/fa/gailen.laura/trunk/grails-app/conf/Config.groovy (revision 2361)
- @@ -74,6 +74,7 @@
- emails {
- alertaSeguimiento = "fniwes@gmail.com"
- administradorUltimoMinuto = "fniwes@gmail.com"
- + errorUPS = "fafa@soluciones3f.com.ar"
- }
- grails.hibernate.cache.queries = true
- grails {
- @@ -172,6 +173,11 @@
- }
- }
- production {
- + emails {
- + alertaSeguimiento = "sistemas@ticketbis.com" // se envia con la sobreventa de entradas
- + administradorUltimoMinuto = "sistemas@ticketbis.com" // cuando se compran entradas pum
- + errorUPS = "sistemas@ticketbis.com" // cuando hay un error con ups
- + }
- imagenes {
- // Ruta a la carpeta donde se guardan las imagenes
- path = "/home/webuser/laura-images/"
- @@ -233,7 +239,8 @@
- }
- debug ups:"grails.app.jobs.GestorUPSJob"
- - debug ups:"grails.app.service.entradia.GestorUPSService"
- + debug ups:"grails.app.jobs.GestorTrackUPSJob"
- + debug ups:"grails.app.service.entradia.GestorUPSService"
- debug ups:"grails.app.controller.entradia.EnvioUPSController"
- debug tpv:'grails.app.service.entradia.MensajesService'
- @@ -263,14 +270,14 @@
- // appender:
- //
- appenders {
- - console name:'stdout', layout:pattern(conversionPattern: '%-5p %d{mm:ss,SSS}: %m [%c]%n') // [%t]
- - rollingFile name:"ups", maxFileSize:2000000, file:"ups.log"
- - rollingFile name:'tpv', maxFileSize:2000000, file:"tpv.log"
- + console name:'stdout', additivity: false, layout:pattern(conversionPattern: '%-5p %d{mm:ss,SSS}: %m [%c]%n') // [%t]
- + rollingFile name:"ups", additivity: false, maxFileSize:2000000, file:"ups.log"
- + rollingFile name:'tpv', additivity: false, maxFileSize:2000000, file:"tpv.log"
- }
- root {
- error stdout
- - additivity = true
- + additivity = false
- }
- debug ups:"grails.app.jobs.GestorUPSJob"
- @@ -282,10 +289,14 @@
- debug tpv:'grails.app.service.entradia.EntradaService'
- debug tpv:'grails.app.controller.entradia.PagarTPVController'
- - debug 'grails.app.controller.entradia.CompraController'
- + // debug 'grails.app.controller.entradia.CompraController', 'grails.app.service'
- - // debug stdout:'grails.app.service'
- - // debug stdout:'grails.app.controller'
- + debug stdout:'grails.app.service'
- + debug stdout:'grails.app.controller'
- + debug stdout:'grails.app.filters'
- + debug stdout:'grails.app.task'
- +
- + info 'org.hibernate'
- error 'org.codehaus.groovy.grails.web.pages', // GSP
- 'org.codehaus.groovy.grails.web.sitemesh', // layouts
- @@ -295,8 +306,8 @@
- 'org.codehaus.groovy.grails.plugins', // plugins
- 'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration
- 'org.codehaus.groovy.grails.web.servlet', // controllers
- - 'org.springframework',
- - 'org.hibernate'
- + 'org.springframework'// , 'org.hibernate'
- +
- }
- jquery.sources="jquery"
- @@ -310,7 +321,8 @@
- "UsuarioAdmin" : "Usuarios",
- "DestacadosAdmin" : "Destacados",
- "FormularioAdmin" : "Formularios",
- - "SeguimientoCompraAdmin" : "Histórico"
- + "SeguimientoCompraAdmin" : "Histórico",
- + "AfiliadoAdmin" : "Afiliado"
- ]
- @@ -357,7 +369,8 @@
- paginacionMisAnuncios = 10
- paginacionMisVentas = 10
- paginacionMisCompras = 10
- - paginacionResumen = 3
- + paginacionMisEnvios = 10
- + paginacionResumen = 3
- }
- Index: C:/fa/gailen.laura/trunk/grails-app/conf/AdminUrlMappings.groovy
- ===================================================================
- --- C:/fa/gailen.laura/trunk/grails-app/conf/AdminUrlMappings.groovy (revision 2360)
- +++ C:/fa/gailen.laura/trunk/grails-app/conf/AdminUrlMappings.groovy (revision 2361)
- @@ -18,6 +18,8 @@
- "/admin/testInfraestructura/$action?/$id?" (controller: "testInfraestructuraAdmin")
- "/admin/seguimientoCompra/$action?/$id?" (controller: "seguimientoCompraAdmin")
- +
- + "/admin/afiliado/$action?/$id?" (controller: "afiliadoAdmin")
- "/admin" ( view: "/admin/index" )
- }
- Index: C:/fa/gailen.laura/trunk/grails-app/controllers/be/TestInfraestructuraAdminController.groovy
- ===================================================================
- --- C:/fa/gailen.laura/trunk/grails-app/controllers/be/TestInfraestructuraAdminController.groovy (revision 2360)
- +++ C:/fa/gailen.laura/trunk/grails-app/controllers/be/TestInfraestructuraAdminController.groovy (revision 2361)
- @@ -10,7 +10,13 @@
- def index = { }
- - def ejecutarGestorUPSJob = {
- + def ejecutarLogVisitasJob = {
- + def res = quartzScheduler.triggerJob("LogVisitasJob", "LauraGroup");
- + render "ejecutarLogVisitasJob - ${res} - se ejecutó la tarea programada.";
- + }
- +
- +
- + def ejecutarGestorUPSJob = {
- def res = quartzScheduler.triggerJob("GestorUPSJob", "UPSServices");
- render "ejecutarGestorUPSJob - ${res} - se ejecutó la tarea programada.";
- }
- Index: C:/fa/gailen.laura/trunk/grails-app/controllers/entradia/CompraController.groovy
- ===================================================================
- --- C:/fa/gailen.laura/trunk/grails-app/controllers/entradia/CompraController.groovy (revision 2360)
- +++ C:/fa/gailen.laura/trunk/grails-app/controllers/entradia/CompraController.groovy (revision 2361)
- @@ -1,7 +1,7 @@
- package entradia
- class CompraController {
- - def entradaService
- + EntradaService entradaService
- def usuarioService
- def authenticationService
- def eventoService
- @@ -64,6 +64,8 @@
- return render(view: "form", model: ["registro": registro, "compra": compra, "entrada": this.recuperarEntrada(), "recibirNotificaciones": recibirNotificaciones])
- }
- + def afiliado = Afiliado.get(request.getCookie("afiliado_id"));
- +
- // Intentamos hacer efectiva la compra
- if (!compra.hasErrors()) {
- // anteriormente aquí se creaba una compra "temporal" que se guarda en el session hasta que
- @@ -79,7 +81,8 @@
- calle: compra.envio_direccion,
- ciudad: compra.envio_ciudad,
- codigoPostal: compra.envio_codigoPostal,
- - pais: compra.pais,
- + pais: compra.pais,
- + afiliado: afiliado,
- formapago_tipo: compra.formapago_tipo,
- formapago_tarjeta_tipo: compra.formapago_tarjeta_tipo,
- @@ -90,7 +93,7 @@
- recibirNotificaciones: compra.recibirNotificaciones,
- ]
- - def entidad = entradaService.comprar( this.recuperarEntrada(), usuario, compra.cantidad, parametros )
- + def entidad = entradaService.comprar( this.recuperarEntrada(), usuario, afiliado, compra.cantidad, parametros )
- // TODO: en caso de error hacer algo mejorcito...
- if(!entidad) return redirect(action: "parametrosIncorrectos") // se produjo un error al persistir la compra
- Index: C:/fa/gailen.laura/trunk/grails-app/domain/entradia/Compra.groovy
- ===================================================================
- --- C:/fa/gailen.laura/trunk/grails-app/domain/entradia/Compra.groovy (revision 2360)
- +++ C:/fa/gailen.laura/trunk/grails-app/domain/entradia/Compra.groovy (revision 2361)
- @@ -22,9 +22,12 @@
- Date dateCreated // fecha de compra
- Date lastUpdated // fecha de ultima modificacion del registro
- + String token
- +
- + Afiliado afiliado
- +
- /** cosas para la entrega **/
- EnvioUPS envioUPS
- - String token
- // Pago de paypal
- org.grails.paypal.Payment payment
- @@ -32,7 +35,7 @@
- def afterInsert= {
- token = TokenGenerator.blend(id)
- }
- - static def hasOne = [EnvioUPS]
- + static def hasOne = [EnvioUPS, Afiliado]
- static def hasMany = [seguimientoCompras: entradia.SeguimientoCompra]
- @@ -50,6 +53,7 @@
- formaEnvio(nullable: true)
- token(nullable: true)
- envioUPS(nullable: true)
- + afiliado(nullable: true)
- dateCreated(nullable: true)
- lastUpdated(nullable: true)
- direccion(nullable: true) // debe ser nullable ya que las compra PUM no tienen direccion
- Index: C:/fa/gailen.laura/trunk/grails-app/domain/entradia/LogVisitaEvento.groovy
- ===================================================================
- --- C:/fa/gailen.laura/trunk/grails-app/domain/entradia/LogVisitaEvento.groovy (revision 2360)
- +++ C:/fa/gailen.laura/trunk/grails-app/domain/entradia/LogVisitaEvento.groovy (revision 2361)
- @@ -5,11 +5,13 @@
- class LogVisitaEvento implements Serializable {
- Evento evento
- + Afiliado afiliado
- +
- Categoria raiz // Para facilitar el filtrado por categoria
- long visitas = 0
- String dummy
- - static belongsTo = [evento: Evento]
- + static belongsTo = [Evento, Afiliado]
- static mapping = {
- cache true
- @@ -18,6 +20,7 @@
- static constraints = {
- dummy(nullable:true)
- raiz(nullable:true)
- + afiliado(nullable:true)
- }
- def actualizaRaiz() {
- Index: C:/fa/gailen.laura/trunk/grails-app/jobs/LogVisitasJob.groovy
- ===================================================================
- --- C:/fa/gailen.laura/trunk/grails-app/jobs/LogVisitasJob.groovy (revision 2360)
- +++ C:/fa/gailen.laura/trunk/grails-app/jobs/LogVisitasJob.groovy (revision 2361)
- @@ -1,23 +1,32 @@
- import entradia.LogVisitaEvento;
- import entradia.Evento;
- +import entradia.Afiliado;
- class LogVisitasJob {
- def timeout = 600000l
- def logVisitasService
- + def group = "LauraGroup"
- def execute() {
- def registro = logVisitasService.reset()
- - registro.each { key, value ->
- - log.debug "Consolidando ${key} => ${value}"
- + registro.each { key, afiliados ->
- + log.debug "Consolidando ${key} => ${afiliados}"
- def ev = Evento.findById(key)
- if(ev) {
- - def log = LogVisitaEvento.findByEvento( Evento.get(key) )
- - if(!log) log = new LogVisitaEvento(evento: Evento.get(key))
- - log.visitas += value
- + afiliados.each { afiliado_id, cantidad ->
- + log.debug "Afiliados ${afiliado_id} => ${cantidad}"
- + Afiliado af = Afiliado.findById(afiliado_id);
- - log.save()
- + def log = LogVisitaEvento.findByEventoAndAfiliado( Evento.get(key), af )
- +
- + if(!log) log = new LogVisitaEvento(evento: Evento.get(key), afiliado: af);
- + log.visitas += cantidad
- +
- + log.save()
- + }
- }
- }
- +
- }
- static triggers = {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement