'**********************************************************
' validateTrainingInformation
' @description: validates the training information
' @param: Nothing
' @return Nothing
'**********************************************************
Function validateTrainingInformation
	positiveOption = "ja / yes"
	negativeOption = "nein / no" 'CC-001048
	lenghtOfPositiveOption = Len(positiveOption)

	Dim sMsg : sMsg = ""
	If LCase(Left(wfvariables.sTrainingMandatory.value,lenghtOfPositiveOption)) = "ja / yes" Then	'check the first part ot the string to allow future string extensions (e.g. ja / yes / oui)
		If wfvariables.sTrainingInterval.value <> "" Then	'CC-000228 - check if the interval is a numeric value
			If IsNumeric(wfvariables.sTrainingInterval.value) = false Then
				sMsg = sMsg & sMsg & getMessageText( "StandardWF", "ObligatoryFieldStart", "Das Feld '" ) & getMaskFieldNameFromVariable (wfvariables.sTrainingInterval.Name) & getMessageText( "StandardWF", "OnlyNumericValues", "' erlaubt nur numerische Werte.") & vbCrlf 
			End If
		End If
		If wfvariables.sTrainingType.value = "" Then
			sMsg = sMsg & getMessageText( "StandardWF", "ObligatoryFieldStart", "Das Feld '" ) & getMaskFieldNameFromVariable (wfvariables.sTrainingType.Name) & getMessageText( "StandardWF", "ObligatoryFieldEnd", "' ist ein Pflichtfeld." ) & vbCrlf 
		End If
		If wfvariables.sTrainingControl.value = "" Then
			sMsg = sMsg & getMessageText( "StandardWF", "ObligatoryFieldStart", "Das Feld '" ) & getMaskFieldNameFromVariable (wfvariables.sTrainingControl.Name) & getMessageText( "StandardWF", "ObligatoryFieldEnd", "' ist ein Pflichtfeld." ) & vbCrlf 
		End If
		If wfvariables.TrainingResponsible.Count = 0 Then
			sMsg = sMsg & getMessageText( "StandardWF", "ObligatoryFieldStart", "Das Feld '" ) & getMaskFieldNameFromVariable (wfvariables.TrainingResponsible.Name) & getMessageText( "StandardWF", "ObligatoryFieldEnd", "' ist ein Pflichtfeld." ) & vbCrlf 
		End If	
	Else
		'CC-001048 removed double checking the training interval
		'If wfvariables.sTrainingInterval.value <> "" OR wfvariables.sTrainingType.value <> "" OR wfvariables.TrainingResponsible.Count > 0 OR wfvariables.sTrainingControl.value <> "" OR wfvariables.sQuestionnaireReference.value <> "" OR wfvariables.sTrainingInterval.value <> "" OR wfvariables.sTrainingUnit.value <> "" Then
		If LCase(Left(wfvariables.sTrainingMandatory.value,Len(negativeOption))) = "nein / no" Then
			If wfvariables.sTrainingInterval.value <> "" OR wfvariables.sTrainingType.value <> "" OR wfvariables.TrainingResponsible.Count > 0 OR wfvariables.sTrainingControl.value <> "" OR wfvariables.sQuestionnaireReference.value <> "" OR wfvariables.sTrainingUnit.value <> "" Then
				'sMsg = sMsg & getMessageText( "StandardWF", "RemoveTrainingInformation", "Da dieses Dokument nicht geschult werden soll müssen alle schulungsrelevanten Einstellungen im Reiter Schulung entfernt werden.") 
				sQuestion = getMessageText( "StandardWF", "RemoveTrainingInformation", "Da dieses Dokument nicht geschult werden soll müssen alle schulungsrelevanten Einstellungen im Reiter Schulung entfernt werden.") 
				sQuestion = sQuestion & vbCrLf & getMessageText( "StandardWF", "RemoveTrainingInformationQuestion","Sollen die schulungsrelevanten Einstellungen entfernt werden?")
				if (MsgBox (sQuestion,vbQuestion+vbYesNo,"enaio") = vbYes) then
					wfvariables.sTrainingInterval.value = ""
					wfvariables.sTrainingType.value = ""
					wfvariables.TrainingResponsible.ClearList
					wfvariables.sTrainingControl.value = ""
					wfvariables.sQuestionnaireReference.value = ""
					wfvariables.sQuestionnaireID.value = ""
					wfvariables.sTrainingUnit.value = ""					
				else
					scriptresult.ResultCode = -1
				End If
			End if
		End If
	End If
	If (wfvariables.sTrainingControl.value = "nein / no") Then	'CC-000911
		If wfvariables.sQuestionnaireReference.value <> "" Then
			sMsg = sMsg & getMessageText("StandardWF","RemoveQuestionnaire","Sie haben ausgewählt, dass keine Erfolgskontrolle durchgeführt werden soll. Bitte entfernen Sie den Fragebogen über die entsprechende Schaltfläche.")
		End If
	End If
	If sMsg <> "" Then
		scriptresult.ResultCode = -1
		MsgBox sMsg,vbInformation,"enaio"
	End If
End Function