示例#1
0
def cerrarTicket():
        if "ID" in session and session['Tipo'] == 4:
            if request.method == 'POST':
                objTicket = Ticket()
                objEmail = Email()
                objUsuario = Usuario()
                IdTicket = int(request.form['IdTicket'])
                Resolucion = request.form['res']

                objTicket.setID(IdTicket)
                objTicket.setResolucion(Resolucion)
                ticket = objTicket.consultarID()
                objUsuario.setID(int(ticket[0].IdCreador))
                usuario = objUsuario.consultarID()
                
                if len(ticket) > 0:
                    if objTicket.cerrarTicket():

                        if len(usuario) > 0:
                            email = usuario[0].Email
                            objEmail.emailActualizacionTicket(email,2,ticket[0].Titulo,0)
                        else:
                            return "Error"

                        return "Exito"
                    else:
                        return "Error"
        else:
            return redirect(url_for('inicio.index'))