'**********************************************************
' InitializeCancelTests	'added by CC-000521
' @description: initializes the cancel test workflow 
' @param: 
' @return: 
'**********************************************************
Function InitializeCancelTests
	Dim xmlFile
	Dim oNode
	
	
	wfvariables.recTrainees.MultiSelect = True
	
	Dim oXmlDoc : Set oXmlDoc = CreateObject("Msxml2.DOMDocument")

	wfvariables.recStructure.iFolderID.Value = "1"	'this value is set for compatibility to the BPL Framework, cause currently no client protocol will be stored if the value is not set. And if no client protocol is set the merge instances function will not work	
	
	wfvariables.sDocumentNumber.Value = "-"	'currently in the beforeforward event is checked if the workflow got a document. in this case we don't need a document, so we set the variable to -
	
	lAcceptedType = thisprocess.WFFile.FileObjects(0).ObjectType
	For a = 0 To thisprocess.WFFile.FileObjects.Count - 1
		'the type of item (0) is already checked in the start event of the workflow,
		'now check, if each file in the WFFile got the same type
		If thisprocess.WFFile.FileObjects(a).ObjectType <> lAcceptedType Then
			wfvariables.sError.Value = "Nur Objekte vom Typ 'Person' dürfen an diesen Workflow übergeben werden."
			wfvariables.bCorrect.Value = 1
			Exit Function 			
		End If
	Next
	
		
	For a = 0 To thisprocess.WFFile.FileObjects.Count - 1

		'sReturn = getPersonObjectInformation(thisprocess.WFFile.FileObjects(a).Id)
		'CC-000900
		Set myPerson = getPersonObjectInformation(thisprocess.WFFile.FileObjects(a).Id)

		'check, if there is a answer questionnaire process running
		sProcessID = getProcessIDByObject(thisprocess.WFFile.FileObjects.Item(a).Id, "Q - Answer")
		debug2File sProcessID
		If sProcessID <> "" Then
			aReturn = Split(sReturn,";")
			Set o1 = wfvariables.recTrainees.CreateListItem
			'CC-0009000
			o1.Item("sName").Value = myPerson.sPersonName
			o1.Item("sLogin").Value = myPerson.sPersonLogin
			o1.Item("sTrainingStatus").Value = myPerson.sPersonTrainingStatus
			o1.Item("sStatusInformation").Value = myPerson.sPersonStatusInformation
			'o1.Item("sTrainingDate").Value = aReturn(4)
			o1.Item("sTrainingType").Value = myPerson.sPersonTrainingType		
			o1.Item("sEmail").Value = myPerson.sPersonEmail
			o1.Item("sResponsible").Value = myPerson.sPersonResponsible
			o1.Item("sUserID").Value = myPerson.sPersonUserID
			o1.Item("sDocTitle").Value = myPerson.sDocTitle
			o1.Item("sDocNumber").Value = myPerson.sDocNumber
			o1.Item("sDocVersion").Value = myPerson.sDocVersion
			o1.Item("sFolderID").Value = myPerson.sFolderID
			o1.Item("ID").Value = thisprocess.WFFile.FileObjects(a).Id
			o1.Item("sProcessID").Value = sProcessID
			o1.Item("sDelete").Value = "nein / no"
			
			wfvariables.recTrainees.AddListItem o1	
		End If
	Next
	

	
	Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject")
	If oFSO.FileExists (xmlFile) = True Then 'delete the xmlFile
		oFSO.DeleteFile xmlFile
	End If
	'clean up
	Set oFSO = Nothing	
End Function