[fix:] plz's and pplz's CAN be alphanumeric

This commit is contained in:
2025-11-27 14:48:24 +01:00
parent 7cd02456bc
commit 8c56717b9c
3 changed files with 48 additions and 38 deletions

View File

@@ -61,10 +61,10 @@ public class DataImport
parts[7], parts[7],
parts[8], parts[8],
parts[9], parts[9],
ParseInt(parts[10]), parts[10],
parts[11], parts[11],
parts[12], parts[12],
ParseInt(parts[13]), parts[13],
parts[14], parts[14],
parts[15], parts[15],
parts[16], parts[16],
@@ -196,10 +196,10 @@ public class DataImport
GetField("anredzus"), GetField("anredzus"),
GetField("strasse"), GetField("strasse"),
GetField("strasse2"), GetField("strasse2"),
ParseInt(GetField("plz")), GetField("plz"),
GetField("ort"), GetField("ort"),
GetField("land"), GetField("land"),
ParseInt(GetField("pplz")), GetField("pplz"),
GetField("postfach"), GetField("postfach"),
GetField("name1"), GetField("name1"),
GetField("name2"), GetField("name2"),

View File

@@ -70,10 +70,10 @@ public class KasPerson
anredzus = ""; anredzus = "";
strasse = ""; strasse = "";
strasse2 = ""; strasse2 = "";
plz = 0; plz = "";
ort = ""; ort = "";
land = ""; land = "";
pplz = 0; pplz = "";
postfach = ""; postfach = "";
name1 = ""; name1 = "";
name2 = ""; name2 = "";
@@ -96,10 +96,10 @@ public class KasPerson
string anredzus, string anredzus,
string strasse, string strasse,
string strasse2, string strasse2,
int plz, string plz,
string ort, string ort,
string land, string land,
int pplz, string pplz,
string postfach, string postfach,
string name1, string name1,
string name2, string name2,
@@ -147,10 +147,10 @@ public class KasPerson
public string anredzus { get; set; } public string anredzus { get; set; }
public string strasse { get; set; } public string strasse { get; set; }
public string strasse2 { get; set; } public string strasse2 { get; set; }
public int plz { get; set; } public string plz { get; set; }
public string ort { get; set; } public string ort { get; set; }
public string land { get; set; } public string land { get; set; }
public int pplz { get; set; } public string pplz { get; set; }
public string postfach { get; set; } public string postfach { get; set; }
public string name1 { get; set; } public string name1 { get; set; }
public string name2 { get; set; } public string name2 { get; set; }

View File

@@ -9,10 +9,8 @@ public class AddressCheck
{ {
public enum ErrorTypes public enum ErrorTypes
{ {
PlzTooShort, PlzNotUsable,
PlzTooLong, PPlzNotUsable,
PPlzTooShort,
PPlzTooLong,
MayBeSameAddress, MayBeSameAddress,
NoPLZorPPLZ NoPLZorPPLZ
} }
@@ -57,52 +55,64 @@ public class AddressCheck
var address_component_count = 2; // cause anrede and name are first var address_component_count = 2; // cause anrede and name are first
// PLZ-Prüfung // PLZ-Prüfung
if (person.plz == 0 || person.plz == null) if (person.plz == "" || person.plz == null)
{ {
hasFaults = true; hasFaults = true;
warnings.Add(WarningTypes.NoPLZ); warnings.Add(WarningTypes.NoPLZ);
} }
else else
{ {
if ((person.plz < 10000 && string.IsNullOrWhiteSpace(person.land)) || if (!AddressCreator.CheckPLZ(person.plz, person.land))
(person.plz < 10000 && person.land == "GER") ||
(person.plz < 10000 && person.land == "DE"))
{ {
hasFaults = true; hasFaults = true;
errors.Add(ErrorTypes.PlzTooShort); errors.Add(ErrorTypes.PlzNotUsable);
}
else if ((person.plz > 99999 && string.IsNullOrWhiteSpace(person.land)) ||
(person.plz > 99999 && person.land == "GER") ||
(person.plz > 99999 && person.land == "DE"))
{
hasFaults = true;
errors.Add(ErrorTypes.PlzTooLong);
} }
// if ((person.plz < 10000 && string.IsNullOrWhiteSpace(person.land)) ||
// (person.plz < 10000 && person.land == "GER") ||
// (person.plz < 10000 && person.land == "DE"))
// {
// hasFaults = true;
// errors.Add(ErrorTypes.PlzTooShort);
// }
// else if ((person.plz > 99999 && string.IsNullOrWhiteSpace(person.land)) ||
// (person.plz > 99999 && person.land == "GER") ||
// (person.plz > 99999 && person.land == "DE"))
// {
// hasFaults = true;
// errors.Add(ErrorTypes.PlzTooLong);
// }
} }
// PPLZ-Prüfung // PPLZ-Prüfung
if (person.pplz == 0 || person.pplz == null) if (person.pplz == "" || person.pplz == null)
{ {
hasFaults = true; hasFaults = true;
warnings.Add(WarningTypes.NoPPLZ); warnings.Add(WarningTypes.NoPPLZ);
} }
else else
{ {
if ((person.pplz < 10000 && string.IsNullOrWhiteSpace(person.land)) ||
(person.pplz < 10000 && person.land == "GER") || if (!AddressCreator.CheckPLZ(person.pplz, person.land))
(person.pplz < 10000 && person.land == "DE"))
{ {
hasFaults = true; hasFaults = true;
errors.Add(ErrorTypes.PPlzTooShort); errors.Add(ErrorTypes.PPlzNotUsable);
}
else if ((person.pplz > 99999 && string.IsNullOrWhiteSpace(person.land)) ||
(person.pplz > 99999 && person.land == "GER") ||
(person.pplz > 99999 && person.land == "DE"))
{
hasFaults = true;
errors.Add(ErrorTypes.PPlzTooLong);
} }
// if ((person.pplz < 10000 && string.IsNullOrWhiteSpace(person.land)) ||
// (person.pplz < 10000 && person.land == "GER") ||
// (person.pplz < 10000 && person.land == "DE"))
// {
// hasFaults = true;
// errors.Add(ErrorTypes.PPlzTooShort);
// }
// else if ((person.pplz > 99999 && string.IsNullOrWhiteSpace(person.land)) ||
// (person.pplz > 99999 && person.land == "GER") ||
// (person.pplz > 99999 && person.land == "DE"))
// {
// hasFaults = true;
// errors.Add(ErrorTypes.PPlzTooLong);
// }
} }
if (warnings.Contains(WarningTypes.NoPLZ) && warnings.Contains(WarningTypes.NoPPLZ)) if (warnings.Contains(WarningTypes.NoPLZ) && warnings.Contains(WarningTypes.NoPPLZ))