Sunteți pe pagina 1din 25

Function exportacion_rm_Exportar(param) ' param As Variant ' record type name is Exportacion_RM ' Cdigo de usuario inicial REM

add your hook code here ' Despliega("Exportando") 'msgbox "exportar" set Sess = getSession if sess.hasValue("IMPORTACION") or sess.nameValue("IMPORTACION") = 1 then else lineaerror = "" idUsuario = sess.GetUserLoginName ' Qry = "Select T1.codigo, T1.apikey from usuarios_redmine T1 where T1.login = '" & idUsuario & "'" Qry = "select distinct T1.misc_info from users T1 where T1.dbid <> 0 and T1 .login_name = '" & idUsuario & "'" ' and (T1.misc_info like '%<codigo>" & idUsuario & "</codigo>%') set ResultSet = sess.BuildSqlQuery(Qry) ResultSet.execute status = ResultSet.MoveNext if status = AD_SUCCESS then ' id_RM = ResultSet.GetColumnValue(1) ' ApiKey = ResultSet.GetColumnValue(2)

id_rm1 = instr(ResultSet.GetColumnValue(1), "<cod igo>") + 8 id_rm2 = instr(ResultSet.GetColumnValue(1),"</cod igo>") - id_rm1 id_RM = Mid(ResultSet.GetColumnValue(1),id_rm1,id _rm2) 'consultamos el idredmine

