only mark fields with missing account as error if required, re-add selected field for checkboxes in file list, make automatic price calculation configurable
This commit is contained in:
@@ -5,4 +5,5 @@ Public Class Config
|
||||
Public Property ConnectionString As String = ""
|
||||
Public Property LastUsedMandator As String = ""
|
||||
Public Property Debug As Boolean = False
|
||||
Public Property AutomaticPriceCalculation As Boolean = True
|
||||
End Class
|
||||
|
||||
@@ -21,9 +21,14 @@ Namespace Documents
|
||||
|
||||
Public Property Imported As Boolean = False
|
||||
|
||||
''' <summary>
|
||||
''' This is used for saving the selected state via checkbox, don't remove!
|
||||
''' </summary>
|
||||
Public Property Selected As Boolean = False
|
||||
|
||||
Public ReadOnly Property HasErrors As Boolean
|
||||
Get
|
||||
Return Mandator Is Nothing Or Rows.Any(Function(r As DocumentRow) r.HasErrors)
|
||||
Return Errors.Count > 0
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ Namespace Documents
|
||||
Private ReadOnly Winline As WinlineData
|
||||
Private ReadOnly MappingConfig As MappingConfig
|
||||
Private ReadOnly TemplateConfig As TemplateConfig
|
||||
Private ReadOnly ApplicationConfig As Config
|
||||
|
||||
Public Property Files As New List(Of Document)
|
||||
|
||||
@@ -44,11 +45,12 @@ Namespace Documents
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pWinline As WinlineData, pMappingConfig As MappingConfig, pTemplateConfig As TemplateConfig)
|
||||
Public Sub New(pLogConfig As LogConfig, pWinline As WinlineData, pMappingConfig As MappingConfig, pTemplateConfig As TemplateConfig, pApplicationConfig As Config)
|
||||
MyBase.New(pLogConfig)
|
||||
Winline = pWinline
|
||||
MappingConfig = pMappingConfig
|
||||
TemplateConfig = pTemplateConfig
|
||||
ApplicationConfig = pApplicationConfig
|
||||
End Sub
|
||||
|
||||
Public Async Function LoadFiles(pTemplate As Template, pMandator As Mandator) As Task(Of Boolean)
|
||||
@@ -273,8 +275,10 @@ Namespace Documents
|
||||
.RunningFunction = "Preis-Funktionen"
|
||||
})
|
||||
|
||||
' These functions will only be applied if the document does not have errors
|
||||
pDocument = Await MaybeApplyPriceFunctions(pDocument, oMandator, pTemplate)
|
||||
If ApplicationConfig.AutomaticPriceCalculation = True Then
|
||||
' These functions will only be applied if the document does not have errors
|
||||
pDocument = Await MaybeApplyPriceFunctions(pDocument, oMandator, pTemplate)
|
||||
End If
|
||||
|
||||
RaiseEvent FileLoadProgress(Me, New FileLoadProgressInfo(FilesTotal, FilesLoaded) With {
|
||||
.RunningFunction = "Feld-Funktionen"
|
||||
@@ -567,7 +571,11 @@ Namespace Documents
|
||||
'})
|
||||
End If
|
||||
Else
|
||||
oNumberItem.Error = FieldError.AccountNotFound
|
||||
' If no account was found and the field is required,
|
||||
' mark it as error. Otherwise, do nothing.
|
||||
If oNumberItem.IsRequired Then
|
||||
oNumberItem.Error = FieldError.AccountNotFound
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user