Apikey1 = instr(ResultSet.GetColumnValue(1),"<api key>") + 8 Apikey2 = instr(ResultSet.GetColumnValue(1), "</a

pikey>") - apikey1 Apikey = Mid(ResultSet.GetColumnValue(1),apikey1 ,apikey2)

tipo_registro = GetFieldValue("tipo_registro_rm") .GetValue ' verifica si es una importacion if sess.hasValue("MAPIKEY") and sess.nameValue("M APIKEY") <> Apikey then apikey = sess.nameValue("MAPIKEY") end if TextoCustom TextoTabla = "'custom_fields':[" = ""

TextoDato1 = "" textoDato = "" TextoRegistro = "" idReq1 = "" idTar1 = "" idDef1 = "" idTarea = GetFieldValue("Tarea_Prueba").GetValue if len(GetFieldValue("Accion_Tareas").GetValue) > 0 then idTar1 = idTarea if GetFieldValue("Accion_Tareas") .GetValue = "Submit" then MODULO = sess.nam eValue("MODULO") idRedmine = GetFi eldValue("ID_Redmine").GetValue idPadre nameValue("IDPADRE") idProject = Mid(i dRedmine,1,len(idRedmine)-7) TextoRegistro = T extoRegistro & "'project_id':'" & idProject & "','tracker_id':'12','description' :'Clear Quest','priority_id':'4','notes':'Clear Quest','parent_issue_id':'" & id = sess.

Padre & "'," & chr(13) & chr(10) TextoCustom = T extoCustom & "{'value':'" & MODULO & "','id':17}, {'value':'1','id':89}," & c hr(13) & chr(10) end if end if

if len(GetFieldValue("Accion_Requerimiento").GetV alue) > 0 then idReq1 = idTarea 'if len(GetFieldValue("Accion_Defecto").GetValue) > 0 then idDef1 = idTarea

' *************************************** CAMPOS STANDARD *********************************** camposTarea = GetfieldValue("Campos_exporta").Get ValueAsList If isArray(camposTarea) Then for each ListItem in camposTarea If listItem<>"" T hen 'msgbox ("cs "&listItem) qr y="select T1.tabla_cq, T1.campo_cq_sql, T1.tabla_rm, T1.codigo_rm from campos_re dmine T1 where T1.nombre ='" & listItem & "'" Se t ResultSet = Sess.BuildSQLQuery(Qry) Re sultSet.Execute st atus = ResultSet.MoveNext if status = AD_SUCCESS then tablacq = ResultSet.GetColumnValue(1) campocq = ResultSet.GetColumnValue(2)

tablarm = ResultSet.GetColumnValue(3) camporm = ResultSet.GetColumnValue(4) ' if inStr(TextoRegistro,tablarm) = 0 then if len(TextoTabla) = 0 then TextoTabla = "{'" & tablarm & "':{" if tablarm = "time_entry" then TextoTabla = TextoTabla & "'issue_i d':'" & getFieldValue("id_redmine").getValue & "'," if sess.hasValue("TAREA") then idTar1 = sess.nameV alue("TAREA") end if end if end if idTarea = GetFieldValue("Tarea_Prueba").GetValue tipo1 = 1

if isNumeric(camporm) then tipo1 = 2 if len(campocq) > 0 and len(tablacq)>0 and len(idTarea) > 0 and le n(tablarm)>0 and len(camporm)>0 then qry1 = "select T1." & campocq & " from " & tablacq & " T1 where T1.id = '" & idTarea & "'" 'msgbox ("qstand "&qry1) if tablacq = "new1_15" then qry1 = "select " & cam pocq & " from " & tablacq & " T1 where T1.dbid = " & idTarea & ""

Set ResultSet1 = Sess.BuildSQLQuery(Qry1) ResultSet1.Execute status1 = ResultSet1.MoveNext if status1 = AD_SUCCESS then campoExp ="" campoExp = ResultSet1.GetColumnValu e(1) if len(campoExp) > 0 then

campoExp = Replace( campoExp,chr(13),"\t") campoExp = Replace( campoExp,chr(10),"\n") if isdate(campoExp) and not isnumeric(campoExp) then campoExp = Fecha_RM(ResultSet1.GetColumnValue( 1)) if tipo1 = 1 then tex toDato = "'" & camporm & "':'" & campoExp & "'," & chr(13) & chr(10) if camporm = "notes" then

textoDato1 = "{'value':'0','id':59}," & chr(13) & chr(10) end if else 'msgbox "entra aqui else"

if camporm = "59" then

textoDato1 = "{'value':'1','id':"& camporm & "}," & chr(13) & chr(10 )

textoDato = "'notes':'" & campoExp & "'," & chr(13) & chr(10) els e

textoDato1 = "{'value':'"& campoExp & "','id':"& camporm & "}," & ch r(13) & chr(10) end if end if TextoRegistro = Tex toRegistro & textoDato TextoCustom toCustom & textoDato1 TextoDato1 = "" textoDato = "" end if end if end if en d if end if next end if = Tex

' *************************************** CAMPO S USUARIOS *********************************** camposTarea = GetfieldValue("Campo_usuarios").Get ValueAsList if isArray(camposTarea) Then for each ListItem in camposTarea If listItem<>"" T hen qr y="select T1.tabla_cq, T1.campo_cq_sql, T1.tabla_rm, T1.codigo_rm from campos_re dmine T1 where T1.nombre ='" & listItem & "'" Se t ResultSet = Sess.BuildSQLQuery(Qry) Re sultSet.Execute st atus = ResultSet.MoveNext if status = AD_SUCCESS then tablacq = ResultSet.GetColumnValue(1) campocq = ResultSet.GetColumnValue(2) tablarm = ResultSet.GetColumnValue(3) camporm = ResultSet.GetColumnValue(4) idTarea = GetFieldValue("Tarea_Prueba").GetValue tipo1 = 1

if isNumeric(camporm) then tipo1 = 2 if len(campocq) > 0 and len(tablacq)>0 and len(idTarea) > 0 and le n(tablarm)>0 and len(camporm)>0 then

qry1 = "select T1." & campocq & " from " & tablacq & " T1 where T1.id = '" & idTarea & "'" Set ResultSet1 = Sess.BuildSQLQuery(Qry1) ResultSet1.Execute status1 = ResultSet1.MoveNext if status1 = AD_SUCCESS then t_usuario = ResultSet1.GetColumnVal ue(1) qry2 = "select t1.login_name from u sers t1 where t1.dbid = '" & t_usuario & "'" Set ResultSet2 = Sess.BuildSQLQuery (Qry2) ResultSet2.Execute status2 = ResultSet2.MoveNext t_usuario = ResultSet2.GetColumnVal ue(1) ' qry2 = "select t1.codigo from us uarios_redmine t1 where t1.login = '" & t_usuario & "'" qry2 = "select distinct T1.misc_inf o from users T1 where T1.dbid <> 0 and ((T1.login_name = '" & t_usuario & "'))" Set ResultSet2 = Sess.BuildSQLQuery (Qry2) ResultSet2.Execute status2 = ResultSet2.MoveNext if status2 = AD_SUCCESS then if inStr(ResultSet2

.GetColumnValue(1),"<codigo>") > 0 then ' c ampoExp = ResultSet2.GetColumnValue(1) cam poExp1 = inStr(ResultSet2.GetColumnValue(1),"<codigo>") + 8 cam poExp2 = inStr(ResultSet2.GetColumnValue(1),"</codigo>") - campoExp1 cam poExp = mid( ResultSet2.GetColumnValue(1),campoExp1,campoExp2) if tipo1 = 1 then

textoDato = "'" & camporm & "':'" & campoExp & "'," & chr(13) & chr (10) els e

textoDato1 = "{'value':'"& campoExp & "','id':"& camporm & "}," & ch r(13) & chr(10) end if Tex toRegistro = TextoRegistro & textoDato Tex toCustom = TextoCustom & textoDato1 Tex toDato1 = "" tex toDato = "" else

lin eaerror = lineaerror & chr(13) & "usuario sin idRedmine: " & t_usuario end if end if end if end if en d if end if next end if

' *************************************** CAMPO S REFERENCIADOS *********************************** camposTarea = GetfieldValue("Campo_Referenciado") .GetValueAsList if isArray(camposTarea) Then for each ListItem in camposTarea If listItem<>"" T hen qr y="select T1.tabla_cq, T1.campo_cq_sql, T1.tabla_rm, T1.codigo_rm, T1.tabla2_cq, T1.campo2_cq from campos_redmine T1 where T1.nombre ='" & listItem & "'" msgbox qry Se t ResultSet = Sess.BuildSQLQuery(Qry) Re sultSet.Execute st atus = ResultSet.MoveNext if status = AD_SUCCESS then tablacq = ResultSet.GetColumnValue(1)

campocq = ResultSet.GetColumnValue(2)'state tablarm = ResultSet.GetColumnValue(3) camporm = ResultSet.GetColumnValue(4)'status id tablacq2 = ResultSet.GetColumnValue(5) campocq2 = LCase(ResultSet.GetColumnValue(6)) idTarea = GetFieldValue("Tarea_Prueba").GetValue tipo1 = 1

if isNumeric(camporm) then tipo1 = 2 end if if len(campocq) > 0 and len(tablacq)>0 and len(idTarea) > 0 and le n(tablarm)>0 and len(camporm)>0 then 'qry1 = "select T1." & campocq & " from " & tablac q & " T1 where T1.id = '" & idTarea & "'" qry1 = "select T3.name from "&tablacq&" T1,statede f T3 where T1.state = T3.id and (T1.id = '"&idTarea&"')" msgbox ("qr1 "&qry1) 'corregir si presenta errores en el futuro if tablacq = "new1_15" then qry1 = "select " & cam pocq & " from " & tablacq & " T1 where T1.dbid = " & idTarea & "" Set ResultSet1 = Sess.BuildSQLQuery(Qry1) ResultSet1.Execute status1 = ResultSet1.MoveNext

if status1 = AD_SUCCESS then t_codigo = ResultSet1.GetColumnValu e(1) 'qry2 = "select t1." & campocq2 & " from " & tablacq2 & " t1 where t1.dbid = '" & t_codigo & "'"

qry2 = "select T1."&campocq2&" from "&tablacq2&" T1 where T1.estado_cq = '"&t_codigo&"' and T1.tipo_registro = '"&t ipo_registro&"'" msgbox "aa" msgbox tipo_registro msgbox qry2 if tablacq2 = "new1_30" then qry2 = "select T1." & campocq2 & " from " & tablacq2 & " T1 where T1.id = '" & t_codi go & "'" if tablacq2 = "new1_29" then qry2 = "select T1." & campocq2 & " from " & tablacq2 & " T1 where T1.id = '" & t_codi go & "'" if tablacq2 = "new1" then qry2 = "s elect T1." & campocq2 & " from " & tablacq2 & " T1 where T1.id = '" & t_codi go & "'" if tablacq2 = "statedef" then qry2 = "select T1." & campocq2 & " from " & tablacq2 & " T1 where T1.id = '" & t_codi go & "'" Set ResultSet2 = Sess.BuildSQLQuery (Qry2) ResultSet2.Execute msgbox "despue de" status2 = ResultSet2.MoveNext if status2 = AD_SUCCESS then

campoExp = ResultSe t2.GetColumnValue(1) if tipo1 = 1 then tex toDato = "'" & camporm & "':'" & campoExp & "'," & chr(13) & chr(10) else tex toDato1 = "{'value':'"& campoExp & "','id':"& camporm & "}," & chr(13) & chr(10) end if

TextoRegistro = Tex toRegistro & textoDato TextoCustom toCustom & textoDato1 TextoDato1 = "" textoDato = "" end if end if end if en d if end if next end if = Tex

' *************************************** CAMBI O DE ESTADO ***********************************

' Pendiente de definir camposTarea = GetfieldValue("Campo_Estados").GetV alueAsList ' no hay campos de estado (pestaa nuevo estado y envio de adjunto) para tarea modificar en la tabla Exportacion_RM if isArray(camposTarea) Then for each ListItem in camposTarea If listItem<>"" T hen qr y="select T1.tabla_cq, T1.campo_cq_sql, T1.tabla_rm, T1.codigo_rm, T1.tabla2_cq, T1.campo2_cq from campos_redmine T1 where T1.nombre ='" & listItem & "'" 'msgbox qry Se t ResultSet = Sess.BuildSQLQuery(Qry) Re sultSet.Execute st atus = ResultSet.MoveNext if status = AD_SUCCESS then tablacq = ResultSet.GetColumnValue(1) campocq = ResultSet.GetColumnValue(2) tablarm = ResultSet.GetColumnValue(3) camporm = ResultSet.GetColumnValue(4) tablacq2 = LCase(ResultSet.GetColumnValue(5)) if tablacq2 = "statedef" then tablacq2 = "estados_equivalente_rd" campocq2 = LCase (ResultSet.GetColumnValue(6)) idTarea = GetFieldValue("Tarea_Prueba").GetValue tipo1 = 1

if isNumeric(camporm) then tipo1 = 2

if len(campocq) > 0 and len(tablacq)>0 and len(idTarea) > 0 and le n(tablarm)>0 and len(camporm)>0 then 'qry1 = "select T1." & campocq & " from " & tablac q & " T1 where T1.id = '" & idTarea & "'"

qry1 = "select T3.name from "&tablacq&" T1,statede f T3 where T1.state = T3.id and (T1.id like '%"&idTarea&"%')" 'msgbox qry1 'Corregir si presenta errores en el futuro if tablacq = "new1_15" then qry1 = "select " & cam pocq & " from " & tablacq & " T1 where T1.dbid = " & idTarea & "" Set ResultSet1 = Sess.BuildSQLQuery(Qry1) ResultSet1.Execute status1 = ResultSet1.MoveNext if status1 = AD_SUCCESS then 'msgbox "aka desarrollo" t_codigo = ResultSet1.GetColumnValu e(1) qry2 = "select T1.estado_cq,T1.cod igo_rm,T1.estado_redmine,T1.tipo_registro,T1.accion from estados_equivalente_rd T1 where T1.estado_cq = '"&t_codigo&"' and T1.tipo_registro = '"&tipo_registro&" '" 'qry2 = "select t1." & campocq2 & " from " & tablacq2 & " t1 where t1.estado_cq = '" & t_codigo & "'" if tablacq2 = "new1_15" then qry2 = "select " & campocq2 & " from " & tablacq2 & " T1 where T1.estado_cq = '" & t_ codigo & "'" if tablacq2 = "new1_29" then qry2 = "select T1." & campocq2 & " from " & tablacq2 & " T1 where T1.estado_cq = '" &

t_codigo & "'" if tablacq2 = "new1" then qry2 = "s elect T1." & campocq2 & " from " & tablacq2 & " T1 where T1.estado_cq = '" & t_codigo & "'" if tablacq2 = "statedef" then qry2 = "select T1." & campocq2 & " from " & tablacq2 & " T1 where T1.estado_cq = '" & t_codigo & "'" 'msgbox tablacq2 Set ResultSet2 = Sess.BuildSQLQuery (Qry2) ResultSet2.Execute status2 = ResultSet2.MoveNext if status2 = AD_SUCCESS then 'msgbox qry2 estado = ResultSet2 .GetColumnValue(1) TipoR = "Tareas"

if len(getFieldValu e("accion_requerimiento").getvalue) > 0 then TipoR = "Requerimiento" if len(getFieldValu e("accion_Defectos").getvalue) > 0 then TipoR = "Defectos" Qry3 = "select dist inct T1.dbid,T1.estado_cq,T1.tipo_registro,T1.estado_redmine,T1.codigo_rm from e stados_equivalente_rd T1 where T1.dbid <> 0 and ((T1.tipo_registro = '" & TipoR & "' and T1.estado_cq = '" & estado & "'))" Set ResultSet3 = Se ss.BuildSQLQuery(Qry3) 'msgbox Qry3 ResultSet3.Execute

status3 = ResultSet 3.MoveNext if status3 = AD_SUC CESS then 'msgbox Qry3 cam poExp = ResultSet3.GetColumnValue(5) if tipo1 = 1 then

textoDato = "'" & camporm & "':'" & campoExp & "'," & chr(13) & chr (10) els e

textoDato1 = "{'value':'"& campoExp & "','id':"& camporm & "}," & ch r(13) & chr(10) end if Tex toRegistro = TextoRegistro & textoDato Tex toCustom = TextoCustom & textoDato1 Tex toDato1 = "" tex toDato = "" end if end if end if

end if en d if end if next end if

'*********************************************** Campos adjuntos ***************************************************

camposTarea = GetfieldValue("Campo_Adjuntos").Get ValueAsList if isArray(camposTarea) Then for each ListItem in camposTarea qry="select T1.ta bla_cq, T1.campo_cq_sql, T1.codigo_rm from campos_redmine T1 where T1.nombre ='" & listItem & "'" set ResultSet = S ess.BuildSQLQuery(Qry) ResultSet.Execute status = ResultSe t.MoveNext if status = AD_SU CCESS then ta blacq = ResultSet.GetColumnValue(1) ca mpocq = ResultSet.GetColumnValue(2) 't ablarm = ResultSet.GetColumnValue(3) ca mporm = ResultSet.GetColumnValue(3) 't ablacq2 = LCase(ResultSet.GetColumnValue(5))

po sicion = getFieldValue("Tarea_Prueba").GetValue SE T Ent=Sess.GetEntity(tipo_registro,posicion) db id = Ent.Getdbid ti po1 = 1 if isNumeric(camporm) then tipo1 = 2 qry2 = "select distinct T1.filename, T1.filesize, T1.entity_dbid from attachments T1 where T1.entity_dbid = "&dbid &"" set ResultSet = Sess.BuildSQLQuery(qry2) ResultSet.Execute do while ResultSet.MoveNext = AD_SUCCESS filename = ResultSet.GetColumnValue(1)

if tipo1 = 1 then textoDato = "'" & camporm & "':'" & filename & "'," & chr(13) & chr(10) else textoDato1 = "{'value':'"& filename & "','id':"& camporm & "}," & chr(13) & chr(10) end if

TextoRegistro = TextoRegistro & textoDato TextoCustom = TextoCustom & textoDato1

TextoDato1 = "" textoDato = "" loop end if next end if

'***************************************** creaci on del txt json *************************************

' MSGBOX "PASO 5. " & chr(13) & textocompleto & chr(13) & TEXTOR EGISTRO & CHR(13) & TEXTOCUSTOM

'msgbox ("entra aqui, texto reg "&textoRegistro& " texto custom "&len(TextoCusto m)) ' si no hay nada en texto registro no se crea el txt, crear algo para else if len(textoRegistro) > 3 or 17 then len(TextoCustom) >

TextoCompleto = TextoTabla if len(TextoRegistro) > 3 then TextoCompleto = T extoCompleto & left(TextoRegistro,len(TextoRegistro)-3) end if if len(TextoCustom) > 17 then if len(TextoRegis tro) > 3 then Te xtoCompleto = TextoCompleto & "," end if TextoCompleto = T extoCompleto & chr(13) & chr(10) & left(TextoCustom,len(TextoCustom) - 3) & "]"

end if TextoCompleto = TextoCompleto & " }}" setFieldValue "json_prueba", Text oCompleto prefijo=GetFieldValue("prefijo"). getValue path vo").getValue postfijo=GetFieldValue("postfijo" ).getValue & apikey if isNumeric(getFieldVAlue("id_re dmine").getValue) then postfijo2=GetFiel dValue("postfijo2").getValue & getFieldVAlue("id_redmine").getValue & ".json " else postfijo2=GetFiel dValue("postfijo2").getValue & getFieldVAlue("id_redmine").getValue & " " end if =GEtFieldVAlue("path_archi

' SET MyShell=CreateObject("WScri pt.Shell") ' error = MyShell.Run (comandoVis ta,1,true) ' despliega(error) nowh = Replace(now,"/","_") nowht = Replace(nowh," ","_") nowhh = Replace(nowht,":","-")

comandoVista = prefijo & path &ti po_registro&" "& idTarea&"_"&nowhh& ".txt " & postfijo & postfijo2 & " >\\srv01 rta01.cobiscorp.int\CQerror\error.txt" VistaPost = comandoVista

Set fs = CreateObject("Scripting. FileSystemObject") ' Set a = fs.CreateTextFile( "c:\ temp\ejecuta.bat", True)

Set a = fs.CreateTextFile( "\\srv 01rta01.cobiscorp.int\webserver\ejecuta"&tipo_registro&"_"& idTarea&"_"&nowhh&". bat", True) ' a.WriteLine("cd " & path) a.WriteLine ("psexec \\srv01rta01 ") a.WriteLine("set path=%path%;c:\w ebserver\curl;c:\webserver\apache\bin;c:\webserver\curl\lib;c:\webserver\curl\sr c;c:\webserver\curl\include;c:\webserver\curl\lib\Release;") 'a.WriteLine("set nombrebat=\\srv 01rta01.cobiscorp.int\webserver\ejecuta"& tipo_registro &"_"& idTarea &"_"& nowh h &".bat") a.WriteLine("set nombrebat=C:\webserver\ejecuta"& tipo_registro &"_"& idTarea &"_"& nowhh &".bat") 'a.WriteLine ("psexec \\srv01rta0 1 "& Chr(34) &"C:\WebServer\ejecuta"&tipo_registro&"_"& idTarea&"_"&nowhh&".bat" & Chr(34) &"") 'a.WriteLine ("psexec \\srv01rta01") a.WriteLine ("cd C:\WebServer") 'a.WriteLine("pushd \\srv01rta01. cobiscorp.int\webserver")'xx 'a.WriteLine("pause")'xx a.WriteLine(comandoVista) a.WriteLine("pause")'xx ' a.WriteLine("PAUSE") a.WriteLine("cd c:\comunicacioncq \cqexp2in") a.WriteLine("del ejecuta2"&tipo_r egistro&"_"& idTarea&"_"&nowhh&".bat") a.WriteLine("cd c:\comunicacioncq \cqexpOut") a.WriteLine("copy " & path & tipo _registro &" "& idTarea &"_"& nowhh & ".txt") ' ' a.WriteLine("pause")'xx a.WriteLine("erase %nombrebat%") a.WriteLine("echo %nombrebat%") a.WriteLine("pause") a.close

Set fs = CreateObject("Scripting. FileSystemObject") Set b = fs.CreateTextFile(path &t ipo_registro&" "& idTarea&"_"&nowhh& ".txt", True) b.WriteLine(TextoCompleto) b.close

' comandoVista = path & "\ejecuta .bat" '' msgbox comandoVista ' SET MyShell=CreateObject("WScri pt.Shell") '' Set MyShell = CreateObject("Sh ell.Application") '' MyShell.ShellExecute comandoVi sta,"","", "runas",1 'error = MyShell.Run (comandoVist a,1,true) '' MyShell.Run comandoVista

Set fs = CreateObject("Scripting. FileSystemObject") ' Set a = fs.CreateTextFile( "c:\ temp\ejecuta.bat", True) ' Set a = fs.CreateTextFile( "\\s rv01rta01.cobiscorp.int\ComunicacionCQ\CQexp2in\ejecuta2.bat", True)

Set a = fs.CreateTextFile( "\\srv 01rta01.cobiscorp.int\CQexp2In\ejecuta2"& tipo_registro &"_"& idTarea &"_"& nowh h &".bat", True)

a.WriteLine("cd c:\webserver") a.WriteLine("c:\webserver\ejecuta "&tipo_registro&"_"& idTarea&"_"&nowhh&".bat") a.WriteLine("PAUSE") a.close

' grabar en el LOG

Set fso = CreateObject("Scripting .FileSystemObject")

Archivo = "\\srv01rta01.cobiscorp .int\CQError\error.txt" Set f = fso.OpenTextFile(Archivo, 1) Do While f.AtEndOfStream <> True linea= f.ReadLine lineaerror = line aerror + linea loop

set wshell = CreateObject("WScript.Shell") wshell.run "\\srv01rta01.cobiscorp.int\webserver\ejecuta"&tipo_registro&"_"& idT area&"_"&nowhh&".bat" set wshell = nothing

registro_tabla = "Log_Redmine" SET EntLog = Sess.BuildEntity(reg istro_tabla) EntLog.SetFieldValue "ID_Redmine" , getFieldValue("ID_Redmine").GetValue if len(idReq1) > 0 then EntLog.Se tFieldValue "ID_Requerimiento", idReq1 if len(idTar1) > 0 then EntLog.Se tFieldValue "ID_Tarea", idTar1 if len(idDef1) > 0 then EntLog.Se tFieldValue "ID_Defecto", idDef1 EntLog.SetFieldValue "Usuario", s ess.GetUserLoginName EntLog.SetFieldValue "Tipo_Activi dad", getFieldValue("Nombre").GetValue EntLog.SetFieldValue "Fecha_Hora" , now EntLog.SetFieldValue "Json_Prueba ", getFieldValue("JSON_Prueba").GetValue EntLog.SetFieldValue "Prefijo", i

dTarea & ".txt " EntLog.SetFieldValue "Postfijo", left(vistaPost,250)

if len(error) > 1 or len(lineaerr or) > 1 then lineaerror = erro r & chr(13) & lineaerror ' Despliega(linea error) EntLog.SetFieldVa lue "Fallida", "S" EntLog.SetFieldVa lue "Mensaje_de_error", lineaerror else EntLog.SetFieldVa lue "Existosa", "S" end if

errorLog = EntLog.Validate if len(errorLog) > 0 then Desplie ga(errorLog) EntLog.Commit else setFieldValue "json_prueba", Text oRegistro ' debe ria haber algo en caso de que no haya nada en los campos "un fa llido o algo para almacenar en el log" end if

S-ar putea să vă placă și